dashboard-shell-shell 1.0.1000000091 → 1.0.1000000093
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -390,10 +390,10 @@ export default {
|
|
|
390
390
|
|
|
391
391
|
rows = rows.map((item) => {
|
|
392
392
|
if (item.key.includes('harvester')) {
|
|
393
|
-
item.key = item.key
|
|
393
|
+
item.key = item.key;
|
|
394
394
|
}
|
|
395
395
|
if (item.value.includes('harvester')) {
|
|
396
|
-
item.value = item.value
|
|
396
|
+
item.value = item.value;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
return item;
|
|
@@ -409,8 +409,8 @@ export default {
|
|
|
409
409
|
[this.valueName]: value,
|
|
410
410
|
};
|
|
411
411
|
|
|
412
|
-
obj.key = obj.key
|
|
413
|
-
obj.value = obj.value
|
|
412
|
+
obj.key = obj.key;
|
|
413
|
+
obj.value = obj.value;
|
|
414
414
|
obj.binary = false;
|
|
415
415
|
obj.canEncode = this.handleBase64;
|
|
416
416
|
obj.supported = true;
|
|
@@ -484,8 +484,8 @@ export default {
|
|
|
484
484
|
// let value = (row[valueName] || '');
|
|
485
485
|
// const key = (row[keyName] || '').trim();
|
|
486
486
|
|
|
487
|
-
const key = (row[keyName]
|
|
488
|
-
let value = (row[valueName]
|
|
487
|
+
const key = (row[keyName] || '').trim();
|
|
488
|
+
let value = (row[valueName] || '').trim();
|
|
489
489
|
|
|
490
490
|
if (value && typeOf(value) === 'object') {
|
|
491
491
|
out[key] = JSON.parse(JSON.stringify(value));
|
|
@@ -289,7 +289,7 @@ export default {
|
|
|
289
289
|
:data-testid="`input-match-type-field-${index}`"
|
|
290
290
|
>
|
|
291
291
|
<div v-if="isView">
|
|
292
|
-
{{ row.matching
|
|
292
|
+
{{ row.matching }}
|
|
293
293
|
<!-- {{ row.matching }} -->
|
|
294
294
|
</div>
|
|
295
295
|
<LabeledSelect
|
|
@@ -305,7 +305,7 @@ export default {
|
|
|
305
305
|
:data-testid="`input-match-expression-key-${index}`"
|
|
306
306
|
>
|
|
307
307
|
<div v-if="isView" class="view-item-value">
|
|
308
|
-
{{ row.key
|
|
308
|
+
{{ row.key }}
|
|
309
309
|
</div>
|
|
310
310
|
<input
|
|
311
311
|
v-else-if="!hasKeySelectOptions"
|
|
@@ -756,7 +756,7 @@ export default {
|
|
|
756
756
|
:data-testid="`namespaces-value-${j}`"
|
|
757
757
|
class="ns-value"
|
|
758
758
|
>
|
|
759
|
-
<div>{{ ns.label
|
|
759
|
+
<div>{{ ns.label }}</div>
|
|
760
760
|
<!-- block user from removing the last selection if ns forced filtering is on -->
|
|
761
761
|
<i
|
|
762
762
|
v-if="!namespaceFilterMode || value.length > 1"
|
|
@@ -867,7 +867,7 @@ export default {
|
|
|
867
867
|
v-if="opt.kind === NAMESPACE_FILTER_KINDS.NAMESPACE"
|
|
868
868
|
class="icon icon-folder"
|
|
869
869
|
/>
|
|
870
|
-
<div>{{ opt.label
|
|
870
|
+
<div>{{ opt.label }}</div>
|
|
871
871
|
<i
|
|
872
872
|
v-if="opt.selected"
|
|
873
873
|
class="icon icon-checkmark"
|
package/config/table-headers.js
CHANGED
|
@@ -162,7 +162,7 @@ export const NAMESPACE = {
|
|
|
162
162
|
name: 'namespace',
|
|
163
163
|
labelKey: 'tableHeaders.namespace',
|
|
164
164
|
value: 'namespace',
|
|
165
|
-
getValue: row => row && row.namespace && row.namespace
|
|
165
|
+
getValue: row => row && row.namespace && row.namespace,
|
|
166
166
|
sort: 'namespace',
|
|
167
167
|
dashIfEmpty: true,
|
|
168
168
|
};
|
package/list/workload.vue
CHANGED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import ResourceTable from '@shell/components/ResourceTable';
|
|
3
|
+
import {
|
|
4
|
+
WORKLOAD_TYPES, SCHEMA, NODE, POD, LIST_WORKLOAD_TYPES
|
|
5
|
+
} from '@shell/config/types';
|
|
6
|
+
import ResourceFetch from '@shell/mixins/resource-fetch';
|
|
7
|
+
import PaginatedResourceTable from '@shell/components/PaginatedResourceTable';
|
|
8
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
9
|
+
|
|
10
|
+
const workloadSchema = {
|
|
11
|
+
id: 'workload',
|
|
12
|
+
type: SCHEMA,
|
|
13
|
+
attributes: {
|
|
14
|
+
kind: 'Workload',
|
|
15
|
+
namespaced: true
|
|
16
|
+
},
|
|
17
|
+
metadata: { name: 'workload' },
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const $loadingResources = ($route, $store) => {
|
|
21
|
+
const allowedResources = [];
|
|
22
|
+
|
|
23
|
+
Object.values(LIST_WORKLOAD_TYPES).forEach((type) => {
|
|
24
|
+
// You may not have RBAC to see some of the types
|
|
25
|
+
if ($store.getters['cluster/schemaFor'](type) ) {
|
|
26
|
+
allowedResources.push(type);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const allTypes = $route.params.resource === workloadSchema.id;
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
loadResources: allTypes ? allowedResources : [$route.params.resource],
|
|
34
|
+
loadIndeterminate: allTypes,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
name: 'ListWorkload',
|
|
40
|
+
components: { ResourceTable, PaginatedResourceTable },
|
|
41
|
+
mixins: [ResourceFetch],
|
|
42
|
+
|
|
43
|
+
props: {
|
|
44
|
+
useQueryParamsForSimpleFiltering: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
async fetch() {
|
|
51
|
+
if (this.paginationEnabled) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (this.allTypes && this.loadResources.length) {
|
|
56
|
+
this.$initializeFetchData(this.loadResources[0], this.loadResources);
|
|
57
|
+
} else {
|
|
58
|
+
this.$initializeFetchData(this.$route.params.resource);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
const schema = this.$store.getters[`cluster/schemaFor`](NODE);
|
|
63
|
+
|
|
64
|
+
if (schema) {
|
|
65
|
+
// Used for shell/components/formatter/Endpoints.vue (too see column page needs to be wide and per page setting 25 or under)
|
|
66
|
+
this.$fetchType(NODE);
|
|
67
|
+
}
|
|
68
|
+
} catch {}
|
|
69
|
+
|
|
70
|
+
this.loadHeathResources();
|
|
71
|
+
|
|
72
|
+
if ( this.allTypes ) {
|
|
73
|
+
this.resources = await Promise.all(this.loadResources.map((allowed) => {
|
|
74
|
+
return this.$fetchType(allowed, this.loadResources);
|
|
75
|
+
}));
|
|
76
|
+
} else {
|
|
77
|
+
const type = this.$route.params.resource;
|
|
78
|
+
|
|
79
|
+
if ( this.$store.getters['cluster/schemaFor'](type) ) {
|
|
80
|
+
const resource = await this.$fetchType(type);
|
|
81
|
+
|
|
82
|
+
this.resources = [resource];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
data() {
|
|
88
|
+
// Ensure these are set on load (to determine if the NS filter is required) rather than too late on `fetch`
|
|
89
|
+
const { loadResources, loadIndeterminate } = $loadingResources(this.$route, this.$store);
|
|
90
|
+
|
|
91
|
+
const { params:{ resource: type } } = this.$route;
|
|
92
|
+
const allTypes = this.$route.params.resource === workloadSchema.id;
|
|
93
|
+
const schema = type !== workloadSchema.id ? this.$store.getters['cluster/schemaFor'](type) : workloadSchema;
|
|
94
|
+
const paginationEnabled = !allTypes && this.$store.getters[`cluster/paginationEnabled`]?.({ id: type });
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
allTypes,
|
|
98
|
+
schema,
|
|
99
|
+
paginationEnabled,
|
|
100
|
+
resources: [],
|
|
101
|
+
loadResources,
|
|
102
|
+
loadIndeterminate
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
computed: {
|
|
107
|
+
filteredRows() {
|
|
108
|
+
const out = [];
|
|
109
|
+
|
|
110
|
+
for ( const typeRows of this.resources ) {
|
|
111
|
+
if ( !typeRows ) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
for ( const row of typeRows ) {
|
|
116
|
+
if (!this.allTypes || !row.ownedByWorkload) {
|
|
117
|
+
out.push(row);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return out;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
headers() {
|
|
126
|
+
return this.$store.getters['type-map/headersFor'](this.schema, false);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
// All of the resources that we will load that we need for the loading indicator
|
|
131
|
+
$loadingResources($route, $store) {
|
|
132
|
+
return $loadingResources($route, $store);
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
methods: {
|
|
136
|
+
loadHeathResources() {
|
|
137
|
+
// See https://github.com/rancher/dashboard/issues/10417, health comes from selectors applied locally to all pods (bad)
|
|
138
|
+
if (this.paginationEnabled) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Fetch these in the background to populate workload health
|
|
143
|
+
if ( this.allTypes ) {
|
|
144
|
+
this.$fetchType(POD);
|
|
145
|
+
this.$fetchType(WORKLOAD_TYPES.JOB);
|
|
146
|
+
} else {
|
|
147
|
+
const type = this.$route.params.resource;
|
|
148
|
+
|
|
149
|
+
if (type === WORKLOAD_TYPES.JOB || type === POD) {
|
|
150
|
+
// Ignore job and pods (we're fetching this anyway, plus they contain their own state)
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (type === WORKLOAD_TYPES.CRON_JOB) {
|
|
155
|
+
this.$fetchType(WORKLOAD_TYPES.JOB);
|
|
156
|
+
} else {
|
|
157
|
+
this.$fetchType(POD);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
typeDisplay() {
|
|
164
|
+
// Used by shell/components/ResourceList/index.vue to override list title (usually found via schema, which doesn't exist for this virtual type)
|
|
165
|
+
return this.$store.getters['type-map/labelFor'](this.schema || workloadSchema, 99);
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
</script>
|
|
169
|
+
|
|
170
|
+
<template>
|
|
171
|
+
<div>
|
|
172
|
+
<PaginatedResourceTable
|
|
173
|
+
v-if="paginationEnabled"
|
|
174
|
+
:schema="schema"
|
|
175
|
+
:use-query-params-for-simple-filtering="useQueryParamsForSimpleFiltering"
|
|
176
|
+
/>
|
|
177
|
+
<ResourceTable
|
|
178
|
+
v-else
|
|
179
|
+
:loading="$fetchState.pending"
|
|
180
|
+
:schema="schema"
|
|
181
|
+
:headers="headers"
|
|
182
|
+
:rows="filteredRows"
|
|
183
|
+
:overflow-y="true"
|
|
184
|
+
:use-query-params-for-simple-filtering="useQueryParamsForSimpleFiltering"
|
|
185
|
+
:force-update-live-and-delayed="forceUpdateLiveAndDelayed"
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
</template>
|