Andy Lee f02074a25e Extract variables to utils/unit
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 8db4de1c4a1200f4f303e4444b6435c581187d72)
2025-03-04 02:47:42 +00:00

54 lines
933 B
Vue

<script>
import UnitInput from '@shell/components/form/UnitInput';
import { MEBIBYTE } from '../../utils/unit';
export default {
name: 'HarvesterReserved',
emits: ['updateReserved'],
components: { UnitInput },
props: {
reservedMemory: {
type: String,
default: null
},
mode: {
type: String,
default: 'create',
},
},
data() {
return { MEBIBYTE, memory: this.reservedMemory };
},
watch: {
reservedMemory(memory) {
this.memory = memory;
},
},
methods: {
change() {
const { memory } = this;
this.$emit('updateReserved', { memory });
},
}
};
</script>
<template>
<UnitInput
v-model:value="memory"
:label="t('harvester.virtualMachine.input.reservedMemory')"
:mode="mode"
:input-exponent="2"
:increment="1024"
:output-modifier="true"
:suffix="MEBIBYTE"
@update:value="change"
/>
</template>