woodpecker/web/src/components/repo/build/BuildProcs.vue
Anbraten 58838f225c
Rewrite of WebUI (#245)
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)
2021-11-03 17:40:31 +01:00

68 lines
2.3 KiB
Vue

<template>
<div class="flex mt-4 w-full bg-gray-600 dark:bg-dark-gray-800 min-h-0 flex-grow">
<div v-if="build.error" class="flex flex-col p-4">
<span class="text-red-400 font-bold text-xl mb-2">Execution error</span>
<span class="text-red-400">{{ build.error }}</span>
</div>
<div class="flex flex-col w-3/12 text-gray-200 dark:text-gray-400">
<div v-for="proc in build.procs" :key="proc.id">
<div class="p-4 pb-1">{{ proc.name }}</div>
<div
v-for="job in proc.children"
:key="job.pid"
class="flex p-2 pl-6 cursor-pointer items-center hover:bg-gray-700 hover:dark:bg-dark-gray-900"
:class="{ 'bg-gray-700 !dark:bg-dark-gray-600': selectedProcId && selectedProcId === job.pid }"
@click="$emit('update:selected-proc-id', job.pid)"
>
<div v-if="['success'].includes(job.state)" class="w-2 h-2 bg-lime-400 rounded-full" />
<div v-if="['pending', 'skipped'].includes(job.state)" class="w-2 h-2 bg-gray-400 rounded-full" />
<div
v-if="['killed', 'error', 'failure', 'blocked', 'declined'].includes(job.state)"
class="w-2 h-2 bg-red-400 rounded-full"
/>
<div v-if="['started', 'running'].includes(job.state)" class="w-2 h-2 bg-blue-400 rounded-full" />
<span class="ml-2">{{ job.name }}</span>
<BuildProcDuration :proc="job" />
</div>
</div>
</div>
<BuildLogs v-if="selectedProcId" :build="build" :proc-id="selectedProcId" class="w-9/12 flex-grow" />
</div>
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue';
import BuildLogs from '~/components/repo/build/BuildLogs.vue';
import BuildProcDuration from '~/components/repo/build/BuildProcDuration.vue';
import { Build } from '~/lib/api/types';
export default defineComponent({
name: 'BuildProcs',
components: {
BuildLogs,
BuildProcDuration,
},
props: {
build: {
type: Object as PropType<Build>,
required: true,
},
selectedProcId: {
type: Number as PropType<number | null>,
default: null,
},
},
emits: {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
'update:selected-proc-id': (selectedProcId: number) => true,
},
});
</script>