woodpecker/web/src/components/pipeline-feed/PipelineFeedItem.vue
Anbraten cab996608e
Use icons for step and workflow states (#1409)
Co-authored-by: 6543 <6543@obermui.de>
2022-11-14 12:25:58 +01:00

55 lines
1.6 KiB
Vue

<template>
<div v-if="pipeline" class="flex text-color w-full">
<PipelineStatusIcon :status="pipeline.status" class="flex items-center" />
<div class="flex flex-col ml-4 min-w-0">
<span class="underline">{{ pipeline.owner }} / {{ pipeline.name }}</span>
<span class="whitespace-nowrap overflow-hidden overflow-ellipsis">{{ message }}</span>
<div class="flex flex-col mt-2">
<div class="flex space-x-2 items-center">
<Icon name="since" />
<Tooltip>
<span>{{ since }}</span>
<template #popper
><span class="font-bold">{{ $t('created') }}</span> {{ created }}</template
>
</Tooltip>
</div>
<div class="flex space-x-2 items-center">
<Icon name="duration" />
<span>{{ duration }}</span>
</div>
</div>
</div>
</div>
</template>
<script lang="ts">
import { Tooltip } from 'floating-vue';
import { defineComponent, PropType, toRef } from 'vue';
import Icon from '~/components/atomic/Icon.vue';
import PipelineStatusIcon from '~/components/repo/pipeline/PipelineStatusIcon.vue';
import usePipeline from '~/compositions/usePipeline';
import { PipelineFeed } from '~/lib/api/types';
export default defineComponent({
name: 'PipelineFeedItem',
components: { PipelineStatusIcon, Icon, Tooltip },
props: {
pipeline: {
type: Object as PropType<PipelineFeed>,
required: true,
},
},
setup(props) {
const pipeline = toRef(props, 'pipeline');
const { since, duration, message, created } = usePipeline(pipeline);
return { since, duration, message, created };
},
});
</script>