Skip to content

Commit

Permalink
Add provisioner selector in Host edit page/Disk
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
  • Loading branch information
torchiaf committed Jul 19, 2024
1 parent f935b87 commit 7c77b91
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/harvester/config/harvester-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ export const ADD_ONS = {
RANCHER_LOGGING: 'rancher-logging',
RANCHER_MONITORING: 'rancher-monitoring',
VM_IMPORT_CONTROLLER: 'vm-import-controller',
HARVESTER_CSI_DRIVER_LVM: 'harvester-csi-driver-lvm'
};
50 changes: 49 additions & 1 deletion pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<script>
import { CSI_DRIVER } from '@shell/config/types';
import { LabeledInput } from '@components/Form/LabeledInput';
import LabelValue from '@shell/components/LabelValue';
import { BadgeState } from '@components/BadgeState';
import { Banner } from '@components/Banner';
import LabeledSelect from '@shell/components/form/LabeledSelect';
import { RadioGroup, RadioButton } from '@components/Form/Radio';
import HarvesterDisk from '../../mixins/harvester-disk';
import Tags from '../../components/DiskTags';
import { HCI } from '../../types';
import { LONGHORN_SYSTEM } from './index';
import { LONGHORN_DRIVER } from '@shell/models/persistentvolume';
export default {
components: {
LabeledInput,
LabeledSelect,
LabelValue,
BadgeState,
Banner,
Expand Down Expand Up @@ -40,10 +44,39 @@ export default {
default: 'edit',
},
},
async fetch() {
const inStore = this.$store.getters['currentProduct'].inStore;
await this.$store.dispatch(`${ inStore }/findAll`, { type: CSI_DRIVER });
},
data() {
return {};
const provisionerFormat = { [LONGHORN_DRIVER]: 'harvester.storage.storageClass.longhornV1.label' };
return {
// TODO add provisioner to Disk
provisioner: {
label: provisionerFormat[LONGHORN_DRIVER],
value: LONGHORN_DRIVER,
},
provisionerFormat
};
},
computed: {
provisioners() {
const inStore = this.$store.getters['currentProduct'].inStore;
const csiDrivers = this.$store.getters[`${ inStore }/all`](CSI_DRIVER) || [];
return csiDrivers.map((provisioner) => {
return {
label: this.provisionerFormat[provisioner.name] || provisioner.name,
value: provisioner.name,
};
});
},
allowSchedulingOptions() {
return [{
label: this.t('generic.enabled'),
Expand Down Expand Up @@ -142,8 +175,10 @@ export default {
return this.blockDevice.isFormatting;
},
},
methods: {
update() {
console.log('change')
this.$emit('input', this.value);
},
},
Expand Down Expand Up @@ -258,6 +293,19 @@ export default {
</RadioGroup>
</div>
</div>
<div class="row mt-10">
<div class="col span-6">
<LabeledSelect
v-model="provisioner"
:mode="mode"
label-key="harvester.host.disk.provisioner"
:localized-label="true"
:searchable="true"
:options="provisioners"
@keydown.native.enter.prevent="()=>{}"
/>
</div>
</div>
</div>
</template>
Expand Down
1 change: 1 addition & 0 deletions pkg/harvester/l10n/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ harvester:
label: Storage Scheduled
storageMaximum:
label: Storage Maximum
provisioner: Provisioner
tags:
label: Host Tags
addLabel: Add Host Tag
Expand Down

0 comments on commit 7c77b91

Please sign in to comment.