Move more of scan workflow UI into the server
This commit is contained in:
parent
ca21ab03c6
commit
bfef998300
2 changed files with 26 additions and 30 deletions
|
|
@ -42,6 +42,7 @@ from openflexure_microscope_server.things.stage import BaseStage
|
|||
from openflexure_microscope_server.ui import (
|
||||
UI_ELEMENT_RESPONSE,
|
||||
Accordion,
|
||||
HTMLBlock,
|
||||
UIElementList,
|
||||
property_control_for,
|
||||
)
|
||||
|
|
@ -562,12 +563,8 @@ class HistoScanWorkflow(RectGridWorkflow[HistoScanSettingsModel]):
|
|||
@lt.endpoint("get", "settings_ui", responses=UI_ELEMENT_RESPONSE)
|
||||
def settings_ui(self) -> UIElementList:
|
||||
"""Return the UI for the workflow's settings in the scan tab."""
|
||||
return UIElementList(
|
||||
scan_settings = UIElementList(
|
||||
[
|
||||
Accordion(
|
||||
title="Background Detect",
|
||||
children=self._background_detector.settings_ui(),
|
||||
),
|
||||
property_control_for(
|
||||
self, "overlap", label="Image Overlap (0.1-0.7)", step=0.05
|
||||
),
|
||||
|
|
@ -596,6 +593,19 @@ class HistoScanWorkflow(RectGridWorkflow[HistoScanSettingsModel]):
|
|||
),
|
||||
]
|
||||
)
|
||||
return UIElementList(
|
||||
[
|
||||
HTMLBlock(html=f"<h4>{self.display_name}</h4><p>{self.ui_blurb}<p>"),
|
||||
Accordion(
|
||||
title="Background Detect",
|
||||
children=self._background_detector.settings_ui(),
|
||||
),
|
||||
Accordion(
|
||||
title="Scan Settings",
|
||||
children=scan_settings,
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
class RegularGridSettingsModel(RectGridSettingsModel):
|
||||
|
|
@ -682,7 +692,7 @@ class RegularGridWorkflow(RectGridWorkflow[RegularGridSettingsModel]):
|
|||
@lt.endpoint("get", "settings_ui", responses=UI_ELEMENT_RESPONSE)
|
||||
def settings_ui(self) -> UIElementList:
|
||||
"""Return the UI for the workflow's settings in the scan tab."""
|
||||
return UIElementList(
|
||||
scan_settings = UIElementList(
|
||||
[
|
||||
property_control_for(
|
||||
self, "overlap", label="Image Overlap (0.1-0.7)", step=0.05
|
||||
|
|
@ -694,6 +704,15 @@ class RegularGridWorkflow(RectGridWorkflow[RegularGridSettingsModel]):
|
|||
),
|
||||
]
|
||||
)
|
||||
return UIElementList(
|
||||
[
|
||||
HTMLBlock(html=f"<h4>{self.display_name}</h4><p>{self.ui_blurb}<p>"),
|
||||
Accordion(
|
||||
title="Scan Settings",
|
||||
children=scan_settings,
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
class SnakeWorkflow(RegularGridWorkflow):
|
||||
|
|
|
|||
|
|
@ -16,17 +16,8 @@
|
|||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<h4 v-if="workflowDisplayName" class="workflow-name">
|
||||
{{ workflowDisplayName }}
|
||||
</h4>
|
||||
<p class="workflow-blurb">{{ workflowBlurb }}</p>
|
||||
<server-specified-interface :elements="workflowSettings" />
|
||||
<ul uk-accordion="multiple: true">
|
||||
<li>
|
||||
<a class="uk-accordion-title" href="#">Scan Settings</a>
|
||||
<div class="uk-accordion-content">
|
||||
<server-specified-interface :elements="workflowSettings" />
|
||||
</div>
|
||||
</li>
|
||||
<li class="uk-open">
|
||||
<a class="uk-accordion-title" href="#">Stitching Settings</a>
|
||||
<div class="uk-accordion-content">
|
||||
|
|
@ -152,8 +143,6 @@ export default {
|
|||
scan_name: "",
|
||||
workflowName: undefined,
|
||||
workflowSettings: [],
|
||||
workflowDisplayName: undefined,
|
||||
workflowBlurb: undefined,
|
||||
workflowOptions: [],
|
||||
};
|
||||
},
|
||||
|
|
@ -206,12 +195,6 @@ export default {
|
|||
this.ready = await this.readThingProperty(this.workflowName, "ready", true);
|
||||
this.workflowSettings =
|
||||
(await this.getThingEndpoint(this.workflowName, "settings_ui")) || [];
|
||||
this.workflowDisplayName = await this.readThingProperty(
|
||||
this.workflowName,
|
||||
"display_name",
|
||||
true,
|
||||
);
|
||||
this.workflowBlurb = await this.readThingProperty(this.workflowName, "ui_blurb", true);
|
||||
}
|
||||
},
|
||||
onScanError: function (error) {
|
||||
|
|
@ -290,10 +273,4 @@ export default {
|
|||
.control-component {
|
||||
width: 33%;
|
||||
}
|
||||
.workflow-name {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.workflow-blurb {
|
||||
color: #a2a2a2;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue