Skip to content

Commit 1a48c70

Browse files
authored
fixed: fields names (#223)
2 parents f039f3f + 862f975 commit 1a48c70

File tree

7 files changed

+181
-347
lines changed

7 files changed

+181
-347
lines changed

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

Lines changed: 11 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ let editingComputeItem: ComputeUnit | null = null
1717
1818
const computeHeaders = ref<DataTableHeader[]>([
1919
{ title: "Name", align: "start", sortable: true, key: "name" },
20-
{ title: "Machine type", align: "start", sortable: true, key: "flavor" },
20+
{ title: "Machine type", align: "start", sortable: true, key: "machine_type" },
2121
{ title: "CPU cores", align: "start", sortable: true, key: "core_count" },
2222
{ title: "Memory [GB]", align: "start", sortable: true, key: "ram" },
2323
{ title: "GPU", align: "start", sortable: true, key: "gpu" },
24-
{ title: "Type", align: "start", sortable: true, key: "type" },
24+
{ title: "Subscription", align: "start", sortable: true, key: "subscription" },
2525
{ title: "Price / month", align: "start", sortable: true, key: "monthlyPrice" },
2626
{ title: "Price / year", align: "start", sortable: true, key: "yearlyPrice" },
2727
{ title: "Actions", key: "actions", align: "end", sortable: false },
@@ -57,18 +57,14 @@ const storageLabSum = computed(() => {
5757
})
5858
5959
const LabSum = computed(() => {
60-
return (
61-
computeLabSum.value.yearlyCostTotal +
62-
storageLabSum.value.HDD.yearlyCostTotal +
63-
storageLabSum.value.NVME.yearlyCostTotal
64-
)
60+
return computeLabSum.value.yearlyCostTotal + storageLabSum.value.HDD.yearlyCostTotal + storageLabSum.value.NVME.yearlyCostTotal
6561
})
6662
6763
const localTitle = ref(props.lab.title)
6864
6965
watch(
7066
() => props.lab.title,
71-
val => {
67+
(val) => {
7268
localTitle.value = val
7369
},
7470
)
@@ -148,13 +144,7 @@ const removeStorageById = (storageId: number) => {
148144
<v-card flat>
149145
<v-card-title>Compute</v-card-title>
150146

151-
<v-data-table-virtual
152-
:items="selectedCompute"
153-
:headers="computeHeaders"
154-
hide-default-footer
155-
hover
156-
item-value="id"
157-
>
147+
<v-data-table-virtual :items="selectedCompute" :headers="computeHeaders" hide-default-footer hover item-value="id">
158148
<template v-slot:item.monthlyPrice="{ item }">
159149
{{ item.monthlyPrice.toFixed(2) + " kr" }}
160150
</template>
@@ -163,18 +153,8 @@ const removeStorageById = (storageId: number) => {
163153
</template>
164154
<template v-slot:item.actions="{ item }">
165155
<div class="d-flex ga-2 justify-end">
166-
<v-icon
167-
color="medium-emphasis"
168-
icon="mdi-pencil"
169-
size="small"
170-
@click="editCompute(selectedCompute.find(c => c.id === item.id)!)"
171-
></v-icon>
172-
<v-icon
173-
color="medium-emphasis"
174-
icon="mdi-delete"
175-
size="small"
176-
@click="removeComputeById(item.id)"
177-
></v-icon>
156+
<v-icon color="medium-emphasis" icon="mdi-pencil" size="small" @click="editCompute(selectedCompute.find((c) => c.id === item.id)!)"></v-icon>
157+
<v-icon color="medium-emphasis" icon="mdi-delete" size="small" @click="removeComputeById(item.id)"></v-icon>
178158
</div>
179159
</template>
180160

@@ -229,18 +209,8 @@ const removeStorageById = (storageId: number) => {
229209
</template>
230210
<template v-slot:item.actions="{ item }">
231211
<div class="d-flex ga-2 justify-end">
232-
<v-icon
233-
color="medium-emphasis"
234-
icon="mdi-pencil"
235-
size="small"
236-
@click="editStorage(selectedStorage.find(s => s.id === item.id)!)"
237-
></v-icon>
238-
<v-icon
239-
color="medium-emphasis"
240-
icon="mdi-delete"
241-
size="small"
242-
@click="removeStorageById(item.id)"
243-
></v-icon>
212+
<v-icon color="medium-emphasis" icon="mdi-pencil" size="small" @click="editStorage(selectedStorage.find((s) => s.id === item.id)!)"></v-icon>
213+
<v-icon color="medium-emphasis" icon="mdi-delete" size="small" @click="removeStorageById(item.id)"></v-icon>
244214
</div>
245215
</template>
246216

@@ -290,22 +260,11 @@ const removeStorageById = (storageId: number) => {
290260
</v-sheet>
291261

292262
<v-dialog v-model="isComputeModalOpen" max-width="600px" min-width="600px">
293-
<MachineModal
294-
:lab-id="lab.id"
295-
:compute-id="lab.selectedCompute.length"
296-
:edit-data="editingComputeItem"
297-
@close="closeComputeModal"
298-
@open-snackbar="openSnackbar"
299-
/>
263+
<MachineModal :lab-id="lab.id" :compute-id="lab.selectedCompute.length" :edit-data="editingComputeItem" @close="closeComputeModal" @open-snackbar="openSnackbar" />
300264
</v-dialog>
301265

302266
<v-dialog v-model="isStorageModalOpen" max-width="600px" min-width="600px">
303-
<StorageModal
304-
:lab-id="lab.id"
305-
:storage-id="lab.selectedStorage.length"
306-
:edit-data="editingStorageItem"
307-
@close="closeStorageModal"
308-
/>
267+
<StorageModal :lab-id="lab.id" :storage-id="lab.selectedStorage.length" :edit-data="editingStorageItem" @close="closeStorageModal" />
309268
</v-dialog>
310269

311270
<v-snackbar v-model="snackbar.show">{{ snackbar.message }}</v-snackbar>

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

Lines changed: 11 additions & 40 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: []
@@ -10,14 +10,14 @@ const emit = defineEmits<{
1010
const formData = ref({
1111
name: "",
1212
subscription: "1Y",
13-
machineFlavor: "default.c1",
13+
machineType: "default.c1",
1414
machineSubscription: "COMMITMENT_1Y",
1515
hddSize: 1,
1616
nvmeSize: 0,
1717
})
1818
1919
const subscriptions = computed(() => {
20-
return priceEstimatorStore.catalogue.labPrices.map(p => {
20+
return priceEstimatorStore.catalogue.labPrices.map((p) => {
2121
const price = p["price.nok.ex.vat"]
2222
const is3Y = p["service.commitment"] === "3Y"
2323
return {
@@ -32,15 +32,15 @@ const machineSubscriptions = [
3232
{ title: "Commitment - 3 Years", value: "COMMITMENT_3Y" },
3333
]
3434
35-
const machineFlavors = computed(() => {
35+
const machineType = computed(() => {
3636
return priceEstimatorStore.catalogue.machinePrices
3737
})
3838
3939
const save = () => {
4040
priceEstimatorStore.addLab({
4141
name: formData.value.name,
42-
subscriptionType: formData.value.subscription,
43-
machineFlavor: formData.value.machineFlavor,
42+
subscription: formData.value.subscription,
43+
machineType: formData.value.machineType,
4444
machineSubscription: formData.value.machineSubscription,
4545
hddSize: Number(formData.value.hddSize),
4646
nvmeSize: Number(formData.value.nvmeSize),
@@ -64,23 +64,11 @@ onMounted(() => {
6464
</v-col>
6565

6666
<v-col cols="12">
67-
<v-select
68-
v-model="formData.subscription"
69-
:items="subscriptions"
70-
label="Subscription Period"
71-
variant="outlined"
72-
></v-select>
67+
<v-select v-model="formData.subscription" :items="subscriptions" label="Subscription Period" variant="outlined"></v-select>
7368
</v-col>
7469

7570
<v-col cols="12">
76-
<v-autocomplete
77-
v-model="formData.machineFlavor"
78-
:items="machineFlavors"
79-
label="Default Home Machine"
80-
variant="outlined"
81-
item-title="title"
82-
item-value="value"
83-
>
71+
<v-autocomplete v-model="formData.machineType" :items="machineType" label="Default Home Machine" variant="outlined" item-title="title" item-value="value">
8472
<template #item="{ item, props }">
8573
<VDivider v-if="'divider' in item.raw" />
8674
<VListSubheader v-else-if="'header' in item.raw" :title="item.raw.header" />
@@ -90,32 +78,15 @@ onMounted(() => {
9078
</v-col>
9179

9280
<v-col cols="12">
93-
<v-select
94-
v-model="formData.machineSubscription"
95-
:items="machineSubscriptions"
96-
label="Home Machine Subscription"
97-
variant="outlined"
98-
></v-select>
81+
<v-select v-model="formData.machineSubscription" :items="machineSubscriptions" label="Home Machine Subscription" variant="outlined"></v-select>
9982
</v-col>
10083

10184
<v-col cols="12" sm="6">
102-
<v-text-field
103-
v-model="formData.hddSize"
104-
label="HDD Storage (TB)"
105-
type="number"
106-
variant="outlined"
107-
min="0"
108-
></v-text-field>
85+
<v-text-field v-model="formData.hddSize" label="HDD Storage (TB)" type="number" variant="outlined" min="0"></v-text-field>
10986
</v-col>
11087

11188
<v-col cols="12" sm="6">
112-
<v-text-field
113-
v-model="formData.nvmeSize"
114-
label="NVMe Storage (TB)"
115-
type="number"
116-
variant="outlined"
117-
min="0"
118-
></v-text-field>
89+
<v-text-field v-model="formData.nvmeSize" label="NVMe Storage (TB)" type="number" variant="outlined" min="0"></v-text-field>
11990
</v-col>
12091
</v-row>
12192
</v-container>

0 commit comments

Comments
 (0)