mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-02 13:39:55 +00:00
58838f225c
Rewrite of the UI using Typescript, Vue3, Windicss and Vite. The design should be close to the current one with some changes: - latest pipeline in a sidebar on the right - secrets and registry as part of the repo-settings (secrets and registry entries shouldn't be used as much so they can be "hidden" under settings IMO) - start page shows list of active repositories with button to enable / add new ones (currently you see all repositories and in most cases you only add new repositories once in a while)
87 lines
3 KiB
Vue
87 lines
3 KiB
Vue
<template>
|
|
<ListItem v-if="build" clickable class="p-0">
|
|
<div class="flex items-center mr-4">
|
|
<div
|
|
class="min-h-full w-3"
|
|
:class="{
|
|
'bg-yellow-400 dark:bg-dark-200': build.status === 'pending',
|
|
'bg-red-400 dark:bg-red-800': buildStatusColors[build.status] === 'red',
|
|
'bg-gray-600 dark:bg-gray-500': buildStatusColors[build.status] === 'gray',
|
|
'bg-lime-400 dark:bg-lime-900': buildStatusColors[build.status] === 'green',
|
|
'bg-blue-400 dark:bg-blue-900': buildStatusColors[build.status] === 'blue',
|
|
}"
|
|
/>
|
|
<div class="w-8 flex">
|
|
<BuildRunningIcon v-if="build.status === 'started' || build.status === 'running'" />
|
|
<BuildStatusIcon v-else class="mx-3" :build="build" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex w-full py-2 px-4">
|
|
<div class="flex items-center"><img class="w-8" :src="build.author_avatar" /></div>
|
|
|
|
<div class="ml-4 flex items-center mx-4">
|
|
<span class="text-gray-600 dark:text-gray-500">{{ message }}</span>
|
|
</div>
|
|
|
|
<div class="flex ml-auto text-gray-500 py-2">
|
|
<div class="flex flex-col space-y-2 w-42">
|
|
<div class="flex space-x-2 items-center">
|
|
<Icon v-if="build.event === 'pull_request'" name="pull_request" />
|
|
<Icon v-else-if="build.event === 'deployment'" name="deployment" />
|
|
<Icon v-else-if="build.event === 'tag'" name="tag" />
|
|
<Icon v-else name="push" />
|
|
<span class="truncate">{{ build.branch }}</span>
|
|
</div>
|
|
<div class="flex space-x-2 items-center">
|
|
<Icon name="commit" />
|
|
<span>{{ build.commit.slice(0, 10) }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-col ml-4 space-y-2 w-42">
|
|
<div class="flex space-x-2 items-center">
|
|
<Icon name="duration" />
|
|
<span>{{ duration }}</span>
|
|
</div>
|
|
<div class="flex space-x-2 items-center">
|
|
<Icon name="since" />
|
|
<span>{{ since }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</ListItem>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent, PropType, toRef } from 'vue';
|
|
|
|
import Icon from '~/components/atomic/Icon.vue';
|
|
import ListItem from '~/components/atomic/ListItem.vue';
|
|
import { buildStatusColors } from '~/components/repo/build/build-status';
|
|
import BuildRunningIcon from '~/components/repo/build/BuildRunningIcon.vue';
|
|
import BuildStatusIcon from '~/components/repo/build/BuildStatusIcon.vue';
|
|
import useBuild from '~/compositions/useBuild';
|
|
import { Build } from '~/lib/api/types';
|
|
|
|
export default defineComponent({
|
|
name: 'BuildItem',
|
|
|
|
components: { Icon, BuildStatusIcon, ListItem, BuildRunningIcon },
|
|
|
|
props: {
|
|
build: {
|
|
type: Object as PropType<Build>,
|
|
required: true,
|
|
},
|
|
},
|
|
|
|
setup(props) {
|
|
const build = toRef(props, 'build');
|
|
const { since, duration, message } = useBuild(build);
|
|
|
|
return { since, duration, message, buildStatusColors };
|
|
},
|
|
});
|
|
</script>
|