Skip to content

Commit b5adc45

Browse files
authored
Merge pull request #395 from Dstack-TEE/fix-ui
vmm-ui: Fix gpu editor layout
2 parents 4660ae5 + 44db965 commit b5adc45

3 files changed

Lines changed: 36 additions & 28 deletions

File tree

vmm/src/console_beta.html

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,8 +1244,16 @@
12441244
row-gap: 16px;
12451245
}
12461246

1247+
.gpu-checkbox-grid {
1248+
display: grid;
1249+
grid-template-columns: 1fr;
1250+
gap: 12px;
1251+
row-gap: 16px;
1252+
}
1253+
12471254
.feature-checkboxes label,
1248-
.checkbox-grid label {
1255+
.checkbox-grid label,
1256+
.gpu-checkbox-grid label {
12491257
display: flex;
12501258
align-items: center;
12511259
gap: 8px;
@@ -1254,7 +1262,8 @@
12541262
}
12551263

12561264
.feature-checkboxes input[type="checkbox"],
1257-
.checkbox-grid input[type="checkbox"] {
1265+
.checkbox-grid input[type="checkbox"],
1266+
.gpu-checkbox-grid input[type="checkbox"] {
12581267
flex-shrink: 0;
12591268
cursor: pointer;
12601269
margin: 0;
@@ -1419,18 +1428,11 @@
14191428
border: 1px solid var(--color-border);
14201429
border-radius: var(--radius-md);
14211430
padding: 16px;
1422-
display: flex;
1423-
flex-direction: column;
1424-
gap: 12px;
14251431
background: var(--color-bg-secondary);
14261432
}
14271433

1428-
.gpu-config-items label {
1429-
display: flex;
1430-
align-items: center;
1431-
gap: 10px;
1434+
.gpu-checkbox-grid label {
14321435
font-size: 14px;
1433-
cursor: pointer;
14341436
}
14351437

14361438
.warning-text {
@@ -1749,10 +1751,12 @@ <h4 class="env-editor-title">Encrypted Environment Variables</h4>
17491751
Select GPUs to attach:
17501752
</div>
17511753
<div class="gpu-config-items">
1752-
<label v-for="gpu in availableGpus" :key="gpu.slot">
1753-
<input type="checkbox" :value="gpu.slot" v-model="selectedGpus">
1754-
<span>{{ gpu.slot }}: {{ gpu.description }} {{ gpu.is_free ? '' : '(in use)' }}</span>
1755-
</label>
1754+
<div class="gpu-checkbox-grid">
1755+
<label v-for="gpu in availableGpus" :key="gpu.slot">
1756+
<input type="checkbox" :value="gpu.slot" v-model="selectedGpus">
1757+
<span>{{ gpu.slot }}: {{ gpu.description }} {{ gpu.is_free ? '' : '(in use)' }}</span>
1758+
</label>
1759+
</div>
17561760
</div>
17571761
</div>
17581762
<div v-else class="gpu-config-hint">

vmm/ui/src/components/GpuConfigEditor.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ const GpuConfigEditorComponent = {
6161
Select GPUs to attach:
6262
</div>
6363
<div class="gpu-config-items">
64-
<label v-for="gpu in availableGpus" :key="gpu.slot">
65-
<input type="checkbox" :value="gpu.slot" v-model="selectedGpus">
66-
<span>{{ gpu.slot }}: {{ gpu.description }} {{ gpu.is_free ? '' : '(in use)' }}</span>
67-
</label>
64+
<div class="gpu-checkbox-grid">
65+
<label v-for="gpu in availableGpus" :key="gpu.slot">
66+
<input type="checkbox" :value="gpu.slot" v-model="selectedGpus">
67+
<span>{{ gpu.slot }}: {{ gpu.description }} {{ gpu.is_free ? '' : '(in use)' }}</span>
68+
</label>
69+
</div>
6870
</div>
6971
</div>
7072
<div v-else class="gpu-config-hint">

vmm/ui/src/styles/main.css

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,8 +1232,16 @@ h1, h2, h3, h4, h5, h6 {
12321232
row-gap: 16px;
12331233
}
12341234

1235+
.gpu-checkbox-grid {
1236+
display: grid;
1237+
grid-template-columns: 1fr;
1238+
gap: 12px;
1239+
row-gap: 16px;
1240+
}
1241+
12351242
.feature-checkboxes label,
1236-
.checkbox-grid label {
1243+
.checkbox-grid label,
1244+
.gpu-checkbox-grid label {
12371245
display: flex;
12381246
align-items: center;
12391247
gap: 8px;
@@ -1242,7 +1250,8 @@ h1, h2, h3, h4, h5, h6 {
12421250
}
12431251

12441252
.feature-checkboxes input[type="checkbox"],
1245-
.checkbox-grid input[type="checkbox"] {
1253+
.checkbox-grid input[type="checkbox"],
1254+
.gpu-checkbox-grid input[type="checkbox"] {
12461255
flex-shrink: 0;
12471256
cursor: pointer;
12481257
margin: 0;
@@ -1407,18 +1416,11 @@ h1, h2, h3, h4, h5, h6 {
14071416
border: 1px solid var(--color-border);
14081417
border-radius: var(--radius-md);
14091418
padding: 16px;
1410-
display: flex;
1411-
flex-direction: column;
1412-
gap: 12px;
14131419
background: var(--color-bg-secondary);
14141420
}
14151421

1416-
.gpu-config-items label {
1417-
display: flex;
1418-
align-items: center;
1419-
gap: 10px;
1422+
.gpu-checkbox-grid label {
14201423
font-size: 14px;
1421-
cursor: pointer;
14221424
}
14231425

14241426
.warning-text {

0 commit comments

Comments
 (0)