1
1
<template >
2
2
<div >
3
- <v-alert
4
- v-if =" errorMessage"
5
- type =" error"
6
- variant =" tonal"
7
- >
3
+ <v-alert v-if =" errorMessage" type =" error" variant =" tonal" >
8
4
{{ errorMessage }}
9
5
</v-alert >
10
- <v-alert
11
- v-if =" !loading && count && items.length < count"
12
- type =" warning"
13
- variant =" tonal"
14
- >
6
+ <v-alert v-if =" !loading && count && items.length < count" type =" error" variant =" tonal" >
15
7
Failed to load <strong >{{ count - items.length }}</strong > deployment{{ count - items.length > 1 ? "s" : "" }}.
16
8
17
9
<span >
18
10
This might happen because the node is down or it's not reachable
19
11
<span v-if =" showEncryption" >or the deployment{{ count - items.length > 1 ? "s are" : " is" }} encrypted by another key</span >.
20
12
</span >
21
- <v-tooltip
22
- location =" top"
23
- text =" Show failed deployments"
24
- >
13
+ <v-tooltip location =" top" text =" Show failed deployments" >
25
14
<template #activator =" { props: slotProps } " >
26
- <v-icon
27
- v-bind =" slotProps"
28
- class =" custom-icon"
29
- @click =" showDialog = true"
30
- >
15
+ <v-icon v-bind =" slotProps" class =" custom-icon" @click =" showDialog = true" >
31
16
mdi-file-document-refresh-outline
32
17
</v-icon >
33
18
</template >
34
19
</v-tooltip >
35
20
36
- <v-dialog
37
- v-model =" showDialog"
38
- transition =" dialog-bottom-transition"
39
- max-width =" 500px"
40
- scrollable
41
- attach =" #modals"
42
- >
21
+ <v-dialog v-model =" showDialog" transition =" dialog-bottom-transition" scrollable attach =" #modals" >
43
22
<v-card >
44
- <v-card-title style =" font-weight : bold " >
45
- Failed Deployments
46
- </v-card-title >
23
+ <v-card-title style =" font-weight : bold " > Failed Deployments Details </v-card-title >
47
24
<v-divider color =" #FFCC00" />
48
25
<v-card-text >
49
- <v-alert
50
- type =" error"
51
- variant =" tonal"
52
- >
53
- Failed to load
54
- <strong >{{ count - items.length }}</strong > deployment{{ count - items.length > 1 ? "s" : "" }}.
55
-
56
- <span >
57
- This might happen because the node is down or it's not reachable
58
- <span v-if =" showEncryption" >or the deployment{{ count - items.length > 1 ? "s are" : " is" }} encrypted by another key</span >.
59
- </span >
60
- </v-alert >
61
- <v-list
26
+ <v-data-table
27
+ :headers =" failedDeploymentsHeader"
62
28
:items =" failedDeploymentList"
63
- item-props
64
- lines =" three"
65
- >
66
- <template #subtitle =" { subtitle } " >
67
- <div v-html =" subtitle" />
68
- </template >
69
- </v-list >
29
+ :items-per-page-options ="
30
+ failedDeploymentList.length > 5
31
+ ? [
32
+ { value: 5, title: '5' },
33
+ { value: 10, title: '10' },
34
+ { value: 20, title: '20' },
35
+ { value: 50, title: '50' },
36
+ ]
37
+ : undefined
38
+ "
39
+ :hide-default-footer =" failedDeploymentList.length <= 5"
40
+ class =" mt-3"
41
+ hover
42
+ ></v-data-table >
70
43
</v-card-text >
71
44
<v-card-actions class =" justify-end my-1 mr-2" >
72
- <v-btn
73
- color =" anchor"
74
- @click =" showDialog = false"
75
- >
76
- Close
77
- </v-btn >
45
+ <v-btn color =" anchor" @click =" showDialog = false" > Close </v-btn >
78
46
</v-card-actions >
79
47
</v-card >
80
48
</v-dialog >
139
107
</template >
140
108
141
109
<template #[` item.flist ` ]=" { item } " >
142
- <v-tooltip
143
- :text =" item.flist"
144
- location =" bottom right"
145
- >
110
+ <v-tooltip :text =" item.flist" location =" bottom right" >
146
111
<template #activator =" { props: slotProps } " >
147
112
<p v-bind =" slotProps" >
148
113
{{ renameFlist(item.flist) }}
158
123
{{ toHumanDate(item.created) }}
159
124
</template >
160
125
<template #[` item.actions ` ]=" { item } " >
161
- <v-chip
162
- v-if =" deleting && ($props.modelValue || []).includes(item)"
163
- color =" error"
164
- >
165
- Deleting...
166
- </v-chip >
167
- <v-btn-group
168
- v-else
169
- variant =" tonal"
170
- >
171
- <slot
172
- :name =" projectName + '-actions'"
173
- :item =" item"
174
- :update =" updateItem"
175
- />
126
+ <v-chip v-if =" deleting && ($props.modelValue || []).includes(item)" color =" error" > Deleting... </v-chip >
127
+ <v-btn-group v-else variant =" tonal" >
128
+ <slot :name =" projectName + '-actions'" :item =" item" :update =" updateItem" />
176
129
</v-btn-group >
177
130
</template >
178
131
179
132
<template #[` item.status ` ]=" { item } " >
180
133
<v-chip :color =" getNodeHealthColor(item.status as string).color" >
181
- <v-tooltip
182
- v-if =" item.status == NodeHealth.Error"
183
- activator =" parent"
184
- location =" top"
185
- >
186
- {{
187
- item.message
188
- }}
134
+ <v-tooltip v-if =" item.status == NodeHealth.Error" activator =" parent" location =" top" >
135
+ {{ item.message }}
189
136
</v-tooltip >
190
- <v-tooltip
191
- v-if =" item.status == NodeHealth.Paused"
192
- activator =" parent"
193
- location =" top"
194
- >
137
+ <v-tooltip v-if =" item.status == NodeHealth.Paused" activator =" parent" location =" top" >
195
138
The deployment contract is in grace period
196
139
</v-tooltip >
197
140
<span class =" text-uppercase" >
201
144
</template >
202
145
<template #[` item.health ` ]=" { item } " >
203
146
<v-chip :color =" getNodeHealthColor(item[0].workloads[0].result.state as string).color" >
204
- <v-tooltip
205
- v-if =" item[0].workloads[0].result.state == NodeHealth.Error"
206
- activator =" parent"
207
- location =" top"
208
- >
209
- {{
210
- item.message
211
- }}
147
+ <v-tooltip v-if =" item[0].workloads[0].result.state == NodeHealth.Error" activator =" parent" location =" top" >
148
+ {{ item.message }}
212
149
</v-tooltip >
213
- <v-tooltip
214
- v-if =" item[0].workloads[0].result.state == NodeHealth.Paused"
215
- activator =" parent"
216
- location =" top"
217
- >
150
+ <v-tooltip v-if =" item[0].workloads[0].result.state == NodeHealth.Paused" activator =" parent" location =" top" >
218
151
The deployment contract is in grace period
219
152
</v-tooltip >
220
153
<span class =" text-uppercase" >
224
157
</template >
225
158
226
159
<template #no-data-text >
227
- <div
228
- v-if =" failedDeploymentList.length > 0"
229
- class =" text-center"
230
- >
160
+ <div v-if =" failedDeploymentList.length > 0" class =" text-center" >
231
161
<p v-text =" 'Couldn\'t load any of your ' + projectTitle + ' deployments.'" />
232
162
<VBtn
233
163
class =" mt-4"
238
168
@click =" loadDeployments"
239
169
/>
240
170
</div >
241
- <p
242
- v-else
243
- v-text =" 'No ' + projectTitle + ' deployments found on this account.'"
244
- />
171
+ <p v-else v-text =" 'No ' + projectTitle + ' deployments found on this account.'" />
245
172
</template >
246
173
</ListTable >
247
174
</div >
@@ -282,7 +209,11 @@ const failedDeployments = ref<
282
209
> ([]);
283
210
const gridStore = useGrid ();
284
211
const grid = gridStore .client as GridClient ;
285
-
212
+ const failedDeploymentsHeader = ref ([
213
+ { title: " Name" , key: " name" , sortable: false },
214
+ { title: " Node ID" , key: " nodes" , sortable: false },
215
+ { title: " Contract ID" , key: " contracts" , sortable: false },
216
+ ]);
286
217
onMounted (loadDeployments );
287
218
288
219
async function loadDomains() {
@@ -311,7 +242,7 @@ async function loadDeployments() {
311
242
312
243
items .value = [];
313
244
loading .value = true ;
314
- updateGrid (grid , { projectName: props .projectName });
245
+ updateGrid (grid , { projectName: props .projectName });
315
246
try {
316
247
const chunk1 = await loadVms (grid ! );
317
248
if (chunk1 .count > 0 && migrateGateways ) {
@@ -483,36 +414,17 @@ const filteredHeaders = computed(() => {
483
414
});
484
415
485
416
const failedDeploymentList = computed (() => {
486
- return failedDeployments .value
487
- .map (({ name , nodes = [], contracts = [] }, index ) => {
488
- const nodeMessage =
489
- nodes .length > 0
490
- ? ` <span class="ml-4 text-primary font-weight-bold">On Node:</span> ${nodes .join (" , " )}.<br/> `
491
- : " " ;
492
- const contractMessage =
493
- contracts .length > 0
494
- ? ` <span class="ml-4 text-primary font-weight-bold">With Contract ID:</span> ${contracts
495
- .map (c => c .contractID )
496
- .join (" , " )}. `
497
- : " " ;
498
-
499
- const subtitle =
500
- nodeMessage + contractMessage === " "
501
- ? ` <span class="ml-4 text-error font-weight-bold">Error:</span> Failed to decrypt deployment data. `
502
- : nodeMessage + contractMessage ;
503
- if (subtitle .includes (" Failed to decrypt deployment data." )) {
504
- showEncryption .value = true ;
505
- }
506
-
507
- const item: any [] = [{ title: name , subtitle }];
508
-
509
- if (index + 1 !== failedDeployments .value .length ) {
510
- item .push ({ type: " divider" , inset: false });
511
- }
417
+ return failedDeployments .value .map (({ name , nodes = [], contracts = [] }) => {
418
+ if (nodes .length === 0 && contracts .length === 0 ) {
419
+ showEncryption .value = true ;
420
+ }
512
421
513
- return item ;
514
- })
515
- .flat (1 );
422
+ return {
423
+ name ,
424
+ nodes: nodes .length > 0 ? nodes .join (" , " ) : " N/A" ,
425
+ contracts: contracts .length > 0 ? contracts .map (c => c .contractID ).join (" , " ) : " N/A" ,
426
+ };
427
+ });
516
428
});
517
429
518
430
function updateItem(newItem : any ) {
@@ -539,7 +451,7 @@ import { ProjectName } from "../types";
539
451
import { migrateModule } from " ../utils/migration" ;
540
452
import AccessDeploymentAlert from " ./AccessDeploymentAlert.vue" ;
541
453
import ListTable from " ./list_table.vue" ;
542
- import { GridClient } from ' @threefold/grid_client' ;
454
+ import { GridClient } from " @threefold/grid_client" ;
543
455
544
456
export default {
545
457
name: " VmDeploymentTable" ,
0 commit comments