Skip to content

Commit 1639583

Browse files
committed
refactor: Change position of Interactive Configuration button
1 parent 8a85bb8 commit 1639583

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

src/components/FeatureTree.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ const TreeNode = ({ node, statusMap, setStatusMap }) => {
9595
// TreeView component
9696
const TreeView = ({ treeData, executeAction }) => {
9797
const SATOperations = [
98-
{ label: "Valid Configuration", value: "PySATSatisfiableConfiguration" },
98+
{ label: "Valid Configuration", value: "PySATSatisfiableConfiguration" , isOperationWithConf: true},
99+
{ label: "Interactive Configuration", value: "configurator", isOperationWithConf: false},
100+
99101
];
100102

101103
const [statusMap, setStatusMap] = useState({});

src/pages/editor/EditorPage.jsx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ function EditorPage({ selectedFile }) {
6565
const viewOptions = [
6666
{ label: "Source View", value: "source" },
6767
{ label: "Graph View", value: "graph" },
68-
{ label: "Configurator", value: "configurator" },
6968
];
7069

7170
function initializeWorker() {
@@ -248,23 +247,28 @@ function EditorPage({ selectedFile }) {
248247
await validateModel();
249248
}
250249
if (validation.valid) {
251-
worker.postMessage({
252-
action: "executeActionWithConf",
253-
data: { action, configuration },
254-
});
255-
setIsRunning(true);
256-
setOutput({ label: action.label, result: "Executing operation" });
257-
worker.onmessage = (event) => {
258-
if (event.data.results !== undefined) {
259-
setOutput(event.data.results);
260-
} else if (event.data.error) {
261-
setOutput({
262-
label: action.label,
263-
result: `An exception has occurred when trying to execute the operation. Please check if the model is well defined.`,
264-
});
265-
}
266-
setIsRunning(false);
267-
};
250+
if (action.isOperationWithConf) {
251+
worker.postMessage({
252+
action: "executeActionWithConf",
253+
data: { action, configuration },
254+
});
255+
setIsRunning(true);
256+
setOutput({ label: action.label, result: "Executing operation" });
257+
worker.onmessage = (event) => {
258+
if (event.data.results !== undefined) {
259+
setOutput(event.data.results);
260+
} else if (event.data.error) {
261+
setOutput({
262+
label: action.label,
263+
result: `An exception has occurred when trying to execute the operation. Please check if the model is well defined.`,
264+
});
265+
}
266+
setIsRunning(false);
267+
};
268+
269+
} else {
270+
toggleView(action)
271+
}
268272
} else {
269273
setOutput({
270274
label: action.label,

0 commit comments

Comments
 (0)