Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two row layout for title and context of pipeline list #3976

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions web/src/assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@
"errors": "Errors ({count})",
"warnings": "Warnings ({count})",
"show_errors": "Show errors",
"we_got_some_errors": "Oh no, we got some errors!",
"duration": "Pipeline duration",
"created": "Created: {created}"
"we_got_some_errors": "Oh no, we got some errors!"
}
},
"org": {
Expand Down Expand Up @@ -469,5 +467,7 @@
"internal_error": "Some internal error occurred",
"registration_closed": "The registration is closed",
"access_denied": "You are not allowed to access this instance",
"invalid_state": "The OAuth state is invalid"
"invalid_state": "The OAuth state is invalid",
"pipeline_duration": "Pipeline duration: {duration}",
"pipeline_created": "Created: {created}"
}
76 changes: 41 additions & 35 deletions web/src/components/repo/pipeline/PipelineItem.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<ListItem v-if="pipeline" class="p-0 w-full">
<div class="flex w-11 items-center md:mr-4">
<div class="flex items-center">
<div
class="h-full w-3"
class="h-full w-2"
:class="{
'bg-wp-state-warn-100': pipeline.status === 'pending',
'bg-wp-state-error-100': pipelineStatusColors[pipeline.status] === 'red',
Expand All @@ -11,36 +11,16 @@
'bg-wp-state-info-100': pipelineStatusColors[pipeline.status] === 'blue',
}"
/>
<div class="w-8 flex flex-wrap justify-between items-center h-full">
<div class="w-12 flex justify-center items-center h-full">
<PipelineRunningIcon v-if="pipeline.status === 'started' || pipeline.status === 'running'" />
<PipelineStatusIcon v-else class="mx-2 md:mx-3" :status="pipeline.status" />
<PipelineStatusIcon v-else :status="pipeline.status" />
</div>
</div>

<div class="flex py-2 px-4 flex-grow min-w-0 <md:flex-wrap">
<div class="<md:hidden flex items-center flex-shrink-0">
<Icon v-if="pipeline.event === 'cron'" name="stopwatch" class="text-wp-text-100" />
<img v-else class="rounded-md w-8" :src="pipeline.author_avatar" />
</div>

<div class="w-full md:w-auto md:mx-4 flex items-center min-w-0">
<!-- eslint-disable-next-line @intlify/vue-i18n/no-raw-text -->
<span class="text-wp-text-alt-100 <md:hidden">#{{ pipeline.number }}</span>
<!-- eslint-disable-next-line @intlify/vue-i18n/no-raw-text -->
<span class="text-wp-text-alt-100 <md:hidden mx-2">-</span>
<span
class="text-wp-text-100 <md:underline whitespace-nowrap overflow-hidden overflow-ellipsis"
:title="message"
>
{{ shortMessage }}
</span>
</div>

<div
class="grid grid-rows-2 grid-cols-2 grid-flow-col w-full md:ml-auto md:w-96 py-2 gap-x-4 gap-y-2 flex-shrink-0 text-wp-text-100"
>
<div class="flex space-x-2 items-center min-w-0">
<span :title="pipelineEventTitle">
<div class="flex py-2 px-2 mr-2 flex-grow min-w-0 <md:flex-wrap">
<div class="w-full md:w-auto flex flex-col items-center min-w-0 py-2 gap-2">
<div class="w-full flex items-center">
<span :title="pipelineEventTitle" class="text-wp-text-100">
<Icon v-if="pipeline.event === 'pull_request'" name="pull-request" />
<Icon v-else-if="pipeline.event === 'pull_request_closed'" name="pull-request-closed" />
<Icon v-else-if="pipeline.event === 'deployment'" name="deployment" />
Expand All @@ -49,24 +29,49 @@
<Icon v-else-if="pipeline.event === 'manual'" name="manual-pipeline" />
<Icon v-else name="push" />
</span>
<span class="truncate">{{ prettyRef }}</span>
<span class="text-wp-text-100 text-lg whitespace-nowrap overflow-hidden overflow-ellipsis" :title="message">
{{ shortMessage }}
</span>
</div>

<div class="flex space-x-2 items-center min-w-0">
<Icon name="commit" />
<span class="truncate">{{ pipeline.commit.slice(0, 10) }}</span>
<div class="flex <md:flex-col w-full gap-2 md:items-center">
<div class="flex items-center min-w-0 text-wp-text-100">
<Icon name="commit" />
<span class="truncate">{{ pipeline.commit.slice(0, 7) }}</span>
</div>

<div class="flex items-center min-w-0 text-wp-text-100">
<span class="truncate">
{{ prettyRef }}
<!-- eslint-disable @intlify/vue-i18n/no-raw-text-->
<span
v-if="pipeline.event === 'pull_request' || pipeline.event === 'pull_request_closed'"
:title="prTitleWithDescription"
>
({{ prTitle }})
</span>
<!-- eslint-enable @intlify/vue-i18n/no-raw-text-->
</span>
</div>
</div>
</div>

<div class="flex space-x-2 items-center min-w-0" :title="$t('repo.pipeline.duration')">
<div class="flex md:flex-col w-full md:ml-auto md:w-42 py-2 gap-x-4 gap-y-2 flex-shrink-0 text-wp-text-100">
<div class="flex space-x-2 items-center min-w-0" :title="$t('pipeline_duration', { duration })">
<Icon name="duration" />
<span class="truncate">{{ duration }}</span>
</div>

<div class="flex space-x-2 items-center min-w-0" :title="$t('repo.pipeline.created', { created })">
<div class="flex space-x-2 items-center min-w-0" :title="$t('pipeline_created', { created })">
<Icon name="since" />
<span class="truncate">{{ since }}</span>
</div>
</div>

<div class="<md:hidden flex items-center flex-shrink-0">
<Icon v-if="pipeline.event === 'cron'" name="stopwatch" class="text-wp-text-100" />
<img v-else class="rounded-md w-8" :src="pipeline.author_avatar" :title="pipeline.author" />
</div>
</div>
</ListItem>
</template>
Expand All @@ -90,7 +95,8 @@ const props = defineProps<{
const { t } = useI18n();

const pipeline = toRef(props, 'pipeline');
const { since, duration, message, shortMessage, prettyRef, created } = usePipeline(pipeline);
const { since, duration, message, shortMessage, prettyRef, created, prTitle, prTitleWithDescription } =
usePipeline(pipeline);

const pipelineEventTitle = computed(() => {
switch (pipeline.value.event) {
Expand Down