Skip to content

Commit ef9b674

Browse files
author
Hrvoje Vucic
committed
Integrate virtual scroll with data table in workflow overview
1 parent c980bbd commit ef9b674

File tree

1 file changed

+82
-33
lines changed
  • client/components/repository/Workflow/Overview

1 file changed

+82
-33
lines changed

client/components/repository/Workflow/Overview/index.vue

Lines changed: 82 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
<template>
22
<v-data-table
3-
@click:row="selectActivity($event.id)"
43
:headers="headers"
54
:items="items"
65
height="100%"
7-
item-class="class"
86
disable-pagination hide-default-footer fixed-header
97
class="overview primary lighten-5">
10-
<template #item.name="{ item, value }">
11-
<div class="d-flex">
12-
<overview-name :value="value" />
13-
<publishing-badge v-if="isAdmin || isRepositoryAdmin" :activity="item" />
14-
</div>
15-
</template>
16-
<template #item.status="{ value }">
17-
<overview-status v-bind="value" />
18-
</template>
19-
<template #item.assignee="{ value }">
20-
<overview-assignee v-bind="value" />
21-
</template>
22-
<template #item.priority="{ value }">
23-
<overview-priority v-bind="value" />
24-
</template>
25-
<template #item.dueDate="{ value }">
26-
<overview-due-date v-if="value" :value="value" />
8+
<template v-slot:body="props">
9+
<v-virtual-scroll :items="props.items" item-height="46">
10+
<template v-slot:default="{ item }">
11+
<v-row
12+
@click="selectActivity(item.id)"
13+
:class="{ selected: isActivitySelected(item.id) }">
14+
<v-col class="name d-flex text-left">
15+
<overview-name :value="item.name" />
16+
<publishing-badge v-if="isAdmin || isRepositoryAdmin" :activity="item" />
17+
</v-col>
18+
<div class="status d-flex align-center text-left">
19+
<overview-status v-bind="item.status" />
20+
</div>
21+
<div class="assignee d-flex align-center text-left">
22+
<overview-assignee v-bind="item.assignee" />
23+
</div>
24+
<div class="priority d-flex align-center text-left">
25+
<overview-priority v-bind="item.priority" />
26+
</div>
27+
<div class="date d-flex align-center text-left">
28+
<overview-due-date v-if="item.dueDate" :value="item.dueDate" />
29+
</div>
30+
</v-row>
31+
</template>
32+
</v-virtual-scroll>
2733
</template>
2834
</v-data-table>
2935
</template>
@@ -78,12 +84,14 @@ export default {
7884
publishedAt,
7985
type,
8086
status: this.getStatusById(status.status),
81-
priority: getPriority(status.priority),
82-
class: this.isActivitySelected(id) && 'selected'
87+
priority: getPriority(status.priority)
8388
}));
8489
}
8590
},
8691
methods: {
92+
selectItem(id) {
93+
this.selectedItemId = id;
94+
},
8795
isActivitySelected(id) {
8896
return this.selectedActivity && this.selectedActivity.id === id;
8997
},
@@ -116,33 +124,74 @@ export default {
116124
</script>
117125

118126
<style lang="scss" scoped>
119-
$row-background: var(--v-primary-lighten4);
127+
$row-background: var(--v-primary-lighten5);
128+
$row-hover-background: var(--v-primary-lighten4);
129+
$status-max-width: 180px;
130+
$assignee-max-width: 340px;
131+
$priority-max-width: 180px;
132+
$date-max-width: 160px;
120133
121134
.overview ::v-deep {
135+
table {
136+
table-layout: fixed;
137+
138+
th:nth-of-type(1), .name {
139+
max-width: calc(100% - #{$status-max-width} - #{$assignee-max-width} - #{$priority-max-width} - #{$date-max-width});
140+
}
141+
142+
.name .v-badge {
143+
padding-left: 8px;
144+
}
145+
146+
th:nth-of-type(2), .status {
147+
width: $status-max-width;
148+
}
149+
150+
th:nth-of-type(3), .assignee {
151+
width: $assignee-max-width;
152+
}
153+
154+
th:nth-of-type(4), .priority {
155+
width: $priority-max-width;
156+
}
157+
158+
th:nth-of-type(5), .date {
159+
width: $date-max-width;
160+
}
161+
}
162+
122163
thead.v-data-table-header {
123164
tr th {
124-
background: #eceff1;
165+
background: $row-background;
125166
}
126-
}
127167
128-
.column-name {
129-
max-width: 17.75rem;
168+
tr:hover {
169+
th {
170+
background: $row-hover-background !important;
171+
}
172+
}
130173
}
131174
132-
.column-assignee {
133-
max-width: 11.5rem;
134-
}
175+
.row {
176+
margin: 0;
177+
background-color: $row-background;
178+
border-bottom: thin solid rgba(0, 0, 0, 0.12);
135179
136-
tr:hover {
137-
background: $row-background !important;
180+
&:hover {
181+
background-color: $row-hover-background;
182+
}
183+
184+
&.selected {
185+
background: $row-hover-background;
186+
}
138187
139188
&:not(.selected) {
140189
cursor: pointer;
141190
}
142191
}
143192
144-
.selected {
145-
background: $row-background;
193+
.v-virtual-scroll {
194+
display: table-row-group;
146195
}
147196
}
148197
</style>

0 commit comments

Comments
 (0)