' )
tr.append $( '| ' ).css 'width', '20px'
@@ -213,23 +238,20 @@ fAddEventParams = ( id ) ->
inp.attr( 'type', 'password' )
tr.append $( ' | ' ).text( ' : ' ).append inp
table.append tr
- fAppendParam name, shielded for name, shielded of oParams
if i > 0
$( '#event_poller_params' ).html 'Required Global Parameters:'
$( '#event_poller_params' ).append table
-
- fDelayed = () ->
fFillEventParams id
- setTimeout fDelayed, 200
fFillEventParams = ( moduleId ) ->
- obj =
- command: 'get_event_poller_user_params'
- body: JSON.stringify
- id: moduleId
fIssueRequest
- body: obj
+ data:
+ command: 'get_event_poller_user_params'
+ body: JSON.stringify
+ id: moduleId
done: ( data ) ->
+ console.log 'filling event params: '
+ console.log data
oParams = JSON.parse data.message
for param, oParam of oParams
par = $( "#event_poller_params tr" ).filter () ->
@@ -239,23 +261,15 @@ fFillEventParams = ( moduleId ) ->
$( 'input', par ).change () ->
$( this ).attr 'unchanged', 'false'
- obj.command = 'get_event_poller_user_arguments'
- obj.body = JSON.stringify
- ruleId: $( '#input_id' ).val()
- moduleId: moduleId
- fIssueRequest
- body: obj
- done: fAddEventUserArgs moduleId # FIXME this is wrong here
-
# Fetch function arguments required for an event polling function
fFetchEventFunctionArgs = ( arrName ) ->
- # FIXME this data gets not populated sometimes!
fIssueRequest
- body:
+ data:
command: 'get_event_poller_function_arguments'
body: JSON.stringify
id: arrName[ 0 ]
done: ( data ) ->
+ console.log 'fetching event function arguments: '
if data.message
oParams = JSON.parse data.message
if oParams[ arrName[ 1 ] ]
@@ -272,10 +286,21 @@ fFetchEventFunctionArgs = ( arrName ) ->
td = $( ' | ' ).appendTo tr
td.append $( '' ).attr 'type', 'text'
tr.append td
- fail: fFailedRequest 'Error fetching action invoker function params'
+
+ fIssueRequest
+ data:
+ command: 'get_event_poller_user_arguments'
+ body: JSON.stringify
+ ruleId: $( '#input_id' ).val()
+ moduleId: moduleId
+ done: fAddEventUserArgs moduleId
+
+ fail: fFailedRequest 'Error fetching event poller function arguments'
fAddEventUserArgs = ( name ) ->
( data ) ->
+ console.log 'filling event funcction arguments: '
+ console.log data
for key, arrFuncs of data.message
par = $ "#event_poller_params"
for oFunc in JSON.parse arrFuncs
@@ -291,7 +316,7 @@ fAddEventUserArgs = ( name ) ->
fAddSelectedAction = ( name ) ->
arrName = name.split ' -> '
- arrEls = $( "#action_params div.modName" ).map( () ->
+ arrEls = $( "#action_invoker_params div.modName" ).map( () ->
$( this ).text()
).get()
table = $( '#selected_actions' )
@@ -302,7 +327,7 @@ fAddSelectedAction = ( name ) ->
td = $( ' | ' ).attr( 'class', 'funcMappings').appendTo tr
fFetchActionFunctionArgs td, arrName
if arrName[ 0 ] not in arrEls
- div = $( '' ).appendTo $( '#action_params' )
+ div = $( ' ' ).appendTo $( '#action_invoker_params' )
subdiv = $( ' ').appendTo div
subdiv.append $( ' ' )
.attr( 'class', 'modName underlined' ).text arrName[ 0 ]
@@ -315,12 +340,11 @@ fAddSelectedAction = ( name ) ->
setTimeout fDelayed, 300
fFetchActionParams = ( div, modName ) ->
- obj =
- command: 'get_action_invoker_params'
- body: JSON.stringify
- id: modName
fIssueRequest
- body: obj
+ data:
+ command: 'get_action_invoker_params'
+ body: JSON.stringify
+ id: modName
done: ( data ) ->
if data.message
oParams = JSON.parse data.message
@@ -342,7 +366,7 @@ fFetchActionParams = ( div, modName ) ->
fFetchActionFunctionArgs = ( tag, arrName ) ->
fIssueRequest
- body:
+ data:
command: 'get_action_invoker_function_arguments'
body: JSON.stringify
id: arrName[ 0 ]
@@ -363,14 +387,14 @@ fFetchActionFunctionArgs = ( tag, arrName ) ->
fFillActionFunction = ( name ) ->
fIssueRequest
- body:
+ data:
command: 'get_action_invoker_user_params'
body: JSON.stringify
id: name
done: fAddActionUserParams name
fIssueRequest
- body:
+ data:
command: 'get_action_invoker_user_arguments'
body: JSON.stringify
ruleId: $( '#input_id' ).val()
@@ -380,7 +404,7 @@ fFillActionFunction = ( name ) ->
fAddActionUserParams = ( name ) ->
( data ) ->
oParams = JSON.parse data.message
- domMod = $( "#action_params div" ).filter () ->
+ domMod = $( "#action_invoker_params div" ).filter () ->
$( 'div.modName', this ).text() is name
for param, oParam of oParams
par = $( "tr", domMod ).filter () ->
@@ -409,7 +433,7 @@ fAddActionUserArgs = ( name ) ->
fOnLoad = () ->
# Fetch the public key from the engine
fIssueRequest
- body: command: 'get_public_key'
+ data: command: 'get_public_key'
done: ( data ) ->
strPublicKey = data.message
fail: ( err ) ->
@@ -448,35 +472,17 @@ fOnLoad = () ->
when 'webhook'
$( '#input_id' ).val "My '#{ oParams.hookname }' Rule"
fPrepareEventType 'Webhook'
- $( 'select_eventhook' ).val oParams.hookname
+ domSelectWebhook.val oParams.hookname
when 'poller'
$( '#input_id' ).val "My '#{ oParams.eventpoller }' Rule"
fPrepareEventType 'Event Poller'
- $( '#input_event' ).change () ->
- $( '#select_event' ).val ''
- $( '#select_event' ).val $( this ).val()
- fFetchEventParams $( '#select_event' ).val()
- if $( '#select_event' ).val() is ''
- $( '#event_start' ).html ''
- $( '#event_interval' ).html ''
- else
- fPlaceAndPaintInterval()
-
# ACTIONS
- # Selected Actions:
- #
- #
- # Required Parameters:
- #
- #
- #
-
fIssueRequest
- body:
+ data:
command: 'get_action_invokers'
done: ( data ) ->
try
@@ -484,32 +490,42 @@ fOnLoad = () ->
catch err
console.error 'ERROR: non-object received from server: ' + data.message
return
- fAppendActions = ( module, actions ) ->
+ i = 0
+ for module, actions of oAis
for act in actions
- arrEls = $( "#action_params div" ).filter () ->
+ i++
+ arrEls = $( "#action_invoker_params div" ).filter () ->
$( this ).text() is "#{ module } -> #{ act }"
- # It could have been loaded async before through the rules ito the action params
+ # It could have been loaded async before through the rules into the action params
if arrEls.length is 0
$( '#select_actions' ).append $( ' |