mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +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 });
|
||||
}
|
||||
},
|
||||
|
||||
@@ -14,9 +14,9 @@ export default {
|
||||
divider,
|
||||
notFilterNamespaces
|
||||
}: any) => {
|
||||
const out: { id: string, kind: string, label: string }[] = [{
|
||||
id: ALL,
|
||||
kind: NAMESPACE_FILTER_KINDS.SPECIAL,
|
||||
const out = [{
|
||||
id: ALL,
|
||||
kind: NAMESPACE_FILTER_KINDS.SPECIAL,
|
||||
label: rootGetters['i18n/t']('nav.ns.all'),
|
||||
}];
|
||||
|
||||
@@ -30,11 +30,9 @@ export default {
|
||||
MANAGEMENT.PROJECT
|
||||
);
|
||||
|
||||
projects = sortBy(
|
||||
filterBy(projects, 'spec.clusterName', cluster.id),
|
||||
['nameDisplay'],
|
||||
null
|
||||
).filter((project: any) => project.nameDisplay !== 'System');
|
||||
projects = sortBy(filterBy(projects, 'spec.clusterName', cluster.id), [
|
||||
'nameDisplay',
|
||||
]).filter((project: any) => project.nameDisplay !== 'System');
|
||||
|
||||
const projectsById: any = {};
|
||||
const namespacesByProject: any = {};
|
||||
@@ -72,8 +70,8 @@ export default {
|
||||
}
|
||||
|
||||
out.push({
|
||||
id: `project://${id}`,
|
||||
kind: 'project',
|
||||
id: `project://${ id }`,
|
||||
kind: 'project',
|
||||
label: project.nameDisplay,
|
||||
});
|
||||
|
||||
@@ -90,8 +88,8 @@ export default {
|
||||
}
|
||||
|
||||
out.push({
|
||||
id: ALL_ORPHANS,
|
||||
kind: 'project',
|
||||
id: ALL_ORPHANS,
|
||||
kind: 'project',
|
||||
label: rootGetters['i18n/t']('nav.ns.orphan'),
|
||||
});
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@ const harvesterFactory = (): CoreStoreSpecifics => {
|
||||
return steveFactory;
|
||||
};
|
||||
const config: CoreStoreConfig = {
|
||||
namespace: PRODUCT_NAME,
|
||||
namespace: PRODUCT_NAME,
|
||||
isClusterStore: true
|
||||
};
|
||||
|
||||
export default {
|
||||
specifics: harvesterFactory(),
|
||||
config,
|
||||
init: steveStoreInit
|
||||
init: steveStoreInit
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user