Skip to content

Commit 5cbfd61

Browse files
author
kei5uke
committed
fix: subscription, machine_type
1 parent 44ba7fe commit 5cbfd61

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

docs/.vitepress/theme/components/price-estimator/LabModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import { ref, computed, onMounted } from "vue"
33
import { priceEstimatorStore } from "./stores/priceEstimatorStore"
4-
import type { MachineFlavor } from "./types"
4+
import type { MachineType } from "./types"
55
66
const emit = defineEmits<{
77
close: []
@@ -40,7 +40,7 @@ const save = () => {
4040
priceEstimatorStore.addLab({
4141
name: formData.value.name,
4242
subscription: formData.value.subscription,
43-
machineFlavor: formData.value.machineFlavor,
43+
machineType: formData.value.machineFlavor,
4444
machineSubscription: formData.value.machineSubscription,
4545
hddSize: Number(formData.value.hddSize),
4646
nvmeSize: Number(formData.value.nvmeSize),

docs/.vitepress/theme/components/price-estimator/MachineModal.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { ref, computed, onMounted } from "vue"
3-
import type { ComputeUnit, PriceListItem, GpuModel, MachineFlavor, MachineFormData } from "./types"
3+
import type { ComputeUnit, PriceListItem, GpuModel, MachineType, MachineFormData } from "./types"
44
import { priceEstimatorStore } from "./stores/priceEstimatorStore"
55
66
const props = defineProps({
@@ -74,11 +74,11 @@ const getGpuPriceMonth = computed((): string | number => {
7474
return yearlyGpu ? Number(yearlyGpu / 12).toFixed(2) : 0
7575
})
7676
77-
const getFlavors = computed((): MachineFlavor[] => {
77+
const getFlavors = computed((): MachineType[] => {
7878
if (!formData.value.subscription) {
7979
return []
8080
}
81-
return priceEstimatorStore.catalogue.machinePrices.filter((item: MachineFlavor) => item)
81+
return priceEstimatorStore.catalogue.machinePrices.filter((item: MachineType) => item)
8282
})
8383
8484
const getGpus = computed(() => {
@@ -102,7 +102,7 @@ const save = () => {
102102
103103
const name = formData.value.name
104104
const machinetitle = priceEstimatorStore.catalogue.machinePrices
105-
.filter((item: MachineFlavor) => item["value"] === formData.value.flavor)[0]
105+
.filter((item: MachineType) => item["value"] === formData.value.flavor)[0]
106106
["title"].split(" - ")[1]
107107
.split(" / ")
108108
const core_count = parseInt(machinetitle[0].split(" ")[0])

docs/.vitepress/theme/components/price-estimator/api/pricesApi.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const price_list_url = "https://assets.hdc.ntnu.no/assets/prices/v5/hunt-cloud-p
55

66
const gpu_models_url = "https://assets.hdc.ntnu.no/assets/js/gpus.json"
77

8-
const machine_flavors_url = "https://assets.hdc.ntnu.no/assets/js/flavors.json"
8+
const machine_types_url = "https://assets.hdc.ntnu.no/assets/js/flavors.json"
99

1010
export default {
1111
async getPriceList() {
@@ -27,12 +27,12 @@ export default {
2727
return []
2828
}
2929
},
30-
async getMachineFlavors() {
30+
async getMachineTypes() {
3131
try {
32-
const response = await axios.get(machine_flavors_url)
32+
const response = await axios.get(machine_types_url)
3333
return response.data
3434
} catch (error) {
35-
console.error("Error fetching machine flavors:", error)
35+
console.error("Error fetching machine types:", error)
3636
return []
3737
}
3838
},

docs/.vitepress/theme/components/price-estimator/stores/priceEstimatorStore.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
type StorageType,
88
type PriceListItem,
99
type GpuModel,
10-
type MachineFlavor,
10+
type MachineType,
1111
type Catalogue,
1212
type SubscriptionType,
1313
storageTypes,
@@ -27,7 +27,7 @@ export const priceEstimatorStore = reactive({
2727
computePrices: [] as PriceListItem[],
2828
storagePrices: [] as PriceListItem[],
2929
gpuPrices: [] as PriceListItem[],
30-
machinePrices: [] as MachineFlavor[],
30+
machinePrices: [] as MachineType[],
3131
availableGpus: [] as GpuModel[],
3232
labPrices: [] as PriceListItem[],
3333
} as Catalogue,
@@ -111,7 +111,7 @@ export const priceEstimatorStore = reactive({
111111
this.catalogue.availableGpus = gpus
112112
})
113113

114-
const machinesPromise = pricesApi.getMachineFlavors().then((machine: MachineFlavor[]) => {
114+
const machinesPromise = pricesApi.getMachineTypes().then((machine: MachineType[]) => {
115115
this.catalogue.machinePrices = machine
116116
})
117117

@@ -140,7 +140,7 @@ export const priceEstimatorStore = reactive({
140140
},
141141

142142
/* Lab helpers */
143-
addLab(payload: { name: string; subscription: string; machineFlavor: string; machineSubscription: string; hddSize: number; nvmeSize: number }) {
143+
addLab(payload: { name: string; subscription: string; machineType: string; machineSubscription: string; hddSize: number; nvmeSize: number }) {
144144
const newLab: LabCard = {
145145
id: this.labs.length,
146146
title: payload.name,
@@ -150,18 +150,18 @@ export const priceEstimatorStore = reactive({
150150
}
151151

152152
// Add compute
153-
const machineInfo = this.catalogue.machinePrices.find((item: MachineFlavor) => item["value"] === payload.machineFlavor)
153+
const machineInfo = this.catalogue.machinePrices.find((item: MachineType) => item["value"] === payload.machineType)
154154

155155
if (machineInfo) {
156-
const prices = this.getComputePriceFromCatalogue(payload.machineFlavor, payload.machineSubscription)
156+
const prices = this.getComputePriceFromCatalogue(payload.machineType, payload.machineSubscription)
157157

158158
const machineTitle = machineInfo["title"].split(" - ")[1].split(" / ")
159159
const coreCount = parseInt(machineTitle[0].split(" ")[0])
160160
const ram = parseInt(machineTitle[1].split(" ")[0])
161161
const unit: ComputeUnit = {
162162
id: 0,
163163
name: "machine-1",
164-
machine_type: payload.machineFlavor,
164+
machine_type: payload.machineType,
165165
core_count: coreCount,
166166
ram,
167167
subscription: payload.machineSubscription as SubscriptionType,
@@ -644,10 +644,10 @@ export const priceEstimatorStore = reactive({
644644
for (const comp of labData.compute) {
645645
this.addComputeToLab(newLabId, {
646646
name: comp.name,
647-
machine_type: comp.flavor,
647+
machine_type: comp.machine_type,
648648
core_count: comp.core_count,
649649
ram: comp.ram,
650-
subscription: comp.type,
650+
subscription: comp.subscription,
651651
gpu: comp.gpu,
652652
})
653653
}

docs/.vitepress/theme/components/price-estimator/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export interface GpuModel {
4848
vram: number
4949
}
5050

51-
export interface MachineFlavor {
51+
export interface MachineType {
5252
title: string
5353
value: string
5454
header?: string
@@ -60,7 +60,7 @@ export interface Catalogue {
6060
storagePrices: PriceListItem[]
6161
gpuPrices: PriceListItem[]
6262
availableGpus: GpuModel[]
63-
machinePrices: MachineFlavor[]
63+
machinePrices: MachineType[]
6464
labPrices: PriceListItem[]
6565
}
6666

0 commit comments

Comments
 (0)