Fix identification of ruby scripts in editor (#1458)

moduleError is not used, so don't even bother setting it, and
just always assign the script if it's set up in the module's configuration.
this makes it easier for different scripting tools to expose their data
in the editor

Signed-off-by: Cody Cutrer <cody@cutrer.us>
pull/1459/head
Cody Cutrer 2022-07-29 13:59:34 -06:00 committed by GitHub
parent c387337c19
commit 420c3ed0dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions

View File

@ -137,7 +137,6 @@ export default {
currentModuleConfig: {},
scriptModuleType: null,
languages: null,
moduleError: null,
script: '',
mode: '',
eventSource: null,
@ -257,15 +256,13 @@ export default {
this.currentModule = this.rule.actions.concat(this.rule.conditions).find((m) => m.id === this.moduleId)
} else {
this.currentModule = this.rule.actions.find((m) => m.id === 'script')
if (!this.currentModule) {
this.currentModule = this.rule.actions.find((m) => m.configuration.script)
}
this.isScriptRule = true
}
if (!this.currentModule ||
this.currentModule.type.indexOf('script') !== 0 ||
(this.currentModule.type === 'jsr223.ScriptedAction' &&
this.currentModule.configuration.type === 'application/x-ruby')) {
this.moduleError = true
} else {
if (this.currentModule) {
this.mode = this.currentModule.configuration.type
this.script = this.currentModule.configuration.script
}