File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -49,11 +49,14 @@ watch(() => store.ruleEditorCode, (newCode) => {
49
49
function handleCodeChange (code ) {
50
50
const parsedYamlCode = yaml .load (code);
51
51
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
52
53
store .ruleEditorCode = {
53
54
originalRule: code,
54
55
normalizedRule: code
55
56
};
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 ;
57
60
return null ;
58
61
}
59
62
@@ -75,7 +78,9 @@ function handleCodeChange(code) {
75
78
rules: rulesArray
76
79
})
77
80
};
78
- store .disableBinaryRun = ! store .languageDetails ;
81
+
82
+ // Enable the eval button if the rule editor is not empty
83
+ store .disableEvalButton = false ;
79
84
emit (' ruleEditorUpdated' );
80
85
};
81
86
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" results-header" >
3
3
<h3 >Results</h3 >
4
- <button @click =" handleRunBinary" :class =" { 'disabled': store.disableBinaryRun }" >Evaluate</button >
4
+ <button @click =" handleRunBinary" :class =" { 'disabled': store.disableEvalButton }" >Evaluate</button >
5
5
</div >
6
6
7
7
<div class =" results-container" >
@@ -97,7 +97,7 @@ onMounted(async () => {
97
97
98
98
99
99
async function handleRunBinary () {
100
- if (! store .ruleEditorCode || store .disableBinaryRun ) return ;
100
+ if (! store .ruleEditorCode || store .disableEvalButton ) return ;
101
101
102
102
isScanLoading .value = true ;
103
103
isTestLoading .value = true ;
Original file line number Diff line number Diff line change @@ -18,5 +18,5 @@ export const store = reactive({
18
18
codeEditorCode : '' ,
19
19
codeEditorDebugLocation : null ,
20
20
mustNotMatchTestCases : [ ] ,
21
- disableBinaryRun : true ,
21
+ disableEvalButton : true ,
22
22
} ) ;
You can’t perform that action at this time.
0 commit comments