@@ -74,7 +74,6 @@ <h4>[[module.name]]</h4>
74
74
createApp ( {
75
75
delimiters : [ '[[' , ']]' ] ,
76
76
setup ( ) {
77
- const query = ref ( "Query" )
78
77
const modules_list = ref ( [ ] )
79
78
const misp_attributes_list = ref ( { } )
80
79
const attr_selected = ref ( [ ] )
@@ -97,48 +96,43 @@ <h4>[[module.name]]</h4>
97
96
status_site . value = ""
98
97
}
99
98
100
- if ( query . value == 'Query' ) {
101
- progress . value = 0
102
- let error_flag = false
99
+ progress . value = 0
100
+ let error_flag = false
103
101
104
- let result_dict = { "modules" : $ ( "#modules_select" ) . val ( ) ,
105
- "input" : $ ( "#input_select" ) . val ( ) ,
106
- "query" : current_query . value
107
- }
108
- result_dict [ "config" ] = { }
109
- for ( let el in config_query . value ) {
110
- result_dict [ "config" ] [ config_query . value [ el ] . name ] = { }
111
- for ( let conf in config_query . value [ el ] . meta . config ) {
112
- $ ( "#error-" + config_query . value [ el ] . meta . config [ conf ] + "-" + config_query . value [ el ] . name ) . text ( "" )
113
- let loc = $ ( "#form-" + config_query . value [ el ] . meta . config [ conf ] + "-" + config_query . value [ el ] . name ) . val ( )
114
- if ( ! loc ) {
115
- error_flag = true
116
- $ ( "#error-" + config_query . value [ el ] . meta . config [ conf ] + "-" + config_query . value [ el ] . name ) . text ( "Please enter value" )
117
- } else {
118
- result_dict [ "config" ] [ config_query . value [ el ] . name ] [ config_query . value [ el ] . meta . config [ conf ] ] = loc
119
- }
102
+ let result_dict = { "modules" : $ ( "#modules_select" ) . val ( ) ,
103
+ "input" : $ ( "#input_select" ) . val ( ) ,
104
+ "query" : current_query . value
105
+ }
106
+ result_dict [ "config" ] = { }
107
+ for ( let el in config_query . value ) {
108
+ result_dict [ "config" ] [ config_query . value [ el ] . name ] = { }
109
+ for ( let conf in config_query . value [ el ] . meta . config ) {
110
+ $ ( "#error-" + config_query . value [ el ] . meta . config [ conf ] + "-" + config_query . value [ el ] . name ) . text ( "" )
111
+ let loc = $ ( "#form-" + config_query . value [ el ] . meta . config [ conf ] + "-" + config_query . value [ el ] . name ) . val ( )
112
+ if ( ! loc ) {
113
+ error_flag = true
114
+ $ ( "#error-" + config_query . value [ el ] . meta . config [ conf ] + "-" + config_query . value [ el ] . name ) . text ( "Please enter value" )
115
+ } else {
116
+ result_dict [ "config" ] [ config_query . value [ el ] . name ] [ config_query . value [ el ] . meta . config [ conf ] ] = loc
120
117
}
121
118
}
122
- if ( ! error_flag ) {
123
- const res = await fetch ( '/run_modules' , {
124
- headers : { "X-CSRFToken" : $ ( "#csrf_token" ) . val ( ) , "Content-Type" : "application/json" } ,
125
- method : "POST" ,
126
- body : JSON . stringify ( result_dict )
127
- } )
128
- if ( await res . status == 201 ) {
129
- let loc = await res . json ( )
130
- query . value = 'Stop'
131
- console . log ( loc [ 'id' ] ) ;
132
- await nextTick ( )
133
- window . location . href = "/query/" + loc [ 'id' ]
134
- } else {
135
- let loc = await res . json ( )
136
- query . value = 'Query'
137
- status_site . value = loc [ 'message' ] || 'Something went wrong'
138
-
139
- if ( status_site . value . includes ( "]" ) ) {
140
- status_site . value = status_site . value . split ( "]" ) [ 1 ]
141
- }
119
+ }
120
+ if ( ! error_flag ) {
121
+ const res = await fetch ( '/run_modules' , {
122
+ headers : { "X-CSRFToken" : $ ( "#csrf_token" ) . val ( ) , "Content-Type" : "application/json" } ,
123
+ method : "POST" ,
124
+ body : JSON . stringify ( result_dict )
125
+ } )
126
+ if ( await res . status == 201 ) {
127
+ let loc = await res . json ( )
128
+ await nextTick ( )
129
+ window . location . href = "/query/" + loc [ 'id' ]
130
+ } else {
131
+ let loc = await res . json ( )
132
+ status_site . value = loc [ 'message' ] || 'Something went wrong'
133
+
134
+ if ( status_site . value . includes ( "]" ) ) {
135
+ status_site . value = status_site . value . split ( "]" ) [ 1 ]
142
136
}
143
137
}
144
138
}
@@ -227,7 +221,6 @@ <h4>[[module.name]]</h4>
227
221
228
222
return {
229
223
message_list,
230
- query,
231
224
progress,
232
225
modules_list,
233
226
misp_attributes_list,
0 commit comments