Skip to content

Commit 10b7d41

Browse files
committed
feat(fe): add component TaskLink
1 parent 8cc08d7 commit 10b7d41

File tree

6 files changed

+211
-151
lines changed

6 files changed

+211
-151
lines changed

web2/package-lock.json

Lines changed: 81 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web2/src/App.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,20 +372,14 @@
372372
<v-app v-else></v-app>
373373
</template>
374374
<style lang="scss">
375+
375376
.v-data-table a {
376377
text-decoration-line: none;
377378
&:hover {
378379
text-decoration-line: underline;
379380
}
380381
}
381382
382-
.breadcrumbs {
383-
384-
}
385-
386-
.breadcrumbs__item {
387-
}
388-
389383
.breadcrumbs__item--link {
390384
text-decoration-line: none;
391385
&:hover {

web2/src/components/TaskLink.vue

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<template>
2+
<span>
3+
<v-icon
4+
v-if="status != null"
5+
small
6+
class="mr-1"
7+
:color="status === 'success' ? 'success' : 'red'"
8+
>mdi-{{ status === 'success' ? 'check' : 'close' }}
9+
</v-icon>
10+
<span v-if="disabled">{{ label }}</span>
11+
<v-tooltip
12+
v-else
13+
color="black"
14+
right
15+
max-width="350"
16+
transition="fade-transition"
17+
:disabled="!tooltip"
18+
>
19+
<template v-slot:activator="{ on, attrs }">
20+
<a
21+
v-bind="attrs"
22+
v-on="on"
23+
@click="showTaskLog()"
24+
:class="{'task-link-with-tooltip': tooltip}"
25+
>{{ label }}</a>
26+
</template>
27+
<span>{{ tooltip }}</span>
28+
</v-tooltip>
29+
</span>
30+
</template>
31+
<style lang="scss">
32+
33+
@import '~vuetify/src/styles/settings/_colors.scss';
34+
35+
.task-link-with-tooltip {
36+
text-decoration: underline !important;
37+
text-decoration-style: dashed !important;
38+
text-decoration-color: gray !important;
39+
}
40+
41+
a.task-link-with-tooltip {
42+
&:hover {
43+
text-decoration-style: solid !important;
44+
text-decoration-color: map-deep-get($blue, 'darken-2') !important;
45+
}
46+
}
47+
48+
</style>
49+
<script>
50+
import EventBus from '@/event-bus';
51+
52+
export default {
53+
props: {
54+
label: String,
55+
tooltip: String,
56+
taskId: Number,
57+
disabled: Boolean,
58+
status: String,
59+
},
60+
methods: {
61+
showTaskLog() {
62+
EventBus.$emit('i-show-task', {
63+
taskId: this.taskId,
64+
});
65+
},
66+
},
67+
};
68+
</script>

web2/src/views/project/History.vue

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,29 @@
2828
'/templates/' + item.template_id"
2929
>{{ item.tpl_alias }}</a>
3030
<v-icon small class="ml-1 mr-1">mdi-arrow-right</v-icon>
31-
<a @click="showTaskLog(item.id)">#{{ item.id }}</a>
32-
<div class="ml-2" v-if="item.version != null">
33-
<v-icon
34-
v-if="item.status === 'success'"
35-
small
36-
color="success"
37-
>mdi-check</v-icon>
38-
<v-icon
39-
v-else
40-
small
41-
color="red"
42-
>mdi-close</v-icon>
43-
<span class="ml-1">{{ item.version }}</span>
44-
</div>
31+
<TaskLink
32+
:task-id="item.id"
33+
:tooltip="item.message"
34+
:label="'#' + item.id"
35+
/>
36+
<TaskLink
37+
:disabled="item.tpl_type === 'build'"
38+
class="ml-2"
39+
v-if="item.tpl_type !== ''"
40+
:status="item.status"
41+
42+
:task-id="item.tpl_type === 'build'
43+
? item.id
44+
: item.build_task.id"
45+
46+
:label="item.tpl_type === 'build'
47+
? item.version
48+
: item.build_task.version"
49+
50+
:tooltip="item.tpl_type === 'build'
51+
? item.message
52+
: item.build_task.message"
53+
/>
4554
</div>
4655
</template>
4756

@@ -64,6 +73,7 @@
6473
import ItemListPageBase from '@/components/ItemListPageBase';
6574
import EventBus from '@/event-bus';
6675
import TaskStatus from '@/components/TaskStatus.vue';
76+
import TaskLink from '@/components/TaskLink.vue';
6777
import socket from '@/socket';
6878
import { TEMPLATE_TYPE_ICONS } from '@/lib/constants';
6979
@@ -74,7 +84,7 @@ export default {
7484
return { TEMPLATE_TYPE_ICONS };
7585
},
7686
77-
components: { TaskStatus },
87+
components: { TaskStatus, TaskLink },
7888
7989
watch: {
8090
async projectId() {

0 commit comments

Comments
 (0)