dashboard-shell-shell 1.0.1000000086 → 1.0.1000000091
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.
- package/components/ResourceDetail/Masthead.vue +1 -0
- package/components/ResourceDetail/index.vue +1 -0
- package/components/ResourceList/Masthead.vue +2 -1
- package/components/ResourceList/index.vue +1 -0
- package/components/SideNav.vue +1 -0
- package/components/SortableTable/index.vue +2 -1
- package/components/nav/NamespaceFilter.vue +4 -0
- package/components/rancherResourceDetail/Masthead.vue +1 -0
- package/components/rancherResourceDetail/index.vue +1 -0
- package/components/rancherResourceList/Masthead-btn.vue +1 -0
- package/components/rancherResourceList/Masthead.vue +2 -1
- package/components/rancherResourceList/index.vue +1 -0
- package/components/rancherSortableTable/index.vue +2 -1
- package/config/product/auth.js +1 -1
- package/config/router/navigation-guards/index.js +28 -77
- package/edit/workload/mixins/workload.js +1 -0
- package/list/workload.vue +0 -187
- package/mixins/resource-fetch.js +1 -0
- package/models/management.cattle.io.setting.js +1 -0
- package/package.json +1 -1
- package/pages/auth/login.vue +1 -0
- package/pages/auth copy/login.vue +1 -0
- package/pages/prefs.vue +1 -0
- package/plugins/dashboard-store/normalize.js +2 -0
- package/plugins/dashboard-store/resource-class.js +1 -0
- package/types/shell/index.d.ts +3 -3
- package/utils/router.js +1 -1
|
@@ -17,6 +17,7 @@ import TabTitle from '@shell/components/TabTitle';
|
|
|
17
17
|
import ActionMenu from '@shell/components/ActionMenuShell.vue';
|
|
18
18
|
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
19
19
|
import { useStore } from 'vuex';
|
|
20
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
20
21
|
|
|
21
22
|
// i18n-uses resourceDetail.header.*
|
|
22
23
|
|
|
@@ -16,6 +16,7 @@ import ForceDirectedTreeChart from '@shell/components/fleet/ForceDirectedTreeCha
|
|
|
16
16
|
import { checkSchemasForFindAllHash } from '@shell/utils/auth';
|
|
17
17
|
import { stringify } from '@shell/utils/error';
|
|
18
18
|
import { Banner } from '@components/Banner';
|
|
19
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
19
20
|
|
|
20
21
|
function modeFor(route) {
|
|
21
22
|
if ( route.query?.mode === _IMPORT ) {
|
|
@@ -6,6 +6,7 @@ import { get } from '@shell/utils/object';
|
|
|
6
6
|
import { AS, _YAML } from '@shell/config/query-params';
|
|
7
7
|
import ResourceLoadingIndicator from './ResourceLoadingIndicator';
|
|
8
8
|
import TabTitle from '@shell/components/TabTitle';
|
|
9
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Resource List Masthead component.
|
|
@@ -130,7 +131,7 @@ export default {
|
|
|
130
131
|
return this.$store.getters['type-map/labelFor'](this.schema, 99);
|
|
131
132
|
},
|
|
132
133
|
_descriptionDisplay() {
|
|
133
|
-
const key = this.$route.path.split('/'
|
|
134
|
+
const key = this.$route.path.split('/'.pop());
|
|
134
135
|
|
|
135
136
|
return this.$store.getters['i18n/t'](`typeDescription."${ key.toLowerCase() }"`);
|
|
136
137
|
},
|
|
@@ -9,6 +9,7 @@ import { ResourceListComponentName } from './resource-list.config';
|
|
|
9
9
|
import { PanelLocation, ExtensionPoint } from '@shell/core/types';
|
|
10
10
|
import ExtensionPanel from '@shell/components/ExtensionPanel';
|
|
11
11
|
import { sameContents } from '@shell/utils/array';
|
|
12
|
+
import { cloud2harvesterhci } from '@shell/utils/router'
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
name: ResourceListComponentName,
|
package/components/SideNav.vue
CHANGED
|
@@ -20,6 +20,7 @@ import { TYPE_MODES } from '@shell/store/type-map';
|
|
|
20
20
|
import { NAME as NAVLINKS } from '@shell/config/product/navlinks';
|
|
21
21
|
import Group from '@shell/components/nav/Group';
|
|
22
22
|
import LocaleSelector from '@shell/components/LocaleSelector';
|
|
23
|
+
import { cloud2harvesterhci, harvester2cloud } from '@shell/utils/router';
|
|
23
24
|
|
|
24
25
|
export default {
|
|
25
26
|
name: 'SideNav',
|
|
@@ -27,6 +27,7 @@ import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue';
|
|
|
27
27
|
import ActionMenu from '@shell/components/ActionMenuShell.vue';
|
|
28
28
|
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
29
29
|
import ActionDropdownShell from '@shell/components/ActionDropdownShell.vue';
|
|
30
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
30
31
|
|
|
31
32
|
// Uncomment for table performance debugging
|
|
32
33
|
// import tableDebug from './debug';
|
|
@@ -415,7 +416,7 @@ export default {
|
|
|
415
416
|
const isLoading = this.loading || false;
|
|
416
417
|
|
|
417
418
|
let isCreatable = false;
|
|
418
|
-
const lastPath = this.$route.path.split('/'
|
|
419
|
+
const lastPath = this.$route.path.split('/'.pop());
|
|
419
420
|
|
|
420
421
|
if (lastPath.includes('.')) {
|
|
421
422
|
isCreatable = this.$store.getters['type-map/optionsFor'](lastPath).isCreatable;
|
|
@@ -20,6 +20,7 @@ import { KEY } from '@shell/utils/platform';
|
|
|
20
20
|
import pAndNFiltering from '@shell/plugins/steve/projectAndNamespaceFiltering.utils';
|
|
21
21
|
import { SETTING } from '@shell/config/settings';
|
|
22
22
|
import paginationUtils from '@shell/utils/pagination-utils';
|
|
23
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
23
24
|
|
|
24
25
|
const forcedNamespaceValidTypes = [NAMESPACE_FILTER_KINDS.DIVIDER, NAMESPACE_FILTER_KINDS.PROJECT, NAMESPACE_FILTER_KINDS.NAMESPACE];
|
|
25
26
|
|
|
@@ -144,6 +145,9 @@ export default {
|
|
|
144
145
|
|
|
145
146
|
const params = { ...this.$route.params };
|
|
146
147
|
let resource = params.resource;
|
|
148
|
+
if (params.resource) {
|
|
149
|
+
resource = resource
|
|
150
|
+
}
|
|
147
151
|
|
|
148
152
|
// Sometimes, different pages may have different namespaces to filter
|
|
149
153
|
const notFilterNamespaces = this.$store.getters[`type-map/optionsFor`](resource).notFilterNamespace || [];
|
|
@@ -17,6 +17,7 @@ import TabTitle from '@shell/components/TabTitle';
|
|
|
17
17
|
import ActionMenu from '@shell/components/ActionMenuShell.vue';
|
|
18
18
|
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
19
19
|
import { useStore } from 'vuex';
|
|
20
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
20
21
|
|
|
21
22
|
// i18n-uses resourceDetail.header.*
|
|
22
23
|
|
|
@@ -16,6 +16,7 @@ import ForceDirectedTreeChart from '@shell/components/fleet/ForceDirectedTreeCha
|
|
|
16
16
|
import { checkSchemasForFindAllHash } from '@shell/utils/auth';
|
|
17
17
|
import { stringify } from '@shell/utils/error';
|
|
18
18
|
import { Banner } from '@components/Banner';
|
|
19
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
19
20
|
|
|
20
21
|
function modeFor(route) {
|
|
21
22
|
if ( route.query?.mode === _IMPORT ) {
|
|
@@ -6,6 +6,7 @@ import { get } from '@shell/utils/object';
|
|
|
6
6
|
import { AS, _YAML } from '@shell/config/query-params';
|
|
7
7
|
import ResourceLoadingIndicator from './ResourceLoadingIndicator';
|
|
8
8
|
import TabTitle from '@shell/components/TabTitle';
|
|
9
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Resource List Masthead component.
|
|
@@ -6,6 +6,7 @@ import { get } from '@shell/utils/object';
|
|
|
6
6
|
import { AS, _YAML } from '@shell/config/query-params';
|
|
7
7
|
import ResourceLoadingIndicator from './ResourceLoadingIndicator';
|
|
8
8
|
import TabTitle from '@shell/components/TabTitle';
|
|
9
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Resource List Masthead component.
|
|
@@ -138,7 +139,7 @@ export default {
|
|
|
138
139
|
return this.$store.getters['type-map/labelFor'](this.schema, 99);
|
|
139
140
|
},
|
|
140
141
|
_descriptionDisplay() {
|
|
141
|
-
const key = this.$route.path.split('/'
|
|
142
|
+
const key = this.$route.path.split('/'.pop());
|
|
142
143
|
|
|
143
144
|
return this.$store.getters['i18n/t'](`typeDescription."${ key.toLowerCase() }"`);
|
|
144
145
|
},
|
|
@@ -9,6 +9,7 @@ import { ResourceListComponentName } from './resource-list.config';
|
|
|
9
9
|
import { PanelLocation, ExtensionPoint } from '@shell/core/types';
|
|
10
10
|
import ExtensionPanel from '@shell/components/ExtensionPanel';
|
|
11
11
|
import { sameContents } from '@shell/utils/array';
|
|
12
|
+
import { cloud2harvesterhci } from '@shell/utils/router'
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
name: ResourceListComponentName,
|
|
@@ -27,6 +27,7 @@ import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue';
|
|
|
27
27
|
import ActionMenu from '@shell/components/ActionMenuShell.vue';
|
|
28
28
|
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
29
29
|
import ActionDropdownShell from '@shell/components/ActionDropdownShell.vue';
|
|
30
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
30
31
|
|
|
31
32
|
// Uncomment for table performance debugging
|
|
32
33
|
// import tableDebug from './debug';
|
|
@@ -415,7 +416,7 @@ export default {
|
|
|
415
416
|
const isLoading = this.loading || false;
|
|
416
417
|
|
|
417
418
|
let isCreatable = false;
|
|
418
|
-
const lastPath = this.$route.path.split('/'
|
|
419
|
+
const lastPath = this.$route.path.split('/'.pop());
|
|
419
420
|
|
|
420
421
|
if (lastPath.includes('.')) {
|
|
421
422
|
isCreatable = this.$store.getters['type-map/optionsFor'](lastPath).isCreatable;
|
package/config/product/auth.js
CHANGED
|
@@ -24,7 +24,7 @@ export function init(store) {
|
|
|
24
24
|
spoofedType,
|
|
25
25
|
virtualType,
|
|
26
26
|
} = DSL(store, NAME);
|
|
27
|
-
|
|
27
|
+
console.log('------------------------------------------------2')
|
|
28
28
|
product({
|
|
29
29
|
ifHaveType: new RegExp(`${ MANAGEMENT.USER }|${ MANAGEMENT.AUTH_CONFIG }`, 'i'),
|
|
30
30
|
ifHaveVerb: 'GET',
|
|
@@ -9,26 +9,32 @@ import { install as installClusters } from '@shell/config/router/navigation-guar
|
|
|
9
9
|
import { install as installHandleInstallRedirect } from '@shell/config/router/navigation-guards/install-redirect';
|
|
10
10
|
import { install as installPageTitle } from '@shell/config/router/navigation-guards/page-title';
|
|
11
11
|
import { install as installServerUpgradeGrowl } from '@shell/config/router/navigation-guards/server-upgrade-growl';
|
|
12
|
-
|
|
12
|
+
import { harvester2cloud } from '@shell/utils/router';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Install router navigation guards
|
|
16
|
+
* 1. 保留原有导航守卫顺序
|
|
17
|
+
* 2. 不在 beforeEach 改 params,只在 push/replace & afterEach 改 URL
|
|
16
18
|
*/
|
|
17
|
-
export function
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
export function installNavigationGuards(router, context) {
|
|
20
|
+
// 最早执行:保证进入逻辑时 params 始终是 harvester
|
|
21
|
+
router.beforeEach((to, from, next) => {
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
console.log('-----------------------------------------------------1');
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// 内部逻辑统一用 harvesterManager
|
|
27
|
+
if (to?.params?.product) {
|
|
28
|
+
to.params.product = to.params.product.replace(/cloud/g, 'harvester')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (to?.params?.cluster) {
|
|
32
|
+
to.params.cluster = to.params.cluster.replace(/cloud/g, 'harvester')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
next();
|
|
36
|
+
});
|
|
24
37
|
|
|
25
|
-
/**
|
|
26
|
-
* Install our router navigation guards with cloud/harvester mapping.
|
|
27
|
-
*/
|
|
28
|
-
export function installNavigationGuards(router, context) {
|
|
29
|
-
// ---------------------------
|
|
30
|
-
// 1. 安装原有导航守卫
|
|
31
|
-
// ---------------------------
|
|
32
38
|
const navigationGuardInstallers = [
|
|
33
39
|
installLoadInitialSettings,
|
|
34
40
|
installAttemptFirstLogin,
|
|
@@ -43,74 +49,19 @@ export function installNavigationGuards(router, context) {
|
|
|
43
49
|
installServerUpgradeGrowl
|
|
44
50
|
];
|
|
45
51
|
|
|
46
|
-
navigationGuardInstallers.forEach(
|
|
52
|
+
navigationGuardInstallers.forEach(installer => installer(router, context));
|
|
47
53
|
|
|
48
|
-
//
|
|
49
|
-
// 2. 入口层 beforeEach: cloud -> harvester
|
|
50
|
-
// ---------------------------
|
|
51
|
-
router.beforeEach((to, from, next) => {
|
|
52
|
-
const newParams = { ...to.params };
|
|
53
|
-
let changed = false;
|
|
54
|
-
|
|
55
|
-
if (newParams.product) {
|
|
56
|
-
const newProduct = newParams.product;
|
|
57
|
-
if (newProduct !== newParams.product) {
|
|
58
|
-
newParams.product = newProduct;
|
|
59
|
-
changed = true;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (newParams.resource) {
|
|
64
|
-
const newResource = newParams.resource;
|
|
65
|
-
if (newResource !== newParams.resource) {
|
|
66
|
-
newParams.resource = newResource;
|
|
67
|
-
changed = true;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// 只有实际修改才 redirect,避免无限循环
|
|
72
|
-
if (changed) {
|
|
73
|
-
next({ ...to, params: newParams, replace: true });
|
|
74
|
-
} else {
|
|
75
|
-
next();
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// ---------------------------
|
|
80
|
-
// 3. 出口层 wrapNav: harvester -> cloud
|
|
81
|
-
// ---------------------------
|
|
82
|
-
const wrapNav = (fn) => function(location, ...args) {
|
|
83
|
-
if (typeof location === 'string') {
|
|
84
|
-
location = location;
|
|
85
|
-
} else if (location?.params) {
|
|
86
|
-
Object.keys(location.params).forEach(key => {
|
|
87
|
-
const val = location.params[key];
|
|
88
|
-
if (typeof val === 'string') {
|
|
89
|
-
location.params[key] = val;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
} else if (location?.path) {
|
|
93
|
-
location.path = location.path;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return fn.call(this, location, ...args);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
router.push = wrapNav(router.push.bind(router));
|
|
100
|
-
router.replace = wrapNav(router.replace.bind(router));
|
|
101
|
-
|
|
102
|
-
// ---------------------------
|
|
103
|
-
// 4. afterEach: 确保用户看到的 URL 是 cloud
|
|
104
|
-
// ---------------------------
|
|
54
|
+
// 最后执行:只改地址栏,不改内部
|
|
105
55
|
router.afterEach((to) => {
|
|
106
|
-
let cloudPath = to.fullPath;
|
|
107
56
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
cloudPath =
|
|
57
|
+
console.log('-----------------------------------------------------3');
|
|
58
|
+
|
|
59
|
+
const cloudPath = to.fullPath
|
|
60
|
+
.replace(/harvester/g, 'cloud')
|
|
111
61
|
|
|
112
62
|
if (cloudPath !== to.fullPath) {
|
|
113
63
|
window.history.replaceState({}, '', cloudPath);
|
|
114
64
|
}
|
|
115
65
|
});
|
|
116
66
|
}
|
|
67
|
+
|
|
@@ -52,6 +52,7 @@ import { TYPES as SECRET_TYPES } from '@shell/models/secret';
|
|
|
52
52
|
import { defaultContainer } from '@shell/models/workload';
|
|
53
53
|
import { allHash } from '@shell/utils/promise';
|
|
54
54
|
|
|
55
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
55
56
|
|
|
56
57
|
const TAB_WEIGHT_MAP = {
|
|
57
58
|
general: 99,
|
package/list/workload.vue
CHANGED
|
@@ -1,187 +0,0 @@
|
|
|
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
|
-
|
|
9
|
-
const workloadSchema = {
|
|
10
|
-
id: 'workload',
|
|
11
|
-
type: SCHEMA,
|
|
12
|
-
attributes: {
|
|
13
|
-
kind: 'Workload',
|
|
14
|
-
namespaced: true
|
|
15
|
-
},
|
|
16
|
-
metadata: { name: 'workload' },
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const $loadingResources = ($route, $store) => {
|
|
20
|
-
const allowedResources = [];
|
|
21
|
-
|
|
22
|
-
Object.values(LIST_WORKLOAD_TYPES).forEach((type) => {
|
|
23
|
-
// You may not have RBAC to see some of the types
|
|
24
|
-
if ($store.getters['cluster/schemaFor'](type) ) {
|
|
25
|
-
allowedResources.push(type);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const allTypes = $route.params.resource === workloadSchema.id;
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
loadResources: allTypes ? allowedResources : [$route.params.resource],
|
|
33
|
-
loadIndeterminate: allTypes,
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default {
|
|
38
|
-
name: 'ListWorkload',
|
|
39
|
-
components: { ResourceTable, PaginatedResourceTable },
|
|
40
|
-
mixins: [ResourceFetch],
|
|
41
|
-
|
|
42
|
-
props: {
|
|
43
|
-
useQueryParamsForSimpleFiltering: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
async fetch() {
|
|
50
|
-
if (this.paginationEnabled) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (this.allTypes && this.loadResources.length) {
|
|
55
|
-
this.$initializeFetchData(this.loadResources[0], this.loadResources);
|
|
56
|
-
} else {
|
|
57
|
-
this.$initializeFetchData(this.$route.params.resource);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const schema = this.$store.getters[`cluster/schemaFor`](NODE);
|
|
62
|
-
|
|
63
|
-
if (schema) {
|
|
64
|
-
// Used for shell/components/formatter/Endpoints.vue (too see column page needs to be wide and per page setting 25 or under)
|
|
65
|
-
this.$fetchType(NODE);
|
|
66
|
-
}
|
|
67
|
-
} catch {}
|
|
68
|
-
|
|
69
|
-
this.loadHeathResources();
|
|
70
|
-
|
|
71
|
-
if ( this.allTypes ) {
|
|
72
|
-
this.resources = await Promise.all(this.loadResources.map((allowed) => {
|
|
73
|
-
return this.$fetchType(allowed, this.loadResources);
|
|
74
|
-
}));
|
|
75
|
-
} else {
|
|
76
|
-
const type = this.$route.params.resource;
|
|
77
|
-
|
|
78
|
-
if ( this.$store.getters['cluster/schemaFor'](type) ) {
|
|
79
|
-
const resource = await this.$fetchType(type);
|
|
80
|
-
|
|
81
|
-
this.resources = [resource];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
data() {
|
|
87
|
-
// Ensure these are set on load (to determine if the NS filter is required) rather than too late on `fetch`
|
|
88
|
-
const { loadResources, loadIndeterminate } = $loadingResources(this.$route, this.$store);
|
|
89
|
-
|
|
90
|
-
const { params:{ resource: type } } = this.$route;
|
|
91
|
-
const allTypes = this.$route.params.resource === workloadSchema.id;
|
|
92
|
-
const schema = type !== workloadSchema.id ? this.$store.getters['cluster/schemaFor'](type) : workloadSchema;
|
|
93
|
-
const paginationEnabled = !allTypes && this.$store.getters[`cluster/paginationEnabled`]?.({ id: type });
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
allTypes,
|
|
97
|
-
schema,
|
|
98
|
-
paginationEnabled,
|
|
99
|
-
resources: [],
|
|
100
|
-
loadResources,
|
|
101
|
-
loadIndeterminate
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
computed: {
|
|
106
|
-
filteredRows() {
|
|
107
|
-
const out = [];
|
|
108
|
-
|
|
109
|
-
for ( const typeRows of this.resources ) {
|
|
110
|
-
if ( !typeRows ) {
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
for ( const row of typeRows ) {
|
|
115
|
-
if (!this.allTypes || !row.ownedByWorkload) {
|
|
116
|
-
out.push(row);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return out;
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
headers() {
|
|
125
|
-
return this.$store.getters['type-map/headersFor'](this.schema, false);
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
// All of the resources that we will load that we need for the loading indicator
|
|
130
|
-
$loadingResources($route, $store) {
|
|
131
|
-
return $loadingResources($route, $store);
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
methods: {
|
|
135
|
-
loadHeathResources() {
|
|
136
|
-
// See https://github.com/rancher/dashboard/issues/10417, health comes from selectors applied locally to all pods (bad)
|
|
137
|
-
if (this.paginationEnabled) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Fetch these in the background to populate workload health
|
|
142
|
-
if ( this.allTypes ) {
|
|
143
|
-
this.$fetchType(POD);
|
|
144
|
-
this.$fetchType(WORKLOAD_TYPES.JOB);
|
|
145
|
-
} else {
|
|
146
|
-
const type = this.$route.params.resource;
|
|
147
|
-
|
|
148
|
-
if (type === WORKLOAD_TYPES.JOB || type === POD) {
|
|
149
|
-
// Ignore job and pods (we're fetching this anyway, plus they contain their own state)
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (type === WORKLOAD_TYPES.CRON_JOB) {
|
|
154
|
-
this.$fetchType(WORKLOAD_TYPES.JOB);
|
|
155
|
-
} else {
|
|
156
|
-
this.$fetchType(POD);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
typeDisplay() {
|
|
163
|
-
// Used by shell/components/ResourceList/index.vue to override list title (usually found via schema, which doesn't exist for this virtual type)
|
|
164
|
-
return this.$store.getters['type-map/labelFor'](this.schema || workloadSchema, 99);
|
|
165
|
-
},
|
|
166
|
-
};
|
|
167
|
-
</script>
|
|
168
|
-
|
|
169
|
-
<template>
|
|
170
|
-
<div>
|
|
171
|
-
<PaginatedResourceTable
|
|
172
|
-
v-if="paginationEnabled"
|
|
173
|
-
:schema="schema"
|
|
174
|
-
:use-query-params-for-simple-filtering="useQueryParamsForSimpleFiltering"
|
|
175
|
-
/>
|
|
176
|
-
<ResourceTable
|
|
177
|
-
v-else
|
|
178
|
-
:loading="$fetchState.pending"
|
|
179
|
-
:schema="schema"
|
|
180
|
-
:headers="headers"
|
|
181
|
-
:rows="filteredRows"
|
|
182
|
-
:overflow-y="true"
|
|
183
|
-
:use-query-params-for-simple-filtering="useQueryParamsForSimpleFiltering"
|
|
184
|
-
:force-update-live-and-delayed="forceUpdateLiveAndDelayed"
|
|
185
|
-
/>
|
|
186
|
-
</div>
|
|
187
|
-
</template>
|
package/mixins/resource-fetch.js
CHANGED
|
@@ -3,6 +3,7 @@ import { COUNT, MANAGEMENT } from '@shell/config/types';
|
|
|
3
3
|
import { SETTING, DEFAULT_PERF_SETTING } from '@shell/config/settings';
|
|
4
4
|
import ResourceFetchNamespaced from '@shell/mixins/resource-fetch-namespaced';
|
|
5
5
|
import ResourceFetchApiPagination from '@shell/mixins/resource-fetch-api-pagination';
|
|
6
|
+
import { cloud2harvesterhci } from '@shell/utils/router'
|
|
6
7
|
|
|
7
8
|
// Number of pages to fetch when loading incrementally
|
|
8
9
|
const PAGES = 4;
|
|
@@ -2,6 +2,7 @@ import { ALLOWED_SETTINGS } from '@shell/config/settings';
|
|
|
2
2
|
import HybridModel from '@shell/plugins/steve/hybrid-class';
|
|
3
3
|
import { isServerUrl } from '@shell/utils/validators/setting';
|
|
4
4
|
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
|
|
5
|
+
import { harvester2cloud } from '@shell/utils/router'
|
|
5
6
|
import {
|
|
6
7
|
_EDIT,
|
|
7
8
|
_UNFLAG,
|
package/package.json
CHANGED
package/pages/auth/login.vue
CHANGED
|
@@ -32,6 +32,7 @@ import loadPlugins from '@shell/plugins/plugin';
|
|
|
32
32
|
import Loading from '@shell/components/Loading';
|
|
33
33
|
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
|
|
34
34
|
import TabTitle from '@shell/components/TabTitle.vue';
|
|
35
|
+
import { harvester2cloud } from '@shell/utils/router'
|
|
35
36
|
|
|
36
37
|
export default {
|
|
37
38
|
name: 'Login',
|
|
@@ -32,6 +32,7 @@ import loadPlugins from '@shell/plugins/plugin';
|
|
|
32
32
|
import Loading from '@shell/components/Loading';
|
|
33
33
|
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
|
|
34
34
|
import TabTitle from '@shell/components/TabTitle.vue';
|
|
35
|
+
import { harvester2cloud } from '@shell/utils/router'
|
|
35
36
|
|
|
36
37
|
export default {
|
|
37
38
|
name: 'Login',
|
package/pages/prefs.vue
CHANGED
|
@@ -18,6 +18,7 @@ import { addObject } from '@shell/utils/array';
|
|
|
18
18
|
import LocaleSelector from '@shell/components/LocaleSelector';
|
|
19
19
|
import TabTitle from '@shell/components/TabTitle';
|
|
20
20
|
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
|
|
21
|
+
import { harvester2cloud } from '@shell/utils/router'
|
|
21
22
|
|
|
22
23
|
export default {
|
|
23
24
|
components: {
|
|
@@ -34,6 +34,7 @@ import { markRaw } from 'vue';
|
|
|
34
34
|
|
|
35
35
|
import { ExtensionPoint, ActionLocation } from '@shell/core/types';
|
|
36
36
|
import { getApplicableExtensionEnhancements } from '@shell/core/plugin-helpers';
|
|
37
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
37
38
|
|
|
38
39
|
export const DNS_LIKE_TYPES = ['dnsLabel', 'dnsLabelRestricted', 'hostname'];
|
|
39
40
|
|
package/types/shell/index.d.ts
CHANGED
|
@@ -4161,9 +4161,9 @@ export function setPromiseResult(promise: any, obj: any, key: any, label: any):
|
|
|
4161
4161
|
// @shell/utils/router
|
|
4162
4162
|
|
|
4163
4163
|
declare module '@shell/utils/router' {
|
|
4164
|
-
export function
|
|
4165
|
-
export function
|
|
4166
|
-
export function
|
|
4164
|
+
export function str: any: any;
|
|
4165
|
+
export function str: any: any;
|
|
4166
|
+
export function str: any: any;
|
|
4167
4167
|
export function cloud2harvester(str: any): any;
|
|
4168
4168
|
export function queryParamsFor(current: any, qp: any, defaults?: {}): any;
|
|
4169
4169
|
export function getClusterFromRoute(to: any): any;
|
package/utils/router.js
CHANGED
|
@@ -89,7 +89,7 @@ export const getPackageFromRoute = (route) => {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
export const getResourceFromRoute = (to) => {
|
|
92
|
-
let resource =
|
|
92
|
+
let resource = to.params?.resource;
|
|
93
93
|
|
|
94
94
|
if (!resource) {
|
|
95
95
|
resource = findMeta(to, 'resource');
|