@c8y/ng1-modules 1019.24.2 → 1020.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICES +8357 -6666
- package/app-logs/app-logs.service.js +1 -1
- package/asset-notes/assetNotes.component.js +1 -1
- package/assetPropertyWidget/main.controller.js +1 -1
- package/cell-id-information-activator/cell-id-information-activator.config.js +1 -1
- package/cell-id-information-activator/cell-id-information-activator.service.js +1 -1
- package/cell-id-usage-statistics/cell-id-usage-statistics.component.js +1 -1
- package/cell-id-usage-statistics/cell-id-usage-statistics.service.js +1 -1
- package/commandTemplates/controllers/commandTemplates.js +1 -1
- package/commandTemplates/views/commandTemplates.html +83 -41
- package/core/core/services/alarms.js +1 -1
- package/core/core/services/application.js +1 -1
- package/core/core/services/auth.js +1 -1
- package/core/core/services/base.js +1 -1
- package/core/core/services/deviceShell.js +1 -1
- package/core/core/services/devices.js +1 -1
- package/core/core/services/dynamicGroups.js +1 -1
- package/core/core/services/geo.js +1 -1
- package/core/core/services/groups.js +1 -1
- package/core/core/services/inventory.js +1 -1
- package/core/core/services/kpi.js +1 -1
- package/core/core/services/measurements.js +1 -1
- package/core/core/services/settings.js +1 -1
- package/core/core/services/tenant.js +1 -1
- package/core/core/services/user.js +1 -1
- package/core/core/services/util.js +1 -1
- package/core/locales/de.po +553 -306
- package/core/locales/en.po +69 -0
- package/core/locales/es.po +562 -314
- package/core/locales/fr.po +560 -313
- package/core/locales/ja_JP.po +587 -299
- package/core/locales/ko.po +334 -327
- package/core/locales/nl.po +636 -389
- package/core/locales/pl.po +558 -310
- package/core/locales/pt_BR.po +575 -328
- package/core/locales/ru.po +21 -320
- package/core/locales/zh_CN.po +330 -323
- package/core/locales/zh_TW.po +330 -323
- package/core/ui/components/passwordStrengthChecklist.html +1 -1
- package/core/ui/configurable-device-list-columns/configurable-columns.service.js +1 -1
- package/core/ui/configurable-device-list-columns/modal-columns-configure.component.js +1 -1
- package/core/ui/controllers/deviceList.js +1 -1
- package/core/ui/controllers/eventList.js +1 -1
- package/core/ui/csvExporter/csvExporter.controller.js +1 -1
- package/core/ui/directives/alarmList.js +1 -1
- package/core/ui/directives/map.js +1 -1
- package/core/ui/directives/map2.js +1 -1
- package/core/ui/operations/operations-timeline.html +24 -10
- package/core/ui/properties/lastDeviceMessage.computedProperty.js +1 -1
- package/core/ui/schemaForm/schemaForm.component.js +1 -1
- package/core/ui/services/deviceListColumns.js +1 -1
- package/core/ui/services/measurementsReport.js +1 -1
- package/core/ui/user/editUser.directive.html +2 -0
- package/core/ui/views/eventList.html +3 -1
- package/dataBroker/connectors/connectors.html +1 -0
- package/dataBroker/connectorsAlarms/connectorAlarms.component.js +1 -1
- package/device-protocol-actility/actility-device.provider.js +1 -1
- package/device-protocol-canbus/canbus-device.provider.js +1 -1
- package/device-protocol-canopen/canopen-device.provider.js +1 -1
- package/device-protocol-deviceDatabase4/device-type-protocol-base.provider.js +1 -1
- package/device-protocol-lora/lora-device.provider.js +1 -1
- package/device-protocol-lpwan/lpwan-device.provider.js +1 -1
- package/device-protocol-modbus/modbus-device.provider.js +1 -1
- package/device-protocol-opcua/opcua-device.provider.js +1 -1
- package/device-protocol-profibus/profibus-device.provider.js +1 -1
- package/device-protocol-sigfox/sigfox-device.provider.js +1 -1
- package/device-protocol-snmp/snmp-device.provider.js +1 -1
- package/device-protocols/device-protocol-import-button.component.js +1 -1
- package/deviceDatabase4/detail/device-type-detail.component.js +1 -1
- package/deviceDatabase4/device-database.service.js +1 -1
- package/deviceDatabase4/device-type-list.component.js +1 -1
- package/deviceDatabase4/modals/configure-discrete-io.component.js +1 -1
- package/deviceDatabase4/modals/configure-register.component.js +1 -1
- package/deviceDatabase4/modals/import-device-type.component.js +1 -1
- package/deviceDatabase4/unique.directive.js +1 -1
- package/deviceDetail/cumulocity.json +0 -1
- package/deviceSelector/controllers/deviceSelectorComboCtrl.js +1 -1
- package/deviceStatusWidget/deviceStatus.component.js +1 -1
- package/deviceStatusWidget/ownerStatus.component.js +1 -1
- package/devicemanagement-availability/controllers/availability.js +1 -1
- package/devicemanagement-availability/views/detail.html +2 -2
- package/devicemanagement-eventList/controllers/eventList.js +1 -1
- package/enterpriseEdition/customBranding/brandingConfigurationUi.provider.js +1 -1
- package/enterpriseEdition/sslCertificate/manageCertificateForm.html +1 -1
- package/eventList/eventList.controller.js +1 -1
- package/generic-ui/generic-ui-inventory-property.component.js +1 -1
- package/groupsHierarchy/controllers/groupsListCtrl.js +1 -1
- package/kpi/controllers/pieChart.js +1 -1
- package/measurements/fragmentChart/fragmentChart.component.js +1 -1
- package/modbusConfiguration4/fieldbus-config.component.js +1 -1
- package/modbusConfiguration4/fieldbus-device-list.component.js +1 -1
- package/modbusWidget4/modbus-widget.service.js +1 -1
- package/modbusWidget4/widget-config.component.js +1 -1
- package/modbusWidget4/widget.component.js +1 -1
- package/package.json +5 -5
- package/remoteAccess/remoteAccess.service.js +1 -1
- package/remoteAccess/remoteAccessSettings/remoteAccessSettings.component.js +1 -1
- package/roles/detail/roleDetailInventory.html +33 -14
- package/scada/mapping.directive.js +1 -1
- package/simulators/simulatorsUi.provider.js +1 -1
- package/smartRestEditor/views/list.html +1 -0
- package/smartRules/directives/smartRuleParamInputKpi.js +1 -1
- package/smartRules/list/smartRulesList.html +25 -0
- package/smartRules/views/edit.html +95 -27
- package/smartRules/views/list.html +39 -5
- package/tenantStatistics/tenant-statistics.component.js +1 -1
- package/userRoles/inventoryRolesTab/inventoryRolesTab.component.js +1 -1
- package/users/userListView/userListView.component.js +1 -1
- package/users/userListView/userListView.html +1 -0
- package/users/userRemovalModal/userRemovalModal.component.html +1 -0
- package/alarmAssets/cumulocity.json +0 -14
- package/alarmAssets/img/all-critical-alarms-widget-pr.png +0 -0
- package/alarmAssets/index.js +0 -1
- package/alarmAssets/views/component.html +0 -8
- package/alarms/cumulocity.json +0 -21
- package/alarms/img/alarm-list-widget-pr.png +0 -0
- package/alarms/index.js +0 -1
- package/alarms/index.mock.js +0 -1
- package/alarms/severity.directive.js +0 -1
- package/alarms/severity.html +0 -13
- package/alarms/styles.css +0 -3
- package/alarms/widget-config.controller.js +0 -1
- package/alarms/widget-config.html +0 -116
- package/alarms/widget.config.js +0 -1
- package/alarms/widget.controller.js +0 -1
- package/alarms/widget.html +0 -15
- package/alarms/widget.module.js +0 -1
- package/alarms/widget.module.mock.js +0 -1
- package/cockpit-alarmRecent/cumulocity.json +0 -18
- package/cockpit-alarmRecent/img/recent-alarms-widget-pr.png +0 -0
- package/cockpit-alarmRecent/index.js +0 -1
- package/cockpit-alarmRecent/views/component.html +0 -7
- package/devicemanagement-aclManagement/controllers/aclManagementCtrl.js +0 -1
- package/devicemanagement-aclManagement/cumulocity.json +0 -21
- package/devicemanagement-aclManagement/index.js +0 -1
- package/devicemanagement-aclManagement/views/index.html +0 -207
- package/devicemanagement-alarmList/controllers/alarmList.js +0 -1
- package/devicemanagement-alarmList/cumulocity.json +0 -24
- package/devicemanagement-alarmList/gallery/alarms.png +0 -0
- package/devicemanagement-alarmList/index.js +0 -1
- package/devicemanagement-alarmList/views/index.html +0 -155
- package/devicemanagement-tracking/controllers/config.js +0 -1
- package/devicemanagement-tracking/controllers/tracking.js +0 -1
- package/devicemanagement-tracking/cumulocity.json +0 -19
- package/devicemanagement-tracking/index.js +0 -1
- package/devicemanagement-tracking/views/index.html +0 -103
- package/devicemanagement-vendMeDeviceControl/controllers/vendMeDeviceControl.js +0 -1
- package/devicemanagement-vendMeDeviceControl/cumulocity.json +0 -18
- package/devicemanagement-vendMeDeviceControl/index.js +0 -1
- package/devicemanagement-vendMeDeviceControl/views/index.html +0 -229
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},t=Object.prototype,s=t.hasOwnProperty,f=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof g?e:g,e=Object.create(e.prototype),n=new G(n||[]);return f(e,"_invoke",{value:(o=t,i=r,a=n,c=h,function(t,e){if(c===y)throw
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},t=Object.prototype,s=t.hasOwnProperty,f=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof g?e:g,e=Object.create(e.prototype),n=new G(n||[]);return f(e,"_invoke",{value:(o=t,i=r,a=n,c=h,function(t,e){if(c===y)throw Error("Generator is already running");if(c===v){if("throw"===t)throw e;return{value:u,done:!0}}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=l(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===h)throw c=v,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=y;r=l(o,i,a);if("normal"===r.type){if(c=a.done?v:p,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=v,a.method="throw",a.arg=r.arg)}})}),e}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var h="suspendedStart",p="suspendedYield",y="executing",v="completed",d={};function g(){}function m(){}function w(){}var e={},b=(i(e,n,function(){return this}),Object.getPrototypeOf),b=b&&b(b(O([]))),L=(b&&b!==t&&s.call(b,n)&&(e=b),w.prototype=g.prototype=Object.create(e));function _(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function x(a,c){var e;f(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=l(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&s.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function O(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(s.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return f(L,"constructor",{value:m.prototype=w,configurable:!0}),f(w,"constructor",{value:m,configurable:!0}),m.displayName=i(w,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,i(t,o,"GeneratorFunction")),t.prototype=Object.create(L),t},a.awrap=function(t){return{__await:t}},_(x.prototype),i(x.prototype,r,function(){return this}),a.AsyncIterator=x,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new x(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(L),i(L,o,"Generator"),i(L,n,function(){return this}),i(L,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=O,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,S(o)),n}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),d}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}!function(){function t(t,e,r,n,o,i,a,c,u){var s=r("Restart device"),f=this,l=c.get("additionalDeviceStatusButtons");function h(t){f.status=i.status(t)}function p(){return(p=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u.delete(f.device);case 2:n.success(r("Device deleted.")),e.path("/device");case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}_.assign(f,{$onInit:function(){o.detailRealtime(f.config.device.id,t,h).then(function(e){f.device=e,f.displayRestartBtn=o.supportsOperation(e,"c8y_Restart"),f.additionalButtonsInfo=l.filter(function(t){return t.canShowButton(e)}).map(function(t){return t.getButtonInfo()})})},restart:function(){a.create({deviceId:f.device.id,description:s,c8y_Restart:{}}).then(function(){n.success(r("Device will be restarted."))})},deleteDevice:function(){return p.apply(this,arguments)}})}t.$inject=["$scope","$location","gettext","c8yAlert","c8yDevices","c8yDeviceStatus","c8yDeviceControl","c8yServiceRegistry","c8yDeviceGridService"],angular.module("c8y.deviceStatus").component("c8yDeviceStatus",{controller:t,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/deviceStatus.html",bindings:{config:"<"}})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(){function e(n,e,i,t,o,r,c,s,a,d,u){var l,v=this,h=d("Enable/disable owner"),w=d("You don't have permission to admin this device.");function g(){r.hasId(v.device)&&(v.ownerInfoFetched=!1,o.canAdminMOs([v.device]).then(function(e){return v.canAdminDevice=e,v.canAdminDevice?n.resolve():(c.danger(w),n.reject())}).then(f).finally(function(){v.ownerInfoFetched=!0}))}function f(){return
|
|
1
|
+
"use strict";!function(){function e(n,e,i,t,o,r,c,s,a,d,u){var l,v=this,h=d("Enable/disable owner"),w=d("You don't have permission to admin this device.");function g(){r.hasId(v.device)&&(v.ownerInfoFetched=!1,o.canAdminMOs([v.device]).then(function(e){return v.canAdminDevice=e,v.canAdminDevice?n.resolve():(c.danger(w),n.reject())}).then(f).finally(function(){v.ownerInfoFetched=!0}))}function f(){return b(!1),i.getOwnerObject(_.get(v,"device.id"),{silentError:!0}).then(function(e){v.owner=e}).catch(function(e){e.serviceUser&&b(e.serviceUser),e.accessDenied&&(v.errorTooltipMessage=d("You don't have permission to enable/disable this owner user.")),e.notFound&&!e.serviceUser&&c.danger(u.getString('Device owner not found for device "{{name}}".',v.device)),e.accessDenied||e.notFound||e.serviceUser||c.danger(r.getResErrorMessage(e))})}function m(){v.isEditMode?v.isEditMode=!1:(v.isEditMode=!0,l=_.get(v,"device.owner"))}function b(e){_.set(v,"serviceUserDevice",e)}function y(){var e,n;v.device.owner?(n=d("Change owner`owner may be a human or system user`"),e=d("Change owner`owner may be a human or system user`"),n={status:"warning",title:n,body:u.getString('You are about to change the owner of this device to "{{ owner }}" user. Unless the credentials on the device are changed accordingly this may interrupt the communication between this device and the platform. Do you want to proceed?',{owner:v.device.owner}),size:"sm",labels:{ok:e,cancel:d("Cancel")}},s(n).then(function(){m(),t.detail(_.get(v,"device.owner"),{silentError:!0}).then(function(){return i.save(_.pick(v.device,["id","owner"]))}).then(function(){c.success(d("Device owner updated."))}).then(function(){g()}).catch(function(){var e=v.device.owner;D(l),c.danger(u.getString('Could not find user "{{errorUser}}". Device owner reverted to "{{owner}}".',{errorUser:e,owner:v.device.owner}))})}).catch(function(){p()})):p()}function p(){m(),D(l)}function D(e){_.set(v,"device.owner",e)}_.assign(v,{$onChanges:function(e){e.device.currentValue&&g()},toggleOwner:function(){function e(){v.owner.enabled=!n}var n=v.owner.enabled,t=_.get(v,"device.id");t&&v.canAdminDevice||e();var o=d(n?"Enable owner":"Disable owner"),r=d(n?"You are about to enable this device owner. Do you want to proceed?":"You are about to disable this device owner, this user will be locked and logged out of the platform. Do you want to proceed?"),r={title:o,body:r,status:"danger",size:"sm",labels:{ok:o,cancel:d("Cancel")}};s(r).then(function(){return i.setOwnerEnabled(t,n).then(function(e){v.owner=e,c.success(d("Owner status updated."))}).catch(e)}).catch(e)},toggleEdit:m,getTooltip:function(){return v.errorTooltipMessage?"":h},keyPressHandler:function(e){return a.handle(e,y,p)},save:y,cancel:p,shouldShowToggle:function(){return!v.isEditMode&&v.ownerInfoFetched&&!v.serviceUserDevice}})}e.$inject=["$q","$scope","c8yInventory","c8yUser","c8yPermissions","c8yBase","c8yAlert","c8yModal","keyboardKeyHandler","gettext","gettextCatalog"],angular.module("c8y.deviceStatus").component("ownerStatus",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/ownerStatus.html",bindings:{device:"<"}})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(){function t(n,t,o,l,a,r){var i,u=t.deviceId,c={},t=a("Availability percentage is based on the number of critical alarms raised and cleared."),
|
|
1
|
+
"use strict";!function(){function t(n,t,o,l,a,r){var i,u=t.deviceId,c={},t=!u,e=a("Availability percentage is based on the number of critical alarms raised and cleared."),d=a("Operability chart displays how many devices had their average availability on particular level in the last 30 days."),v=o.createEnum([{name:"DAY",value:1,label:a("Last 24 hours availability")},{name:"WEEK",value:7,label:a("Last 7 days availability")},{name:"MONTH",value:30,label:a("Last 30 days availability")}]),m=o.createEnum([{name:"DOWNTIME",value:"downtime",label:a("Downtime"),color:"#d9534f"},{name:"UPTIME",value:"uptime",label:a("Uptime"),color:"#5cb85c"}]);function s(r){t=r,a=moment(),t=moment().subtract(t.value,"days"),e=o.dateFullFormat;var t,a,e,i={dateFrom:t.format(e),dateTo:a.format(e),id:u};return(i.id?l.reports.downtimeDuration(i):l.reports.downtimeDurationAggregation(i)).then(function(t){var a,e,n;a=r,e=i,t=t.data,n=t.downtimeDuration,e=f(i,t)-n,c[a.name]={name:a.name,label:a.label,order:a.ordinal,data:[{key:m.DOWNTIME.value,val:n},{key:m.UPTIME.value,val:e}]}})}function f(t,a){var a=1<arguments.length&&void 0!==a?a:{},e=moment(t.dateFrom),t=moment(t.dateTo),n=1;return"number"==typeof a.deviceCount?n=a.deviceCount:Array.isArray(a.availabilityStats)&&(n=a.availabilityStats.length),t.diff(e,"seconds")*(n||1)}function y(t){var a=_.find(t,{key:m.UPTIME.value}).val;return a/(a+_.find(t,{key:m.DOWNTIME.value}).val)*100}_.assign(n,{intervalsData:c,showOverviewBreadcrumbs:t,availabilityTooltip:e,operabilityTooltip:d,x:function(){return function(t){return t.key}},y:function(){return function(t){return t.val}},xGraph:function(){return function(t){return t[0]}},yGraph:function(){return function(t){return t[1]}},xTickFormat:function(){return function(t){return"".concat(t,"%")}},color:function(){return function(t){return _.find(m,{value:t.data.key}).color}},colorGraph:function(){return function(){return m.UPTIME.color}},tooltip:function(){return function(t){return r.getString(_.find(m,{value:t}).label)}},tooltipGraph:function(){return function(t,a,e){e=Math.round(e);return r.getPlural(e,"1 device","{{$count}} devices",{})}},percentage:y,percentageClass:function(t){return 50<y(t)?"text-success":"text-danger"}}),v.values().forEach(s),u||(a=o.dateFullFormat,i={dateFrom:moment().subtract(30,"day").format(a),dateTo:moment().format(a)},l.reports.downtimeDuration(i).then(function(t){var a,e;a=i,t=(t=t.data).availabilityStats,e=f(a),a=t.map(function(t){var a=t.downtimeDuration;return t.percent=100*(e-a)/e,t}),n.graphData=[{key:"operability",values:function(a){for(var n=10,r=[],t=function(){var e=i*n,t=a.filter(function(t){return a=e,(t=t).percent<=a&&t.percent>a-n;var a}).length;r.push([e,t])},i=0;i<=10;i++)t();return r}(a)}]}))}t.$inject=["$scope","$routeParams","c8yBase","c8yAlarms","gettext","gettextCatalog"],angular.module("c8y.parts.availability").controller("availabilityReportCtrl",t)}();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<c8y-breadcrumbs-set>
|
|
1
|
+
<c8y-breadcrumbs-set ng-if="showOverviewBreadcrumbs">
|
|
2
2
|
<c8y-breadcrumbs-item
|
|
3
3
|
icon="signal"
|
|
4
4
|
label="{{ 'Availability' | translate }}"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
class="percentage"
|
|
32
32
|
ng-class="percentageClass(intervalData.data)"
|
|
33
33
|
>
|
|
34
|
-
{{ percentage(intervalData.data) | number
|
|
34
|
+
{{ percentage(intervalData.data) | number: 0 }}%
|
|
35
35
|
</span>
|
|
36
36
|
<nvd3-pie-chart
|
|
37
37
|
id="interval{{ $index }}"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e){e=_objectSpread(_objectSpread({},e),{},{pageSize:50});_.assign(this,{filters:e})}e.$inject=["$routeParams"],angular.module("c8y.parts.eventList").controller("eventListCtrl",e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){var r;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,a,i,n,l=[],s=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(o=i.call(r)).done)&&(l.push(o.value),l.length!==e);s=!0);}catch(t){c=!0,a=t}finally{try{if(!s&&null!=r.return&&(n=r.return(),Object(n)!==n))return}finally{if(c)throw a}}return l}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function ownKeys(e,t){var r,o=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)),o}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(p){c.$inject=["$q","$http","c8yPermissions","gettextCatalog","c8yInventory","c8yBinary","c8yPublicOptions","c8yBrandingMapping"];var f="brandingVariables",t={title:p("General"),items:["html_title"]},e={title:p("Main logo"),items:["favicon","brand-logo-img","brand-logo-height"]},r={title:p("Navigator logo"),items:["appLogo","appLogo-height"]},o={title:p("Font"),key:"font.options",items:["font-family-sans-serif","headings-font-family","navigator-font-family","__import-font"]},a={title:p("Colors"),items:["brand-primary","brand-complementary","brand-dark","brand-light","text-color","link-color","body-background-color"]},i={title:p("Top bar"),items:["headerColor","header-text-color","header-hover-color"]},n={title:p("Navigator"),items:["navColor","navColorHeader","navigator-title-color","navigator-text-color","navigator-separator-color","navigator-color-active","navigator-active-bg"]},l={title:p("Misc"),items:["btn-border-radius-base"]},s={title:p("Cookie banner"),items:["cookieBannerDisabled","cookieBannerTitle","cookieBannerText","policyUrl"]},m=[t,e,r,o,a],u=[i,n,l,s];return{$get:c};function c(i,n,t,r,l,s,o,c){var a=["brand-logo-img","appLogo","favicon"];return{getSchema:g,getForm:function(){return i.when([_.map(m,e),_.map(u,e)])},getSchemaFormOptions:function(){return t.hasAnyRole(["ROLE_OPTION_MANAGEMENT_ADMIN"]).then(function(t){return{formDefaults:{readonly:!t}}})},getBranding:function(){var t=g(),e=l.list({type:f}),r=o.read();return i.all({schema:t,managedObjects:e,publicOptions:r}).then(function(t){var r=_.pick(t.managedObjects[0],["id","c8y_less_variables","binary_ref","cookieBanner"]),o=(_.isEmpty(r)&&!_.isEmpty(t.publicOptions)&&(r=function(t){var r={},e=t.brandingCssVars,o=t.cookieBanner,a=t.extraCssUrls,i=t.faviconUrl,t=t.globalTitle,n=_.omitBy(_objectSpread(_objectSpread(_objectSpread({},e),o),{},{faviconUrl:i,globalTitle:t}),_.isUndefined),l=_.invert(c.cssVarMapping);Object.keys(n).forEach(function(t){var e=function(t){if("string"==typeof t){if(t.endsWith("%"))return Number(t.slice(0,-1));if(t.endsWith("px"))return Number(t.slice(0,-2))}return t}(n[t]);l[t]?r[l[t]]=e:r[t]=e}),a&&a.length&&(r["__import-font"]=a[0]);r["navigator-font-family"]&&(r["navigator-font-family"]=function(e){var r,o=_.invert(c.fontFamilyCssVars);return Object.keys(o).forEach(function(t){e.includes(t)&&(r=o[t])}),r}(e["navigator-font-family"]));o=c.fileProperties.map(function(t){return t.key});return["appLogo-height","brand-logo-height","navigator-app-icon-size","btn-border-radius-base"].forEach(function(t){r[t]&&(r[t]=parseInt(r[t],10))}),{c8y_less_variables:_.omit(r,o),binary_ref:_.pick(r,o)}}(t.publicOptions)),[]);return _.each(a,function(e){var a,t;r.binary_ref&&r.binary_ref[e]&&((t=(t=r.binary_ref[e]).id?l.detail(t,{},{silentError:!0}):(a=(t=t).startsWith("url(")?t.slice(4,-1):t,n.get(a,{responseType:"blob"}).then(function(o){return s.readDataUri(o.data).then(function(t){var e=o.headers(),r=_slicedToArray(a.split("/").pop().split("?"),1)[0],r=new File([o.data],r,{type:e["content-type"]});return _.set(r,"fileSrc",t),_.set(r,"length",e["content-length"]),{data:r}})}))).then(function(t){r.c8y_less_variables[e]=t.data},function(){}),o.push(t.catch(function(){return!1})))}),i.all(o).then(_.constant(r))})},saveConfiguration:function(t,e){t={type:f,c8y_less_variables:t.c8y_less_variables,binary_ref:t.binary_ref||{}};e&&(t.id=e);return l.save(t)},saveBinary:function(e,t,r,o){if(_.isEqual(t,o)&&t.id)return i.when(o);var a={c8y_Branding:e,fileSrc:t.fileSrc};return s.upload(t,a).then(function(t){return r&&r[e]&&o&&s.removeBinary(r[e]),t.data})},BINARY_VARS:a};function g(){var t=p("Hex, rgb or rgba value. Default: {{defaultColor}}"),e={message:{cssColor:r.getString("Must be a valid CSS color value.")},validator:{cssColor:function(t){var e;return!!_.isEmpty(t)||((e=document.createElement("SPAN")).style.color=t,!_.isEmpty(e.style.color))}}};return i.when({type:"object",properties:{html_title:{title:r.getString("Title"),type:"string",description:r.getString("Title to be used in browser tab")},"brand-logo-img":{title:"".concat(r.getString("Brand logo")),type:"string",description:r.getString("Supported files: *.png, *.svg, *.jpg"),format:"file","x-schema-form":{type:"fileUpload",allowedFileType:[".png",".svg",".jpg"]}},favicon:{title:"".concat(r.getString("Favicon")),type:"string",description:r.getString("Supported files: *.ico"),format:"file","x-schema-form":{type:"fileUpload",allowedFileType:[".ico"]}},"brand-logo-height":{title:r.getString("Brand logo height"),type:"number",minimum:0,description:r.getString("Height for setting the right proportion for the logo: height / width x 100")},appLogo:{title:r.getString("Navigator logo"),type:"string",description:r.getString("Supported files: *.png, *.svg, *.jpg"),format:"file","x-schema-form":{type:"fileUpload",allowedFileType:[".png",".svg",".jpg"]}},"appLogo-height":{title:r.getString("Navigator logo height"),type:"number",minimum:0,description:r.getString("Height for setting the right proportion for the navigator logo: height / width x 100")},"font-family-sans-serif":{title:r.getString("Base font stack"),type:"string","x-schema-form":{placeholder:r.getString('e.g. "Lato", Arial, Verdana, sans-serif')}},"headings-font-family":{title:r.getString("Headings font stack"),type:"string","x-schema-form":{placeholder:r.getString('e.g. "Lato", Arial, Verdana, sans-serif')}},"navigator-font-family":{title:r.getString("Navigator font stack"),type:"string",default:"@font-family-sans-serif","x-schema-form":{type:"radios",enum:["@font-family-sans-serif","@headings-font-family"],titleMap:[{value:"@font-family-sans-serif",name:r.getString("Same as base font")},{value:"@headings-font-family",name:r.getString("Same as headings font")}]}},"__import-font":{title:r.getString("URL"),description:r.getString("A link to existing remote fonts (for example, Google Fonts)"),type:"string"},"brand-primary":{title:"".concat(r.getString("Main brand color")),type:"string",description:r.getString("Hex, rgb or rgba value."),"x-schema-form":{placeholder:r.getString("e.g.: #27b3ce"),validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"brand-complementary":{title:r.getString("Secondary brand color"),type:"string",description:r.getString(t,{defaultColor:d("brand-complementary")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"brand-dark":{title:r.getString("Dark brand color"),type:"string",description:r.getString(t,{defaultColor:d("brand-dark")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"brand-light":{title:r.getString("Light brand color"),type:"string",description:r.getString(t,{defaultColor:d("brand-light")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"text-color":{title:r.getString("Text color"),type:"string",description:r.getString(t,{defaultColor:d("text-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"link-color":{title:r.getString("Link color"),type:"string",description:r.getString(t,{defaultColor:d("link-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"body-background-color":{title:r.getString("Main background color"),type:"string",description:r.getString(t,{defaultColor:d("body-background-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},headerColor:{title:r.getString("Background color"),type:"string",description:r.getString(t,{defaultColor:d("headerColor")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"header-text-color":{title:r.getString("Text color"),type:"string",description:r.getString(t,{defaultColor:d("header-text-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"header-hover-color":{title:r.getString("Button hover text color"),type:"string",description:r.getString(t,{defaultColor:d("header-hover-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},navColor:{title:r.getString("Background color"),type:"string",description:r.getString(t,{defaultColor:d("navColor")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},navColorHeader:{title:r.getString("Logo wrapper background color"),type:"string",description:r.getString(t,{defaultColor:d("navColorHeader")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-title-color":{title:r.getString("Title color"),type:"string",description:r.getString(t,{defaultColor:d("navigator-title-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-text-color":{title:r.getString("Text and buttons color"),type:"string",description:r.getString(t,{defaultColor:d("navigator-text-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-separator-color":{title:r.getString("Separator line color"),type:"string",description:r.getString(t,{defaultColor:d("navigator-separator-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-color-active":{title:r.getString("Text color of current item in navigator"),type:"string",description:r.getString(t,{defaultColor:d("navigator-color-active")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-active-bg":{title:r.getString("Background color of current item in navigator"),type:"string",description:r.getString(t,{defaultColor:d("navigator-active-bg")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"btn-border-radius-base":{title:r.getString("Button border-radius"),type:"number",minimum:0,maximum:20,description:r.getString("Value in px")},cookieBannerDisabled:{title:r.getString("Disable cookie banner"),type:"boolean"},cookieBannerTitle:{title:r.getString("Title"),type:"string","x-schema-form":{condition:"!model.cookieBannerDisabled"}},cookieBannerText:{title:r.getString("Text"),type:"string","x-schema-form":{type:"textarea",condition:"!model.cookieBannerDisabled"}},policyUrl:{title:r.getString("Link to privacy policy"),type:"string","x-schema-form":{placeholder:r.getString("e.g. https://example.com/mypolicy"),condition:"!model.cookieBannerDisabled"}}}})}function d(t){return{"brand-complementary":"#07b91A","text-color":"#444","link-color":"main brand color","body-background-color":"#FAFAFA","brand-dark":"#0B385B","brand-light":"#5FAEEC",headerColor:"#FFFFFF","header-text-color":"#49595B","header-hover-color":"main brand color",navColor:"#2c3637",navColorHeader:"transparent","navigator-title-color":"#FFFFFF","navigator-text-color":"#FAFAFA","navigator-separator-color":"#FAFAFA","navigator-color-active":"#FAFAFA","navigator-active-bg":"main brand color"}[t]}function e(t){var e={type:"collapse"};return _.assign(e,t),e.items=_.map(e.items,function(t){return{key:[t]}}),e.title=r.getString(e.title),e}}}t.$inject=["gettext"],angular.module("c8y.custom-branding").provider("c8yBrandingConfigurationUi",t)}();
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){var r;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,a,i,n,l=[],s=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(o=i.call(r)).done)&&(l.push(o.value),l.length!==e);s=!0);}catch(t){c=!0,a=t}finally{try{if(!s&&null!=r.return&&(n=r.return(),Object(n)!==n))return}finally{if(c)throw a}}return l}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function ownKeys(e,t){var r,o=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)),o}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(p){c.$inject=["$q","$http","c8yPermissions","gettextCatalog","c8yInventory","c8yBinary","c8yPublicOptions","c8yBrandingMapping"];var f="brandingVariables",t={title:p("General"),items:["html_title"]},e={title:p("Main logo"),items:["favicon","brand-logo-img","brand-logo-height"]},r={title:p("Navigator logo"),items:["appLogo","appLogo-height"]},o={title:p("Font"),key:"font.options",items:["font-family-sans-serif","headings-font-family","navigator-font-family","__import-font"]},a={title:p("Colors"),items:["brand-primary","brand-complementary","brand-dark","brand-light","text-color","link-color","body-background-color"]},i={title:p("Top bar"),items:["headerColor","header-text-color","header-hover-color"]},n={title:p("Navigator"),items:["navColor","navColorHeader","navigator-title-color","navigator-text-color","navigator-separator-color","navigator-color-active","navigator-active-bg"]},l={title:p("Misc"),items:["btn-border-radius-base"]},s={title:p("Cookie banner"),items:["cookieBannerDisabled","cookieBannerTitle","cookieBannerText","policyUrl"]},m=[t,e,r,o,a],u=[i,n,l,s];return{$get:c};function c(i,n,t,r,l,s,o,c){var a=["brand-logo-img","appLogo","favicon"];return{getSchema:g,getForm:function(){return i.when([_.map(m,e),_.map(u,e)])},getSchemaFormOptions:function(){return t.hasAnyRole(["ROLE_OPTION_MANAGEMENT_ADMIN"]).then(function(t){return{formDefaults:{readonly:!t}}})},getBranding:function(){var t=g(),e=l.list({type:f}),r=o.read();return i.all({schema:t,managedObjects:e,publicOptions:r}).then(function(t){var r=_.pick(t.managedObjects[0],["id","c8y_less_variables","binary_ref","cookieBanner"]),o=(_.isEmpty(r)&&!_.isEmpty(t.publicOptions)&&(r=function(t){var r={},e=t.brandingCssVars,o=t.cookieBanner,a=t.extraCssUrls,i=t.faviconUrl,t=t.globalTitle,n=_.omitBy(_objectSpread(_objectSpread(_objectSpread({},e),o),{},{faviconUrl:i,globalTitle:t}),_.isUndefined),l=_.invert(c.cssVarMapping);Object.keys(n).forEach(function(t){var e=function(t){if("string"==typeof t){if(t.endsWith("%"))return Number(t.slice(0,-1));if(t.endsWith("px"))return Number(t.slice(0,-2))}return t}(n[t]);l[t]?r[l[t]]=e:r[t]=e}),a&&a.length&&(r["__import-font"]=a[0]);r["navigator-font-family"]&&(r["navigator-font-family"]=function(e){var r,o=_.invert(c.fontFamilyCssVars);return Object.keys(o).forEach(function(t){e.includes(t)&&(r=o[t])}),r}(e["navigator-font-family"]));o=c.fileProperties.map(function(t){return t.key});return["appLogo-height","brand-logo-height","navigator-app-icon-size","btn-border-radius-base"].forEach(function(t){r[t]&&(r[t]=parseInt(r[t],10))}),{c8y_less_variables:_.omit(r,o),binary_ref:_.pick(r,o)}}(t.publicOptions)),[]);return _.each(a,function(e){var a,t;r.binary_ref&&r.binary_ref[e]&&((t=(t=r.binary_ref[e]).id?l.detail(t,{},{silentError:!0}):(a=(t=t).startsWith("url(")?t.slice(4,-1):t,n.get(a,{responseType:"blob"}).then(function(o){return s.readDataUri(o.data).then(function(t){var e=o.headers(),r=_slicedToArray(a.split("/").pop().split("?"),1)[0],r=new File([o.data],r,{type:e["content-type"]});return _.set(r,"fileSrc",t),_.set(r,"length",e["content-length"]),{data:r}})}))).then(function(t){r.c8y_less_variables[e]=t.data},function(){}),o.push(t.catch(function(){return!1})))}),i.all(o).then(_.constant(r))})},saveConfiguration:function(t,e){t={type:f,c8y_less_variables:t.c8y_less_variables,binary_ref:t.binary_ref||{}};e&&(t.id=e);return l.save(t)},saveBinary:function(e,t,r,o){if(_.isEqual(t,o)&&t.id)return i.when(o);var a={c8y_Branding:e,fileSrc:t.fileSrc};return s.upload(t,a).then(function(t){return r&&r[e]&&o&&s.removeBinary(r[e]),t.data})},BINARY_VARS:a};function g(){var t=p("Hex, rgb or rgba value. Default: {{defaultColor}}"),e={message:{cssColor:r.getString("Must be a valid CSS color value.")},validator:{cssColor:function(t){var e;return!!_.isEmpty(t)||((e=document.createElement("SPAN")).style.color=t,!_.isEmpty(e.style.color))}}};return i.when({type:"object",properties:{html_title:{title:r.getString("Title"),type:"string",description:r.getString("Title to be used in browser tab")},"brand-logo-img":{title:"".concat(r.getString("Brand logo")),type:"string",description:r.getString("Supported files: *.png, *.svg, *.jpg"),format:"file","x-schema-form":{type:"fileUpload",allowedFileType:[".png",".svg",".jpg"]}},favicon:{title:"".concat(r.getString("Favicon")),type:"string",description:r.getString("Supported files: *.ico"),format:"file","x-schema-form":{type:"fileUpload",allowedFileType:[".ico"]}},"brand-logo-height":{title:r.getString("Brand logo height"),type:"number",minimum:0,description:r.getString("Height for setting the right proportion for the logo: height / width x 100")},appLogo:{title:r.getString("Navigator logo"),type:"string",description:r.getString("Supported files: *.png, *.svg, *.jpg"),format:"file","x-schema-form":{type:"fileUpload",allowedFileType:[".png",".svg",".jpg"]}},"appLogo-height":{title:r.getString("Navigator logo height"),type:"number",minimum:0,description:r.getString("Height for setting the right proportion for the navigator logo: height / width x 100")},"font-family-sans-serif":{title:r.getString("Base font stack"),type:"string","x-schema-form":{placeholder:r.getString('e.g. "Lato", Arial, Verdana, sans-serif')}},"headings-font-family":{title:r.getString("Headings font stack"),type:"string","x-schema-form":{placeholder:r.getString('e.g. "Lato", Arial, Verdana, sans-serif')}},"navigator-font-family":{title:r.getString("Navigator font stack"),type:"string",default:"@font-family-sans-serif","x-schema-form":{type:"radios",enum:["@font-family-sans-serif","@headings-font-family"],titleMap:[{value:"@font-family-sans-serif",name:r.getString("Same as base font")},{value:"@headings-font-family",name:r.getString("Same as headings font")}]}},"__import-font":{title:r.getString("URL"),description:r.getString("A link to existing remote fonts (for example, Google Fonts)"),type:"string"},"brand-primary":{title:"".concat(r.getString("Main brand color")),type:"string",description:r.getString("Hex, rgb or rgba value."),"x-schema-form":{placeholder:r.getString("e.g.: #27b3ce"),validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"brand-complementary":{title:r.getString("Secondary brand color"),type:"string",description:r.getString(t,{defaultColor:d("brand-complementary")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"brand-dark":{title:r.getString("Dark brand color"),type:"string",description:r.getString(t,{defaultColor:d("brand-dark")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"brand-light":{title:r.getString("Light brand color"),type:"string",description:r.getString(t,{defaultColor:d("brand-light")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"text-color":{title:r.getString("Text color"),type:"string",description:r.getString(t,{defaultColor:d("text-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"link-color":{title:r.getString("Link color"),type:"string",description:r.getString(t,{defaultColor:d("link-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"body-background-color":{title:r.getString("Main background color"),type:"string",description:r.getString(t,{defaultColor:d("body-background-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},headerColor:{title:r.getString("Background color"),type:"string",description:r.getString(t,{defaultColor:d("headerColor")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"header-text-color":{title:r.getString("Text color"),type:"string",description:r.getString(t,{defaultColor:d("header-text-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"header-hover-color":{title:r.getString("Button hover text color"),type:"string",description:r.getString(t,{defaultColor:d("header-hover-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},navColor:{title:r.getString("Background color"),type:"string",description:r.getString(t,{defaultColor:d("navColor")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},navColorHeader:{title:r.getString("Logo wrapper background color"),type:"string",description:r.getString(t,{defaultColor:d("navColorHeader")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-title-color":{title:r.getString("Title color"),type:"string",description:r.getString(t,{defaultColor:d("navigator-title-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-text-color":{title:r.getString("Text and buttons color"),type:"string",description:r.getString(t,{defaultColor:d("navigator-text-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-separator-color":{title:r.getString("Separator line color"),type:"string",description:r.getString(t,{defaultColor:d("navigator-separator-color")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-color-active":{title:r.getString("Text color of current item in navigator"),type:"string",description:r.getString(t,{defaultColor:d("navigator-color-active")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"navigator-active-bg":{title:r.getString("Background color of current item in navigator"),type:"string",description:r.getString(t,{defaultColor:d("navigator-active-bg")}),"x-schema-form":{validationMessage:_objectSpread({},e.message),$validators:_objectSpread({},e.validator)}},"btn-border-radius-base":{title:r.getString("Button border-radius"),type:"number",minimum:0,maximum:20,description:r.getString("Value in px")},cookieBannerDisabled:{title:r.getString("Disable cookie banner"),type:"boolean"},cookieBannerTitle:{title:r.getString("Title"),type:"string","x-schema-form":{condition:"!model.cookieBannerDisabled"}},cookieBannerText:{title:r.getString("Text"),type:"string","x-schema-form":{type:"textarea",condition:"!model.cookieBannerDisabled"}},policyUrl:{title:r.getString("Link to privacy policy"),type:"string","x-schema-form":{placeholder:r.getString("e.g. https://example.com/mypolicy"),condition:"!model.cookieBannerDisabled"}}}})}function d(t){return{"brand-complementary":"#07b91A","text-color":"#444","link-color":"main brand color","body-background-color":"#FAFAFA","brand-dark":"#0B385B","brand-light":"#5FAEEC",headerColor:"#FFFFFF","header-text-color":"#49595B","header-hover-color":"main brand color",navColor:"#2c3637",navColorHeader:"transparent","navigator-title-color":"#FFFFFF","navigator-text-color":"#FAFAFA","navigator-separator-color":"#FAFAFA","navigator-color-active":"#FAFAFA","navigator-active-bg":"main brand color"}[t]}function e(t){var e={type:"collapse"};return _.assign(e,t),e.items=_.map(e.items,function(t){return{key:[t]}}),e.title=r.getString(e.title),e}}}t.$inject=["gettext"],angular.module("c8y.custom-branding").provider("c8yBrandingConfigurationUi",t)}();
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
>
|
|
40
40
|
First you must upload the appropriate certificate by clicking "Upload certificate".
|
|
41
41
|
</p>
|
|
42
|
-
<p>Make sure that:</p>
|
|
42
|
+
<p translate>Make sure that:</p>
|
|
43
43
|
<ul>
|
|
44
44
|
<li translate>The certificate is in a valid PKCS#12 (.pk12) format</li>
|
|
45
45
|
<li translate>The certificate is not password protected</li>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var o,n=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach(function(t){_defineProperty(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var o,n=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach(function(t){_defineProperty(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}angular.module("c8y.eventList").controller("EventListCtrl",["$scope",function(e){var o=this;function n(t){o.options=_.cloneDeep(t)||{},o.options.source=e.child.config.device&&e.child.config.device.id,e.child.config.widgetInstanceGlobalTimeContext&&(e.child.config.canDecoupleGlobalTimeContext=!1,o.timeRangeUnit="minute")}e.$watch("child.config.options",function(t,e){t&&!_.isEqual(t,e)&&n(t)}),e.$watch("child.config.device",function(t){t&&n(e.child.config.options)},!0),e.$watch("child.config.date",function(){e.child.config.widgetInstanceGlobalTimeContext&&n(_objectSpread(_objectSpread({},e.child.config.options),{},{dateFrom:e.child.config.date[0].toISOString(),dateTo:e.child.config.date[1].toISOString()}))}),n(e.child.config.options)}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,t,p){var u=this;_.assign(u,{$doCheck:function(){var e=_.get(u.context,u.property.path);u.model!==e&&(u.model=function(o){return _.forEach(o,function(e,t){try{var r=JSON.parse(e);0<_.keys(r).length&&(o[t]=_.reduce(r,function(e,t,r){return e[parseInt(r,10)]=t,e},[]))}catch(e){}})}(e))},$onChanges:function(){(function(){var e=u.property.key;u.schema={type:"object",properties:_defineProperty({},e,u.property)},u.form=[{key:[e],description:!1,notitle:!0,properties:_defineProperty({},e,u.property),labelHtmlClass:"no-label"}]})(),function(){var e=u.property.items;e&&_.get(e,"title")&&delete e.title;u.inputValueSchema={type:"object",properties:{inputValue:u.property},required:["inputValue"]},u.inputValueForm=[{key:["inputValue"],notitle:!0,description:!1,readonly:!1,uiSortable:{disabled:!0}}],u.placeholders={inputValue:_.cloneDeep(_.get(u.context,"".concat(u.property.path,".").concat(u.property.key)))}}()},execute:function(e,t){var r=(void 0!==t?t:"").inputValue,o=u.property,n=o.type,o=o.items,o=_.get(o,"type"),i=!1;n&&"array"===n&&o&&"string"===o&&(n=JSON.stringify(r),o=JSON.stringify(n),t.inputValue=o.match(/^"(.*)"$/)[1],i=!0);n=JSON.parse(p.replaceOperationTemplatePlaceholders(e.template,u.context,u.property,t));i&&(t.inputValue=r);u.createOperation({operation:n,name:e.name})},operationPopoverTemplate:":::PLUGIN_PATH:::/generic-ui-inventory-property-operation-popover.html",needsUserInput:function(e){return _.includes(e.template,"${inputValue}")},noOperationsSupported:function(){return 0<_.get(u.property,"operations.length",0)},needsForm:function(){return"operations"!==u.property.type&&!(0<_.intersection(["execute","execute with parameters"],_.map(u.property.operations,function(e){return e.name.toLowerCase()})).length)},isInProgress:function(t){return _.some(u.operations,function(e){return t.name===_.get(e,"c8y_JsonSchemaContext.operation")&&_.includes(["PENDING","EXECUTING"],e.status)})},options:{supressPropertyTitles:!0}})}e.$inject=["$location","$uibModal","c8yGenericUi"],angular.module("c8y.genericUi").component("c8yGenericUiInventoryProperty",{bindings:{property:"<",context:"<",operations:"<",createOperation:"&"},templateUrl:":::PLUGIN_PATH:::/generic-ui-inventory-property.html",controller:e,controllerAs:"vm"})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var n,i=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)),i}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var n,i=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)),i}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(n,e,t,i,r,o,c,u,a,p,s,f,l,g,d,y,E,h,K){var v,m,b,D=this,M="c8y_IsDeviceGroup",C={};function z(e){m=e,n.currentGroup=e,D.currentGroup=e}function G(){var e;return m?s.isGroup(m)&&(e=("function"==typeof _.get(n,"paging.refresh")?n.paging.refresh():S().then(w)).then(P)):e=s.getTopLevelGroups("devicemanagement"===K.getCurrentContextPath(),{withChildren:!1,pageSize:20,skipChildCount:!0}),e}function S(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return e.pageSize||(e.pageSize=20),e.withChildren=!1,o.children(m,"childAssets",{skipDetail:!0,params:e})}function w(e){var t;return O(e)?(t=e.data,0===o.onChildren(e).length&&(t=_objectSpread(_objectSpread({},t),{},{next:!1})),n.paging=c.createPaging(t,S)):e.paging&&(n.paging=e.paging),e}function O(e){return"number"==typeof e.status}function P(e){return O(e)?o.onChildren(e):e}function j(e){b=(b=b||[]).concat(e),n.items=b,D.items=b}function T(e){return C={},b&&(b.length=0),e}function k(){delete n.newGroup}function H(e){m?d.updateGroupChildren(m):d.addGroupNavigation(e)}function I(e){t.url("/device/".concat(e.id))}function A(e){return!L(e)&&!u.isDeviceOrChildDevice(e)}function L(e){return s.isGroup(e)||l.isDynamicGroup(e)}function $(){n.refreshLoading=!0,G().then(T).then(j).finally(function(){n.refreshLoading=!1})}function N(e){return"number"==typeof x(e)}function x(e){return"number"==typeof e.childCount?e.childCount:"number"==typeof C[e.id]?C[e.id]:void 0}_.assign(D,{c8yConfig:g,getTitle:function(){var e;e=m?m.name:E("Groups");return e},getSubtitle:function(){return b?h.getPlural(b.length,"Showing 1 item","Showing {{$count}} items",{}):void 0},isDeviceListViewEnabled:function(){return l.isDynamicGroup(D.currentGroup)},hasChildCount:N,childCount:x,fetchChildCount:function(t){N(t)||void 0!==C[t.id]||(C[t.id]="loading",(l.isDynamicGroup(t)?l.getChildCount(t):s.getItemsCount(t)).then(function(e){C[t.id]=e},function(){delete C[t.id]}))}}),_.assign(n,{addNewGroup:function(){n.newGroup={groupType:i.groupId?p.getDeviceSubgroupType():p.getDeviceGroupType(),name:""},D.newGroup=n.newGroup},cancelNewGroup:k,refresh:$,loadNext:function(){n.paging.loading=!0,n.paging.next().then(w).then(P).then(j).finally(function(){n.paging.loading=!1})},onClickEditGroup:function(e){y.editGroup(e)},onClickDeleteGroup:function(e){y.deleteGroupWithConfirmation(e).then(_.partial(_.pull,n.items,e))},onClickUnassignDevice:function(e){return y.unassignDevice(m,e).then(function(){return _.remove(b,{id:e.id})})},onClickDeleteDevice:function(e){return y.deleteDeviceWithConfirmation(e,A(e)).then(function(){return _.remove(n.items,{id:e.id})})},saveNewGroup:function(e){var t=function(e){e=_.cloneDeep(e);return e[M]={},e.type=e.groupType.type,delete e.groupType,e}(e),t=m?o.createChildAsset(t,m):o.createConfirm(t);return t.then(c.getResData).then(H),t.then(function(){a.success(h.getString('Group "{{name}}" created.',e)),G().then(T).then(j),k()})},drillDown:function(e){t.url("/group/".concat(e.id))},getLinkToDM:function(e){e={deviceId:e.id};return r(v||"")(e)},goToDeviceDetails:I,goToDeviceAlarms:function(e){_.some(f.getTabsByURL("/device/".concat(e.id)),{name:"Alarms"})?t.url("/device/".concat(e.id,"/alarms")):I(e)},getIconForGroup:function(e){return s.getIconSpecs(e).iconOpen},isGroupOrDynamicGroup:L,isGroup:s.isGroup,isDeviceOrChildDevice:u.isDeviceOrChildDevice,isOtherItem:A,assignDevices:function(){y.assignDevices(m).then($)},deviceModel:u.model,deviceSerial:u.serial,c8yConfig:g,getDeviceTitle:function(e){return _.get(e,"name",h.getString("Device {{id}}",e))}}),function(){if(n.inSearchMode)return;var e=i.groupId,t=_.isUndefined(e);c.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){v=e}),(t?G():function(e){return o.detail(e,{withParents:!0,withChildren:!1}).then(c.getResData)}(e).then(z).then(G)).then(w).then(j)}(),D.inSearchMode=n.inSearchMode,e.$on("c8yGroupCreateAndAssign::created",function(){$()})}e.$inject=["$scope","$rootScope","$location","$routeParams","$interpolate","c8yInventory","c8yBase","c8yDevices","c8yAlert","c8yGroupTypesConfig","c8yGroups","c8yTabs","c8yDynamicGroups","c8yConfig","groupTypesHierarchyNavigator","groupsHierarchySvc","gettext","gettextCatalog","c8yApplication"],angular.module("c8y.groupsHierarchy").controller("groupsListCtrl",e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(r,t,o){var i=t.createWidget(r);r.child.alerts.setAlertGroupDismissStrategy("warning","temporary_or_permanent"),i.refresh=function(){var n,t=this.mostRecentKpi.dataPoints,e=this.mostRecentKpi.measurements;r.dps=_.filter(t,function(t){return e[t.id]}),r.measurements=_.map(r.dps,function(t){return e[t.id].value<0?_objectSpread(_objectSpread({},e[t.id]),{},{value:0}):e[t.id]}),n=i.mostRecentKpi.measurements,t=_.filter(r.dps,function(t){return n[t.id].value<0}),r.child.alerts.clear("warning"),t.length&&(t=_.map(t,function(t){var e=t.label,t=n[t.id],r=t.value,t=t.unit;return"".concat(e,": ").concat(r).concat(t)}).join("; "),t={text:o.getString("Negative measurements received from data point(s): {{ list }}",{list:t}),type:"warning"},r.child.alerts.addAlerts(t))},i.onNotification=i.refresh,r.$watch("child.config.pieChartOptions",function(){r.options=r.child.config.pieChartOptions||{}}),r.options=r.child.config.pieChartOptions||{},i.init()}t.$inject=["$scope","baseWidgetSvc","gettextCatalog"],angular.module("c8y.parts.kpi").controller("pieChartCtrl",t)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(a,n,e){var o,u=this,m=d3.scale.category10();function r(e){var t=e.currentValue,e=e.previousValue;return!_.isEmpty(t)&&!_.isEmpty(e)&&!_.isEqual(t,e)}function i(e){u.fragmentSeriesPairs=_.groupBy(e,"fragment")}function c(){u.channel="/measurements/".concat(o)}function f(){var n,r,i,e=_.get(u.fragmentSeriesPairs,u.fragment),e=_.reduce(e,function(e,t){var n=t.series,t=t.unit;return _.assign(e,_defineProperty({},n,{unit:t}))},{}),e=(n=0,r=u.fragment,i={__target:{id:o},fragment:r,lineType:"line",renderType:"area"},_.map(e,function(e,t){return _.assign({series:t,unit:e.unit,label:a.humanizeFragment("".concat(r," => ").concat(t)),color:m(n++),__active:!0},i)}));_.set(u,"dataPoints",e)}u.aggregation="MINUTELY",u.interval=e._defaultDuration,_.assign(u,{$onChanges:function(e){var t=e.device,e=e.fragment;u.device&&u.fragment&&((r(t)||r(e))&&(u.fragmentSeriesPairs=void 0),o=a.getId(u.device),u.fragmentSeriesPairs?(c(),f()):n.getSupportedSeries(o).then(i).then(function(){c(),f()}))},$onInit:function(){u.dateFrom=moment().subtract(1,"hour").toDate(),u.dateTo=new Date},onUpdateDates:function(e,t){u.dateFrom=e;e=moment().diff(moment(t),"seconds")<5;u.realtime&&!e&&(u.realtime=!1);u.dateTo=t},updateScale:function(e){_.forEach(e.series,function(e){var t,n=e.dataPoint,r=_.find(u.dataPoints,function(e){return e.fragment===n.fragment&&e.series===n.series});r&&(e=e.values,(t=_.minBy(e,"val.min").val.min)===(e=_.maxBy(e,"val.max").val.max)&&(--t,e+=1),r.min=t,r.max=e)})}})}e.$inject=["c8yBase","c8yDevices","INTERVAL_CONSTANTS"],angular.module("c8y.core.measurements2").component("c8yMeasurementsFragmentChart",{templateUrl:":::PLUGIN_PATH:::/fragmentChart/fragmentChart.html",controllerAs:"vm",controller:e,bindings:{fragment:"<",device:"<",dateFrom:"=",dateTo:"=",realtime:"=?",hideRealtimeButton:"=?"}})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var i;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o,a,s=[],u=!0,c=!1;try{if(o=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,r,t,i,o,a,n,s,u,c,d,l,y,f,p,v){var g=this,m=t.deviceId,b={types:[]},A={IS_REQUIRED:"required",ADDRESS_IN_USE:"address-in-use",ADDRESSES_IN_USE:"addresses-in-use",ADDRESS_INVALID:"address-invalid",POLLING_RATE_LARGER_THAN_TRANSMIT_RATE:"polling-rate-larger-than-transmit-rate",ONLY_NATURAL_NUMBERS_ALLOWED:"only-natural-numbers-allowed",IPADDRESS_INVALID_FORMAT:"ip",INVALID_URL:"invalid-url",NODE_IN_USE:"node-in-use",NODE_OUT_OF_RANGE:"node-out-of-range",IP_RANGE:"ip-range",PORT_INVALID:"port-invalid",IP_RANGE_MAXLIMIT:"ip-range-maxlimit",ENGINEID_IN_USE:"engineid-in-use",IS_MIN:"min"},I=(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(I={},A.IS_REQUIRED,p("This field is required.")),A.ADDRESS_IN_USE,p("This address is already in use.")),A.ADDRESSES_IN_USE,p("These addresses are already in use.")),A.ADDRESS_INVALID,p("Addresses from 248 up to 254 are not allowed.")),A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,p("Polling rate must be equal to or smaller than transmit rate.")),A.ONLY_NATURAL_NUMBERS_ALLOWED,p("Only natural numbers allowed.")),A.IPADDRESS_INVALID_FORMAT,p("The IP address format is invalid.")),A.INVALID_URL,p("The URL format is invalid. The only supported protocols are http, https and opc.tcp.")),A.NODE_IN_USE,p("This node id is already in use.")),A.IP_RANGE,p("Invalid IP address range.")),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(I,A.PORT_INVALID,p("Invalid port number.")),A.IP_RANGE_MAXLIMIT,p("Max. 30 IP addresses in total allowed.")),A.NODE_OUT_OF_RANGE,p("Only node ID(s) between 1 and 127 are allowed.")),A.ENGINEID_IN_USE,p("This engine ID is already in use.")),A.IS_MIN,p("Value cannot be lower than minimum.")));function S(){var i=g.device,e={},t=(_.assign(g,{hasSerialConfigOperation:s.supportsOperation(i,"c8y_SerialConfiguration"),hasFieldBusConfigOperation:(t=i,O()&&s.supportsOperation(t,"c8y_CanConfiguration")||h()&&s.supportsOperation(t,"c8y_ModbusConfiguration")||L()&&s.supportsOperation(t,"c8y_OPCUAConfiguration")||M()&&s.supportsOperation(t,"c8y_ProfibusConfiguration")||U()&&s.supportsOperation(t,"c8y_CANopenConfiguration")||w()&&s.supportsOperation(t,"c8y_SNMPConfiguration")),serialConfiguration:_.get(i,"c8y_SerialConfiguration",{}),fieldbusConfiguration:function(e){var t={};e&&(h()?t=e.c8y_ModbusConfiguration:O()?t=e.c8y_CanConfiguration:L()?(e.c8y_OPCUAGateway&&(e.c8y_OPCUAGateway.transmitRate=e.c8y_OPCUAGateway.transmitRate||0,_.unset(e,"c8y_OPCUAGateway.userIdentityPassword")),t=e.c8y_OPCUAGateway):M()?(_.defaultsDeep(e,{c8y_ProfibusConfiguration:{baudRate:p("automatic")}}),t=e.c8y_ProfibusConfiguration):U()?t=e.c8y_CANopenConfiguration:w()&&(e.c8y_SNMPGateway&&(e.c8y_SNMPGateway.transmitRate=e.c8y_SNMPGateway.transmitRate||0,_.unset(e,"c8y_SNMPGateway.userIdentityPassword")),t=e.c8y_SNMPGateway));return t}(i)}),(w()||h())&&(e={pageSize:2e3}),g.tab);return d.getAvailableDeviceTypes({fieldbusType:t},e).then(function(e){var t=d.getFieldbusVersionFromDevice(i);_.set(g.fieldbusConfiguration,"maxFieldbusVersion",t),b.types=_.filter(e,function(e){return e.fieldbusVersion<=t})})}function P(){e={pageSize:1,fragmentType:"c8y_SnmpAutoDiscovery",status:"EXECUTING"},e=n.timeOrderFilter(e||{}),_.assign(e,_.pick(t,"deviceId")),e.revert=!0;var e;return a.list(e).then(D).then(T)}function D(e){var i,t,n=_slicedToArray(e,1)[0];return!!n&&(g.autoDiscoveryInProgress=!0,i=r.defer(),e="operation".concat(n.id),t="/operations/".concat(n.deviceId),l.getStatus(e,t)&&l.destroySubscription(e,t),l.addListener(e,t,"UPDATE",function(e,t){t.id===n.id&&(t.status===a.status.SUCCESSFUL||t.status===a.status.FAILED?i.resolve(t):i.notify(t))}),l.start(e,t),r.when({completed:i.promise}))}function N(){return s.childDevices(m).then(function(e){e=w()?_.orderBy(e,["name"],["asc"]):e;g.devices=_.map(e,function(e){var t,i,n,r,o,a;return h()&&e.c8y_ModbusDevice?(a=R({device:o=e,fieldbusDeviceFragment:"c8y_ModbusDevice"}),a={id:o.id,name:o.name,deviceType:_.get(a,"name"),address:o.c8y_ModbusDevice.address,ipAddress:o.c8y_ModbusDevice.ipAddress,protocol:o.c8y_ModbusDevice.protocol}):O()&&e.c8y_CanDevice?(r=R({device:o=e,fieldbusDeviceFragment:"c8y_CanDevice"}),a={id:o.id,name:o.name,deviceType:_.get(r,"name")}):L()&&e.c8y_OPCUADevice?(n=R({device:r=e,fieldbusDeviceFragment:"c8y_OPCUADevice"}),a={id:r.id,name:r.name,deviceType:_.get(n,"name"),directoryPath:r.c8y_OPCUADevice.browsePath}):M()&&e.c8y_ProfibusDevice?(i=R({device:n=e,fieldbusDeviceFragment:"c8y_ProfibusDevice"}),a={id:n.id,name:n.name,deviceType:_.get(i,"name")}):U()&&e.c8y_CANopenDevice?(t=R({device:i=e,fieldbusDeviceFragment:"c8y_CANopenDevice"}),a={id:i.id,name:i.name,deviceType:_.get(t,"name"),nodeId:i.c8y_CANopenDevice.nodeId}):w()&&e.c8y_SNMPDevice&&(e=R({device:t=e,fieldbusDeviceFragment:"c8y_SNMPDevice"}),a={id:t.id,name:t.name,deviceType:_.get(e,"name"),ipAddress:t.c8y_SNMPDevice.ipAddress,port:t.c8y_SNMPDevice.port,version:t.c8y_SNMPDevice.version,auth:_.get(t.c8y_SNMPDevice,"auth",{})}),a})})}function R(e){var t=e.device,i=e.fieldbusDeviceFragment;return _(b.types).find(function(e){e=e.id;return _.get(t,"".concat(i,".type"))==="/inventory/managedObjects/".concat(e)})}function C(){var e=g.fieldbusCommunicationForm;e.$setPristine(),e.$setUntouched()}function E(e){var t,e=e.split("-").map(function(e){return e.trim()}),i=f.validation.ip.pattern,n=f.validation.ipV6.pattern;if(2===e.length){var e=_slicedToArray(e,2),r=e[0],e=e[1],i=i.test(r)&&i.test(e),n=n.test(r)&&n.test(e);if(i||n)try{t=new o.Ip.Range(r,e)}catch(e){}}return t}function T(e){e.completed.then(function(e){e.status===a.status.SUCCESSFUL?(c.success(p("Autodiscovery completed.")),g.autoDiscoveryInProgress=!1):e.status===a.status.FAILED&&(e.failureReason?c.danger(v.getString('Autodiscovery failed due to: "{{ failureReason | translate }}".',e)):c.danger(p("Autodiscovery failed.")),g.autoDiscoveryInProgress=!1)},_.noop,function(){c.success(p("Autodiscovery in progress."))}).then(N)}function h(){return"modbus"===g.tab}function O(){return"canbus"===g.tab}function L(){return"opcua"===g.tab}function M(){return"profibus"===g.tab}function U(){return"canopen"===g.tab}function w(){return"snmp"===g.tab}_.assign(g,{$onInit:function(){s.detail(m).then(n.getResData).then(function(e){h()?_.defaults(e.c8y_SerialConfiguration,{baudRate:19200,dataBits:8,parity:"E",stopBits:1}):O()&&(g.serialConfigurationOptions.baudRates=[1e5,125e3,25e4,5e5,1e6]),g.device=e}).then(S).then(N).then(P)},shouldShowSerialPanel:function(){return h()&&_.get(g,"device.c8y_SerialConfiguration")},isModbusTab:h,isCanBusTab:O,isOPCUATab:L,isProfibusTab:M,isCanOpenTab:U,isSNMPTab:w,getFieldValidationHints:_.curryRight(n.validationHints)(I),serialConfigurationOptions:{baudRates:[110,300,600,1200,2400,4800,9600,14400,19200,38400,57600,115200,25e4,460800,5e5,921600,1e6],dataBits:[8],parities:["N","E","O"],stopBits:[1,2]},fieldbusConfigurationOptions:{baudRates:[{value:1e3,label:"1 Mbit/s"},{value:800,label:"800 kbit/s"},{value:500,label:"500 kbit/s"},{value:250,label:"250 kbit/s"},{value:125,label:"125 kbit/s"},{value:50,label:"50 kbit/s"},{value:20,label:"20 kbit/s"},{value:10,label:"10 kbit/s"}]},deviceConfigurationOptions:b,fieldErrors:A,fieldErrorsToMessages:I,saveSerialConfig:function(){!function(e){return a.create({deviceId:e.id,description:p("Set serial configuration"),c8y_SerialConfiguration:e.c8y_SerialConfiguration})}(g.device).then(function(){return c.success(p("Settings will be applied."))})},saveFieldbusConfig:function(){!function(e){var t=r.resolve();h()&&e.c8y_ModbusConfiguration?t=function(e){return a.create({deviceId:e.id,description:p("Set modbus configuration"),c8y_ModbusConfiguration:_.omit(e.c8y_ModbusConfiguration,["maxFieldbusVersion"])})}(e):O()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Bus configuration"),c8y_CanConfiguration:_.omit(e.c8y_CanConfiguration,["maxFieldbusVersion"])})}(e):L()?t=function(e){var t=e.c8y_OPCUAGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_OPCUAGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_OPCUAGateway"]))}(e):M()?t=function(e){return a.create({deviceId:e.id,description:p("Set Profibus configuration"),c8y_ProfibusConfiguration:_.pick(e.c8y_ProfibusConfiguration,["transmitRate","slaveAddress"])})}(e):U()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Open configuration"),c8y_CANopenConfiguration:_.omit(e.c8y_CANopenConfiguration,["maxFieldbusVersion"])})}(e):w()&&(t=function(e){var t=e.c8y_SNMPGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_SNMPGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_SNMPGateway"])).then(C)}(e));return t}(g.device).then(function(){return c.success(p("Settings will be applied."))})},invalid:function(e,t){(h()||L())&&!function(e){var e=g[e],t=e.pollingRate;{var i,n,r;t&&(e=e.transmitRate,n=i=!0,r=t.$modelValue<=e.$modelValue,L()&&0===e.$modelValue&&(r=!0),(!_.isInteger(e.$modelValue)||e.$modelValue<=0)&&(i=!1),(!_.isInteger(t.$modelValue)||t.$modelValue<=0)&&(n=!1),e.$setValidity(A.ONLY_NATURAL_NUMBERS_ALLOWED,i),e.$setValidity(A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r),t.$setValidity(A.ONLY_NATURAL_NUMBERS_ALLOWED,n),t.$setValidity(A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r))}}(e);L()&&!function(e){var e=g[e].OPCUAUrl,t=f.validation.opcuaBrowsePath.pattern,i=e.$modelValue;e.$setValidity(A.INVALID_URL,!i||t.test(i))}(e);w()&&!function(e){var e=g[e].ipRange,t=e.$modelValue;t&&(t=t.split(",").map(function(e){return e.trim()}),t=_.every(t,E),e.$setValidity(A.IP_RANGE,t),t)&&!function(e){var t=e.$modelValue,i=!0,n=!0,r=BigInt(30);{var o;t&&(o=BigInt(0),t=t.split(","),_.forEach(t,function(e){e=E(e);e||(i=!1),o+=BigInt(e.countIps())}),r<o||o<-r)&&(n=!1)}e.$setValidity(A.IP_RANGE,i),e.$setValidity(A.IP_RANGE_MAXLIMIT,n)}(e)}(e);return n.invalid(g,e,t)},reloadDevices:N,onClickDelete:function(e){u({title:p("Delete device"),body:v.getString('You are about to delete device "{{name}}". Do you want to proceed?',e),size:"sm",labels:{ok:p("Delete")},status:"danger"}).then(function(){return s.remove(e)}).then(function(){return U()?y.onRemove(g.device,e):r.resolve()}).then(function(){g.devices=_.without(g.devices,e),s.update({id:g.device.id}),c.success(p("Device deleted."))}).catch(function(e){e&&c.danger(e)})},navigateToDetail:function(e){i.url("device/".concat(e.id))},triggerAutodiscovery:function(e){g.autoDiscoveryInProgress=!0;e=e.ipRange.$modelValue;e&&(e={deviceId:m,description:p("Autodiscovery request"),c8y_SnmpAutoDiscovery:{ipRange:e}},a.createWithNotifications(e).then(T))},autoDiscoveryInProgress:!1,canTriggerAutodiscovery:function(e){return g.autoDiscoveryInProgress||e.ipRange.$dirty||_.isEmpty(e.ipRange.$modelValue)}})}e.$inject=["$rootScope","$q","$routeParams","$location","$window","c8yDeviceControl","c8yBase","c8yDevices","c8yModal","c8yAlert","c8yDeviceDatabase","c8yRealtime","c8yCanopenDevice","c8yConfig","gettext","gettextCatalog"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusConfig",{templateUrl:":::PLUGIN_PATH:::/fieldbus-config.html",bindings:{tab:"@"},controllerAs:"vm",controller:e})}();
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var i;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o,a,s=[],u=!0,c=!1;try{if(o=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,r,t,i,o,a,n,s,u,c,d,l,y,f,p,v){var g=this,m=t.deviceId,b={types:[]},A={IS_REQUIRED:"required",ADDRESS_IN_USE:"address-in-use",ADDRESSES_IN_USE:"addresses-in-use",ADDRESS_INVALID:"address-invalid",POLLING_RATE_LARGER_THAN_TRANSMIT_RATE:"polling-rate-larger-than-transmit-rate",ONLY_NATURAL_NUMBERS_ALLOWED:"only-natural-numbers-allowed",IPADDRESS_INVALID_FORMAT:"ip",INVALID_URL:"invalid-url",NODE_IN_USE:"node-in-use",NODE_OUT_OF_RANGE:"node-out-of-range",IP_RANGE:"ip-range",PORT_INVALID:"port-invalid",IP_RANGE_MAXLIMIT:"ip-range-maxlimit",ENGINEID_IN_USE:"engineid-in-use",IS_MIN:"min"},I=(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(I={},A.IS_REQUIRED,p("This field is required.")),A.ADDRESS_IN_USE,p("This address is already in use.")),A.ADDRESSES_IN_USE,p("These addresses are already in use.")),A.ADDRESS_INVALID,p("Addresses from 248 up to 254 are not allowed.")),A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,p("Polling rate must be equal to or smaller than transmit rate.")),A.ONLY_NATURAL_NUMBERS_ALLOWED,p("Only natural numbers allowed.")),A.IPADDRESS_INVALID_FORMAT,p("The IP address format is invalid.")),A.INVALID_URL,p("The URL format is invalid. The only supported protocols are http, https and opc.tcp.")),A.NODE_IN_USE,p("This node id is already in use.")),A.IP_RANGE,p("Invalid IP address range.")),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(I,A.PORT_INVALID,p("Invalid port number.")),A.IP_RANGE_MAXLIMIT,p("Max. 30 IP addresses in total allowed.")),A.NODE_OUT_OF_RANGE,p("Only node ID(s) between 1 and 127 are allowed.")),A.ENGINEID_IN_USE,p("This engine ID is already in use.")),A.IS_MIN,p("Value cannot be lower than minimum.")));function P(){var i=g.device,e={},t=(_.assign(g,{hasSerialConfigOperation:s.supportsOperation(i,"c8y_SerialConfiguration"),hasFieldBusConfigOperation:(t=i,O()&&s.supportsOperation(t,"c8y_CanConfiguration")||h()&&s.supportsOperation(t,"c8y_ModbusConfiguration")||L()&&s.supportsOperation(t,"c8y_OPCUAConfiguration")||M()&&s.supportsOperation(t,"c8y_ProfibusConfiguration")||U()&&s.supportsOperation(t,"c8y_CANopenConfiguration")||w()&&s.supportsOperation(t,"c8y_SNMPConfiguration")),serialConfiguration:_.get(i,"c8y_SerialConfiguration",{}),fieldbusConfiguration:function(e){var t={};e&&(h()?t=e.c8y_ModbusConfiguration:O()?t=e.c8y_CanConfiguration:L()?(e.c8y_OPCUAGateway&&(e.c8y_OPCUAGateway.transmitRate=e.c8y_OPCUAGateway.transmitRate||0,_.unset(e,"c8y_OPCUAGateway.userIdentityPassword")),t=e.c8y_OPCUAGateway):M()?(_.defaultsDeep(e,{c8y_ProfibusConfiguration:{baudRate:p("automatic")}}),t=e.c8y_ProfibusConfiguration):U()?t=e.c8y_CANopenConfiguration:w()&&(e.c8y_SNMPGateway&&(e.c8y_SNMPGateway.transmitRate=e.c8y_SNMPGateway.transmitRate||0,_.unset(e,"c8y_SNMPGateway.userIdentityPassword")),t=e.c8y_SNMPGateway));return t}(i)}),(w()||h())&&(e={pageSize:2e3}),g.tab);return d.getAvailableDeviceTypes({fieldbusType:t},e).then(function(e){var t=d.getFieldbusVersionFromDevice(i);_.set(g.fieldbusConfiguration,"maxFieldbusVersion",t),b.types=_.filter(e,function(e){return e.fieldbusVersion<=t})})}function S(){e={pageSize:1,fragmentType:"c8y_SnmpAutoDiscovery",status:"EXECUTING"},e=n.timeOrderFilter(e||{}),_.assign(e,_.pick(t,"deviceId")),e.revert=!0;var e;return a.list(e).then(D).then(T)}function D(e){var i,t,n=_slicedToArray(e,1)[0];return!!n&&(g.autoDiscoveryInProgress=!0,i=r.defer(),e="operation".concat(n.id),t="/operations/".concat(n.deviceId),l.getStatus(e,t)&&l.destroySubscription(e,t),l.addListener(e,t,"UPDATE",function(e,t){t.id===n.id&&(t.status===a.status.SUCCESSFUL||t.status===a.status.FAILED?i.resolve(t):i.notify(t))}),l.start(e,t),r.when({completed:i.promise}))}function N(){return s.childDevices(m).then(function(e){e=w()?_.orderBy(e,["name"],["asc"]):e;g.devices=_.map(e,function(e){var t,i,n,r,o,a;return h()&&e.c8y_ModbusDevice?(a=R({device:o=e,fieldbusDeviceFragment:"c8y_ModbusDevice"}),a={id:o.id,name:o.name,deviceType:_.get(a,"name"),address:o.c8y_ModbusDevice.address,ipAddress:o.c8y_ModbusDevice.ipAddress,protocol:o.c8y_ModbusDevice.protocol}):O()&&e.c8y_CanDevice?(r=R({device:o=e,fieldbusDeviceFragment:"c8y_CanDevice"}),a={id:o.id,name:o.name,deviceType:_.get(r,"name")}):L()&&e.c8y_OPCUADevice?(n=R({device:r=e,fieldbusDeviceFragment:"c8y_OPCUADevice"}),a={id:r.id,name:r.name,deviceType:_.get(n,"name"),directoryPath:r.c8y_OPCUADevice.browsePath}):M()&&e.c8y_ProfibusDevice?(i=R({device:n=e,fieldbusDeviceFragment:"c8y_ProfibusDevice"}),a={id:n.id,name:n.name,deviceType:_.get(i,"name")}):U()&&e.c8y_CANopenDevice?(t=R({device:i=e,fieldbusDeviceFragment:"c8y_CANopenDevice"}),a={id:i.id,name:i.name,deviceType:_.get(t,"name"),nodeId:i.c8y_CANopenDevice.nodeId}):w()&&e.c8y_SNMPDevice&&(e=R({device:t=e,fieldbusDeviceFragment:"c8y_SNMPDevice"}),a={id:t.id,name:t.name,deviceType:_.get(e,"name"),ipAddress:t.c8y_SNMPDevice.ipAddress,port:t.c8y_SNMPDevice.port,version:t.c8y_SNMPDevice.version,auth:_.get(t.c8y_SNMPDevice,"auth",{})}),a})})}function R(e){var t=e.device,i=e.fieldbusDeviceFragment;return _(b.types).find(function(e){e=e.id;return _.get(t,"".concat(i,".type"))==="/inventory/managedObjects/".concat(e)})}function C(){var e=g.fieldbusCommunicationForm;e.$setPristine(),e.$setUntouched()}function E(e){var t,e=e.split("-").map(function(e){return e.trim()}),i=f.validation.ip.pattern,n=f.validation.ipV6.pattern;if(2===e.length){var e=_slicedToArray(e,2),r=e[0],e=e[1],i=i.test(r)&&i.test(e),n=n.test(r)&&n.test(e);if(i||n)try{t=new o.Ip.Range(r,e)}catch(e){}}return t}function T(e){e.completed.then(function(e){e.status===a.status.SUCCESSFUL?(c.success(p("Autodiscovery completed.")),g.autoDiscoveryInProgress=!1):e.status===a.status.FAILED&&(e.failureReason?c.danger(v.getString('Autodiscovery failed due to: "{{ failureReason | translate }}".',e)):c.danger(p("Autodiscovery failed.")),g.autoDiscoveryInProgress=!1)},_.noop,function(){c.success(p("Autodiscovery in progress."))}).then(N)}function h(){return"modbus"===g.tab}function O(){return"canbus"===g.tab}function L(){return"opcua"===g.tab}function M(){return"profibus"===g.tab}function U(){return"canopen"===g.tab}function w(){return"snmp"===g.tab}_.assign(g,{$onInit:function(){s.detail(m).then(n.getResData).then(function(e){h()?_.defaults(e.c8y_SerialConfiguration,{baudRate:19200,dataBits:8,parity:"E",stopBits:1}):O()&&(g.serialConfigurationOptions.baudRates=[1e5,125e3,25e4,5e5,1e6]),g.device=e}).then(P).then(N).then(S)},shouldShowSerialPanel:function(){return h()&&_.get(g,"device.c8y_SerialConfiguration")},isModbusTab:h,isCanBusTab:O,isOPCUATab:L,isProfibusTab:M,isCanOpenTab:U,isSNMPTab:w,getFieldValidationHints:_.curryRight(n.validationHints)(I),serialConfigurationOptions:{baudRates:[110,300,600,1200,2400,4800,9600,14400,19200,38400,57600,115200,25e4,460800,5e5,921600,1e6],dataBits:[8],parities:["N","E","O"],stopBits:[1,2]},fieldbusConfigurationOptions:{baudRates:[{value:1e3,label:"1 Mbit/s"},{value:800,label:"800 kbit/s"},{value:500,label:"500 kbit/s"},{value:250,label:"250 kbit/s"},{value:125,label:"125 kbit/s"},{value:50,label:"50 kbit/s"},{value:20,label:"20 kbit/s"},{value:10,label:"10 kbit/s"}]},deviceConfigurationOptions:b,fieldErrors:A,fieldErrorsToMessages:I,saveSerialConfig:function(){!function(e){return a.create({deviceId:e.id,description:p("Set serial configuration"),c8y_SerialConfiguration:e.c8y_SerialConfiguration})}(g.device).then(function(){return c.success(p("Settings will be applied."))})},saveFieldbusConfig:function(){!function(e){var t=r.resolve();h()&&e.c8y_ModbusConfiguration?t=function(e){return a.create({deviceId:e.id,description:p("Set modbus configuration"),c8y_ModbusConfiguration:_.omit(e.c8y_ModbusConfiguration,["maxFieldbusVersion"])})}(e):O()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Bus configuration"),c8y_CanConfiguration:_.omit(e.c8y_CanConfiguration,["maxFieldbusVersion"])})}(e):L()?t=function(e){var t=e.c8y_OPCUAGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_OPCUAGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_OPCUAGateway"]))}(e):M()?t=function(e){return a.create({deviceId:e.id,description:p("Set Profibus configuration"),c8y_ProfibusConfiguration:_.pick(e.c8y_ProfibusConfiguration,["transmitRate","slaveAddress"])})}(e):U()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Open configuration"),c8y_CANopenConfiguration:_.omit(e.c8y_CANopenConfiguration,["maxFieldbusVersion"])})}(e):w()&&(t=function(e){var t=e.c8y_SNMPGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_SNMPGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_SNMPGateway"])).then(C)}(e));return t}(g.device).then(function(){return c.success(p("Settings will be applied."))})},invalid:function(e,t){(h()||L())&&!function(e){var e=g[e],t=e.pollingRate;{var i,n,r;t&&(e=e.transmitRate,n=i=!0,r=t.$modelValue<=e.$modelValue,L()&&0===e.$modelValue&&(r=!0),(!_.isInteger(e.$modelValue)||e.$modelValue<=0)&&(i=!1),(!_.isInteger(t.$modelValue)||t.$modelValue<=0)&&(n=!1),e.$setValidity(A.ONLY_NATURAL_NUMBERS_ALLOWED,i),e.$setValidity(A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r),t.$setValidity(A.ONLY_NATURAL_NUMBERS_ALLOWED,n),t.$setValidity(A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r))}}(e);L()&&!function(e){var e=g[e].OPCUAUrl,t=f.validation.opcuaBrowsePath.pattern,i=e.$modelValue;e.$setValidity(A.INVALID_URL,!i||t.test(i))}(e);w()&&!function(e){var e=g[e].ipRange,t=e.$modelValue;t&&(t=t.split(",").map(function(e){return e.trim()}),t=_.every(t,E),e.$setValidity(A.IP_RANGE,t),t)&&!function(e){var t=e.$modelValue,i=!0,n=!0,r=BigInt(30);{var o;t&&(o=BigInt(0),t=t.split(","),_.forEach(t,function(e){e=E(e);e||(i=!1),o+=BigInt(e.countIps())}),r<o||o<-r)&&(n=!1)}e.$setValidity(A.IP_RANGE,i),e.$setValidity(A.IP_RANGE_MAXLIMIT,n)}(e)}(e);return n.invalid(g,e,t)},reloadDevices:N,onClickDelete:function(e){u({title:p("Delete device"),body:v.getString('You are about to delete device "{{name}}". Do you want to proceed?',e),size:"sm",labels:{ok:p("Delete")},status:"danger"}).then(function(){return s.remove(e)}).then(function(){return U()?y.onRemove(g.device,e):r.resolve()}).then(function(){g.devices=_.without(g.devices,e),s.update({id:g.device.id}),c.success(p("Device deleted."))}).catch(function(e){e&&c.danger(e)})},navigateToDetail:function(e){i.url("device/".concat(e.id))},triggerAutodiscovery:function(e){g.autoDiscoveryInProgress=!0;e=e.ipRange.$modelValue;e&&(e={deviceId:m,description:p("Autodiscovery request"),c8y_SnmpAutoDiscovery:{ipRange:e}},a.createWithNotifications(e).then(T))},autoDiscoveryInProgress:!1,canTriggerAutodiscovery:function(e){return g.autoDiscoveryInProgress||e.ipRange.$dirty||_.isEmpty(e.ipRange.$modelValue)}})}e.$inject=["$rootScope","$q","$routeParams","$location","$window","c8yDeviceControl","c8yBase","c8yDevices","c8yModal","c8yAlert","c8yDeviceDatabase","c8yRealtime","c8yCanopenDevice","c8yConfig","gettext","gettextCatalog"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusConfig",{templateUrl:":::PLUGIN_PATH:::/fieldbus-config.html",bindings:{tab:"@"},controllerAs:"vm",controller:e})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},e=Object.prototype,s=e.hasOwnProperty,d=Object.defineProperty||function(e,t,n){e[t]=n.value},t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",n=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function i(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(u){i=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o,i,a,c,t=t&&t.prototype instanceof m?t:m,t=Object.create(t.prototype),r=new S(r||[]);return d(t,"_invoke",{value:(o=e,i=n,a=r,c=f,function(e,t){if(c===v)throw new Error("Generator is already running");if(c===h){if("throw"===e)throw t;return{value:u,done:!0}}for(a.method=e,a.arg=t;;){var n=a.delegate;if(n){n=function e(t,n){var r=n.method,o=t.iterator[r];if(o===u)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=u,e(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;r=l(o,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,y;o=r.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=u),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}(n,a);if(n){if(n===y)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===f)throw c=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=v;n=l(o,i,a);if("normal"===n.type){if(c=a.done?h:p,n.arg===y)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(c=h,a.method="throw",a.arg=n.arg)}})}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}a.wrap=c;var f="suspendedStart",p="suspendedYield",v="executing",h="completed",y={};function m(){}function g(){}function _(){}var t={},b=(i(t,r,function(){return this}),Object.getPrototypeOf),b=b&&b(b(I([]))),w=(b&&b!==e&&s.call(b,r)&&(t=b),_.prototype=m.prototype=Object.create(t));function E(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function x(a,c){var t;d(this,"_invoke",{value:function(n,r){function e(){return new c(function(e,t){!function t(e,n,r,o){var i,e=l(a[e],a,n);if("throw"!==e.type)return(n=(i=e.arg).value)&&"object"==_typeof(n)&&s.call(n,"__await")?c.resolve(n.__await).then(function(e){t("next",e,r,o)},function(e){t("throw",e,r,o)}):c.resolve(n).then(function(e){i.value=e,r(i)},function(e){return t("throw",e,r,o)});o(e.arg)}(n,r,e,t)})}return t=t?t.then(e,e):e()}})}function D(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function N(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function I(t){if(t||""===t){var n,e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return n=-1,(e=function e(){for(;++n<t.length;)if(s.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=u,e.done=!0,e}).next=e}throw new TypeError(_typeof(t)+" is not iterable")}return d(w,"constructor",{value:g.prototype=_,configurable:!0}),d(_,"constructor",{value:g,configurable:!0}),g.displayName=i(_,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,i(e,o,"GeneratorFunction")),e.prototype=Object.create(w),e},a.awrap=function(e){return{__await:e}},E(x.prototype),i(x.prototype,n,function(){return this}),a.AsyncIterator=x,a.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var i=new x(c(e,t,n,r),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},E(w),i(w,o,"Generator"),i(w,r,function(){return this}),i(w,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,n=Object(e),r=[];for(t in n)r.push(t);return r.reverse(),function e(){for(;r.length;){var t=r.pop();if(t in n)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=I,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(N),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=u)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function e(e,t){return i.type="throw",i.arg=n,r.next=e,t&&(r.method="next",r.arg=u),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),N(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,o=this.tryEntries[t];if(o.tryLoc===e)return"throw"===(n=o.completion).type&&(r=n.arg,N(o)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:I(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=u),y}},a}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,n){var r=c.apply(e,a);function o(e){asyncGeneratorStep(r,t,n,o,i,"next",e)}function i(e){asyncGeneratorStep(r,t,n,o,i,"throw",e)}o(void 0)})}}!function(){function e(o,n,i,a,c,u,s,d,l,r,f){var e,p=this,t=l.snmpVersions,v=l.snmpAuthPrivProtocols,h=l.snmpAuthProtocols,y=l.snmpSecurityLevels;function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var n,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=p.mode,r=p.device,t.adding=!0,t.protocol=n,e.prev=3,S())return e.next=7,l.update(r,t);e.next=7;break;case 7:p.expandedId="",p.reloadDevices(),i.success(f("Child device changes saved.")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),t.adding=!1,i.danger(f("Failed to change child device."));case 13:o.$apply();case 14:case"end":return e.stop()}},e,null,[[3,10]])}))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t,n,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.mode,n=p.device,(r=p.newDevice).adding=!0,r.protocol=t,e.prev=3,w())return e.next=7,a.create(n,r);e.next=9;break;case 7:e.next=32;break;case 9:if(E())return e.next=12,c.create(n,r);e.next=14;break;case 12:e.next=32;break;case 14:if(x())return e.next=17,u.create(n,r);e.next=19;break;case 17:e.next=32;break;case 19:if(D())return e.next=22,s.create(n,r);e.next=24;break;case 22:e.next=32;break;case 24:if(N())return e.next=27,d.create(n,r);e.next=29;break;case 27:e.next=32;break;case 29:if(S())return e.next=32,l.create(n,r);e.next=32;break;case 32:b(),p.reloadDevices(),i.success(f("New child device added.")),e.next=38;break;case 35:e.prev=35,e.t0=e.catch(3),p.newDevice.adding=!1,i.danger(f("Failed to add new child device."));case 38:o.$apply();case 39:case"end":return e.stop()}},e,null,[[3,35]])}))).apply(this,arguments)}function b(){p.expandedId="",_.unset(p,"newDevice"),p[e].$setPristine(),document.getElementsByName("vm.".concat(e))[0].reset()}function w(){return"modbus"===p.tab}function E(){return"canbus"===p.tab}function x(){return"opcua"===p.tab}function D(){return"profibus"===p.tab}function N(){return"canopen"===p.tab}function S(){return"snmp"===p.tab}_.assign(p,{$onInit:function(){e="new".concat(p.mode,"DeviceForm"),p.expandedId=""},shouldShowSection:function(){var e=p.device,t=p.mode,n=!1;w()?"TCP"===t?n=r.supportsOperation(e,"c8y_ModbusDevice"):"RTU"===t&&(n=r.supportsOperation(e,"c8y_ModbusDevice")&&e.c8y_SerialConfiguration):E()&&"CAN"===t?n=r.supportsOperation(e,"c8y_CanDevice"):D()&&"Profibus"===t?n=r.supportsOperation(e,"c8y_ProfibusDevice"):N()&&"CANopen"===t&&(n=r.supportsOperation(e,"c8y_CANopenAddDevice"));return n},isModbusTab:w,isCanBusTab:E,isOPCUATab:x,isProfibusTab:D,isCanOpenTab:N,isSNMPTab:S,invalid:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"new".concat(p.mode,"DeviceForm");return function(e){var t=p.mode,n=p.fieldErrors;{var r,o,i,a;"TCP"===t||"RTU"===t?(a=p[e],(i=a.address)&&(o=i.$modelValue,"TCP"===t?(a=a.ipAddress,r=a.$modelValue,_.isUndefined(o)||i.$setValidity(n.ADDRESS_INVALID,function(e){return e<=247||255===e}(o)),r=o&&r&&_.some(p.devices,{address:o,ipAddress:r,protocol:"TCP"}),i.$setValidity(n.ADDRESSES_IN_USE,!r),a.$setValidity(n.ADDRESSES_IN_USE,!r)):"RTU"===t&&(a=o&&_.some(p.devices,{address:o,protocol:"RTU"}),i.$setValidity(n.ADDRESS_IN_USE,!a)))):"CANopen"===t?(r=p[e].nodeId)&&(o=r.$modelValue)&&(i=function(e){return 1<=e&&e<=127}(o),a=function(t){return p.devices.find(function(e){return!(!e||!e.nodeId)&&e.nodeId===t})}(o),i?a?(r.$setValidity(n.NODE_OUT_OF_RANGE,!0),r.$setValidity(n.NODE_IN_USE,!1)):(r.$setValidity(n.NODE_OUT_OF_RANGE,!0),r.$setValidity(n.NODE_IN_USE,!0)):(r.$setValidity(n.NODE_OUT_OF_RANGE,!1),r.$setValidity(n.NODE_IN_USE,!0))):"SNMP"===t&&function(e){var t,n=p[e];e&&(t=function(e){return _.toNumber(e.replace("form",""))}(e));(function(e,t){var n=p.fieldErrors;{var r;e.snmpVersionEngineId&&(e=e.snmpVersionEngineId,r=e.$modelValue)&&e.$setValidity(n.ENGINEID_IN_USE,!function(t,n){if(n)return _.some(p.devices,function(e){return(_.toNumber(e.id)!==n||t!==e.auth.engineId)&&e.engineId===t});return _.some(p.devices,function(e){return e.auth.engineId===t})}(r,t))}})(n,t),function(e,t){var n=p.fieldErrors,e=e.ipAddress,r=e.$modelValue;e.$setValidity(n.ADDRESS_IN_USE,!function(t,n){if(n)return _.some(p.devices,function(e){return(_.toNumber(e.id)!==n||t!==e.ipAddress)&&e.ipAddress===t});return _.some(p.devices,{ipAddress:t})}(r,t))}(n,t),function(e){var t=p.fieldErrors,e=e.port,n=e.$modelValue;e.$setValidity(t.PORT_INVALID,!_.isNaN(_.toNumber(n)))}(n)}(e)}}(t),n.invalid(p,t,e)},getFieldValidationHints:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"new".concat(p.mode,"DeviceForm"),t=_.get(p,"".concat(t,".").concat(e));if(t)return n.validationHints(t,p.fieldErrorsToMessages);return""},isFormInvalid:function(){return _.get(p,"".concat(e,".$invalid"))||_.get(p,"newDevice.adding")},startAddingNewDevice:function(){p.newDevice={name:null,deviceType:null,address:null},S()&&(p.newDevice=_.extend(p.newDevice,{version:null,port:null,auth:{}}),p.toggle("newDevice"))},addNewDevice:function(){return g.apply(this,arguments)},clearNewDevice:b,filterByMode:function(){if(w())return function(e){return _.get(e,"protocol")===p.mode};if(N())return function(e){return e.nodeId};return function(){return!0}},snmpVersions:t,snmpAuthPrivProtocols:v,snmpAuthProtocols:h,snmpSecurityLevels:y,updateDevice:function(e){return m.apply(this,arguments)},startEditDevice:function(e){var t=_.cloneDeep(e);t.adding=!1,_.isUndefined(t.deviceType)||(e=p.deviceConfigurationOptions,t.deviceType=_.find(e.types,function(e){return e.name===t.deviceType}));return t},isEditFormInvalid:function(e,t){return _.get(p,"".concat(e,".$invalid"))||_.get(t,"adding")},toggle:function(e){p.expandedId===e?p.expandedId="":p.expandedId=e},clearEditDevice:function(){p.expandedId=""},getSnmpVersionLabel:function(e){e=_.find(t,{value:e});return _.get(e,"label")},getFormName:function(e){if(e)return e=e.id,"vm.form".concat(_.toString(e));return"vm.form"},getDeviceFormName:function(e){return"form".concat(e.id)},expandedId:void 0})}e.$inject=["$rootScope","c8yBase","c8yAlert","c8yModbusDevice","c8yCanbusDevice","c8yOPCUADevice","c8yProfibusDevice","c8yCanopenDevice","c8ySNMPDevice","c8yDevices","gettext"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusDeviceList",{templateUrl:":::PLUGIN_PATH:::/fieldbus-device-list.html",bindings:{tab:"@",mode:"@",fieldErrors:"<",fieldErrorsToMessages:"<",deviceConfigurationOptions:"<",device:"<",devices:"<",reloadDevices:"<",onClickDelete:"<",navigateToDetail:"<"},controllerAs:"vm",controller:e})}();
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},e=Object.prototype,s=e.hasOwnProperty,d=Object.defineProperty||function(e,t,n){e[t]=n.value},t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",n=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function i(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(u){i=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o,i,a,c,t=t&&t.prototype instanceof m?t:m,t=Object.create(t.prototype),r=new S(r||[]);return d(t,"_invoke",{value:(o=e,i=n,a=r,c=f,function(e,t){if(c===v)throw Error("Generator is already running");if(c===h){if("throw"===e)throw t;return{value:u,done:!0}}for(a.method=e,a.arg=t;;){var n=a.delegate;if(n){n=function e(t,n){var r=n.method,o=t.iterator[r];if(o===u)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=u,e(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;r=l(o,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,y;o=r.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=u),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}(n,a);if(n){if(n===y)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===f)throw c=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=v;n=l(o,i,a);if("normal"===n.type){if(c=a.done?h:p,n.arg===y)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(c=h,a.method="throw",a.arg=n.arg)}})}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}a.wrap=c;var f="suspendedStart",p="suspendedYield",v="executing",h="completed",y={};function m(){}function g(){}function _(){}var t={},b=(i(t,r,function(){return this}),Object.getPrototypeOf),b=b&&b(b(I([]))),w=(b&&b!==e&&s.call(b,r)&&(t=b),_.prototype=m.prototype=Object.create(t));function E(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function x(a,c){var t;d(this,"_invoke",{value:function(n,r){function e(){return new c(function(e,t){!function t(e,n,r,o){var i,e=l(a[e],a,n);if("throw"!==e.type)return(n=(i=e.arg).value)&&"object"==_typeof(n)&&s.call(n,"__await")?c.resolve(n.__await).then(function(e){t("next",e,r,o)},function(e){t("throw",e,r,o)}):c.resolve(n).then(function(e){i.value=e,r(i)},function(e){return t("throw",e,r,o)});o(e.arg)}(n,r,e,t)})}return t=t?t.then(e,e):e()}})}function D(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function N(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function I(t){if(t||""===t){var n,e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return n=-1,(e=function e(){for(;++n<t.length;)if(s.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=u,e.done=!0,e}).next=e}throw new TypeError(_typeof(t)+" is not iterable")}return d(w,"constructor",{value:g.prototype=_,configurable:!0}),d(_,"constructor",{value:g,configurable:!0}),g.displayName=i(_,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,i(e,o,"GeneratorFunction")),e.prototype=Object.create(w),e},a.awrap=function(e){return{__await:e}},E(x.prototype),i(x.prototype,n,function(){return this}),a.AsyncIterator=x,a.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var i=new x(c(e,t,n,r),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},E(w),i(w,o,"Generator"),i(w,r,function(){return this}),i(w,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,n=Object(e),r=[];for(t in n)r.push(t);return r.reverse(),function e(){for(;r.length;){var t=r.pop();if(t in n)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=I,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(N),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=u)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function e(e,t){return i.type="throw",i.arg=n,r.next=e,t&&(r.method="next",r.arg=u),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),N(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,o=this.tryEntries[t];if(o.tryLoc===e)return"throw"===(n=o.completion).type&&(r=n.arg,N(o)),r}throw Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:I(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=u),y}},a}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,n){var r=c.apply(e,a);function o(e){asyncGeneratorStep(r,t,n,o,i,"next",e)}function i(e){asyncGeneratorStep(r,t,n,o,i,"throw",e)}o(void 0)})}}!function(){function e(o,n,i,a,c,u,s,d,l,r,f){var e,p=this,t=l.snmpVersions,v=l.snmpAuthPrivProtocols,h=l.snmpAuthProtocols,y=l.snmpSecurityLevels;function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var n,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=p.mode,r=p.device,t.adding=!0,t.protocol=n,e.prev=3,S())return e.next=7,l.update(r,t);e.next=7;break;case 7:p.expandedId="",p.reloadDevices(),i.success(f("Child device changes saved.")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),t.adding=!1,i.danger(f("Failed to change child device."));case 13:o.$apply();case 14:case"end":return e.stop()}},e,null,[[3,10]])}))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t,n,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.mode,n=p.device,(r=p.newDevice).adding=!0,r.protocol=t,e.prev=3,w())return e.next=7,a.create(n,r);e.next=9;break;case 7:e.next=32;break;case 9:if(E())return e.next=12,c.create(n,r);e.next=14;break;case 12:e.next=32;break;case 14:if(x())return e.next=17,u.create(n,r);e.next=19;break;case 17:e.next=32;break;case 19:if(D())return e.next=22,s.create(n,r);e.next=24;break;case 22:e.next=32;break;case 24:if(N())return e.next=27,d.create(n,r);e.next=29;break;case 27:e.next=32;break;case 29:if(S())return e.next=32,l.create(n,r);e.next=32;break;case 32:b(),p.reloadDevices(),i.success(f("New child device added.")),e.next=38;break;case 35:e.prev=35,e.t0=e.catch(3),p.newDevice.adding=!1,i.danger(f("Failed to add new child device."));case 38:o.$apply();case 39:case"end":return e.stop()}},e,null,[[3,35]])}))).apply(this,arguments)}function b(){p.expandedId="",_.unset(p,"newDevice"),p[e].$setPristine(),document.getElementsByName("vm.".concat(e))[0].reset()}function w(){return"modbus"===p.tab}function E(){return"canbus"===p.tab}function x(){return"opcua"===p.tab}function D(){return"profibus"===p.tab}function N(){return"canopen"===p.tab}function S(){return"snmp"===p.tab}_.assign(p,{$onInit:function(){e="new".concat(p.mode,"DeviceForm"),p.expandedId=""},shouldShowSection:function(){var e=p.device,t=p.mode,n=!1;w()?"TCP"===t?n=r.supportsOperation(e,"c8y_ModbusDevice"):"RTU"===t&&(n=r.supportsOperation(e,"c8y_ModbusDevice")&&e.c8y_SerialConfiguration):E()&&"CAN"===t?n=r.supportsOperation(e,"c8y_CanDevice"):D()&&"Profibus"===t?n=r.supportsOperation(e,"c8y_ProfibusDevice"):N()&&"CANopen"===t&&(n=r.supportsOperation(e,"c8y_CANopenAddDevice"));return n},isModbusTab:w,isCanBusTab:E,isOPCUATab:x,isProfibusTab:D,isCanOpenTab:N,isSNMPTab:S,invalid:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"new".concat(p.mode,"DeviceForm");return function(e){var t=p.mode,n=p.fieldErrors;{var r,o,i,a;"TCP"===t||"RTU"===t?(a=p[e],(i=a.address)&&(o=i.$modelValue,"TCP"===t?(a=a.ipAddress,r=a.$modelValue,_.isUndefined(o)||i.$setValidity(n.ADDRESS_INVALID,function(e){return e<=247||255===e}(o)),r=o&&r&&_.some(p.devices,{address:o,ipAddress:r,protocol:"TCP"}),i.$setValidity(n.ADDRESSES_IN_USE,!r),a.$setValidity(n.ADDRESSES_IN_USE,!r)):"RTU"===t&&(a=o&&_.some(p.devices,{address:o,protocol:"RTU"}),i.$setValidity(n.ADDRESS_IN_USE,!a)))):"CANopen"===t?(r=p[e].nodeId)&&(o=r.$modelValue)&&(i=function(e){return 1<=e&&e<=127}(o),a=function(t){return p.devices.find(function(e){return!(!e||!e.nodeId)&&e.nodeId===t})}(o),i?a?(r.$setValidity(n.NODE_OUT_OF_RANGE,!0),r.$setValidity(n.NODE_IN_USE,!1)):(r.$setValidity(n.NODE_OUT_OF_RANGE,!0),r.$setValidity(n.NODE_IN_USE,!0)):(r.$setValidity(n.NODE_OUT_OF_RANGE,!1),r.$setValidity(n.NODE_IN_USE,!0))):"SNMP"===t&&function(e){var t,n=p[e];e&&(t=function(e){return _.toNumber(e.replace("form",""))}(e));(function(e,t){var n=p.fieldErrors;{var r;e.snmpVersionEngineId&&(e=e.snmpVersionEngineId,r=e.$modelValue)&&e.$setValidity(n.ENGINEID_IN_USE,!function(t,n){if(n)return _.some(p.devices,function(e){return(_.toNumber(e.id)!==n||t!==e.auth.engineId)&&e.engineId===t});return _.some(p.devices,function(e){return e.auth.engineId===t})}(r,t))}})(n,t),function(e,t){var n=p.fieldErrors,e=e.ipAddress,r=e.$modelValue;e.$setValidity(n.ADDRESS_IN_USE,!function(t,n){if(n)return _.some(p.devices,function(e){return(_.toNumber(e.id)!==n||t!==e.ipAddress)&&e.ipAddress===t});return _.some(p.devices,{ipAddress:t})}(r,t))}(n,t),function(e){var t=p.fieldErrors,e=e.port,n=e.$modelValue;e.$setValidity(t.PORT_INVALID,!_.isNaN(_.toNumber(n)))}(n)}(e)}}(t),n.invalid(p,t,e)},getFieldValidationHints:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"new".concat(p.mode,"DeviceForm"),t=_.get(p,"".concat(t,".").concat(e));if(t)return n.validationHints(t,p.fieldErrorsToMessages);return""},isFormInvalid:function(){return _.get(p,"".concat(e,".$invalid"))||_.get(p,"newDevice.adding")},startAddingNewDevice:function(){p.newDevice={name:null,deviceType:null,address:null},S()&&(p.newDevice=_.extend(p.newDevice,{version:null,port:null,auth:{}}),p.toggle("newDevice"))},addNewDevice:function(){return g.apply(this,arguments)},clearNewDevice:b,filterByMode:function(){if(w())return function(e){return _.get(e,"protocol")===p.mode};if(N())return function(e){return e.nodeId};return function(){return!0}},snmpVersions:t,snmpAuthPrivProtocols:v,snmpAuthProtocols:h,snmpSecurityLevels:y,updateDevice:function(e){return m.apply(this,arguments)},startEditDevice:function(e){var t=_.cloneDeep(e);t.adding=!1,_.isUndefined(t.deviceType)||(e=p.deviceConfigurationOptions,t.deviceType=_.find(e.types,function(e){return e.name===t.deviceType}));return t},isEditFormInvalid:function(e,t){return _.get(p,"".concat(e,".$invalid"))||_.get(t,"adding")},toggle:function(e){p.expandedId===e?p.expandedId="":p.expandedId=e},clearEditDevice:function(){p.expandedId=""},getSnmpVersionLabel:function(e){e=_.find(t,{value:e});return _.get(e,"label")},getFormName:function(e){if(e)return e=e.id,"vm.form".concat(_.toString(e));return"vm.form"},getDeviceFormName:function(e){return"form".concat(e.id)},expandedId:void 0})}e.$inject=["$rootScope","c8yBase","c8yAlert","c8yModbusDevice","c8yCanbusDevice","c8yOPCUADevice","c8yProfibusDevice","c8yCanopenDevice","c8ySNMPDevice","c8yDevices","gettext"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusDeviceList",{templateUrl:":::PLUGIN_PATH:::/fieldbus-device-list.html",bindings:{tab:"@",mode:"@",fieldErrors:"<",fieldErrorsToMessages:"<",deviceConfigurationOptions:"<",device:"<",devices:"<",reloadDevices:"<",onClickDelete:"<",navigateToDetail:"<"},controllerAs:"vm",controller:e})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},e=Object.prototype,s=e.hasOwnProperty,l=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function i(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(u){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o,i,a,c,t=t&&t.prototype instanceof m?t:m,t=Object.create(t.prototype),n=new j(n||[]);return l(t,"_invoke",{value:(o=e,i=r,a=n,c=p,function(e,t){if(c===g)throw new Error("Generator is already running");if(c===h){if("throw"===e)throw t;return{value:u,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r){r=function e(t,r){var n=r.method,o=t.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=u,e(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=f(o,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===p)throw c=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=g;r=f(o,i,a);if("normal"===r.type){if(c=a.done?h:y,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=h,a.method="throw",a.arg=r.arg)}})}),t}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=c;var p="suspendedStart",y="suspendedYield",g="executing",h="completed",d={};function m(){}function v(){}function b(){}var t={},_=(i(t,n,function(){return this}),Object.getPrototypeOf),_=_&&_(_(O([]))),w=(_&&_!==e&&s.call(_,n)&&(t=_),b.prototype=m.prototype=Object.create(t));function E(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function T(a,c){var t;l(this,"_invoke",{value:function(r,n){function e(){return new c(function(e,t){!function t(e,r,n,o){var i,e=f(a[e],a,r);if("throw"!==e.type)return(r=(i=e.arg).value)&&"object"==_typeof(r)&&s.call(r,"__await")?c.resolve(r.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):c.resolve(r).then(function(e){i.value=e,n(i)},function(e){return t("throw",e,n,o)});o(e.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function O(t){if(t||""===t){var r,e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return r=-1,(e=function e(){for(;++r<t.length;)if(s.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=u,e.done=!0,e}).next=e}throw new TypeError(_typeof(t)+" is not iterable")}return l(w,"constructor",{value:v.prototype=b,configurable:!0}),l(b,"constructor",{value:v,configurable:!0}),v.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,i(e,o,"GeneratorFunction")),e.prototype=Object.create(w),e},a.awrap=function(e){return{__await:e}},E(T.prototype),i(T.prototype,r,function(){return this}),a.AsyncIterator=T,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new T(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},E(w),i(w,o,"Generator"),i(w,n,function(){return this}),i(w,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,r=Object(e),n=[];for(t in r)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=O,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=u)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return i.type="throw",i.arg=r,n.next=e,t&&(n.method="next",n.arg=u),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,o=this.tryEntries[t];if(o.tryLoc===e)return"throw"===(r=o.completion).type&&(n=r.arg,S(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:O(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=u),d}},a}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,t,r,o,i,"next",e)}function i(e){asyncGeneratorStep(n,t,r,o,i,"throw",e)}o(void 0)})}}!function(){function e(c,e,t,u,s,l){var r=e.MODBUS_DEVICE_FRAGMENT,n=e.PROFIBUS_DEVICE_FRAGMENT;return{getConfigModel:function(e){return o.apply(this,arguments)},updateConfigModel:function(e,t){_.set(e,"categoriesConfig",_.map(t,function(e){return{name:e.name,label:e.label,elements:_.compact(_.map(e.elements,function(e){return e.show?_.pick(e,["refId","label","type"]):void 0}))}})),_.unset(e,"coils"),_.unset(e,"registers")},getWidgetModel:function(e){return h.apply(this,arguments)},isAtLeastOneElementSelected:function(e){return _.some(e,function(e){return _.some(e.elements,"show")})},isDiscreteIOSelectedInConfig:window.c8y_testing&&g,isRegisterSelectedInConfig:window.c8y_testing&&y};function o(){return(o=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=_.get(t,"device"))return e.next=4,b(r);e.next=6;break;case 4:return r=e.sent,e.abrupt("return",function(){return i.apply(this,arguments)}({fieldbusDevice:r,widgetConfig:t}));case 6:return e.abrupt("return",c.resolve([]));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.fieldbusDevice,n=t.widgetConfig,e.next=3,w(r);case 3:if(o=e.sent,i=m({fieldbusDevice:r,deviceType:o}),_.isEmpty(i))return e.abrupt("return",[]);e.next=7;break;case 7:return a=_.groupBy(i,E),e.abrupt("return",_(n).chain().get("categoriesConfig",[]).map(function(e){var t=_.get(a,e.name);_.defaults(e,{label:e.name||l("Uncategorized")});t=_.flow([f,p])({categoryConfigElements:e.elements,deviceType:o,elements:i,categoryElements:t,widgetConfig:n}).categoryConfigElements;return e.elements=t,e}).thru(function(e){return T({categoriesConfig:e,categories:a,deviceType:o,widgetConfig:n})}).value());case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function f(e){var t=e.categoryConfigElements,n=e.deviceType,o=e.elements,r=e.categoryElements,e=e.widgetConfig;return{categoryConfigElements:_.map(t,function(e){var t=e.refId,r=e.type,t=s.findElementBestMatchingRefId(o,t,r);if(t)return _.defaults(e,{name:t.name,type:t.meta.type.value,typeLabel:s.getElementTypeLabel(t,n),show:!0,label:t.name})}),deviceType:n,elements:o,categoryElements:r,widgetConfig:e}}function p(e){var t=e.categoryConfigElements,r=e.deviceType,n=e.elements,o=e.categoryElements,i=e.widgetConfig;return{categoryConfigElements:[].concat(_toConsumableArray(t),_toConsumableArray(_(o).filter(function(e){return!_.find(t,{refId:s.getElementRefId(e)})}).map(function(e){return{refId:s.getElementRefId(e),label:e.name,show:a(e,i),name:e.name,type:e.meta.type.value,typeLabel:s.getElementTypeLabel(e,r)}}).value())),deviceType:r,elements:n,categoryElements:o,widgetConfig:i}}function a(e,t){return(e.meta.type===s.ElementType.REGISTER?y:g)(e,t)}function y(e,t){var r=e.id,n=e.input,o=e.number,e=e.startBit,t=t.registers;return _.includes(t,r)||_.includes(t,[n,o,e].join(","))||_.includes(t,o)||!!_.find(t,{number:o,startBit:e})}function g(e,t){var r=e.id,n=e.input,e=e.number,t=t.coils;return _.includes(t,r)||_.includes(t,[n,e].join(","))||_.includes(t,e)}function h(){return(h=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=_.get(t,"device.id"),r=u.detailRealtime(o),n=r.then(w),o=function(){return d.apply(this,arguments)}(o,t).then(function(e){return _.get(t,"categoriesConfig",e)}),e.next=6,c.all({fieldbusDevice:r,deviceType:n,categoriesConfig:o});case 6:return r=e.sent,n=r.fieldbusDevice,o=r.deviceType,a=r.categoriesConfig,i=m({fieldbusDevice:n,deviceType:o}),a=_.map(a,function(e){return _.defaults(_objectSpread(_objectSpread({},e),{},{elements:_(e.elements).map(function(e){var t=s.findElementBestMatchingRefId(i,e.refId,e.type);return t?_.defaults(_objectSpread(_objectSpread({},e),t),{label:t.name,show:!0}):e}).filter("show").value()}),{label:e.name})}),e.abrupt("return",{device:n,categories:a});case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n,o,i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b(t);case 2:return n=e.sent,e.next=5,w(n);case 5:return o=e.sent,i=m({fieldbusDevice:n,deviceType:o}),i=_.groupBy(i,E),e.abrupt("return",T({categoriesConfig:[],categories:i,deviceType:o,widgetConfig:r}));case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function m(e){var t=e.fieldbusDevice,e=e.deviceType,e=s.getElementsWithMeta(e);return _.has(t,r)||_.has(t,n)?e:_.filter(e,v)}function v(e){return e.meta.type===s.ElementType.REGISTER&&!e.input}function b(e){return s.isFieldbusDevice(e)?c.resolve(e):u.detail(t.getId(e)).then(t.getResData)}function w(e){return s.getDeviceTypeFromDevice(e)}function E(e){return _.get(e,"category","")}function T(e){var r=e.categoriesConfig,t=e.categories,n=e.deviceType,o=e.widgetConfig;return[].concat(_toConsumableArray(r),_toConsumableArray(_(t).pickBy(function(e,t){return!_.find(r,{name:t})}).map(function(e,t){return{name:t,label:t||l("Uncategorized"),elements:_.map(e,function(e){return{refId:s.getElementRefId(e),label:e.name,show:a(e,o),name:e.name,type:e.meta.type.value,typeLabel:s.getElementTypeLabel(e,n)}})}}).value()))}}e.$inject=["$q","fieldbusConstants","c8yBase","c8yDevices","c8yDeviceDatabase","gettext"],angular.module("c8y.modbusWidget4").factory("modbusWidgetSvc",e)}();
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},e=Object.prototype,s=e.hasOwnProperty,l=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function i(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(u){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o,i,a,c,t=t&&t.prototype instanceof m?t:m,t=Object.create(t.prototype),n=new O(n||[]);return l(t,"_invoke",{value:(o=e,i=r,a=n,c=p,function(e,t){if(c===g)throw Error("Generator is already running");if(c===h){if("throw"===e)throw t;return{value:u,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r){r=function e(t,r){var n=r.method,o=t.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=u,e(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=f(o,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===p)throw c=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=g;r=f(o,i,a);if("normal"===r.type){if(c=a.done?h:y,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=h,a.method="throw",a.arg=r.arg)}})}),t}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=c;var p="suspendedStart",y="suspendedYield",g="executing",h="completed",d={};function m(){}function v(){}function b(){}var t={},_=(i(t,n,function(){return this}),Object.getPrototypeOf),_=_&&_(_(S([]))),w=(_&&_!==e&&s.call(_,n)&&(t=_),b.prototype=m.prototype=Object.create(t));function E(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function T(a,c){var t;l(this,"_invoke",{value:function(r,n){function e(){return new c(function(e,t){!function t(e,r,n,o){var i,e=f(a[e],a,r);if("throw"!==e.type)return(r=(i=e.arg).value)&&"object"==_typeof(r)&&s.call(r,"__await")?c.resolve(r.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):c.resolve(r).then(function(e){i.value=e,n(i)},function(e){return t("throw",e,n,o)});o(e.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function S(t){if(t||""===t){var r,e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return r=-1,(e=function e(){for(;++r<t.length;)if(s.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=u,e.done=!0,e}).next=e}throw new TypeError(_typeof(t)+" is not iterable")}return l(w,"constructor",{value:v.prototype=b,configurable:!0}),l(b,"constructor",{value:v,configurable:!0}),v.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,i(e,o,"GeneratorFunction")),e.prototype=Object.create(w),e},a.awrap=function(e){return{__await:e}},E(T.prototype),i(T.prototype,r,function(){return this}),a.AsyncIterator=T,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new T(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},E(w),i(w,o,"Generator"),i(w,n,function(){return this}),i(w,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,r=Object(e),n=[];for(t in r)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=S,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=u)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return i.type="throw",i.arg=r,n.next=e,t&&(n.method="next",n.arg=u),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,o=this.tryEntries[t];if(o.tryLoc===e)return"throw"===(r=o.completion).type&&(n=r.arg,j(o)),n}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=u),d}},a}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,t,r,o,i,"next",e)}function i(e){asyncGeneratorStep(n,t,r,o,i,"throw",e)}o(void 0)})}}!function(){function e(c,e,t,u,s,l){var r=e.MODBUS_DEVICE_FRAGMENT,n=e.PROFIBUS_DEVICE_FRAGMENT;return{getConfigModel:function(e){return o.apply(this,arguments)},updateConfigModel:function(e,t){_.set(e,"categoriesConfig",_.map(t,function(e){return{name:e.name,label:e.label,elements:_.compact(_.map(e.elements,function(e){return e.show?_.pick(e,["refId","label","type"]):void 0}))}})),_.unset(e,"coils"),_.unset(e,"registers")},getWidgetModel:function(e){return h.apply(this,arguments)},isAtLeastOneElementSelected:function(e){return _.some(e,function(e){return _.some(e.elements,"show")})},isDiscreteIOSelectedInConfig:window.c8y_testing&&g,isRegisterSelectedInConfig:window.c8y_testing&&y};function o(){return(o=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=_.get(t,"device"))return e.next=4,b(r);e.next=6;break;case 4:return r=e.sent,e.abrupt("return",function(){return i.apply(this,arguments)}({fieldbusDevice:r,widgetConfig:t}));case 6:return e.abrupt("return",c.resolve([]));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.fieldbusDevice,n=t.widgetConfig,e.next=3,w(r);case 3:if(o=e.sent,i=m({fieldbusDevice:r,deviceType:o}),_.isEmpty(i))return e.abrupt("return",[]);e.next=7;break;case 7:return a=_.groupBy(i,E),e.abrupt("return",_(n).chain().get("categoriesConfig",[]).map(function(e){var t=_.get(a,e.name);_.defaults(e,{label:e.name||l("Uncategorized")});t=_.flow([f,p])({categoryConfigElements:e.elements,deviceType:o,elements:i,categoryElements:t,widgetConfig:n}).categoryConfigElements;return e.elements=t,e}).thru(function(e){return T({categoriesConfig:e,categories:a,deviceType:o,widgetConfig:n})}).value());case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function f(e){var t=e.categoryConfigElements,n=e.deviceType,o=e.elements,r=e.categoryElements,e=e.widgetConfig;return{categoryConfigElements:_.map(t,function(e){var t=e.refId,r=e.type,t=s.findElementBestMatchingRefId(o,t,r);if(t)return _.defaults(e,{name:t.name,type:t.meta.type.value,typeLabel:s.getElementTypeLabel(t,n),show:!0,label:t.name})}),deviceType:n,elements:o,categoryElements:r,widgetConfig:e}}function p(e){var t=e.categoryConfigElements,r=e.deviceType,n=e.elements,o=e.categoryElements,i=e.widgetConfig;return{categoryConfigElements:[].concat(_toConsumableArray(t),_toConsumableArray(_(o).filter(function(e){return!_.find(t,{refId:s.getElementRefId(e)})}).map(function(e){return{refId:s.getElementRefId(e),label:e.name,show:a(e,i),name:e.name,type:e.meta.type.value,typeLabel:s.getElementTypeLabel(e,r)}}).value())),deviceType:r,elements:n,categoryElements:o,widgetConfig:i}}function a(e,t){return(e.meta.type===s.ElementType.REGISTER?y:g)(e,t)}function y(e,t){var r=e.id,n=e.input,o=e.number,e=e.startBit,t=t.registers;return _.includes(t,r)||_.includes(t,[n,o,e].join(","))||_.includes(t,o)||!!_.find(t,{number:o,startBit:e})}function g(e,t){var r=e.id,n=e.input,e=e.number,t=t.coils;return _.includes(t,r)||_.includes(t,[n,e].join(","))||_.includes(t,e)}function h(){return(h=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=_.get(t,"device.id"),r=u.detailRealtime(o),n=r.then(w),o=function(){return d.apply(this,arguments)}(o,t).then(function(e){return _.get(t,"categoriesConfig",e)}),e.next=6,c.all({fieldbusDevice:r,deviceType:n,categoriesConfig:o});case 6:return r=e.sent,n=r.fieldbusDevice,o=r.deviceType,a=r.categoriesConfig,i=m({fieldbusDevice:n,deviceType:o}),a=_.map(a,function(e){return _.defaults(_objectSpread(_objectSpread({},e),{},{elements:_(e.elements).map(function(e){var t=s.findElementBestMatchingRefId(i,e.refId,e.type);return t?_.defaults(_objectSpread(_objectSpread({},e),t),{label:t.name,show:!0}):e}).filter("show").value()}),{label:e.name})}),e.abrupt("return",{device:n,categories:a});case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n,o,i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b(t);case 2:return n=e.sent,e.next=5,w(n);case 5:return o=e.sent,i=m({fieldbusDevice:n,deviceType:o}),i=_.groupBy(i,E),e.abrupt("return",T({categoriesConfig:[],categories:i,deviceType:o,widgetConfig:r}));case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function m(e){var t=e.fieldbusDevice,e=e.deviceType,e=s.getElementsWithMeta(e);return _.has(t,r)||_.has(t,n)?e:_.filter(e,v)}function v(e){return e.meta.type===s.ElementType.REGISTER&&!e.input}function b(e){return s.isFieldbusDevice(e)?c.resolve(e):u.detail(t.getId(e)).then(t.getResData)}function w(e){return s.getDeviceTypeFromDevice(e)}function E(e){return _.get(e,"category","")}function T(e){var r=e.categoriesConfig,t=e.categories,n=e.deviceType,o=e.widgetConfig;return[].concat(_toConsumableArray(r),_toConsumableArray(_(t).pickBy(function(e,t){return!_.find(r,{name:t})}).map(function(e,t){return{name:t,label:t||l("Uncategorized"),elements:_.map(e,function(e){return{refId:s.getElementRefId(e),label:e.name,show:a(e,o),name:e.name,type:e.meta.type.value,typeLabel:s.getElementTypeLabel(e,n)}})}}).value()))}}e.$inject=["$q","fieldbusConstants","c8yBase","c8yDevices","c8yDeviceDatabase","gettext"],angular.module("c8y.modbusWidget4").factory("modbusWidgetSvc",e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},t=Object.prototype,f=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),n=new O(n||[]);return l(e,"_invoke",{value:(o=t,i=r,a=n,c=h,function(t,e){if(c===y)throw
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},t=Object.prototype,f=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),n=new O(n||[]);return l(e,"_invoke",{value:(o=t,i=r,a=n,c=h,function(t,e){if(c===y)throw Error("Generator is already running");if(c===g){if("throw"===t)throw e;return{value:u,done:!0}}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=s(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===h)throw c=g,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=y;r=s(o,i,a);if("normal"===r.type){if(c=a.done?g:p,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=g,a.method="throw",a.arg=r.arg)}})}),e}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var h="suspendedStart",p="suspendedYield",y="executing",g="completed",d={};function v(){}function m(){}function w(){}var e={},b=(i(e,n,function(){return this}),Object.getPrototypeOf),b=b&&b(b(j([]))),L=(b&&b!==t&&f.call(b,n)&&(e=b),w.prototype=v.prototype=Object.create(e));function _(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function x(a,c){var e;l(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=s(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&f.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(f.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return l(L,"constructor",{value:m.prototype=w,configurable:!0}),l(w,"constructor",{value:m,configurable:!0}),m.displayName=i(w,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,i(t,o,"GeneratorFunction")),t.prototype=Object.create(L),t},a.awrap=function(t){return{__await:t}},_(x.prototype),i(x.prototype,r,function(){return this}),a.AsyncIterator=x,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new x(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(L),i(L,o,"Generator"),i(L,n,function(){return this}),i(L,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&f.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=f.call(o,"catchLoc"),c=f.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&f.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,S(o)),n}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),d}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}!function(){function t(e,r){var t,n,o=this;function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.getConfigModel(o.config);case 2:o.categoriesConfig=t.sent,e.$apply();case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}_.assign(o,{$doCheck:function(){_.isEqual(t,o.config.device)||(t=o.config.device,function(){i.apply(this,arguments)}());!_.isEqual(n,o.categoriesConfig)&&(n=_.cloneDeep(o.categoriesConfig),function(){{var t;if(n)return t=r.isAtLeastOneElementSelected(n),o.modbusWidgetConfigForm.modbusWidgetValidation.$setValidity("at-least-one-field-selected",t),o.atLeastOneElementSelected=t}return}())&&r.updateConfigModel(o.config,n)}})}t.$inject=["$rootScope","modbusWidgetSvc"],angular.module("c8y.modbusWidget4").component("c8yModbusWidgetConfig",{templateUrl:":::PLUGIN_PATH:::/widget-config.html",bindings:{config:"<"},controllerAs:"vm",controller:t})}();
|