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:
Cody Jackson 2024-09-16 15:18:31 -07:00 committed by Francesco Torchia
parent d761b88ba0
commit 2d2615128c
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
9 changed files with 48 additions and 39 deletions

View File

@ -1,3 +1,4 @@
//@ts-nocheck
import { importTypes } from '@rancher/auto-import';
import { IPlugin } from '@shell/core/types';
import extensionRoutes from './routing/harvester-routing';

View File

@ -1,3 +1,4 @@
//@ts-nocheck
import {
NODE,
CONFIG_MAP,

View File

@ -1,3 +1,4 @@
//@ts-nocheck
import { ClusterNotFoundError } from '@shell/utils/error';
import { SETTING } from '@shell/config/settings';
import { COUNT, NAMESPACE, MANAGEMENT } from '@shell/config/types';
@ -17,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);
@ -43,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 });
}
};
@ -66,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);
@ -79,14 +80,14 @@ 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 }),
};
@ -100,15 +101,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,
};
@ -133,9 +134,9 @@ export default {
if (isMultiCluster) {
commit('managementChanged', {
ready: true,
ready: true,
isMultiCluster: true,
isRancher: true,
isRancher: true,
}, { root: true });
}
},

View File

@ -1,3 +1,4 @@
//@ts-nocheck
import {
NAMESPACE_FILTER_KINDS,
NAMESPACE_FILTER_ALL as ALL,
@ -14,8 +15,8 @@ export default {
notFilterNamespaces
}: any) => {
const out: { id: string, kind: string, label: string }[] = [{
id: ALL,
kind: NAMESPACE_FILTER_KINDS.SPECIAL,
id: ALL,
kind: NAMESPACE_FILTER_KINDS.SPECIAL,
label: rootGetters['i18n/t']('nav.ns.all'),
}];
@ -71,8 +72,8 @@ export default {
}
out.push({
id: `project://${ id }`,
kind: 'project',
id: `project://${id}`,
kind: 'project',
label: project.nameDisplay,
});
@ -89,8 +90,8 @@ export default {
}
out.push({
id: ALL_ORPHANS,
kind: 'project',
id: ALL_ORPHANS,
kind: 'project',
label: rootGetters['i18n/t']('nav.ns.orphan'),
});

View File

@ -1,3 +1,4 @@
//@ts-nocheck
import { CoreStoreSpecifics, CoreStoreConfig } from '@shell/core/types';
import { SteveFactory, steveStoreInit } from '@shell/plugins/steve/index';
@ -27,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
};

View File

@ -1,3 +1,4 @@
//@ts-nocheck
import { _MERGE } from '@shell/plugins/dashboard-store/actions';
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
polling[type] = new PollerSequential(
async() => {
async () => {
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
// (in rancher land these are all handled individually, here we have bulk changes)

View File

@ -34,7 +34,7 @@
],
"paths": {
"@shell/*": [
"../../node_modules/@rancher/shell/*"
"@rancher/shell/*"
],
"@components/*": [
"@rancher/components/*"
@ -45,9 +45,11 @@
"**/*.ts",
"**/*.d.ts",
"**/*.tsx",
"**/*.vue"
"**/*.vue",
"./index.d.ts"
],
"exclude": [
"../../node_modules"
"../../node_modules",
"**/*.test.ts"
]
}

View File

@ -37,6 +37,7 @@
]
},
"exclude": [
"node_modules"
"node_modules",
"**/*.test.ts"
]
}

View File

@ -13323,9 +13323,9 @@ type-fest@^0.8.0, type-fest@^0.8.1:
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
type-fest@^4.4.0:
version "4.26.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.26.0.tgz#703f263af10c093cd6277d079e26b9e17d517c4b"
integrity sha512-OduNjVJsFbifKb57UqZ2EMP1i4u64Xwow3NYXUtBbD4vIwJdQd4+xl8YDou1dlm4DVrtwT/7Ky8z8WyCULVfxw==
version "4.26.1"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.26.1.tgz#a4a17fa314f976dd3e6d6675ef6c775c16d7955e"
integrity sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==
type-is@~1.6.17, type-is@~1.6.18:
version "1.6.18"