mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 05:01:43 +00:00
Putting in some temporary workarounds regarding the typesystem
Without these changes we can't build the app using `yarn build-pkg harvester` because it complains about missing modules in @rancher/shell imports. I believe this will be resolved by https://github.com/rancher/dashboard/issues/11797#issue-2502509655 and we should remove this change once that occurs.
This commit is contained in:
parent
d761b88ba0
commit
2d2615128c
@ -1,3 +1,4 @@
|
|||||||
|
//@ts-nocheck
|
||||||
import { importTypes } from '@rancher/auto-import';
|
import { importTypes } from '@rancher/auto-import';
|
||||||
import { IPlugin } from '@shell/core/types';
|
import { IPlugin } from '@shell/core/types';
|
||||||
import extensionRoutes from './routing/harvester-routing';
|
import extensionRoutes from './routing/harvester-routing';
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
//@ts-nocheck
|
||||||
import {
|
import {
|
||||||
NODE,
|
NODE,
|
||||||
CONFIG_MAP,
|
CONFIG_MAP,
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
//@ts-nocheck
|
||||||
import { ClusterNotFoundError } from '@shell/utils/error';
|
import { ClusterNotFoundError } from '@shell/utils/error';
|
||||||
import { SETTING } from '@shell/config/settings';
|
import { SETTING } from '@shell/config/settings';
|
||||||
import { COUNT, NAMESPACE, MANAGEMENT } from '@shell/config/types';
|
import { COUNT, NAMESPACE, MANAGEMENT } from '@shell/config/types';
|
||||||
@ -17,16 +18,16 @@ export default {
|
|||||||
const cluster = await dispatch('management/find', {
|
const cluster = await dispatch('management/find', {
|
||||||
type: MANAGEMENT.CLUSTER,
|
type: MANAGEMENT.CLUSTER,
|
||||||
id,
|
id,
|
||||||
opt: { url: `${ MANAGEMENT.CLUSTER }s/${ escape(id) }` }
|
opt: { url: `${MANAGEMENT.CLUSTER}s/${escape(id)}` }
|
||||||
}, { root: true });
|
}, { root: true });
|
||||||
|
|
||||||
let virtualBase = `/k8s/clusters/${ escape(id) }/v1/harvester`;
|
let virtualBase = `/k8s/clusters/${escape(id)}/v1/harvester`;
|
||||||
|
|
||||||
if (id === 'local') {
|
if (id === 'local') {
|
||||||
virtualBase = `/v1/harvester`;
|
virtualBase = `/v1/harvester`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !cluster ) {
|
if (!cluster) {
|
||||||
commit('clusterId', null, { root: true });
|
commit('clusterId', null, { root: true });
|
||||||
commit('applyConfig', { baseUrl: null });
|
commit('applyConfig', { baseUrl: null });
|
||||||
throw new ClusterNotFoundError(id);
|
throw new ClusterNotFoundError(id);
|
||||||
@ -43,22 +44,22 @@ export default {
|
|||||||
|
|
||||||
const projectArgs = {
|
const projectArgs = {
|
||||||
type: MANAGEMENT.PROJECT,
|
type: MANAGEMENT.PROJECT,
|
||||||
opt: {
|
opt: {
|
||||||
url: `${ MANAGEMENT.PROJECT }/${ escape(id) }`,
|
url: `${MANAGEMENT.PROJECT}/${escape(id)}`,
|
||||||
watchNamespace: id
|
watchNamespace: id
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchProjects = async() => {
|
const fetchProjects = async () => {
|
||||||
let limit = 30000;
|
let limit = 30000;
|
||||||
const sleep = 100;
|
const sleep = 100;
|
||||||
|
|
||||||
while ( limit > 0 && !rootState.managementReady ) {
|
while (limit > 0 && !rootState.managementReady) {
|
||||||
await setTimeout(() => {}, sleep);
|
await setTimeout(() => { }, sleep);
|
||||||
limit -= sleep;
|
limit -= sleep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rootGetters['management/schemaFor'](MANAGEMENT.PROJECT) ) {
|
if (rootGetters['management/schemaFor'](MANAGEMENT.PROJECT)) {
|
||||||
return dispatch('management/findAll', projectArgs, { root: true });
|
return dispatch('management/findAll', projectArgs, { root: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -66,8 +67,8 @@ export default {
|
|||||||
if (id !== 'local' && getters['schemaFor'](MANAGEMENT.SETTING)) { // multi-cluster
|
if (id !== 'local' && getters['schemaFor'](MANAGEMENT.SETTING)) { // multi-cluster
|
||||||
const settings = await dispatch('findAll', {
|
const settings = await dispatch('findAll', {
|
||||||
type: MANAGEMENT.SETTING,
|
type: MANAGEMENT.SETTING,
|
||||||
id: SETTING.SYSTEM_NAMESPACES,
|
id: SETTING.SYSTEM_NAMESPACES,
|
||||||
opt: { url: `${ virtualBase }/${ MANAGEMENT.SETTING }s/`, force: true }
|
opt: { url: `${virtualBase}/${MANAGEMENT.SETTING}s/`, force: true }
|
||||||
});
|
});
|
||||||
|
|
||||||
const systemNamespaces = settings?.find((x: any) => x.id === SETTING.SYSTEM_NAMESPACES);
|
const systemNamespaces = settings?.find((x: any) => x.id === SETTING.SYSTEM_NAMESPACES);
|
||||||
@ -79,14 +80,14 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hash: { [key: string]: Promise<any>} = {
|
const hash: { [key: string]: Promise<any> } = {
|
||||||
projects: fetchProjects(),
|
projects: fetchProjects(),
|
||||||
virtualCount: dispatch('findAll', { type: COUNT }),
|
virtualCount: dispatch('findAll', { type: COUNT }),
|
||||||
virtualNamespaces: dispatch('findAll', { type: NAMESPACE }),
|
virtualNamespaces: dispatch('findAll', { type: NAMESPACE }),
|
||||||
settings: dispatch('findAll', { type: HCI.SETTING }),
|
settings: dispatch('findAll', { type: HCI.SETTING }),
|
||||||
clusters: dispatch('management/findAll', {
|
clusters: dispatch('management/findAll', {
|
||||||
type: MANAGEMENT.CLUSTER,
|
type: MANAGEMENT.CLUSTER,
|
||||||
opt: { force: true }
|
opt: { force: true }
|
||||||
}, { root: true }),
|
}, { root: true }),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -100,15 +101,15 @@ export default {
|
|||||||
|
|
||||||
commit('updateNamespaces', {
|
commit('updateNamespaces', {
|
||||||
filters: [],
|
filters: [],
|
||||||
all: getters.filterNamespace(),
|
all: getters.filterNamespace(),
|
||||||
getters
|
getters
|
||||||
}, { root: true });
|
}, { root: true });
|
||||||
|
|
||||||
// Solve compatibility with Rancher v2.6.x, fell remove these codes after not support v2.6.x
|
// Solve compatibility with Rancher v2.6.x, fell remove these codes after not support v2.6.x
|
||||||
const definition = {
|
const definition = {
|
||||||
def: false,
|
def: false,
|
||||||
parseJSON: true,
|
parseJSON: true,
|
||||||
inheritFrom: DEV,
|
inheritFrom: DEV,
|
||||||
asUserPreference: true,
|
asUserPreference: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -133,9 +134,9 @@ export default {
|
|||||||
|
|
||||||
if (isMultiCluster) {
|
if (isMultiCluster) {
|
||||||
commit('managementChanged', {
|
commit('managementChanged', {
|
||||||
ready: true,
|
ready: true,
|
||||||
isMultiCluster: true,
|
isMultiCluster: true,
|
||||||
isRancher: true,
|
isRancher: true,
|
||||||
}, { root: true });
|
}, { root: true });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
//@ts-nocheck
|
||||||
import {
|
import {
|
||||||
NAMESPACE_FILTER_KINDS,
|
NAMESPACE_FILTER_KINDS,
|
||||||
NAMESPACE_FILTER_ALL as ALL,
|
NAMESPACE_FILTER_ALL as ALL,
|
||||||
@ -14,8 +15,8 @@ export default {
|
|||||||
notFilterNamespaces
|
notFilterNamespaces
|
||||||
}: any) => {
|
}: any) => {
|
||||||
const out: { id: string, kind: string, label: string }[] = [{
|
const out: { id: string, kind: string, label: string }[] = [{
|
||||||
id: ALL,
|
id: ALL,
|
||||||
kind: NAMESPACE_FILTER_KINDS.SPECIAL,
|
kind: NAMESPACE_FILTER_KINDS.SPECIAL,
|
||||||
label: rootGetters['i18n/t']('nav.ns.all'),
|
label: rootGetters['i18n/t']('nav.ns.all'),
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@ -71,8 +72,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
out.push({
|
out.push({
|
||||||
id: `project://${ id }`,
|
id: `project://${id}`,
|
||||||
kind: 'project',
|
kind: 'project',
|
||||||
label: project.nameDisplay,
|
label: project.nameDisplay,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -89,8 +90,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
out.push({
|
out.push({
|
||||||
id: ALL_ORPHANS,
|
id: ALL_ORPHANS,
|
||||||
kind: 'project',
|
kind: 'project',
|
||||||
label: rootGetters['i18n/t']('nav.ns.orphan'),
|
label: rootGetters['i18n/t']('nav.ns.orphan'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
//@ts-nocheck
|
||||||
import { CoreStoreSpecifics, CoreStoreConfig } from '@shell/core/types';
|
import { CoreStoreSpecifics, CoreStoreConfig } from '@shell/core/types';
|
||||||
|
|
||||||
import { SteveFactory, steveStoreInit } from '@shell/plugins/steve/index';
|
import { SteveFactory, steveStoreInit } from '@shell/plugins/steve/index';
|
||||||
@ -27,12 +28,12 @@ const harvesterFactory = (): CoreStoreSpecifics => {
|
|||||||
return steveFactory;
|
return steveFactory;
|
||||||
};
|
};
|
||||||
const config: CoreStoreConfig = {
|
const config: CoreStoreConfig = {
|
||||||
namespace: PRODUCT_NAME,
|
namespace: PRODUCT_NAME,
|
||||||
isClusterStore: true
|
isClusterStore: true
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
specifics: harvesterFactory(),
|
specifics: harvesterFactory(),
|
||||||
config,
|
config,
|
||||||
init: steveStoreInit
|
init: steveStoreInit
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
//@ts-nocheck
|
||||||
import { _MERGE } from '@shell/plugins/dashboard-store/actions';
|
import { _MERGE } from '@shell/plugins/dashboard-store/actions';
|
||||||
import PollerSequential from '@shell/utils/poller-sequential';
|
import PollerSequential from '@shell/utils/poller-sequential';
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ export const actions = {
|
|||||||
console.warn('Epinio: Polling started for: ', type);// eslint-disable-line no-console
|
console.warn('Epinio: Polling started for: ', type);// eslint-disable-line no-console
|
||||||
|
|
||||||
polling[type] = new PollerSequential(
|
polling[type] = new PollerSequential(
|
||||||
async() => {
|
async () => {
|
||||||
console.debug('Epinio: Polling: ', type); // eslint-disable-line no-console
|
console.debug('Epinio: Polling: ', type); // eslint-disable-line no-console
|
||||||
// NOTE - In order for lists to automatically update resources opt to MERGE data in place instead of replace
|
// NOTE - In order for lists to automatically update resources opt to MERGE data in place instead of replace
|
||||||
// (in rancher land these are all handled individually, here we have bulk changes)
|
// (in rancher land these are all handled individually, here we have bulk changes)
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@shell/*": [
|
"@shell/*": [
|
||||||
"../../node_modules/@rancher/shell/*"
|
"@rancher/shell/*"
|
||||||
],
|
],
|
||||||
"@components/*": [
|
"@components/*": [
|
||||||
"@rancher/components/*"
|
"@rancher/components/*"
|
||||||
@ -45,9 +45,11 @@
|
|||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
"**/*.d.ts",
|
"**/*.d.ts",
|
||||||
"**/*.tsx",
|
"**/*.tsx",
|
||||||
"**/*.vue"
|
"**/*.vue",
|
||||||
|
"./index.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"../../node_modules"
|
"../../node_modules",
|
||||||
|
"**/*.test.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -37,6 +37,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules",
|
||||||
|
"**/*.test.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -13323,9 +13323,9 @@ type-fest@^0.8.0, type-fest@^0.8.1:
|
|||||||
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
|
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
|
||||||
|
|
||||||
type-fest@^4.4.0:
|
type-fest@^4.4.0:
|
||||||
version "4.26.0"
|
version "4.26.1"
|
||||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.26.0.tgz#703f263af10c093cd6277d079e26b9e17d517c4b"
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.26.1.tgz#a4a17fa314f976dd3e6d6675ef6c775c16d7955e"
|
||||||
integrity sha512-OduNjVJsFbifKb57UqZ2EMP1i4u64Xwow3NYXUtBbD4vIwJdQd4+xl8YDou1dlm4DVrtwT/7Ky8z8WyCULVfxw==
|
integrity sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==
|
||||||
|
|
||||||
type-is@~1.6.17, type-is@~1.6.18:
|
type-is@~1.6.17, type-is@~1.6.18:
|
||||||
version "1.6.18"
|
version "1.6.18"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user