Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions docs/.vitepress/theme/components/price-estimator/LabModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ const formData = ref({
subscription: "1Y",
machineType: "c1",
machineSubscription: "COMMITMENT_1Y",
hddSize: 1,
nvmeSize: 0,
archive: 0.4,
work: 0.3,
scratch: 0.3,
})

const subscriptions = computed(() => {
Expand Down Expand Up @@ -42,8 +43,9 @@ const save = () => {
subscription: formData.value.subscription,
machineType: formData.value.machineType,
machineSubscription: formData.value.machineSubscription,
hddSize: Number(formData.value.hddSize),
nvmeSize: Number(formData.value.nvmeSize),
archive: Number(formData.value.archive),
work: Number(formData.value.work),
scratch: Number(formData.value.scratch),
isDefault: true,
})
emit("close")
Expand Down Expand Up @@ -83,11 +85,15 @@ onMounted(() => {
</v-col>

<v-col cols="12" sm="6">
<v-text-field v-model="formData.hddSize" label="HDD Storage (TB)" type="number" variant="outlined" min="0"></v-text-field>
<v-text-field v-model="formData.archive" label="Archive Storage (TB)" type="number" variant="outlined" min="0" placeholder="0.4"></v-text-field>
</v-col>

<v-col cols="12" sm="6">
<v-text-field v-model="formData.nvmeSize" label="NVMe Storage (TB)" type="number" variant="outlined" min="0"></v-text-field>
<v-text-field v-model="formData.work" label="Work Storage (TB)" type="number" variant="outlined" min="0" placeholder="0.3"></v-text-field>
</v-col>

<v-col cols="12" sm="6">
<v-text-field v-model="formData.scratch" label="Scratch Storage (TB)" type="number" variant="outlined" min="0" placeholder="0.4"></v-text-field>
</v-col>
</v-row>
</v-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const priceEstimatorStore = reactive({
},

/* Lab helpers */
addLab(payload: { name: string; subscription: string; machineType: string; machineSubscription: string; hddSize: number; nvmeSize: number; isDefault: boolean }) {
addLab(payload: { name: string; subscription: string; machineType: string; machineSubscription: string; isDefault: boolean; archive: number; work: number; scratch: number }) {
const newLab: LabCard = {
id: this.labs.length,
title: payload.name,
Expand Down Expand Up @@ -189,36 +189,46 @@ export const priceEstimatorStore = reactive({
newLab.selectedCompute.push(unit)
}

// Add HDD storage
if (payload.hddSize > 0) {
const hddPrices = this.getStoragePriceFromCatalogue("HDD", payload.hddSize)
if (hddPrices) {
newLab.selectedStorage.push({
id: 0,
name: "volume-1",
usage: "Archive",
type: "HDD",
size: payload.hddSize,
monthlyPrice: hddPrices.monthlyPrice,
yearlyPrice: hddPrices.yearlyPrice,
})
}
// Add Archieve storage
const archivePrice = this.getStoragePriceFromCatalogue("HDD", payload.archive)
if (archivePrice) {
newLab.selectedStorage.push({
id: 0,
name: "volume-1",
usage: "Archive",
type: "HDD",
size: payload.archive,
monthlyPrice: archivePrice.monthlyPrice,
yearlyPrice: archivePrice.yearlyPrice,
})
}

// Add NVME storage
if (payload.nvmeSize > 0) {
const nvmePrices = this.getStoragePriceFromCatalogue("NVME", payload.nvmeSize)
if (nvmePrices) {
newLab.selectedStorage.push({
id: newLab.selectedStorage.length,
name: "volume-nvme",
usage: "Work",
type: "NVME",
size: payload.nvmeSize,
monthlyPrice: nvmePrices.monthlyPrice,
yearlyPrice: nvmePrices.yearlyPrice,
})
}
// Add Work storage
const workPrice = this.getStoragePriceFromCatalogue("HDD", payload.work)
if (workPrice) {
newLab.selectedStorage.push({
id: 1,
name: "volume-2",
usage: "Work",
type: "HDD",
size: payload.work,
monthlyPrice: workPrice.monthlyPrice,
yearlyPrice: workPrice.yearlyPrice,
})
}

// Add Scratch storage
const scratchPrice = this.getStoragePriceFromCatalogue("HDD", payload.scratch)
if (scratchPrice) {
newLab.selectedStorage.push({
id: 2,
name: "volume-3",
usage: "Scratch",
type: "HDD",
size: payload.scratch,
monthlyPrice: scratchPrice.monthlyPrice,
yearlyPrice: scratchPrice.yearlyPrice,
})
}

// Update
Expand Down