Skip to content

Commit df72e96

Browse files
committed
rename disableBinaryRun to disableEvalButton
Signed-off-by: matthiasgekiere <[email protected]>
1 parent 4a5a4df commit df72e96

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/components/RuleEditor.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,14 @@ watch(() => store.ruleEditorCode, (newCode) => {
4949
function handleCodeChange(code) {
5050
const parsedYamlCode = yaml.load(code);
5151
if (!parsedYamlCode || !parsedYamlCode.rules || parsedYamlCode.rules.length === 0) {
52+
// when parsed yaml is empty, reset the normalized rule and original rule and disable binary run
5253
store.ruleEditorCode = {
5354
originalRule: code,
5455
normalizedRule: code
5556
};
56-
store.disableBinaryRun = true;
57+
// Disable the eval button if the rule editor is empty.
58+
// Running the binary by clicking on the evaluate button doesn't make sense when no rule is configured.
59+
store.disableEvalButton = true;
5760
return null;
5861
}
5962
@@ -75,7 +78,9 @@ function handleCodeChange(code) {
7578
rules: rulesArray
7679
})
7780
};
78-
store.disableBinaryRun = !store.languageDetails;
81+
82+
// Enable the eval button if the rule editor is not empty
83+
store.disableEvalButton = false;
7984
emit('ruleEditorUpdated');
8085
};
8186

src/components/RuleResults.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="results-header">
33
<h3>Results</h3>
4-
<button @click="handleRunBinary" :class="{ 'disabled': store.disableBinaryRun }">Evaluate</button>
4+
<button @click="handleRunBinary" :class="{ 'disabled': store.disableEvalButton }">Evaluate</button>
55
</div>
66

77
<div class="results-container">
@@ -97,7 +97,7 @@ onMounted(async () => {
9797
9898
9999
async function handleRunBinary() {
100-
if (!store.ruleEditorCode || store.disableBinaryRun) return;
100+
if (!store.ruleEditorCode || store.disableEvalButton) return;
101101
102102
isScanLoading.value = true;
103103
isTestLoading.value = true;

src/store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ export const store = reactive({
1818
codeEditorCode: '',
1919
codeEditorDebugLocation: null,
2020
mustNotMatchTestCases: [],
21-
disableBinaryRun: true,
21+
disableEvalButton: true,
2222
});

0 commit comments

Comments
 (0)