mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import { set } from '@shell/utils/object';
|
|
import HarvesterResource from './harvester';
|
|
|
|
export default class HciInventory extends HarvesterResource {
|
|
applyDefaults() {
|
|
const defaultSpec = {
|
|
baseboardSpec: {
|
|
connection: {
|
|
authSecretRef: {},
|
|
insecureTLS: false,
|
|
}
|
|
},
|
|
events: {
|
|
enabled: true,
|
|
pollingInterval: '1h',
|
|
},
|
|
primaryDisk: '',
|
|
managementInterfaceMacAddress: '',
|
|
};
|
|
|
|
set(this, 'metadata.annotations', {});
|
|
set(this, 'spec', this.spec || defaultSpec);
|
|
set(this, 'spec.baseboardSpec', this.spec?.baseboardSpec || defaultSpec.baseboardSpec);
|
|
set(this, 'spec.baseboardSpec.connection', this.spec?.baseboardSpec?.connection || defaultSpec.baseboardSpec.connection);
|
|
set(this, 'spec.baseboardSpec.connection.authSecretRef', this.spec?.baseboardSpec?.connection?.authSecretRef || {});
|
|
}
|
|
|
|
get warningMessages() {
|
|
const out = [];
|
|
|
|
if (this.metadata?.state?.error) {
|
|
out.push({ text: this.metadata?.state.message });
|
|
}
|
|
|
|
return out;
|
|
}
|
|
|
|
get customValidationRules() {
|
|
return [
|
|
{
|
|
path: 'spec.events.pollingInterval',
|
|
translationKey: 'harvester.seeder.inventory.pollingInterval.label',
|
|
validators: ['interval'],
|
|
},
|
|
];
|
|
}
|
|
}
|