mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-07 06:36:09 +08:00
Add pkg/harvester components + shell portings - 1
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import HarvesterResource from './harvester';
|
||||
import { set } from '@shell/utils/object';
|
||||
|
||||
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'],
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user