Some UI enhancement (#2468)

- Closes #2001 
-
https://github.com/woodpecker-ci/woodpecker/discussions/2162#discussioncomment-6666895
- shows prettyRef for deployments
This commit is contained in:
qwerty287 2023-09-17 12:32:23 +02:00 committed by GitHub
parent 7e8cd1cfa4
commit 78ebd55acc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 17 deletions

View file

@ -4,5 +4,5 @@ coverage/
LICENSE
components.d.ts
src/assets/locales/*.json
src/assets/timeAgoLocales/*.json
src/assets/timeAgoLocales/
!src/assets/locales/en.json

View file

@ -2,7 +2,14 @@
<div v-if="pipeline" class="flex text-wp-text-100 w-full">
<PipelineStatusIcon :status="pipeline.status" class="flex items-center" />
<div class="flex flex-col ml-4 min-w-0">
<span class="underline">{{ repo?.owner }} / {{ repo?.name }}</span>
<router-link
:to="{
name: 'repo',
params: { repoId: pipeline.repo_id },
}"
class="underline"
>{{ repo?.owner }} / {{ repo?.name }}</router-link
>
<span class="whitespace-nowrap overflow-hidden overflow-ellipsis" :title="message">{{ title }}</span>
<div class="flex flex-col mt-2">
<div class="flex space-x-2 items-center" :title="created">

View file

@ -10,21 +10,28 @@
</div>
<span>{{ pipeline.author }}</span>
</div>
<div class="flex space-x-1 items-center min-w-0">
<a
v-if="pipeline.event === 'pull_request'"
class="flex items-center space-x-1 text-wp-link-100 hover:text-wp-link-200 min-w-0"
:href="pipeline.link_url"
>
<Icon name="pull_request" />
<span class="truncate">{{ prettyRef }}</span>
</a>
<router-link
v-else-if="pipeline.event === 'push' || pipeline.event === 'manual' || pipeline.event === 'deployment'"
class="flex items-center space-x-1 text-wp-link-100 hover:text-wp-link-200 min-w-0"
:to="{ name: 'repo-branch', params: { branch: prettyRef } }"
>
<Icon v-if="pipeline.event === 'manual'" name="manual-pipeline" />
<Icon v-if="pipeline.event === 'push'" name="push" />
<Icon v-if="pipeline.event === 'deployment'" name="deployment" />
<Icon v-else-if="pipeline.event === 'tag'" name="tag" />
<a
v-else-if="pipeline.event === 'pull_request'"
class="flex items-center space-x-1 text-wp-link-100 hover:text-wp-link-200 min-w-0"
:href="pipeline.link_url"
target="_blank"
>
<Icon name="pull_request" />
<span class="truncate">{{ prettyRef }}</span>
</a>
<span v-if="pipeline.event !== 'pull_request'" class="truncate">{{ prettyRef }}</span>
<Icon v-else-if="pipeline.event === 'push'" name="push" />
<Icon v-else-if="pipeline.event === 'deployment'" name="deployment" />
<span class="truncate">{{ prettyRef }}</span>
</router-link>
<div v-else class="flex space-x-1 items-center min-w-0">
<Icon v-if="pipeline.event === 'tag'" name="tag" />
<span class="truncate">{{ prettyRef }}</span>
</div>
<div class="flex items-center flex-shrink-0">
<template v-if="pipeline.event === 'pull_request'">

View file

@ -87,7 +87,7 @@ export default (pipeline: Ref<Pipeline | undefined>) => {
const title = computed(() => message.value.split('\n')[0]);
const prettyRef = computed(() => {
if (pipeline.value?.event === 'push') {
if (pipeline.value?.event === 'push' || pipeline.value?.event === 'deployment') {
return pipeline.value.branch;
}