diff --git a/src/apps/callflows/app.js b/src/apps/callflows/app.js index eb0fb16..829ca78 100644 --- a/src/apps/callflows/app.js +++ b/src/apps/callflows/app.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); require([ @@ -29,14 +29,14 @@ define(function(require){ css: [ 'app', 'icons' ], - i18n: { + i18n: { 'en-US': { customCss: false } }, // Defines API requests not included in the SDK requests: {}, - // Define the events available for other apps + // Define the events available for other apps subscribe: { 'callflows.fetchActions': 'define_callflow_nodes' }, @@ -342,7 +342,7 @@ define(function(require){ renderEntityManager: function(container) { var self = this, - entityActions = _.indexBy(_.filter(self.actions, function(action) { + entityActions = _.keyBy(_.filter(self.actions, function(action) { return action.hasOwnProperty('listEntities'); }), 'module'), template = $(monster.template(self, 'layout', { actions: entityActions })); @@ -997,7 +997,7 @@ define(function(require){ if(data && data.id) { self.callApi({ - resource: 'callflow.get', + resource: 'callflow.get', data: { accountId: self.accountId, callflowId: data.id @@ -1105,7 +1105,7 @@ define(function(require){ return parent; }, - construct_action: function(json) { + construct_action: function(json) { var action = ''; if('data' in json) { @@ -1328,7 +1328,7 @@ define(function(require){ } var metadata = self.dataCallflow.hasOwnProperty('ui_metadata') ? self.dataCallflow.ui_metadata : false, - isHiddenCallflow = metadata && metadata.hasOwnProperty('origin') && _.contains(['voip','migration','mobile', 'callqueues'], metadata.origin); + isHiddenCallflow = metadata && metadata.hasOwnProperty('origin') && _.includes(['voip','migration','mobile', 'callqueues'], metadata.origin); isHiddenCallflow ? $('#hidden_callflow_warning').show() : $('#hidden_callflow_warning').hide(); }, @@ -1557,7 +1557,7 @@ define(function(require){ $('.add_number', popup).click(function(event) { event.preventDefault(); var number = $('input[name="number_type"]:checked', popup).val() === 'your_numbers' ? $('#list_numbers option:selected', popup).val() : $('#add_number_text', popup).val(); - + if(number !== 'select_none' && number !== '') { self.flow.numbers.push(number); popup.dialog('close'); @@ -1599,7 +1599,7 @@ define(function(require){ callflow: self.actions[node.actionName] })); - // If an API request takes some time, the user can try to re-click on the element, we do not want to let that re-fire a request to the back-end. + // If an API request takes some time, the user can try to re-click on the element, we do not want to let that re-fire a request to the back-end. // So we set a 500ms timer that will prevent any other interaction with the callflow element. var isAlreadyClicked = false; @@ -1708,7 +1708,7 @@ define(function(require){ }); $('.node-options .jump', layout).click(function() { - + var $this = $(this), callflowId = $this.attr('id'); self.editCallflow({ id: callflowId }); @@ -2029,7 +2029,7 @@ define(function(require){ } }); - tabs.find('li').on('click', function(ev) { + tabs.find('li').on('click', function(ev) { ev.preventDefault(); var $this = $(this), diff --git a/src/apps/callflows/submodules/blacklist/blacklist.js b/src/apps/callflows/submodules/blacklist/blacklist.js index 661551f..32c4cc3 100644 --- a/src/apps/callflows/submodules/blacklist/blacklist.js +++ b/src/apps/callflows/submodules/blacklist/blacklist.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { diff --git a/src/apps/callflows/submodules/callcenter/callcenter.js b/src/apps/callflows/submodules/callcenter/callcenter.js index 4d8f388..c5c8ef8 100644 --- a/src/apps/callflows/submodules/callcenter/callcenter.js +++ b/src/apps/callflows/submodules/callcenter/callcenter.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), toastr = require('toastr'), monster = require('monster'), timezone = require('monster-timezone'); @@ -141,7 +141,7 @@ define(function(require){ ev.preventDefault(); self.queuePopupEdit({ - data: _data, + data: _data, callback: function(_data) { node.setMetadata('id', _data.id || 'null'); node.caption = _data.name || ''; diff --git a/src/apps/callflows/submodules/conference/conference.js b/src/apps/callflows/submodules/conference/conference.js index 13266f8..bafd935 100644 --- a/src/apps/callflows/submodules/conference/conference.js +++ b/src/apps/callflows/submodules/conference/conference.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { diff --git a/src/apps/callflows/submodules/device/device.js b/src/apps/callflows/submodules/device/device.js index 067874a..4ce5f6f 100644 --- a/src/apps/callflows/submodules/device/device.js +++ b/src/apps/callflows/submodules/device/device.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { @@ -389,7 +389,7 @@ define(function(require){ dataGlobal.extra = dataGlobal.extra || {}; dataGlobal.extra.isShoutcast = false; - // if the value is set to a stream, we need to set the value of the media_id to shoutcast so it gets selected by the old select mechanism, + // if the value is set to a stream, we need to set the value of the media_id to shoutcast so it gets selected by the old select mechanism, // but we also need to store the value so we can display it if (dataGlobal.data.hasOwnProperty('music_on_hold') && dataGlobal.data.music_on_hold.hasOwnProperty('media_id')) { if (dataGlobal.data.music_on_hold.media_id.indexOf('://') >= 0) { diff --git a/src/apps/callflows/submodules/directory/directory.js b/src/apps/callflows/submodules/directory/directory.js index d2cc109..fdf6067 100644 --- a/src/apps/callflows/submodules/directory/directory.js +++ b/src/apps/callflows/submodules/directory/directory.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { @@ -287,7 +287,7 @@ define(function(require){ directoryPopupEdit: function(args) { var self = this, - popup, + popup, popup_html, data = args.data, callback = args.callback, diff --git a/src/apps/callflows/submodules/faxbox/faxbox.js b/src/apps/callflows/submodules/faxbox/faxbox.js index bd189a4..fa363ba 100644 --- a/src/apps/callflows/submodules/faxbox/faxbox.js +++ b/src/apps/callflows/submodules/faxbox/faxbox.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'), timezone = require('monster-timezone'); diff --git a/src/apps/callflows/submodules/featurecodes/featurecodes.js b/src/apps/callflows/submodules/featurecodes/featurecodes.js index 43b5e44..235c20f 100644 --- a/src/apps/callflows/submodules/featurecodes/featurecodes.js +++ b/src/apps/callflows/submodules/featurecodes/featurecodes.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'), toastr = require('toastr'); diff --git a/src/apps/callflows/submodules/groups/groups.js b/src/apps/callflows/submodules/groups/groups.js index ce2c2da..f166282 100644 --- a/src/apps/callflows/submodules/groups/groups.js +++ b/src/apps/callflows/submodules/groups/groups.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { @@ -47,7 +47,7 @@ define(function(require){ form_data.endpoints = {}; $('.rows .row:not(#row_no_data)', groups_html).each(function(k, v) { - form_data.endpoints[$(v).data('id')] = { + form_data.endpoints[$(v).data('id')] = { type: $(v).data('type'), weight: k+1 }; @@ -1157,7 +1157,7 @@ define(function(require){ mediaData = isCreation ? {} : { id: $('#ringback', popup_html).val() }; monster.pub('callflows.media.editPopup', { - data: mediaData, + data: mediaData, callback: function(_mediaData) { if (_mediaData) { if (isCreation) { @@ -1290,7 +1290,7 @@ define(function(require){ endpoints.push(item_data); global_timeout = computeTimeout(parseFloat(item_data.delay), parseFloat(item_data.timeout), global_timeout); }); - + if (repeats < 1) { repeats = 1; } @@ -1476,7 +1476,7 @@ define(function(require){ delete form_data.users; return form_data; }, - + groupsSave: function(form_data, data, success, error) { var self = this, normalized_data = self.groupsNormalizeData($.extend(true, {}, data.data, form_data)); diff --git a/src/apps/callflows/submodules/media/media.js b/src/apps/callflows/submodules/media/media.js index e5e1d25..c4d597a 100644 --- a/src/apps/callflows/submodules/media/media.js +++ b/src/apps/callflows/submodules/media/media.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { @@ -107,7 +107,7 @@ define(function(require){ if($('#upload_div', media_html).is(':visible') && $('#file').val() != '') { if(file === 'updating') { monster.ui.alert(self.i18n.active().callflows.media.the_file_you_want_to_apply); - + $this.removeClass('disabled'); } else { @@ -285,7 +285,7 @@ define(function(require){ data = args.data, callback = args.callback, data_defaults = args.data_defaults || {}, - popup, + popup, popup_html = $('
'); self.mediaEdit(data, popup_html, $('.inline_content', popup_html), { @@ -377,7 +377,7 @@ define(function(require){ ev.preventDefault(); self.mediaPopupEdit({ - data: _data, + data: _data, callback: function(media) { node.setMetadata('id', media.id || 'null'); node.caption = media.name || ''; diff --git a/src/apps/callflows/submodules/menu/menu.js b/src/apps/callflows/submodules/menu/menu.js index 455c78e..7a0c961 100644 --- a/src/apps/callflows/submodules/menu/menu.js +++ b/src/apps/callflows/submodules/menu/menu.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { @@ -47,7 +47,7 @@ define(function(require){ monster.parallel({ media_list: function(callback) { self.callApi({ - resource: 'media.list', + resource: 'media.list', data: { accountId: self.accountId, filters: { paginate:false } @@ -101,7 +101,7 @@ define(function(require){ menuPopupEdit: function(data, callback, data_defaults) { var self = this, - popup, + popup, popup_html = $('
'); self.menuEdit(data, popup_html, $('.inline_content', popup_html), { diff --git a/src/apps/callflows/submodules/misc/misc.js b/src/apps/callflows/submodules/misc/misc.js index bc0b022..5eb3f9c 100644 --- a/src/apps/callflows/submodules/misc/misc.js +++ b/src/apps/callflows/submodules/misc/misc.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { @@ -502,7 +502,7 @@ define(function(require){ data_webhook: { 'http_verb': node.getMetadata('http_verb') || 'get', 'retries': node.getMetadata('retries') || '3', - 'uri': node.getMetadata('uri') || '' + 'uri': node.getMetadata('uri') || '' } })), popup; @@ -510,7 +510,7 @@ define(function(require){ 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'); }); diff --git a/src/apps/callflows/submodules/qubicle/qubicle.js b/src/apps/callflows/submodules/qubicle/qubicle.js index f0f36ea..85c3d24 100644 --- a/src/apps/callflows/submodules/qubicle/qubicle.js +++ b/src/apps/callflows/submodules/qubicle/qubicle.js @@ -1,6 +1,6 @@ define(function(require) { var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { diff --git a/src/apps/callflows/submodules/resource/resource.js b/src/apps/callflows/submodules/resource/resource.js index bfd45f4..c7538ee 100644 --- a/src/apps/callflows/submodules/resource/resource.js +++ b/src/apps/callflows/submodules/resource/resource.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { diff --git a/src/apps/callflows/submodules/temporalset/temporalset.js b/src/apps/callflows/submodules/temporalset/temporalset.js index 4b16f68..533893a 100644 --- a/src/apps/callflows/submodules/temporalset/temporalset.js +++ b/src/apps/callflows/submodules/temporalset/temporalset.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'); var app = { @@ -144,7 +144,7 @@ define(function(require){ temporalSetFormatRules: function(data) { var self = this, - mapRules = _.indexBy(data.field_data.rules, 'id'), + mapRules = _.keyBy(data.field_data.rules, 'id'), formattedData = {}; formattedData.available = _.map(data.field_data.rules, function(rule) { diff --git a/src/apps/callflows/submodules/timeofday/timeofday.js b/src/apps/callflows/submodules/timeofday/timeofday.js index 61cd279..71c4318 100644 --- a/src/apps/callflows/submodules/timeofday/timeofday.js +++ b/src/apps/callflows/submodules/timeofday/timeofday.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'), timezone = require('monster-timezone'); diff --git a/src/apps/callflows/submodules/user/user.js b/src/apps/callflows/submodules/user/user.js index d36e37c..0a5a576 100644 --- a/src/apps/callflows/submodules/user/user.js +++ b/src/apps/callflows/submodules/user/user.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'), timezone = require('monster-timezone'); @@ -78,7 +78,7 @@ define(function(require){ ev.preventDefault(); self.userPopupEdit({ - data: _data, + data: _data, callback: function(_data) { node.setMetadata('id', _data.id || 'null'); node.setMetadata('timeout', $('#parameter_input', popup_html).val()); @@ -433,7 +433,7 @@ define(function(require){ render_data.extra = render_data.extra || {}; render_data.extra.isShoutcast = false; - // if the value is set to a stream, we need to set the value of the media_id to shoutcast so it gets selected by the old select mechanism, + // if the value is set to a stream, we need to set the value of the media_id to shoutcast so it gets selected by the old select mechanism, // but we also need to store the value so we can display it if (render_data.data.hasOwnProperty('music_on_hold') && render_data.data.music_on_hold.hasOwnProperty('media_id')) { if (render_data.data.music_on_hold.media_id.indexOf('://') >= 0) { diff --git a/src/apps/callflows/submodules/vmbox/vmbox.js b/src/apps/callflows/submodules/vmbox/vmbox.js index de82b7f..a53d23c 100644 --- a/src/apps/callflows/submodules/vmbox/vmbox.js +++ b/src/apps/callflows/submodules/vmbox/vmbox.js @@ -1,6 +1,6 @@ define(function(require){ var $ = require('jquery'), - _ = require('underscore'), + _ = require('lodash'), monster = require('monster'), timezone = require('monster-timezone'); @@ -431,7 +431,7 @@ define(function(require){ ev.preventDefault(); self.vmboxPopupEdit({ - data: _data, + data: _data, callback: function(vmbox) { node.setMetadata('id', vmbox.id || 'null'); @@ -489,7 +489,7 @@ define(function(require){ // this is also the node we want to use when we drag it onto a callflow as we want the back-end to use the default action set in the schemas 'voicemail[id=*]': getVoicemailNode(true), - // the default action being "compose", the front-end needs a node handling the "compose" action. + // the default action being "compose", the front-end needs a node handling the "compose" action. // but we set the flag to false so we don't have 2 times the same node in the right list of actions 'voicemail[id=*,action=compose]': getVoicemailNode(false),