Cody Jackson 2d2615128c
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.
2024-10-23 17:00:57 +02:00

38 lines
1.2 KiB
TypeScript

//@ts-nocheck
import { _MERGE } from '@shell/plugins/dashboard-store/actions';
import PollerSequential from '@shell/utils/poller-sequential';
const polling: any = {};
const POLL_INTERVAL = 10000;
export const actions = {
unsubscribe() {
Object.entries(polling).forEach(([type, poll]: [any, any]) => {
console.warn('Epinio: Polling stopped for: ', type); // eslint-disable-line no-console
poll.stop();
delete polling[type];
});
},
watch({ dispatch, rootGetters }: any, { type }: any) {
if (rootGetters['type-map/isSpoofed'](type) || polling[type]) {
// Ignore spoofed
return;
}
console.warn('Epinio: Polling started for: ', type);// eslint-disable-line no-console
polling[type] = new PollerSequential(
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)
await dispatch('findAll', { type, opt: { force: true, load: _MERGE } });
},
POLL_INTERVAL,
5
);
polling[type].start();
}
};