Skip to content

Commit a431612

Browse files
committed
Removed isEchemMode from data and made it a boolean based on time_series_source, which has default log
1 parent 9d68d5a commit a431612

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

webapp/src/components/datablocks/XRDInsituBlock.vue

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export default {
108108
return {
109109
folderNameError: "",
110110
isUpdating: false,
111-
isEchemMode: false, // false = temperature, true = echem
112111
};
113112
},
114113
watch: {
@@ -150,25 +149,25 @@ export default {
150149
data_granularity: createComputedSetterForBlockField("data_granularity"),
151150
sample_granularity: createComputedSetterForBlockField("sample_granularity"),
152151
time_series_source: createComputedSetterForBlockField("time_series_source"),
152+
isEchemMode() {
153+
return this.time_series_source === "echem";
154+
},
155+
},
156+
created() {
157+
// Ensure time_series_source is set to "log" by default if not present
158+
if (this.time_series_source === undefined || this.time_series_source === null) {
159+
this.time_series_source = "log";
160+
}
153161
},
154162
methods: {
155163
toggleMode() {
156-
this.isEchemMode = !this.isEchemMode;
157-
// Use the computed setter to update the backend field
158-
this.time_series_source = this.isEchemMode ? "echem" : "log";
159-
// Optionally clear folder selections when switching modes
164+
this.time_series_source = this.isEchemMode ? "log" : "echem";
160165
this.time_series_folder_name = "";
161166
this.echem_folder_name = "";
162167
this.folderNameError = "";
163-
this.setModeFlag(this.isEchemMode ? "echem" : "log");
164168
this.updateBlock();
165169
console.info("Toggled mode, time_series_source set to", this.time_series_source);
166170
},
167-
setModeFlag(flag) {
168-
this.$store.state.all_item_data[this.item_id]["blocks_obj"][
169-
this.block_id
170-
].time_series_source = flag;
171-
},
172171
onFileChange() {
173172
this.xrd_folder_name = "";
174173
this.time_series_folder_name = "";

0 commit comments

Comments
 (0)