Skip to content

Commit a052975

Browse files
committed
Switched to two buttong for mode
1 parent a431612 commit a052975

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

webapp/src/components/datablocks/XRDInsituBlock.vue

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
<template>
22
<DataBlockBase :item_id="item_id" :block_id="block_id">
3-
<div class="mb-2">
4-
<button class="btn btn-secondary" @click="toggleMode">
5-
Switch to {{ isEchemMode ? "Temperature" : "Echem" }} mode
6-
</button>
7-
<span class="ml-2 font-italic"
8-
>Current mode: {{ isEchemMode ? "Echem" : "Temperature" }}</span
9-
>
3+
<div class="mb-2 d-flex align-items-center">
4+
<span class="mr-2 font-weight-bold">Mode:</span>
5+
<div class="btn-group" role="group" aria-label="Mode toggle">
6+
<button
7+
type="button"
8+
class="btn"
9+
:class="isEchemMode ? 'btn-outline-secondary' : 'btn-secondary'"
10+
@click="setMode('log')"
11+
>
12+
Temperature
13+
</button>
14+
<button
15+
type="button"
16+
class="btn"
17+
:class="isEchemMode ? 'btn-secondary' : 'btn-outline-secondary'"
18+
@click="setMode('echem')"
19+
>
20+
Electrochemistry
21+
</button>
22+
</div>
1023
</div>
1124
<FileSelectDropdown
1225
v-model="file_id"
@@ -160,13 +173,14 @@ export default {
160173
}
161174
},
162175
methods: {
163-
toggleMode() {
164-
this.time_series_source = this.isEchemMode ? "log" : "echem";
176+
setMode(mode) {
177+
this.time_series_source = mode;
178+
this.xrd_folder_name = "";
165179
this.time_series_folder_name = "";
166180
this.echem_folder_name = "";
167181
this.folderNameError = "";
168182
this.updateBlock();
169-
console.info("Toggled mode, time_series_source set to", this.time_series_source);
183+
console.info("Mode set to", mode);
170184
},
171185
onFileChange() {
172186
this.xrd_folder_name = "";
@@ -180,12 +194,7 @@ export default {
180194
this.time_series_folder_name &&
181195
(!this.isEchemMode || this.echem_folder_name)
182196
) {
183-
this.folderNameError = "";
184197
this.updateBlock();
185-
} else if (this.xrd_folder_name || this.time_series_folder_name || this.echem_folder_name) {
186-
this.folderNameError = this.isEchemMode
187-
? "XRD, Temperature, and Echem folders are required."
188-
: "XRD and Temperature folders are required.";
189198
}
190199
},
191200
onGranularitySubmit() {

0 commit comments

Comments
 (0)