Skip to content

Commit d252cac

Browse files
be-smithml-evs
authored andcommitted
Added echem mode to insitu xrd block
Removed isEchemMode from data and made it a boolean based on time_series_source, which has default log Switched to two buttong for mode Changed label to log Updated colour of new mode text Use released in situ plugin version
1 parent cceebea commit d252cac

File tree

3 files changed

+60
-10
lines changed

3 files changed

+60
-10
lines changed

pydatalab/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ dev-dependencies = [
132132
]
133133

134134
[tool.uv.sources]
135-
datalab-app-plugin-insitu = { git = "https://github.com/datalab-org/datalab-app-plugin-insitu.git", rev = "v0.2.0" }
135+
datalab-app-plugin-insitu = { git = "https://github.com/datalab-org/datalab-app-plugin-insitu.git", rev = "v0.3.0" }
136136

137137
[tool.pytest.ini_options]
138138
addopts = "--cov-report=xml --cov ./src/pydatalab"

pydatalab/uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webapp/src/components/datablocks/XRDInsituBlock.vue

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
<template>
22
<DataBlockBase :item_id="item_id" :block_id="block_id">
3+
<div class="mb-2 d-flex align-items-center">
4+
<label class="mr-2"><b>Mode:</b></label>
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>
23+
</div>
324
<FileSelectDropdown
425
v-model="file_id"
526
:item_id="item_id"
@@ -19,13 +40,21 @@
1940
/>
2041
</div>
2142
<div class="col-lg-4 col-md-6 col-sm-12 mb-2">
22-
<label class="mr-2"><b>Temperature or Echem folder name</b></label>
43+
<label class="mr-2"><b>Log folder name</b></label>
2344
<FolderSelect
2445
v-model="time_series_folder_name"
2546
:options="availableFolders"
2647
@update:model-value="onFolderSelected"
2748
/>
2849
</div>
50+
<div v-if="isEchemMode" class="col-lg-4 col-md-6 col-sm-12 mb-2">
51+
<label class="mr-2"><b>Echem folder name</b></label>
52+
<FolderSelect
53+
v-model="echem_folder_name"
54+
:options="availableFolders"
55+
@update:model-value="onFolderSelected"
56+
/>
57+
</div>
2958
</div>
3059
<div v-if="folderNameError" class="alert alert-danger mt-2 mx-auto">
3160
{{ folderNameError }}
@@ -127,24 +156,45 @@ export default {
127156
},
128157
xrd_folder_name: createComputedSetterForBlockField("xrd_folder_name"),
129158
time_series_folder_name: createComputedSetterForBlockField("time_series_folder_name"),
159+
echem_folder_name: createComputedSetterForBlockField("echem_folder_name"),
130160
file_id: createComputedSetterForBlockField("file_id"),
131161
folder_name: createComputedSetterForBlockField("folder_name"),
132162
data_granularity: createComputedSetterForBlockField("data_granularity"),
133163
sample_granularity: createComputedSetterForBlockField("sample_granularity"),
164+
time_series_source: createComputedSetterForBlockField("time_series_source"),
165+
isEchemMode() {
166+
return this.time_series_source === "echem";
167+
},
168+
},
169+
created() {
170+
// Ensure time_series_source is set to "log" by default if not present
171+
if (this.time_series_source === undefined || this.time_series_source === null) {
172+
this.time_series_source = "log";
173+
}
134174
},
135175
methods: {
176+
setMode(mode) {
177+
this.time_series_source = mode;
178+
this.xrd_folder_name = "";
179+
this.time_series_folder_name = "";
180+
this.echem_folder_name = "";
181+
this.folderNameError = "";
182+
this.updateBlock();
183+
console.info("Mode set to", mode);
184+
},
136185
onFileChange() {
137186
this.xrd_folder_name = "";
138187
this.time_series_folder_name = "";
139-
188+
this.echem_folder_name = "";
140189
this.updateBlock();
141190
},
142191
onFolderSelected() {
143-
if (this.xrd_folder_name && this.time_series_folder_name) {
144-
this.folderNameError = "";
192+
if (
193+
this.xrd_folder_name &&
194+
this.time_series_folder_name &&
195+
(!this.isEchemMode || this.echem_folder_name)
196+
) {
145197
this.updateBlock();
146-
} else if (this.xrd_folder_name || this.time_series_folder_name) {
147-
this.folderNameError = "XRD and either an echem or temperature folder is required.";
148198
}
149199
},
150200
onGranularitySubmit() {

0 commit comments

Comments
 (0)