From ee06b1b5a1de466f6060272182fbbe0fe596fbc6 Mon Sep 17 00:00:00 2001 From: Remco van Vugt Date: Tue, 20 Feb 2018 17:53:20 +0100 Subject: [PATCH 1/5] Added check_cid callflow module to branch on A-number --- src/apps/callflows/i18n/en-US.json | 8 +- src/apps/callflows/submodules/misc/misc.js | 83 +++++++++++++++++++ .../views/check_cid-callflowEdit.html | 14 ++++ .../views/check_cid-childCallflow.html | 23 +++++ 4 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 src/apps/callflows/views/check_cid-callflowEdit.html create mode 100644 src/apps/callflows/views/check_cid-childCallflow.html diff --git a/src/apps/callflows/i18n/en-US.json b/src/apps/callflows/i18n/en-US.json index 67e6a23..29edeb1 100644 --- a/src/apps/callflows/i18n/en-US.json +++ b/src/apps/callflows/i18n/en-US.json @@ -1286,7 +1286,13 @@ "current": "Current", "original": "Original" } - } + }, + "check_cid": "Match caller number", + "check_cid_tip": "Branch in a callflow based on the A number", + "check_cid_match": "Match", + "check_cid_nomatch": "No match", + "check_cid_matchnomatch": "Match or no match?", + "regex": "Regex" }, "__comment": "UI-1260: created common control for carrier selection", "__version": "v3.20_s2", diff --git a/src/apps/callflows/submodules/misc/misc.js b/src/apps/callflows/submodules/misc/misc.js index 8eb18b0..3d0fb6c 100644 --- a/src/apps/callflows/submodules/misc/misc.js +++ b/src/apps/callflows/submodules/misc/misc.js @@ -395,6 +395,89 @@ define(function(require){ } } }, + 'check_cid[]': { + name: self.i18n.active().oldCallflows.check_cid, + icon: 'lightbulb-o', + category: self.i18n.active().oldCallflows.caller_id_cat, + module: 'check_cid', + tip: self.i18n.active().oldCallflows.check_cid_tip, + data: { + }, + rules: [ + { + type: 'quantity', + maxSize: 2 + } + ], + isUsable: 'true', + weight: 60, + caption: function(node, caption_map) { + return ''; + }, + edit: function(node, callback) { + var popup, popup_html; + + popup_html = $(monster.template(self, 'check_cid-callflowEdit', { + data_check_cid: { + 'regex': node.getMetadata('regex') || '' + } + })), + popup; + $('#add', popup_html).click(function() { + var regex = $('#regex_input', popup_html).val(); + node.setMetadata('regex', regex); + node.setMetadata('use_absolute_mode', false); + node.caption = regex; + + popup.dialog('close'); + }); + + popup = monster.ui.dialog(popup_html, { + title: self.i18n.active().oldCallflows.check_cid_title, + beforeClose: function() { + if(typeof callback == 'function') { + callback(); + } + } + }); + }, + key_caption: function(child_node, caption_map) { + var key = child_node.key; + return (key != '_') ? key : self.i18n.active().oldCallflows.check_cid_match; + }, + key_edit: function(child_node, callback) { + var popup, popup_html; + + popup_html = $(monster.template(self, 'check_cid-childCallflow', { + items: { + 'match': self.i18n.active().oldCallflows.check_cid_match, + 'nomatch': self.i18n.active().oldCallflows.check_cid_nomatch + }, + selected: child_node.key + })); + + popup_html.find('#add').on('click', function() { + child_node.key = $('#check_cid_callflow_key_selector', popup_html).val(); + + child_node.key_caption = $('#check_cid_callflow_key_selector option:selected', popup_html).text(); + + popup.dialog('close'); + }); + + popup = monster.ui.dialog(popup_html, { + title: self.i18n.active().oldCallflows.check_cid_matchnomatch, + minHeight: '0', + beforeClose: function() { + if (typeof callback === 'function') { + callback(); + } + } + }); + + + } + + }, 'manual_presence[]': { name: self.i18n.active().oldCallflows.manual_presence, icon: 'lightbulb-o', diff --git a/src/apps/callflows/views/check_cid-callflowEdit.html b/src/apps/callflows/views/check_cid-callflowEdit.html new file mode 100644 index 0000000..911e633 --- /dev/null +++ b/src/apps/callflows/views/check_cid-callflowEdit.html @@ -0,0 +1,14 @@ +
+

{{ i18n.oldCallflows.check_cid }}

+
+
+ +
+
+
+ +
+
diff --git a/src/apps/callflows/views/check_cid-childCallflow.html b/src/apps/callflows/views/check_cid-childCallflow.html new file mode 100644 index 0000000..b28d001 --- /dev/null +++ b/src/apps/callflows/views/check_cid-childCallflow.html @@ -0,0 +1,23 @@ +
+
+
+ +
+
+
+ +
+
From 546c114825381ec70cc4a6c1d87df27b643fd51f Mon Sep 17 00:00:00 2001 From: Remco van Vugt Date: Wed, 21 Feb 2018 14:52:38 +0100 Subject: [PATCH 2/5] Added functionality to callflow jump (cf_callflow) node to jump to corresponding callflow --- src/apps/callflows/app.js | 8 ++++++++ src/apps/callflows/style/app.css | 4 ++-- src/apps/callflows/views/node.html | 11 +++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/apps/callflows/app.js b/src/apps/callflows/app.js index afd6391..4461d21 100644 --- a/src/apps/callflows/app.js +++ b/src/apps/callflows/app.js @@ -144,6 +144,7 @@ define(function(require){ self.editCallflow({ id: callflowId }); }); + callflowList.on('scroll', function() { if(!isLoading && callflowList.data('next-key') && (callflowList.scrollTop() >= (callflowList[0].scrollHeight - callflowList.innerHeight() - 100))) { isLoading = true; @@ -1561,6 +1562,13 @@ define(function(require){ } }); + $('.node-options .jump', layout).click(function() { + + var $this = $(this), + callflowId = $this.attr('id'); + self.editCallflow({ id: callflowId }); + }); + return layout; }, diff --git a/src/apps/callflows/style/app.css b/src/apps/callflows/style/app.css index 95b0ce0..78325f4 100644 --- a/src/apps/callflows/style/app.css +++ b/src/apps/callflows/style/app.css @@ -349,7 +349,7 @@ #ws_callflow .module { font-size: 13px; - height: 59px; + height: 49px; margin-top: 15px; cursor: default; } @@ -1740,4 +1740,4 @@ .ui-dialog-content .monster-link:not(.disabled):focus .fa { background: transparent; color: #22A5FF; -} \ No newline at end of file +} diff --git a/src/apps/callflows/views/node.html b/src/apps/callflows/views/node.html index 9ae9926..0aa106d 100644 --- a/src/apps/callflows/views/node.html +++ b/src/apps/callflows/views/node.html @@ -5,7 +5,14 @@ {{ callflow.name }} -
{{ node.caption }}
+ +
+ {{#compare node.module "===" "callflow"}} + +
+ {{else}} + {{ node.caption }} + {{/compare}}
-
\ No newline at end of file + From b057a2ccbd7ec63c7cd3626c1b9d380b64eeb874 Mon Sep 17 00:00:00 2001 From: Remco van Vugt Date: Wed, 21 Feb 2018 15:35:21 +0100 Subject: [PATCH 3/5] Added callflow node to send webhook Changed icons of new modules to be unique --- src/apps/callflows/submodules/misc/misc.js | 49 +++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/src/apps/callflows/submodules/misc/misc.js b/src/apps/callflows/submodules/misc/misc.js index 3d0fb6c..bc0b022 100644 --- a/src/apps/callflows/submodules/misc/misc.js +++ b/src/apps/callflows/submodules/misc/misc.js @@ -397,7 +397,7 @@ define(function(require){ }, 'check_cid[]': { name: self.i18n.active().oldCallflows.check_cid, - icon: 'lightbulb-o', + icon: 'list-ol', category: self.i18n.active().oldCallflows.caller_id_cat, module: 'check_cid', tip: self.i18n.active().oldCallflows.check_cid_tip, @@ -477,6 +477,53 @@ define(function(require){ } + }, + 'webhook[]': { + name: self.i18n.active().oldCallflows.webhook, + icon: 'upload', + category: self.i18n.active().oldCallflows.integrations_cat, + module: 'webhook', + tip: self.i18n.active().oldCallflows.webhook_tip, + data: { + }, + rules: [ + { + type: 'quantity', + maxSize: '1' + } + ], + isUsable: 'true', + weight: 40, + caption: function(node, caption_map) { + return node.getMetadata('webhook') || ''; + }, + edit: function(node, callback) { + var popup_html = $(monster.template(self, 'webhook-callflowEdit', { + data_webhook: { + 'http_verb': node.getMetadata('http_verb') || 'get', + 'retries': node.getMetadata('retries') || '3', + 'uri': node.getMetadata('uri') || '' + } + })), + popup; + $('#add', popup_html).click(function() { + node.setMetadata('http_verb', $('#http_verb option:selected', popup_html).val()); + node.setMetadata('retries', $('#retries_input', popup_html).val()); + node.setMetadata('uri', $('#uri_input', popup_html).val()); + + popup.dialog('close'); + }); + + popup = monster.ui.dialog(popup_html, { + title: self.i18n.active().oldCallflows.webhook_title, + beforeClose: function() { + if(typeof callback == 'function') { + callback(); + } + } + }); + } + }, 'manual_presence[]': { name: self.i18n.active().oldCallflows.manual_presence, From cf478c98e6bf8bd449c9a36149781762b0e7e9ed Mon Sep 17 00:00:00 2001 From: Remco van Vugt Date: Wed, 21 Feb 2018 15:36:39 +0100 Subject: [PATCH 4/5] Added missing view --- .../callflows/views/webhook-callflowEdit.html | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/apps/callflows/views/webhook-callflowEdit.html diff --git a/src/apps/callflows/views/webhook-callflowEdit.html b/src/apps/callflows/views/webhook-callflowEdit.html new file mode 100644 index 0000000..cfec44a --- /dev/null +++ b/src/apps/callflows/views/webhook-callflowEdit.html @@ -0,0 +1,28 @@ +
+

{{ i18n.oldCallflows.webhook }}

+
+
+ + + + + + +
+
+
+ +
+
From 5464a583d3bd830f81599c1d2f693de70ecd1cc5 Mon Sep 17 00:00:00 2001 From: Remco van Vugt Date: Wed, 21 Feb 2018 15:37:44 +0100 Subject: [PATCH 5/5] Added missing elements in language file --- src/apps/callflows/i18n/en-US.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/apps/callflows/i18n/en-US.json b/src/apps/callflows/i18n/en-US.json index 29edeb1..9ee7419 100644 --- a/src/apps/callflows/i18n/en-US.json +++ b/src/apps/callflows/i18n/en-US.json @@ -1138,6 +1138,7 @@ "advanced_cat": "Advanced", "call_recording_cat": "Call Recording", "caller_id_cat": "Caller-ID", + "integrations_cat": "Integrations", "delete_callflow": "Delete callflow", "save_changes": "Save changes", "invalid_number": "Invalid number!", @@ -1292,7 +1293,13 @@ "check_cid_match": "Match", "check_cid_nomatch": "No match", "check_cid_matchnomatch": "Match or no match?", - "regex": "Regex" + "regex": "Regex", + "webhook": "Send webhook", + "webhook_tip": "Send a webhook to an external webservice when this callflow node is hit", + "webhook_title": "Send a HTTP webhook", + "webhook_uri": "URI", + "webhook_method": "HTTP method", + "webhook_retry": "# retries" }, "__comment": "UI-1260: created common control for carrier selection", "__version": "v3.20_s2",