mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-06 22:26:05 +08:00
Latest changes from harvester/master
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
@@ -18,16 +18,16 @@ export default {
|
||||
const cluster = await dispatch('management/find', {
|
||||
type: MANAGEMENT.CLUSTER,
|
||||
id,
|
||||
opt: { url: `${MANAGEMENT.CLUSTER}s/${escape(id)}` }
|
||||
opt: { url: `${ MANAGEMENT.CLUSTER }s/${ escape(id) }` }
|
||||
}, { root: true });
|
||||
|
||||
let virtualBase = `/k8s/clusters/${escape(id)}/v1/harvester`;
|
||||
let virtualBase = `/k8s/clusters/${ escape(id) }/v1/harvester`;
|
||||
|
||||
if (id === 'local') {
|
||||
virtualBase = `/v1/harvester`;
|
||||
}
|
||||
|
||||
if (!cluster) {
|
||||
if ( !cluster ) {
|
||||
commit('clusterId', null, { root: true });
|
||||
commit('applyConfig', { baseUrl: null });
|
||||
throw new ClusterNotFoundError(id);
|
||||
@@ -44,22 +44,22 @@ export default {
|
||||
|
||||
const projectArgs = {
|
||||
type: MANAGEMENT.PROJECT,
|
||||
opt: {
|
||||
url: `${MANAGEMENT.PROJECT}/${escape(id)}`,
|
||||
opt: {
|
||||
url: `${ MANAGEMENT.PROJECT }/${ escape(id) }`,
|
||||
watchNamespace: id
|
||||
}
|
||||
};
|
||||
|
||||
const fetchProjects = async () => {
|
||||
const fetchProjects = async() => {
|
||||
let limit = 30000;
|
||||
const sleep = 100;
|
||||
|
||||
while (limit > 0 && !rootState.managementReady) {
|
||||
await setTimeout(() => { }, sleep);
|
||||
while ( limit > 0 && !rootState.managementReady ) {
|
||||
await setTimeout(() => {}, sleep);
|
||||
limit -= sleep;
|
||||
}
|
||||
|
||||
if (rootGetters['management/schemaFor'](MANAGEMENT.PROJECT)) {
|
||||
if ( rootGetters['management/schemaFor'](MANAGEMENT.PROJECT) ) {
|
||||
return dispatch('management/findAll', projectArgs, { root: true });
|
||||
}
|
||||
};
|
||||
@@ -67,8 +67,8 @@ export default {
|
||||
if (id !== 'local' && getters['schemaFor'](MANAGEMENT.SETTING)) { // multi-cluster
|
||||
const settings = await dispatch('findAll', {
|
||||
type: MANAGEMENT.SETTING,
|
||||
id: SETTING.SYSTEM_NAMESPACES,
|
||||
opt: { url: `${virtualBase}/${MANAGEMENT.SETTING}s/`, force: true }
|
||||
id: SETTING.SYSTEM_NAMESPACES,
|
||||
opt: { url: `${ virtualBase }/${ MANAGEMENT.SETTING }s/`, force: true }
|
||||
});
|
||||
|
||||
const systemNamespaces = settings?.find((x: any) => x.id === SETTING.SYSTEM_NAMESPACES);
|
||||
@@ -80,17 +80,21 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
const hash: { [key: string]: Promise<any> } = {
|
||||
projects: fetchProjects(),
|
||||
virtualCount: dispatch('findAll', { type: COUNT }),
|
||||
const hash: { [key: string]: Promise<any>} = {
|
||||
projects: fetchProjects(),
|
||||
virtualCount: dispatch('findAll', { type: COUNT }),
|
||||
virtualNamespaces: dispatch('findAll', { type: NAMESPACE }),
|
||||
settings: dispatch('findAll', { type: HCI.SETTING }),
|
||||
clusters: dispatch('management/findAll', {
|
||||
settings: dispatch('findAll', { type: HCI.SETTING }),
|
||||
clusters: dispatch('management/findAll', {
|
||||
type: MANAGEMENT.CLUSTER,
|
||||
opt: { force: true }
|
||||
opt: { force: true }
|
||||
}, { root: true }),
|
||||
};
|
||||
|
||||
if (getters['schemaFor'](HCI.RESOURCE_QUOTA)) {
|
||||
hash.resourceQuota = dispatch('findAll', { type: HCI.RESOURCE_QUOTA });
|
||||
}
|
||||
|
||||
if (getters['schemaFor'](HCI.UPGRADE)) {
|
||||
hash.upgrades = dispatch('findAll', { type: HCI.UPGRADE });
|
||||
}
|
||||
@@ -101,15 +105,15 @@ export default {
|
||||
|
||||
commit('updateNamespaces', {
|
||||
filters: [],
|
||||
all: getters.filterNamespace(),
|
||||
all: getters.filterNamespace(),
|
||||
getters
|
||||
}, { root: true });
|
||||
|
||||
// Solve compatibility with Rancher v2.6.x, fell remove these codes after not support v2.6.x
|
||||
const definition = {
|
||||
def: false,
|
||||
parseJSON: true,
|
||||
inheritFrom: DEV,
|
||||
def: false,
|
||||
parseJSON: true,
|
||||
inheritFrom: DEV,
|
||||
asUserPreference: true,
|
||||
};
|
||||
|
||||
@@ -134,9 +138,9 @@ export default {
|
||||
|
||||
if (isMultiCluster) {
|
||||
commit('managementChanged', {
|
||||
ready: true,
|
||||
ready: true,
|
||||
isMultiCluster: true,
|
||||
isRancher: true,
|
||||
isRancher: true,
|
||||
}, { root: true });
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user