@c8y/ng1-modules 1017.44.0 → 1017.46.0
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 +1025 -984
- package/administration-tfaSettings/tfa-settings.component.js +1 -1
- package/alarmsEventsExplorer/alarmsEventsTimelinesChart/alarmsEventsTimelinesChart.service.js +1 -1
- package/app-logs/app-logs/app-logs.component.js +1 -1
- package/app-logs/app-logs.service.js +1 -1
- package/assetPropertyWidget/main.controller.js +1 -1
- package/assetTable/assetTable2/assets.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/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/binary.js +1 -1
- package/core/core/services/dynamicGroups.js +1 -1
- package/core/core/services/events.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/license.js +1 -1
- package/core/core/services/permissions.js +1 -1
- package/core/core/services/realtime.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/userGroup.js +1 -1
- package/core/core/services/util.js +1 -1
- package/core/sdk/directives/repeat.js +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/csvExporter/csvExporter.controller.js +1 -1
- package/core/ui/directives/alarmList.js +1 -1
- package/core/ui/directives/auditList.js +1 -1
- package/core/ui/directives/binaryInput.js +1 -1
- package/core/ui/directives/binaryOut.js +1 -1
- package/core/ui/directives/interval.js +1 -1
- package/core/ui/directives/map.js +1 -1
- package/core/ui/directives/map2.js +1 -1
- package/core/ui/directives/sunburstChart.js +1 -1
- package/core/ui/directives/textOut.js +1 -1
- package/core/ui/forms/uib-dropdown.decorator.js +1 -1
- package/core/ui/header/action-bar.service.js +1 -1
- package/core/ui/properties/lastDeviceMessage.computedProperty.js +1 -1
- package/core/ui/properties/propertiesLibrary.service.js +1 -1
- package/core/ui/providers/httpCache.js +1 -1
- package/core/ui/providers/views.js +1 -1
- package/core/ui/providers/zip.js +1 -1
- package/core/ui/sanitize-html/sanitize-html.service.js +1 -1
- package/core/ui/schemaForm/fileUpload.config.js +1 -1
- package/core/ui/schemaForm/overrides/decorators/decorators.decorator.js +1 -1
- package/core/ui/schemaForm/schemaForm.component.js +1 -1
- package/core/ui/services/deviceListColumns.js +1 -1
- package/core/ui/user/editUser.directive.html +1 -0
- package/core/ui/user/userPicker.html +6 -1
- package/dashboard2/dashboard.service.js +1 -1
- package/dataBroker/connectorsAlarms/connectorAlarms.component.js +1 -1
- package/dataPointExplorer/services/dataPoints.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/deviceControlRelay/relayControl/relayControl.directive.js +1 -1
- package/deviceDatabase4/detail/device-type-detail.component.js +1 -1
- package/deviceDatabase4/detail/message-id-configuration-description.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/parsers/device-type-parser-eds.service.js +1 -1
- package/deviceDatabase4/unique.directive.js +1 -1
- package/deviceSelector/controllers/deviceSelectorComboCtrl.js +1 -1
- package/devicemanagement-alarmList/controllers/alarmList.js +1 -1
- package/devicemanagement-availability/controllers/availability.js +1 -1
- package/devicemanagement-eventList/controllers/eventList.js +1 -1
- package/enterpriseEdition/createFile.js +1 -1
- package/enterpriseEdition/customBranding/brandingConfigurationUi.provider.js +1 -1
- package/enterpriseEdition/customBranding/brandingDeploy.service.js +1 -1
- package/export/services/api.js +1 -1
- package/generic-ui/generic-ui-inventory-property.component.js +1 -1
- package/groupsHierarchy/controllers/groupsListCtrl.js +1 -1
- package/groupsHierarchy/groupsHierarchyUi.provider.js +1 -1
- package/kpi/controllers/pieChart.js +1 -1
- package/measurements/directives/lineChart.js +1 -1
- package/measurements/fragmentChart/fragmentChart.component.js +1 -1
- package/measurements/measurements2/axisY.service.js +1 -1
- package/measurements/measurements2/chart.service.js +1 -1
- package/measurements/measurements2/series.service.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 +2 -2
- package/remoteAccess/remoteAccess.service.js +1 -1
- package/remoteAccess/remoteAccessSettings/remoteAccessSettings.component.js +1 -1
- package/rotation3dWidget/components/webscene.component.js +1 -1
- package/scada/mapping.directive.js +1 -1
- package/smartRules/directives/smartRuleParamInputKpi.js +1 -1
- package/smartRules/services/smartRuleTemplates.js +1 -1
- package/tenantApplications/views/index.html +1 -0
- package/tenantStatistics/tenant-statistics.component.js +1 -1
- package/tenants/controllers/detail.js +1 -1
- package/userRoles/inventoryRolesTab/inventoryRolesTab.component.js +1 -1
|
@@ -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 i};var i={},e=Object.prototype,l=e.hasOwnProperty,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=t.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a,i,u,c,o=t&&t.prototype instanceof p?t:p,s=Object.create(o.prototype),l=new x(n||[]);return s._invoke=(a=e,i=r,u=l,c="suspendedStart",function(e,t){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===e)throw t;return R()}for(u.method=e,u.arg=t;;){var r=u.delegate;if(r){var n=w(r,u);if(n){if(n===f)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===c)throw c="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c="executing";var o=d(a,i,u);if("normal"===o.type){if(c=u.done?"completed":"suspendedYield",o.arg===f)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c="completed",u.method="throw",u.arg=o.arg)}}),s}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}i.wrap=u;var f={};function p(){}function c(){}function s(){}var h={};a(h,o,function(){return this});var v=Object.getPrototypeOf,y=v&&v(v(E([])));y&&y!==e&&l.call(y,o)&&(h=y);var m=s.prototype=p.prototype=Object.create(h);function g(e){["next","throw","return"].forEach(function(t){a(e,t,function(e){return this._invoke(t,e)})})}function b(c,s){var t;this._invoke=function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var a=d(c[e],c,r);if("throw"!==a.type){var i=a.arg,u=i.value;return u&&"object"==_typeof(u)&&l.call(u,"__await")?s.resolve(u.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(u).then(function(e){i.value=e,n(i)},function(e){return t("throw",e,n,o)})}o(a.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=d(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function _(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 x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:R}}function R(){return{value:void 0,done:!0}}return a(m,"constructor",c.prototype=s),a(s,"constructor",c),c.displayName=a(s,n,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===c||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,a(e,n,"GeneratorFunction")),e.prototype=Object.create(m),e},i.awrap=function(e){return{__await:e}},g(b.prototype),a(b.prototype,r,function(){return this}),i.AsyncIterator=b,i.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var a=new b(u(e,t,r,n),o);return i.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},g(m),a(m,n,"Generator"),a(m,o,function(){return this}),a(m,"toString",function(){return"[object Generator]"}),i.keys=function(r){var n=[];for(var e in r)n.push(e);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}},i.values=E,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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 a.type="throw",a.arg=r,n.next=e,t&&(n.method="next",n.arg=void 0),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],a=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var i=l.call(o,"catchLoc"),u=l.call(o,"finallyLoc");if(i&&u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!u)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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},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),f},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),f}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},i}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,r[e])})}return t}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var o="c8yModbusDevice";function e(e,t,r,E){n.$inject=["c8yDeviceDatabase","c8yDeviceControl","gettextCatalog","c8yInventory","c8yDevices","c8yAlert","c8yBase","c8yUser","$q"];var R={label:E("Modbus"),fieldbusType:"modbus",serviceName:o};return e.getDeviceTypeProtocolProvider(R,n);function n(c,s,l,e,d,a,f,n,p){var t,r=c.ElementType,h=r.DISCRETE_IO,v=r.REGISTER,o=(_defineProperty(t={},h.value,"c8y_CoilStatus"),_defineProperty(t,v.value,"c8y_RegisterStatus"),t),i=_objectSpread({},R,{discreteOutputs:{functionalities:{showStatus:!0,updateStatus:!0}},discreteInputs:{functionalities:{showStatus:!0,updateStatus:!1}},holdingRegisters:{number:!0,startBit:{max:15},noBits:{max:64,base:16},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0,littleEndian:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:{number:!0,startBit:{max:15},noBits:{max:64,base:16},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0,littleEndian:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},options:{serverTime:!0},deviceFragments:["c8y_ModbusDevice"],deviceConfiguration:{fragment:"c8y_ModbusConfiguration",icon:"microchip"},versions:[{number:5,checks:[function(e){return _.some(e.c8y_Registers,function(e){return 16<e.noBits})},function(e){return _.some(e.c8y_Registers,function(e){return!_.isUndefined(e.littleEndian)})}]}]});return{registerFeaturesManifest:function(){c.registerFeaturesManifest(u().then(function(e){return e&&i}))},isAvailable:u,create:function(o,a){var i,u;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(y(o,a));case 2:return i=e.sent,e.t0=f,e.next=6,_regeneratorRuntime().awrap(d.createConfirm(i));case 6:return e.t1=e.sent,u=e.t0.getResData.call(e.t0,e.t1),e.next=10,_regeneratorRuntime().awrap(d.addChildDevice(o,u));case 10:return u.owner=o.owner,e.next=13,_regeneratorRuntime().awrap(d.save(u));case 13:return e.abrupt("return",s.create((t=o,r=a.deviceType,n=u,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_ModbusDevice:{id:n.id,name:n.name,address:n.c8y_ModbusDevice.address,ipAddress:n.c8y_ModbusDevice.ipAddress,type:"/inventory/managedObjects/".concat(r.id),protocol:n.c8y_ModbusDevice.protocol}})));case 14:case"end":return e.stop()}var t,r,n},null,null,null,Promise)},canUpdateElement:g,isElementChangePending:function(e){return e.changePending},getCurrentElementValue:m,getCurrentElementValueFormatted:function(e,t){var r=m(e,t);t.meta.enumType&&(r=t.meta.enumValues[r].label);return r},updateElement:function(t,r,n){var o,a,i,u;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:if(g(t,r))return e.next=3,_regeneratorRuntime().awrap(c.getDeviceTypeFromDevice(t));e.next=12;break;case 3:return o=e.sent,a=b(t,o,r,n),r.changePending=!0,i=w(r,n),e.next=9,_regeneratorRuntime().awrap(S(a,i));case 9:return(u=e.sent).status===s.status.SUCCESSFUL?(x(t,r,n),r.changePending=!1):u.status===s.status.FAILED&&(r.changePending=!1),e.abrupt("return",u);case 12:return e.abrupt("return",p.reject());case 13:case"end":return e.stop()}},null,null,null,Promise)},getAlertMessagesFns:w,sendOperationAndGetResult:S};function u(){return c.isFeatureFieldbus4Available()}function y(e,t){var r;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(n.current());case 2:return r=e.sent,e.abrupt("return",{name:t.name,type:t.deviceType.name,c8y_ModbusDevice:{address:t.address,ipAddress:t.ipAddress,type:"/inventory/managedObjects/".concat(t.deviceType.id),protocol:t.protocol},owner:r.id});case 4:case"end":return e.stop()}},null,null,null,Promise)}function m(e,t){var r=o[t.meta.type.value];return e&&e[r]&&parseFloat(e[r][t.name])}function g(e,t){var r=t.statusMapping;return!e.c8y_ModbusReadOnlyDevice&&r&&"write"===r.status}function b(e,t,r,n){var o=r.meta.type;return o===h?function(e,t,r){return{deviceId:e.id,description:'Change status of "'.concat(t.name,'" to "').concat(r.label,'".'),c8y_SetCoil:{address:e.c8y_ModbusDevice.address,input:t.input,coil:t.number,value:r.value}}}(e,r,n):o===v?function(e,t,r,n){var o=n.label||n.value,a=!n.label&&r.unit?" ".concat(r.unit):"",i={deviceId:e.id,description:'Change value of "'.concat(r.name,'" to ').concat(o).concat(a,"."),c8y_SetRegister:{}};"opcua"===t.fieldbusType?i.c8y_SetRegister={address:e.c8y_OPCUADevice.browsePath,register:r.browsePath,value:n.value}:i.c8y_SetRegister={ipAddress:_.get(e,"c8y_ModbusDevice.ipAddress",""),address:e.c8y_ModbusDevice.address,input:r.input,register:r.number,startBit:r.startBit,noBits:r.noBits,value:n.value};return i}(e,t,r,n):void 0}function w(e,t){var r,n,o,a,i=e.meta.type,u={name:e.name};i===h?(u.label=t.label,r=E("Status of {{name}} will be changed to {{label}}"),n=E("Status of {{name}} has been changed to {{label}}"),o=E("Failed to change status of {{name}} to {{label}}"),a=E('Failed to change status of {{name}} to {{label}} due to: "{{operation.failureReason | translate}}".')):i===v&&(u.value=t.label||t.value,u.unit=!t.label&&e.unit?" ".concat(e.unit):"",r=E("Value of {{name}} will be changed to {{value}}{{unit}}"),n=E("Value of {{name}} has been changed to {{value}}{{unit}}"),o=E("Failed to change value of {{name}} to {{value}}{{unit}}"),a=E('Failed to change value of {{name}} to {{value}}{{unit}} due to: "{{operation.failureReason | translate}}".'));var c=function(t){return function(e){return l.getString(t,_objectSpread({},u,{operation:e}))}};return{onCreated:c(r),onSuccess:c(n),onFailure:c(o),onFailureWithReason:c(a)}}function S(t,r){var n,o;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(s.createWithNotifications(t));case 2:return(n=e.sent).created.then(function(){r.onCreated?a.success(r.onCreated(t)):a.success(l.getString('"{{description | translate}}" will be executed.',t))}),e.next=6,_regeneratorRuntime().awrap(n.completed);case 6:return(o=e.sent).status===s.status.SUCCESSFUL?r.onSuccess?a.success(r.onSuccess(t)):a.success(l.getString('"{{description | translate}}" completed.',t)):o.status===s.status.FAILED&&(o.failureReason?r.onFailureWithReason?a.danger(r.onFailureWithReason(o)):a.danger(l.getString('"{{description | translate}}" failed due to: "{{failureReason | translate}}".',o)):r.onFailure?a.danger(r.onFailure(t)):a.danger(l.getString('"{{description | translate}}" failed.',t))),e.abrupt("return",o);case 9:case"end":return e.stop()}},null,null,null,Promise)}function x(e,t,r){var n=t.meta.type;n===h?_.set(e,["c8y_CoilStatus",t.name],r.value):n===v&&_.set(e,["c8y_RegisterStatus",t.name],r.value)}}}angular.module("c8y.modbus").provider(o,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 a={},e=Object.prototype,l=e.hasOwnProperty,u=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new E(n||[]);return u(i,"_invoke",{value:function(i,a,u){var c="suspendedStart";return function(e,t){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===e)throw t;return L()}for(u.method=e,u.arg=t;;){var r=u.delegate;if(r){var n=w(r,u);if(n){if(n===s)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===c)throw c="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c="executing";var o=f(i,a,u);if("normal"===o.type){if(c=u.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c="completed",u.method="throw",u.arg=o.arg)}}}(e,r,a)}),i}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 s={};function d(){}function p(){}function v(){}var y={};i(y,o,function(){return this});var h=Object.getPrototypeOf,m=h&&h(h(P([])));m&&m!==e&&l.call(m,o)&&(y=m);var g=v.prototype=d.prototype=Object.create(y);function b(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function _(c,s){var t;u(this,"_invoke",{value:function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=f(c[e],c,r);if("throw"!==i.type){var a=i.arg,u=a.value;return u&&"object"==_typeof(u)&&l.call(u,"__await")?s.resolve(u.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(u).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function w(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,s;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function S(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 x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:L}}function L(){return{value:void 0,done:!0}}return u(g,"constructor",{value:p.prototype=v,configurable:!0}),u(v,"constructor",{value:p,configurable:!0}),p.displayName=i(v,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,i(e,n,"GeneratorFunction")),e.prototype=Object.create(g),e},a.awrap=function(e){return{__await:e}},b(_.prototype),i(_.prototype,r,function(){return this}),a.AsyncIterator=_,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new _(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},b(g),i(g,n,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(e){var r=Object(e),n=[];for(var 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=P,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=l.call(o,"catchLoc"),u=l.call(o,"finallyLoc");if(a&&u){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(!u)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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,s):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),s},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),x(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},a}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(u){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=u.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 _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,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){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var o="c8yModbusDevice";function e(e,t,r,O){n.$inject=["c8yDeviceDatabase","c8yDeviceControl","gettextCatalog","c8yInventory","c8yDevices","c8yAlert","c8yBase","c8yUser","$q"];var j={label:O("Modbus"),fieldbusType:"modbus",serviceName:o};return e.getDeviceTypeProtocolProvider(j,n);function n(c,s,l,e,f,i,d,o,p){var t,r=c.ElementType,v=r.DISCRETE_IO,y=r.REGISTER,n=(_defineProperty(t={},v.value,"c8y_CoilStatus"),_defineProperty(t,y.value,"c8y_RegisterStatus"),t),a=_objectSpread({},j,{discreteOutputs:{functionalities:{showStatus:!0,updateStatus:!0}},discreteInputs:{functionalities:{showStatus:!0,updateStatus:!1}},holdingRegisters:{number:!0,startBit:{max:15},noBits:{max:64,base:16},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0,littleEndian:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:{number:!0,startBit:{max:15},noBits:{max:64,base:16},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0,littleEndian:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},options:{serverTime:!0},deviceFragments:["c8y_ModbusDevice"],deviceConfiguration:{fragment:"c8y_ModbusConfiguration",icon:"microchip"},versions:[{number:5,checks:[function(e){return _.some(e.c8y_Registers,function(e){return 16<e.noBits})},function(e){return _.some(e.c8y_Registers,function(e){return!_.isUndefined(e.littleEndian)})}]}]});return{registerFeaturesManifest:function(){c.registerFeaturesManifest(u().then(function(e){return e&&a}))},isAvailable:u,create:function(e,t){return h.apply(this,arguments)},canUpdateElement:S,isElementChangePending:function(e){return e.changePending},getCurrentElementValue:b,getCurrentElementValueFormatted:function(e,t){var r=b(e,t);t.meta.enumType&&(r=t.meta.enumValues[r].label);return r},updateElement:function(e,t,r){return w.apply(this,arguments)},getAlertMessagesFns:E,sendOperationAndGetResult:P};function u(){return c.isFeatureFieldbus4Available()}function h(){return(h=_asyncToGenerator(_regeneratorRuntime().mark(function e(o,i){var a,u;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m(o,i);case 2:return a=e.sent,e.t0=d,e.next=6,f.createConfirm(a);case 6:return e.t1=e.sent,u=e.t0.getResData.call(e.t0,e.t1),e.next=10,f.addChildDevice(o,u);case 10:return u.owner=o.owner,e.next=13,f.save(u);case 13:return e.abrupt("return",s.create((t=o,r=i.deviceType,n=u,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_ModbusDevice:{id:n.id,name:n.name,address:n.c8y_ModbusDevice.address,ipAddress:n.c8y_ModbusDevice.ipAddress,type:"/inventory/managedObjects/".concat(r.id),protocol:n.c8y_ModbusDevice.protocol}})));case 14:case"end":return e.stop()}var t,r,n},e)}))).apply(this,arguments)}function m(e,t){return g.apply(this,arguments)}function g(){return(g=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.current();case 2:return n=e.sent,e.abrupt("return",{name:r.name,type:r.deviceType.name,c8y_ModbusDevice:{address:r.address,ipAddress:r.ipAddress,type:"/inventory/managedObjects/".concat(r.deviceType.id),protocol:r.protocol},owner:n.id});case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function b(e,t){var r=n[t.meta.type.value];return e&&e[r]&&parseFloat(e[r][t.name])}function w(){return(w=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r,n){var o,i,a,u;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(S(t,r))return e.next=3,c.getDeviceTypeFromDevice(t);e.next=12;break;case 3:return o=e.sent,i=x(t,o,r,n),r.changePending=!0,a=E(r,n),e.next=9,P(i,a);case 9:return(u=e.sent).status===s.status.SUCCESSFUL?(R(t,r,n),r.changePending=!1):u.status===s.status.FAILED&&(r.changePending=!1),e.abrupt("return",u);case 12:return e.abrupt("return",p.reject());case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function S(e,t){var r=t.statusMapping;return!e.c8y_ModbusReadOnlyDevice&&r&&"write"===r.status}function x(e,t,r,n){var o=r.meta.type;return o===v?function(e,t,r){return{deviceId:e.id,description:'Change status of "'.concat(t.name,'" to "').concat(r.label,'".'),c8y_SetCoil:{address:e.c8y_ModbusDevice.address,input:t.input,coil:t.number,value:r.value}}}(e,r,n):o===y?function(e,t,r,n){var o=n.label||n.value,i=!n.label&&r.unit?" ".concat(r.unit):"",a={deviceId:e.id,description:'Change value of "'.concat(r.name,'" to ').concat(o).concat(i,"."),c8y_SetRegister:{}};"opcua"===t.fieldbusType?a.c8y_SetRegister={address:e.c8y_OPCUADevice.browsePath,register:r.browsePath,value:n.value}:a.c8y_SetRegister={ipAddress:_.get(e,"c8y_ModbusDevice.ipAddress",""),address:e.c8y_ModbusDevice.address,input:r.input,register:r.number,startBit:r.startBit,noBits:r.noBits,value:n.value};return a}(e,t,r,n):void 0}function E(e,t){var r,n,o,i,a=e.meta.type,u={name:e.name};a===v?(u.label=t.label,r=O("Status of {{name}} will be changed to {{label}}"),n=O("Status of {{name}} has been changed to {{label}}"),o=O("Failed to change status of {{name}} to {{label}}"),i=O('Failed to change status of {{name}} to {{label}} due to: "{{operation.failureReason | translate}}".')):a===y&&(u.value=t.label||t.value,u.unit=!t.label&&e.unit?" ".concat(e.unit):"",r=O("Value of {{name}} will be changed to {{value}}{{unit}}"),n=O("Value of {{name}} has been changed to {{value}}{{unit}}"),o=O("Failed to change value of {{name}} to {{value}}{{unit}}"),i=O('Failed to change value of {{name}} to {{value}}{{unit}} due to: "{{operation.failureReason | translate}}".'));var c=function(t){return function(e){return l.getString(t,_objectSpread({},u,{operation:e}))}};return{onCreated:c(r),onSuccess:c(n),onFailure:c(o),onFailureWithReason:c(i)}}function P(e,t){return L.apply(this,arguments)}function L(){return(L=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n,o;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.createWithNotifications(t);case 2:return(n=e.sent).created.then(function(){r.onCreated?i.success(r.onCreated(t)):i.success(l.getString('"{{description | translate}}" will be executed.',t))}),e.next=6,n.completed;case 6:return(o=e.sent).status===s.status.SUCCESSFUL?r.onSuccess?i.success(r.onSuccess(t)):i.success(l.getString('"{{description | translate}}" completed.',t)):o.status===s.status.FAILED&&(o.failureReason?r.onFailureWithReason?i.danger(r.onFailureWithReason(o)):i.danger(l.getString('"{{description | translate}}" failed due to: "{{failureReason | translate}}".',o)):r.onFailure?i.danger(r.onFailure(t)):i.danger(l.getString('"{{description | translate}}" failed.',t))),e.abrupt("return",o);case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function R(e,t,r){var n=t.meta.type;n===v?_.set(e,["c8y_CoilStatus",t.name],r.value):n===y&&_.set(e,["c8y_RegisterStatus",t.name],r.value)}}}angular.module("c8y.modbus").provider(o,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 a={},e=Object.prototype,l=e.hasOwnProperty,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i,a,c,u,o=t&&t.prototype instanceof p?t:p,s=Object.create(o.prototype),l=new x(n||[]);return s._invoke=(i=e,a=r,c=l,u="suspendedStart",function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return L()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=w(r,c);if(n){if(n===h)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=f(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===h)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}),s}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 h={};function p(){}function u(){}function s(){}var y={};i(y,o,function(){return this});var d=Object.getPrototypeOf,v=d&&d(d(P([])));v&&v!==e&&l.call(v,o)&&(y=v);var m=s.prototype=p.prototype=Object.create(y);function g(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function b(u,s){var t;this._invoke=function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=f(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function _(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 O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:L}}function L(){return{value:void 0,done:!0}}return i(m,"constructor",u.prototype=s),i(s,"constructor",u),u.displayName=i(s,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===u||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,i(e,n,"GeneratorFunction")),e.prototype=Object.create(m),e},a.awrap=function(e){return{__await:e}},g(b.prototype),i(b.prototype,r,function(){return this}),a.AsyncIterator=b,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new b(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},g(m),i(m,n,"Generator"),i(m,o,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),a.keys=function(r){var n=[];for(var e in r)n.push(e);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=P,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=l.call(o,"catchLoc"),c=l.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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):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),h},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),O(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},a}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,r[e])})}return t}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","gettext"];var r="c8yOPCUADevice";function e(e,a){t.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yDevices","c8yBase","c8yUser","c8yTenant","$q"];var c={label:a("OPC UA legacy"),fieldbusType:"opcua",serviceName:r};return e.getDeviceTypeProtocolProvider(c,t);function t(t,u,s,l,n,r,o){var i=_objectSpread({},c,{options:!1,discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:a("Variables"),noRegistersDefinedMessage:a("No variables defined."),elementTypeLabel:a("Variable"),newRegisterModalTitle:a("New variable"),editRegisterModalTitle:a('Edit variable: "{{name}}"'),addRegisterButtonLabel:a("Add variable"),validation:{invalidName:a("Name must be unique among variables."),invalidMeasurement:a("Selected measurement type and series are already used by another variable.")},browsePath:!0,nodeType:!0,attributeType:!0,multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:!1,deviceFragments:["c8y_OPCUADevice","c8y_OPCUAGateway"],deviceConfiguration:{fragment:"c8y_OPCUAGateway",icon:"cogs"}});return{registerFeaturesManifest:function(){t.registerFeaturesManifest(function(){var e={isFeatureFieldbus4Subscribed:t.isFeatureFieldbus4Available(),isOpcuaLegacySubscribed:r.isSubscribed({name:"feature-opcua-legacy"})};return o.all(e).then(function(e){return e.isFeatureFieldbus4Subscribed&&e.isOpcuaLegacySubscribed})}().then(function(e){return e&&i}))},create:function(o,i){var a,c;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(f(o,i));case 2:return a=e.sent,e.t0=l,e.next=6,_regeneratorRuntime().awrap(s.createConfirm(a));case 6:return e.t1=e.sent,c=e.t0.getResData.call(e.t0,e.t1),e.next=10,_regeneratorRuntime().awrap(s.addChildDevice(o,c));case 10:return c.owner=o.owner,e.next=13,_regeneratorRuntime().awrap(s.save(c));case 13:return e.abrupt("return",u.create((t=o,r=i.deviceType,n=c,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_OPCUADevice:{id:n.id,name:n.name,browsePath:n.c8y_OPCUADevice.browsePath,type:"/inventory/managedObjects/".concat(r.id)}})));case 14:case"end":return e.stop()}var t,r,n},null,null,null,Promise)},isOpcua:function(e){return!!(e||{}).c8y_OPCUADevice}};function f(e,t){var r;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(n.current());case 2:return r=e.sent,e.abrupt("return",{name:t.name,type:t.deviceType.name,c8y_OPCUADevice:{browsePath:t.directoryPath,type:"/inventory/managedObjects/".concat(t.deviceType.id)},owner:r.id});case 4:case"end":return e.stop()}},null,null,null,Promise)}}}angular.module("c8y.opcua").provider(r,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 a={},e=Object.prototype,l=e.hasOwnProperty,c=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new x(n||[]);return c(i,"_invoke",{value:function(i,a,c){var u="suspendedStart";return function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return S()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=_(r,c);if(n){if(n===s)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=f(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}}(e,r,a)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=u;var s={};function p(){}function y(){}function h(){}var d={};i(d,o,function(){return this});var v=Object.getPrototypeOf,m=v&&v(v(L([])));m&&m!==e&&l.call(m,o)&&(d=m);var g=h.prototype=p.prototype=Object.create(d);function b(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function w(u,s){var t;c(this,"_invoke",{value:function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=f(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function _(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,s;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function P(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 O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:S}}function S(){return{value:void 0,done:!0}}return c(g,"constructor",{value:y.prototype=h,configurable:!0}),c(h,"constructor",{value:y,configurable:!0}),y.displayName=i(h,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,i(e,n,"GeneratorFunction")),e.prototype=Object.create(g),e},a.awrap=function(e){return{__await:e}},b(w.prototype),i(w.prototype,r,function(){return this}),a.AsyncIterator=w,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new w(u(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},b(g),i(g,n,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(e){var r=Object(e),n=[];for(var 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=L,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=l.call(o,"catchLoc"),c=l.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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,s):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),s},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),O(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},a}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 _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,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){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","gettext"];var r="c8yOPCUADevice";function e(e,p){t.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yDevices","c8yBase","c8yUser","c8yTenant","$q"];var y={label:p("OPC UA legacy"),fieldbusType:"opcua",serviceName:r};return e.getDeviceTypeProtocolProvider(y,t);function t(t,u,s,l,o,r,n){var i=_objectSpread({},y,{options:!1,discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:p("Variables"),noRegistersDefinedMessage:p("No variables defined."),elementTypeLabel:p("Variable"),newRegisterModalTitle:p("New variable"),editRegisterModalTitle:p('Edit variable: "{{name}}"'),addRegisterButtonLabel:p("Add variable"),validation:{invalidName:p("Name must be unique among variables."),invalidMeasurement:p("Selected measurement type and series are already used by another variable.")},browsePath:!0,nodeType:!0,attributeType:!0,multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0},functionalities:{showStatus:!0,updateStatus:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:!1,deviceFragments:["c8y_OPCUADevice","c8y_OPCUAGateway"],deviceConfiguration:{fragment:"c8y_OPCUAGateway",icon:"cogs"}});return{registerFeaturesManifest:function(){t.registerFeaturesManifest(function(){var e={isFeatureFieldbus4Subscribed:t.isFeatureFieldbus4Available(),isOpcuaLegacySubscribed:r.isSubscribed({name:"feature-opcua-legacy"})};return n.all(e).then(function(e){return e.isFeatureFieldbus4Subscribed&&e.isOpcuaLegacySubscribed})}().then(function(e){return e&&i}))},create:function(e,t){return a.apply(this,arguments)},isOpcua:function(e){return!!(e||{}).c8y_OPCUADevice}};function a(){return(a=_asyncToGenerator(_regeneratorRuntime().mark(function e(o,i){var a,c;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f(o,i);case 2:return a=e.sent,e.t0=l,e.next=6,s.createConfirm(a);case 6:return e.t1=e.sent,c=e.t0.getResData.call(e.t0,e.t1),e.next=10,s.addChildDevice(o,c);case 10:return c.owner=o.owner,e.next=13,s.save(c);case 13:return e.abrupt("return",u.create((t=o,r=i.deviceType,n=c,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_OPCUADevice:{id:n.id,name:n.name,browsePath:n.c8y_OPCUADevice.browsePath,type:"/inventory/managedObjects/".concat(r.id)}})));case 14:case"end":return e.stop()}var t,r,n},e)}))).apply(this,arguments)}function f(e,t){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.current();case 2:return n=e.sent,e.abrupt("return",{name:r.name,type:r.deviceType.name,c8y_OPCUADevice:{browsePath:r.directoryPath,type:"/inventory/managedObjects/".concat(r.deviceType.id)},owner:n.id});case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}}}angular.module("c8y.opcua").provider(r,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 a={},e=Object.prototype,l=e.hasOwnProperty,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i,a,c,u,o=t&&t.prototype instanceof p?t:p,s=Object.create(o.prototype),l=new P(n||[]);return s._invoke=(i=e,a=r,c=l,u="suspendedStart",function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return E()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=w(r,c);if(n){if(n===d)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=f(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===d)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}),s}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 d={};function p(){}function u(){}function s(){}var h={};i(h,o,function(){return this});var y=Object.getPrototypeOf,v=y&&y(y(L([])));v&&v!==e&&l.call(v,o)&&(h=v);var g=s.prototype=p.prototype=Object.create(h);function m(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function b(u,s){var t;this._invoke=function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=f(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=f(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function _(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 x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:E}}function E(){return{value:void 0,done:!0}}return i(g,"constructor",u.prototype=s),i(s,"constructor",u),u.displayName=i(s,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===u||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,i(e,n,"GeneratorFunction")),e.prototype=Object.create(g),e},a.awrap=function(e){return{__await:e}},m(b.prototype),i(b.prototype,r,function(){return this}),a.AsyncIterator=b,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new b(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},m(g),i(g,n,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(r){var n=[];for(var e in r)n.push(e);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=L,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=l.call(o,"catchLoc"),c=l.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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=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),x(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},a}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,r[e])})}return t}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var i="c8yProfibusDevice";function e(e,t,r,o){n.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yModbusDevice","gettextCatalog","c8yDevices","c8yBase","c8yUser","$q"];var a={label:o("Profibus"),fieldbusType:"profibus",serviceName:i};return e.getDeviceTypeProtocolProvider(a,n);function n(e,p,h,t,u,s,i,y){var r=_objectSpread({},a,{discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:o("Registers"),noRegistersDefinedMessage:o("No registers defined."),elementTypeLabel:o("Register"),newRegisterModalTitle:o("New register"),editRegisterModalTitle:o('Edit register: "{{name}}"'),addRegisterButtonLabel:o("Add register"),validation:{invalidName:o("Name must be unique among registers."),invalidMeasurement:o("Selected measurement type and series are already used by another register.")},number:!0,startBit:{max:63},noBits:{max:64},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0},functionalities:{readWriteMutex:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:!1,options:{serverTime:!0},deviceFragments:["c8y_ProfibusDevice"],deviceConfiguration:{fragment:"c8y_ProfibusConfiguration",icon:"bios"}});return{registerFeaturesManifest:function(){e.registerFeaturesManifest(n().then(function(e){return e&&r}))},updateElement:function(c,u,s){var l,f,d;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:if(h.canUpdateElement(c,u))return void 0,r=(t={device:c,register:u,valueMap:s}).device,n=t.register,o=t.valueMap,i=o.label||o.value,a=!o.label&&n.unit?" ".concat(n.unit):"",l={deviceId:r.id,description:'Change value of "'.concat(n.name,'" to ').concat(i).concat(a,"."),c8y_SetRegister:{address:r.c8y_RegisterStatus.ProfibusSlave_Address,register:n.number,startBit:n.startBit,noBits:n.noBits,value:o.value}},u.changePending=!0,f=h.getAlertMessagesFns(u,s),e.next=6,_regeneratorRuntime().awrap(h.sendOperationAndGetResult(l,f));e.next=9;break;case 6:return(d=e.sent).status===p.status.SUCCESSFUL?(_.set(c,["c8y_RegisterStatus",u.name],s.value),u.changePending=!1):d.status===p.status.FAILED&&(u.changePending=!1),e.abrupt("return",d);case 9:return e.abrupt("return",y.reject());case 10:case"end":return e.stop()}var t,r,n,o,i,a},null,null,null,Promise)},isAvailable:n,create:function(o,i){var a,c;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(l(i));case 2:return a=e.sent,e.t0=s,e.next=6,_regeneratorRuntime().awrap(u.createConfirm(a));case 6:return e.t1=e.sent,c=e.t0.getResData.call(e.t0,e.t1),e.next=10,_regeneratorRuntime().awrap(u.addChildDevice(o,c));case 10:return c.owner=o.owner,e.next=13,_regeneratorRuntime().awrap(u.save(c));case 13:return e.abrupt("return",p.create((t=o,r=c,n=i.deviceType,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_ProfibusDevice:{id:r.id,name:r.name,type:"/inventory/managedObjects/".concat(n.id)}})));case 14:case"end":return e.stop()}var t,r,n},null,null,null,Promise)}};function n(){return e.isFeatureFieldbus4Available()}function l(t){var r,n,o;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,n=t.deviceType,e.next=3,_regeneratorRuntime().awrap(i.current());case 3:return o=e.sent,e.abrupt("return",{name:r,type:n.name,c8y_ProfibusDevice:{type:"/inventory/managedObjects/".concat(n.id)},owner:o.id});case 5:case"end":return e.stop()}},null,null,null,Promise)}}}angular.module("c8y.profibus").provider(i,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 a={},e=Object.prototype,l=e.hasOwnProperty,c=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new L(n||[]);return c(i,"_invoke",{value:function(i,a,c){var u="suspendedStart";return function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return S()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=_(r,c);if(n){if(n===s)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=f(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}}(e,r,a)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=u;var s={};function p(){}function d(){}function y(){}var v={};i(v,o,function(){return this});var h=Object.getPrototypeOf,g=h&&h(h(E([])));g&&g!==e&&l.call(g,o)&&(v=g);var m=y.prototype=p.prototype=Object.create(v);function b(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function w(u,s){var t;c(this,"_invoke",{value:function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=f(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function _(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,s;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function x(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:S}}function S(){return{value:void 0,done:!0}}return c(m,"constructor",{value:d.prototype=y,configurable:!0}),c(y,"constructor",{value:d,configurable:!0}),d.displayName=i(y,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,i(e,n,"GeneratorFunction")),e.prototype=Object.create(m),e},a.awrap=function(e){return{__await:e}},b(w.prototype),i(w.prototype,r,function(){return this}),a.AsyncIterator=w,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new w(u(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},b(m),i(m,n,"Generator"),i(m,o,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),a.keys=function(e){var r=Object(e),n=[];for(var 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=E,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=l.call(o,"catchLoc"),c=l.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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,s):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),s},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),P(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},a}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 _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,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){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var o="c8yProfibusDevice";function e(e,t,r,f){n.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yModbusDevice","gettextCatalog","c8yDevices","c8yBase","c8yUser","$q"];var p={label:f("Profibus"),fieldbusType:"profibus",serviceName:o};return e.getDeviceTypeProtocolProvider(p,n);function n(e,d,y,t,u,s,i,v){var r=_objectSpread({},p,{discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:f("Registers"),noRegistersDefinedMessage:f("No registers defined."),elementTypeLabel:f("Register"),newRegisterModalTitle:f("New register"),editRegisterModalTitle:f('Edit register: "{{name}}"'),addRegisterButtonLabel:f("Add register"),validation:{invalidName:f("Name must be unique among registers."),invalidMeasurement:f("Selected measurement type and series are already used by another register.")},number:!0,startBit:{max:63},noBits:{max:64},multiplier:{min:1,step:1},divisor:!0,decimalPlaces:!0,unit:!0,options:{signed:!0,enumType:!0},functionalities:{readWriteMutex:!0,sendMeasurement:!0,raiseAlarm:!0,sendEvent:!0}},inputRegisters:!1,options:{serverTime:!0},deviceFragments:["c8y_ProfibusDevice"],deviceConfiguration:{fragment:"c8y_ProfibusConfiguration",icon:"bios"}});return{registerFeaturesManifest:function(){e.registerFeaturesManifest(n().then(function(e){return e&&r}))},updateElement:function(e,t,r){return c.apply(this,arguments)},isAvailable:n,create:function(e,t){return o.apply(this,arguments)}};function n(){return e.isFeatureFieldbus4Available()}function o(){return(o=_asyncToGenerator(_regeneratorRuntime().mark(function e(o,i){var a,c;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l(i);case 2:return a=e.sent,e.t0=s,e.next=6,u.createConfirm(a);case 6:return e.t1=e.sent,c=e.t0.getResData.call(e.t0,e.t1),e.next=10,u.addChildDevice(o,c);case 10:return c.owner=o.owner,e.next=13,u.save(c);case 13:return e.abrupt("return",d.create((t=o,r=c,n=i.deviceType,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_ProfibusDevice:{id:r.id,name:r.name,type:"/inventory/managedObjects/".concat(n.id)}})));case 14:case"end":return e.stop()}var t,r,n},e)}))).apply(this,arguments)}function l(e){return a.apply(this,arguments)}function a(){return(a=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,n=t.deviceType,e.next=3,i.current();case 3:return o=e.sent,e.abrupt("return",{name:r,type:n.name,c8y_ProfibusDevice:{type:"/inventory/managedObjects/".concat(n.id)},owner:o.id});case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function c(){return(c=_asyncToGenerator(_regeneratorRuntime().mark(function e(c,u,s){var l,f,p;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(y.canUpdateElement(c,u))return void 0,r=(t={device:c,register:u,valueMap:s}).device,n=t.register,o=t.valueMap,i=o.label||o.value,a=!o.label&&n.unit?" ".concat(n.unit):"",l={deviceId:r.id,description:'Change value of "'.concat(n.name,'" to ').concat(i).concat(a,"."),c8y_SetRegister:{address:r.c8y_RegisterStatus.ProfibusSlave_Address,register:n.number,startBit:n.startBit,noBits:n.noBits,value:o.value}},u.changePending=!0,f=y.getAlertMessagesFns(u,s),e.next=6,y.sendOperationAndGetResult(l,f);e.next=9;break;case 6:return(p=e.sent).status===d.status.SUCCESSFUL?(_.set(c,["c8y_RegisterStatus",u.name],s.value),u.changePending=!1):p.status===d.status.FAILED&&(u.changePending=!1),e.abrupt("return",p);case 9:return e.abrupt("return",v.reject());case 10:case"end":return e.stop()}var t,r,n,o,i,a},e)}))).apply(this,arguments)}}}angular.module("c8y.profibus").provider(o,e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _objectSpread(t){for(var e=1;e<arguments.length;e++){var
|
|
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 _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&i.push.apply(i,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),i.forEach(function(e){_defineProperty(t,e,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){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);var i=r.call(e,t||"default");if("object"!==_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","c8yDeviceProtocolUiProvider","c8yViewsProvider","gettext"];var n="c8ySigfoxDevice";function e(e,t,r,a){i.$inject=["c8yDeviceDatabase","c8yTenant"];var s={label:a("Sigfox"),fieldbusType:"sigfox",serviceName:n};return e.getDeviceTypeProtocolProvider(s,i);function i(e,t){var r={name:"sigfox-agent"},i=[e.MessageIdSources.PAYLOAD],n=_objectSpread({},s,{type:"c8y_SigfoxDeviceType",configuration:{messageIdConfiguration:i},discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:a("Values"),noRegistersDefinedMessage:a("No values defined."),newRegisterModalTitle:a("New value"),editRegisterModalTitle:a('Edit value: "{{name}}"'),addRegisterButtonLabel:a("Add value"),validation:{invalidName:a("Name must be unique among values."),invalidMeasurement:a("Selected measurement type and series are already used by another value in the same message type.")},messageTypeId:{label:a("Message type ID")},startBit:!0,noBits:!0,multiplier:!0,offset:!0,decimalPlaces:!1,options:{signed:!0,bcd:!0,littleEndian:!0},functionalities:{showStatus:!1,updateStatus:!1,sendMeasurement:!0,raiseAlarm:{alarmStatus:!0},sendEvent:{fragmentType:!0,innerType:!0},sendManagedObjectUpdate:!0},unit:{requiredForSendMeasurement:!0}},inputRegisters:!1,options:!1});return{registerFeaturesManifest:function(){e.registerFeaturesManifest(o().then(function(e){return e&&n}))},isSubscribed:o};function o(){return t.isSubscribed(r)}}}angular.module("c8y.sigfox").provider(n,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 a={},e=Object.prototype,l=e.hasOwnProperty,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i,a,c,u,o=t&&t.prototype instanceof d?t:d,s=Object.create(o.prototype),l=new P(n||[]);return s._invoke=(i=e,a=r,c=l,u="suspendedStart",function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return x()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=w(r,c);if(n){if(n===p)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=f(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===p)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}),s}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={};function d(){}function u(){}function s(){}var h={};i(h,o,function(){return this});var v=Object.getPrototypeOf,y=v&&v(v(E([])));y&&y!==e&&l.call(y,o)&&(h=y);var m=s.prototype=d.prototype=Object.create(h);function g(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function b(u,s){var t;this._invoke=function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=f(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return p;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=f(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,p;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function _(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 P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:x}}function x(){return{value:void 0,done:!0}}return i(m,"constructor",u.prototype=s),i(s,"constructor",u),u.displayName=i(s,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===u||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,i(e,n,"GeneratorFunction")),e.prototype=Object.create(m),e},a.awrap=function(e){return{__await:e}},g(b.prototype),i(b.prototype,r,function(){return this}),a.AsyncIterator=b,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new b(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},g(m),i(m,n,"Generator"),i(m,o,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),a.keys=function(r){var n=[];for(var e in r)n.push(e);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=E,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=l.call(o,"catchLoc"),c=l.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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):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),p},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),p}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},a}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,r[e])})}return t}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","gettext"];var r="c8ySNMPDevice";function e(e,v){t.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yTenant","c8yDevices","c8yBase","c8yUser","$q"];var y={label:v("SNMP"),fieldbusType:"snmp",serviceName:r};return e.getDeviceTypeProtocolProvider(y,t);function t(t,u,r,s,l,o,n){var i={name:"snmp-mib-parser"},a=_objectSpread({},y,{options:!1,discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:v("Components"),noRegistersDefinedMessage:v("No components defined."),elementTypeLabel:v("Component"),newRegisterModalTitle:v("New component"),editRegisterModalTitle:v('Edit component: "{{name}}"'),addRegisterButtonLabel:v("Add component"),validation:{invalidName:v("Name must be unique among components.")},description:!0,oid:!0,functionalities:{raiseAlarm:!0,sendMeasurement:!0,sendEvent:!0}},deviceFragments:["c8y_SNMPDevice","c8y_SNMPGateway"],deviceConfiguration:{fragment:"c8y_SNMPGateway",icon:"cogs"}}),e=l.createEnum([{value:0,label:v("Version 1"),name:"VERSION_1"},{value:1,label:v("Version 2c"),name:"VERSION_2C"},{value:3,name:"VERSION_3",label:v("Version 3")}]),c=l.createEnum([{value:1,name:"NOAUTH_NOPRIV",label:v("NOAUTH_NOPRIV")},{value:2,name:"AUTH_NOPRIV",label:v("AUTH_NOPRIV")},{value:3,name:"AUTH_PRIV",label:v("AUTH_PRIV")}]),f=l.createEnum([{value:1,name:"MD5",label:v("MD5")},{value:2,name:"SHA",label:v("SHA")}]);return{registerFeaturesManifest:function(){t.registerFeaturesManifest(p().then(function(e){return e&&a}))},isSubscribed:p,create:function(o,i){var a,c;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(d(o,i));case 2:return a=e.sent,e.t0=l,e.next=6,_regeneratorRuntime().awrap(s.createConfirm(a));case 6:return e.t1=e.sent,c=e.t0.getResData.call(e.t0,e.t1),e.next=10,_regeneratorRuntime().awrap(s.addChildDevice(o,c));case 10:return c.owner=o.owner,e.next=13,_regeneratorRuntime().awrap(s.save(c));case 13:return e.abrupt("return",u.create((t=o,r=i.deviceType,n=c,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_SNMPDevice:h(r,n)})));case 14:case"end":return e.stop()}var t,r,n},null,null,null,Promise)},update:function(o,i){var a;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(d(o,i));case 2:return(a=e.sent).id=i.id,a.owner=o.owner,e.next=7,_regeneratorRuntime().awrap(s.update(a));case 7:return e.abrupt("return",u.create((t=o,r=i.deviceType,n=a,{deviceId:t.id,description:'Updated child device of "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_SNMPDevice:h(r,n)})));case 8:case"end":return e.stop()}var t,r,n},null,null,null,Promise)},isSNMP:function(e){return!!(e||{}).c8y_SNMPDevice},snmpVersions:e,snmpAuthPrivProtocols:l.createEnum([{value:1,name:"DES",label:v("DES")},{value:2,name:"AES128",label:v("AES128")},{value:3,name:"AES192",label:v("AES192")},{value:4,name:"AES256",label:v("AES256")}]),snmpAuthProtocols:f,snmpSecurityLevels:c};function p(){var e={isFeatureFieldbus4Available:t.isFeatureFieldbus4Available(),isSubscribed:r.isSubscribed(i)};return n.all(e).then(function(e){return e.isFeatureFieldbus4Available&&e.isSubscribed})}function d(e,r){var n;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(o.current());case 2:return n=e.sent,e.abrupt("return",{name:r.name,type:r.deviceType.name,c8y_SNMPDevice:{ipAddress:r.ipAddress,port:r.port,version:r.version,auth:(t=r.auth,_.pick(t,["username","privPassword","authPassword","authProtocol","privProtocol","securityLevel","engineId"])),type:"/inventory/managedObjects/".concat(r.deviceType.id)},owner:n.id});case 4:case"end":return e.stop()}var t},null,null,null,Promise)}function h(e,t){return{id:t.id,name:t.name,ipAddress:t.c8y_SNMPDevice.ipAddress,port:t.c8y_SNMPDevice.port,version:t.c8y_SNMPDevice.version,auth:t.c8y_SNMPDevice.auth,type:"/inventory/managedObjects/".concat(e.id)}}}}angular.module("c8y.snmp").provider(r,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 a={},e=Object.prototype,l=e.hasOwnProperty,c=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new E(n||[]);return c(i,"_invoke",{value:function(i,a,c){var u="suspendedStart";return function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return N()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=_(r,c);if(n){if(n===s)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=f(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}}(e,r,a)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=u;var s={};function p(){}function v(){}function d(){}var y={};i(y,o,function(){return this});var h=Object.getPrototypeOf,m=h&&h(h(x([])));m&&m!==e&&l.call(m,o)&&(y=m);var g=d.prototype=p.prototype=Object.create(y);function b(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function w(u,s){var t;c(this,"_invoke",{value:function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=f(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function _(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,s;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function S(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:N}}function N(){return{value:void 0,done:!0}}return c(g,"constructor",{value:v.prototype=d,configurable:!0}),c(d,"constructor",{value:v,configurable:!0}),v.displayName=i(d,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,n,"GeneratorFunction")),e.prototype=Object.create(g),e},a.awrap=function(e){return{__await:e}},b(w.prototype),i(w.prototype,r,function(){return this}),a.AsyncIterator=w,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new w(u(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},b(g),i(g,n,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(e){var r=Object(e),n=[];for(var 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=x,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=l.call(o,"catchLoc"),c=l.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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,s):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),s},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),P(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},a}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 _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,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){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){e.$inject=["c8yDeviceTypeProtocolBaseProvider","gettext"];var r="c8ySNMPDevice";function e(e,g){t.$inject=["c8yDeviceDatabase","c8yDeviceControl","c8yTenant","c8yDevices","c8yBase","c8yUser","$q"];var b={label:g("SNMP"),fieldbusType:"snmp",serviceName:r};return e.getDeviceTypeProtocolProvider(b,t);function t(t,u,r,s,l,o,n){var i={name:"snmp-mib-parser"},a=_objectSpread({},b,{options:!1,discreteOutputs:!1,discreteInputs:!1,holdingRegisters:{sectionTitle:g("Components"),noRegistersDefinedMessage:g("No components defined."),elementTypeLabel:g("Component"),newRegisterModalTitle:g("New component"),editRegisterModalTitle:g('Edit component: "{{name}}"'),addRegisterButtonLabel:g("Add component"),validation:{invalidName:g("Name must be unique among components.")},description:!0,oid:!0,functionalities:{raiseAlarm:!0,sendMeasurement:!0,sendEvent:!0}},deviceFragments:["c8y_SNMPDevice","c8y_SNMPGateway"],deviceConfiguration:{fragment:"c8y_SNMPGateway",icon:"cogs"}}),e=l.createEnum([{value:0,label:g("Version 1"),name:"VERSION_1"},{value:1,label:g("Version 2c"),name:"VERSION_2C"},{value:3,name:"VERSION_3",label:g("Version 3")}]),c=l.createEnum([{value:1,name:"NOAUTH_NOPRIV",label:g("NOAUTH_NOPRIV")},{value:2,name:"AUTH_NOPRIV",label:g("AUTH_NOPRIV")},{value:3,name:"AUTH_PRIV",label:g("AUTH_PRIV")}]),f=l.createEnum([{value:1,name:"MD5",label:g("MD5")},{value:2,name:"SHA",label:g("SHA")}]);return{registerFeaturesManifest:function(){t.registerFeaturesManifest(p().then(function(e){return e&&a}))},isSubscribed:p,create:function(e,t){return v.apply(this,arguments)},update:function(e,t){return d.apply(this,arguments)},isSNMP:function(e){return!!(e||{}).c8y_SNMPDevice},snmpVersions:e,snmpAuthPrivProtocols:l.createEnum([{value:1,name:"DES",label:g("DES")},{value:2,name:"AES128",label:g("AES128")},{value:3,name:"AES192",label:g("AES192")},{value:4,name:"AES256",label:g("AES256")}]),snmpAuthProtocols:f,snmpSecurityLevels:c};function p(){var e={isFeatureFieldbus4Available:t.isFeatureFieldbus4Available(),isSubscribed:r.isSubscribed(i)};return n.all(e).then(function(e){return e.isFeatureFieldbus4Available&&e.isSubscribed})}function v(){return(v=_asyncToGenerator(_regeneratorRuntime().mark(function e(o,i){var a,c;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y(o,i);case 2:return a=e.sent,e.t0=l,e.next=6,s.createConfirm(a);case 6:return e.t1=e.sent,c=e.t0.getResData.call(e.t0,e.t1),e.next=10,s.addChildDevice(o,c);case 10:return c.owner=o.owner,e.next=13,s.save(c);case 13:return e.abrupt("return",u.create((t=o,r=i.deviceType,n=c,{deviceId:t.id,description:'Added new child device to "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_SNMPDevice:m(r,n)})));case 14:case"end":return e.stop()}var t,r,n},e)}))).apply(this,arguments)}function d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark(function e(o,i){var a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y(o,i);case 2:return(a=e.sent).id=i.id,a.owner=o.owner,e.next=7,s.update(a);case 7:return e.abrupt("return",u.create((t=o,r=i.deviceType,n=a,{deviceId:t.id,description:'Updated child device of "'.concat(t.name,'" (ID: ').concat(t.id,")."),c8y_SNMPDevice:m(r,n)})));case 8:case"end":return e.stop()}var t,r,n},e)}))).apply(this,arguments)}function y(e,t){return h.apply(this,arguments)}function h(){return(h=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.current();case 2:return n=e.sent,e.abrupt("return",{name:r.name,type:r.deviceType.name,c8y_SNMPDevice:{ipAddress:r.ipAddress,port:r.port,version:r.version,auth:(t=r.auth,_.pick(t,["username","privPassword","authPassword","authProtocol","privProtocol","securityLevel","engineId"])),type:"/inventory/managedObjects/".concat(r.deviceType.id)},owner:n.id});case 4:case"end":return e.stop()}var t},e)}))).apply(this,arguments)}function m(e,t){return{id:t.id,name:t.name,ipAddress:t.c8y_SNMPDevice.ipAddress,port:t.c8y_SNMPDevice.port,version:t.c8y_SNMPDevice.version,auth:t.c8y_SNMPDevice.auth,type:"/inventory/managedObjects/".concat(e.id)}}}}angular.module("c8y.snmp").provider(r,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 a={},t=Object.prototype,s=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=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(t){i=function(t,e,r){return t[e]=r}}function
|
|
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 a={},t=Object.prototype,s=t.hasOwnProperty,c=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=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(t){i=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new E(n||[]);return c(i,"_invoke",{value:function(i,a,c){var u="suspendedStart";return function(t,e){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return j()}for(c.method=t,c.arg=e;;){var r=c.delegate;if(r){var n=x(r,c);if(n){if(n===l)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=f(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===l)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}}(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var l={};function h(){}function p(){}function y(){}var v={};i(v,o,function(){return this});var d=Object.getPrototypeOf,g=d&&d(d(S([])));g&&g!==t&&s.call(g,o)&&(v=g);var m=y.prototype=h.prototype=Object.create(v);function w(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function b(u,l){var e;c(this,"_invoke",{value:function(r,n){function t(){return new l(function(t,e){!function e(t,r,n,o){var i=f(u[t],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&s.call(c,"__await")?l.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):l.resolve(c).then(function(t){a.value=t,n(a)},function(t){return e("throw",t,n,o)})}o(i.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function x(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function L(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 _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function S(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(s.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:j}}function j(){return{value:void 0,done:!0}}return c(m,"constructor",{value:p.prototype=y,configurable:!0}),c(y,"constructor",{value:p,configurable:!0}),p.displayName=i(y,n,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,i(t,n,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},w(b.prototype),i(b.prototype,r,function(){return this}),a.AsyncIterator=b,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new b(u(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},w(m),i(m,n,"Generator"),i(m,o,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var r=Object(t),n=[];for(var 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=S,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},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=void 0),!!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 new 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}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):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),l},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),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},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(r,n,o,i,a){var c=this;function t(){return(t=_asyncToGenerator(_regeneratorRuntime().mark(function t(){var e;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r.importDeviceTypeWithUI();case 3:e=t.sent,i.success(a("New device protocol imported.")),c.onImported({importedProtocol:e}),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),u(t.t0);case 11:o.$apply();case 12:case"end":return t.stop()}},t,null,[[0,8]])}))).apply(this,arguments)}function u(t){if(_.isObjectLike(t)){var e=t.errorMessage;e?i.danger(n.getString('Could not import device protocol due to: "{{errorMessage | translate}}".',{errorMessage:e})):i.danger(a("Could not import device protocol."))}}_.assign(c,{importDeviceType:function(){return t.apply(this,arguments)}})}t.$inject=["c8yDeviceDatabase","gettextCatalog","$rootScope","c8yAlert","gettext"],angular.module("c8y.deviceProtocols").component("c8yDeviceProtocolImportButton",{bindings:{onImported:"&"},templateUrl:":::PLUGIN_PATH:::/device-protocol-import-button.html",controller:t,controllerAs:"vm"})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _slicedToArray(r,t){return _arrayWithHoles(r)||_iterableToArrayLimit(r,t)||_unsupportedIterableToArray(r,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(r,t){if(r){if("string"==typeof r)return _arrayLikeToArray(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(r,t):void 0}}function _arrayLikeToArray(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,o,a=[],
|
|
1
|
+
"use strict";function _slicedToArray(r,t){return _arrayWithHoles(r)||_iterableToArrayLimit(r,t)||_unsupportedIterableToArray(r,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(r,t){if(r){if("string"==typeof r)return _arrayLikeToArray(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(r,t):void 0}}function _arrayLikeToArray(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,o,l,a,i=[],u=!0,c=!1;try{if(l=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=l.call(e)).done)&&(i.push(n.value),i.length!==t);u=!0);}catch(r){c=!0,o=r}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return i}}function _arrayWithHoles(r){if(Array.isArray(r))return r}angular.module("c8y.deviceControl.relay").directive("c8yRelayControl",function(){return{restrict:"E",scope:{device:"&",suppressAlerts:"&",onSuccess:"&",onError:"&"},controller:"c8yRelayControlCtrl",controllerAs:"ctrl",templateUrl:":::PLUGIN_PATH:::/relayControl/relayControl.html",link:function(r,t,e,n){var o=t.find("input"),l=_slicedToArray(o,1),a=l[0];n.buttonChecked=function(){return a.checked}}}});
|
|
@@ -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 a={},e=Object.prototype,l=e.hasOwnProperty,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i,a,c,u,o=t&&t.prototype instanceof d?t:d,s=Object.create(o.prototype),l=new T(n||[]);return s._invoke=(i=e,a=r,c=l,u="suspendedStart",function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return E()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=_(r,c);if(n){if(n===f)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=p(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===f)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}),s}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=c;var f={};function d(){}function u(){}function s(){}var y={};i(y,o,function(){return this});var g=Object.getPrototypeOf,h=g&&g(g(R([])));h&&h!==e&&l.call(h,o)&&(y=h);var v=s.prototype=d.prototype=Object.create(y);function m(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function w(u,s){var t;this._invoke=function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=p(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}}function _(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=p(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function b(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 x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function R(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:E}}function E(){return{value:void 0,done:!0}}return i(v,"constructor",u.prototype=s),i(s,"constructor",u),u.displayName=i(s,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===u||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,i(e,n,"GeneratorFunction")),e.prototype=Object.create(v),e},a.awrap=function(e){return{__await:e}},m(w.prototype),i(w.prototype,r,function(){return this}),a.AsyncIterator=w,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new w(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},m(v),i(v,n,"Generator"),i(v,o,function(){return this}),i(v,"toString",function(){return"[object Generator]"}),a.keys=function(r){var n=[];for(var e in r)n.push(e);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=R,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=l.call(o,"catchLoc"),c=l.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&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),x(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},a}!function(){function e(a,e,n,o,i,c,t,u,s,l,p){var f=this,r=f.id,d=!0;function y(r){var n,o;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap((t=r,g()?c.getEmptyDeviceType():c.getDeviceType(t)));case 2:n=e.sent,o=n.fieldbusType,_.assign(f,{deviceType:n,formValue:{fieldbusType:o},features:_.find(f.deviceTypesFeatures,{fieldbusType:o})}),a.$apply();case 6:case"end":return e.stop()}var t},null,null,null,Promise)}function g(){return"new"===r}function h(){f.deviceType.name?t.changeTitle({title:f.deviceType.name},{skipTitleTranslation:!0}):t.changeTitle({title:l("New device type")})}function v(e){return x(e,c.addElementId(c.getEmptyDiscreteOutput()),f.deviceType.c8y_Coils)}function m(e){return x(e,c.addElementId(c.getEmptyDiscreteInput()),f.deviceType.c8y_Coils)}function w(e){return T(e,c.addElementId(c.getEmptyHoldingRegister(f.deviceType)),f.deviceType.c8y_Registers)}function b(e){return T(e,c.addElementId(c.getEmptyInputRegister()),f.deviceType.c8y_Registers)}function x(e,t,r){return R("DiscreteIO",e,t,r)}function T(e,t,r){return R("Register",e,t,r)}function R(t,r,n,o){var i;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_regeneratorRuntime().awrap(c["edit".concat(t,"WithUI")](r||n,f.deviceType));case 3:i=e.sent,E(r,o,i),I(),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),e.t0&&"escape key press"!==e.t0&&s.danger(e.t0);case 11:a.$apply();case 12:case"end":return e.stop()}},null,null,[[0,8]],Promise)}function E(e,t,r){(_.get(f.features,"holdingRegisters.number.useHex",!1)&&!r.number.startsWith("0x")&&(r.number="0x".concat(r.number)),e)?t[_.indexOf(t,e)]=r:t.push(r)}function D(t,r,n){return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_regeneratorRuntime().awrap(u({title:l("Delete item"),body:p.getString(n,t),labels:{ok:l("Delete")},status:"danger"}));case 3:i.removeFromList(r,t),I(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),e.t0&&s.danger(e.t0);case 10:a.$apply();case 11:case"end":return e.stop()}},null,null,[[0,7]],Promise)}function L(){var t,r;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_regeneratorRuntime().awrap(u({title:l("Confirm device type change?"),body:p.getString("By changing device type, all changes will be lost. Do you really want to proceed?")}));case 3:return c.removeAllElements(f.deviceType),I(),t=f.formValue.fieldbusType,f.deviceType.fieldbusType=t,e.abrupt("return",t);case 10:return e.prev=10,e.t0=e.catch(0),r=f.deviceType.fieldbusType,f.formValue.fieldbusType=r,e.abrupt("return",r);case 15:case"end":return e.stop()}},null,null,[[0,10]],Promise)}function I(){var e=f.deviceType;_.assign(f,{discreteOutputsCategorized:c.getDiscreteOutputsCategorized(e),discreteInputsCategorized:c.getDiscreteInputsCategorized(e),holdingRegistersCategorized:c.getHoldingRegistersCategorized(e),inputRegistersCategorized:c.getInputRegistersCategorized(e)})}_.assign(f,{$onInit:function(){return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(_regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(c.getFeaturesManifestsAsync());case 2:f.deviceTypesFeatures=e.sent,a.$apply();case 4:case"end":return e.stop()}},null,null,null,Promise));case 2:return e.next=4,_regeneratorRuntime().awrap(y(r));case 4:I(),h(),a.$apply();case 7:case"end":return e.stop()}},null,null,null,Promise)},isNew:g,isEmpty:_.isEmpty,editDiscreteOutput:v,editDiscreteInput:m,editHoldingRegister:w,editInputRegister:b,addDiscreteOutput:v,addDiscreteInput:m,addHoldingRegister:w,addInputRegister:b,removeDiscreteOutput:function(e){return D(e,f.deviceType.c8y_Coils,l('Do you really want to remove "{{name}}"?'))},removeDiscreteInput:function(e){return D(e,f.deviceType.c8y_Coils,l('Do you really want to remove "{{name}}"?'))},removeHoldingRegister:function(e){return D(e,f.deviceType.c8y_Registers,l('Do you really want to remove "{{name}}"?'))},removeInputRegister:function(e){return D(e,f.deviceType.c8y_Registers,l('Do you really want to remove "{{name}}"?'))},save:function(t){var r;return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return _.get(t,"c8y_MessageIdConfiguration.source")||(r=_.get(f.features.configuration,"messageIdConfiguration[0].value"),_.set(t,"c8y_MessageIdConfiguration.source",r)),e.prev=1,e.next=4,_regeneratorRuntime().awrap(c.save(t));case 4:s.success(l("Device type saved.")),d=!0,o.path("/deviceprotocols"),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),s.danger(e.t0.errorMessage);case 12:a.$apply();case 13:case"end":return e.stop()}},null,null,[[1,9]],Promise)},saveDisabled:function(){var e=f.deviceType;return _.get(f,"deviceTypeForm.$invalid")||!e||_.isEmpty(e.c8y_Coils)&&_.isEmpty(e.c8y_Registers)},changeDeviceType:function(){if(f.deviceType.fieldbusType)!function(){var t;_regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_regeneratorRuntime().awrap(L());case 2:t=e.sent,f.features=_.find(f.deviceTypesFeatures,{fieldbusType:t}),a.$apply();case 5:case"end":return e.stop()}},null,null,null,Promise)}();else{var e=f.formValue.fieldbusType;f.deviceType.fieldbusType=e,f.features=_.find(f.deviceTypesFeatures,{fieldbusType:e})}},messageIdSources:c.MessageIdSources,toggleMainEdit:function(){f.editingMain=!f.editingMain}}),e.$watch("vm.deviceType",function(e,t){t&&e!==t&&(d=!1)},!0),e.$on("$locationChangeStart",function(t,r){return _regeneratorRuntime().async(function(e){for(;;)switch(e.prev=e.next){case 0:if(d){e.next=13;break}return t.preventDefault(),e.prev=2,e.next=5,_regeneratorRuntime().awrap(u({title:l("Discard changes"),body:l("You are about to leave this page and discard the changes made. Do you want to proceed?"),status:"warning",labels:{ok:l("Discard")}}));case 5:d=!0,n.location.href=r,a.$apply(),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),e.t0&&s.danger(e.t0);case 13:case"end":return e.stop()}},null,null,[[2,10]],Promise)})}e.$inject=["$rootScope","$scope","$window","$location","c8yBase","c8yDeviceDatabase","c8yTitle","c8yModal","c8yAlert","gettext","gettextCatalog"],angular.module("c8y.deviceDatabase4").component("c8yDeviceTypeDetail",{templateUrl:":::PLUGIN_PATH:::/detail/device-type-detail.html",bindings:{id:"<"},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 a={},e=Object.prototype,p=e.hasOwnProperty,c=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=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(e){i=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof f?t:f,i=Object.create(o.prototype),a=new R(n||[]);return c(i,"_invoke",{value:function(i,a,c){var u="suspendedStart";return function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return D()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=b(r,c);if(n){if(n===s)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=l(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}}(e,r,a)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=u;var s={};function f(){}function y(){}function d(){}var h={};i(h,o,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(E([])));g&&g!==e&&p.call(g,o)&&(h=g);var m=d.prototype=f.prototype=Object.create(h);function w(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function _(u,s){var t;c(this,"_invoke",{value:function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=l(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&p.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function b(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=l(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,s;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function T(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 x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(p.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:D}}function D(){return{value:void 0,done:!0}}return c(m,"constructor",{value:y.prototype=d,configurable:!0}),c(d,"constructor",{value:y,configurable:!0}),y.displayName=i(d,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,n,"GeneratorFunction")),e.prototype=Object.create(m),e},a.awrap=function(e){return{__await:e}},w(_.prototype),i(_.prototype,r,function(){return this}),a.AsyncIterator=_,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new _(u(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},w(m),i(m,n,"Generator"),i(m,o,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),a.keys=function(e){var r=Object(e),n=[];for(var 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=E,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&p.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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=void 0),!!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=p.call(o,"catchLoc"),c=p.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&&p.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,s):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),s},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),x(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},a}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(a,e,n,o,i,c,t,u,s,p,l){var f=this,r=f.id,y=!0;function d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark(function e(){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:return e.next=4,g(r);case 4:F(),b(),a.$apply();case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function h(){return v.apply(this,arguments)}function v(){return(v=_asyncToGenerator(_regeneratorRuntime().mark(function e(){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.getFeaturesManifestsAsync();case 2:f.deviceTypesFeatures=e.sent,a.$apply();case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function g(e){return m.apply(this,arguments)}function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark(function e(r){var n,o;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t=r,w()?c.getEmptyDeviceType():c.getDeviceType(t);case 2:n=e.sent,o=n.fieldbusType,_.assign(f,{deviceType:n,formValue:{fieldbusType:o},features:_.find(f.deviceTypesFeatures,{fieldbusType:o})}),a.$apply();case 6:case"end":return e.stop()}var t},e)}))).apply(this,arguments)}function w(){return"new"===r}function b(){f.deviceType.name?t.changeTitle({title:f.deviceType.name},{skipTitleTranslation:!0}):t.changeTitle({title:p("New device type")})}function T(e){return D(e,c.addElementId(c.getEmptyDiscreteOutput()),f.deviceType.c8y_Coils)}function x(e){return D(e,c.addElementId(c.getEmptyDiscreteInput()),f.deviceType.c8y_Coils)}function R(e){return L(e,c.addElementId(c.getEmptyHoldingRegister(f.deviceType)),f.deviceType.c8y_Registers)}function E(e){return L(e,c.addElementId(c.getEmptyInputRegister()),f.deviceType.c8y_Registers)}function D(e,t,r){return I("DiscreteIO",e,t,r)}function L(e,t,r){return I("Register",e,t,r)}function I(e,t,r,n){return k.apply(this,arguments)}function k(){return(k=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r,n,o){var i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,c["edit".concat(t,"WithUI")](r||n,f.deviceType);case 3:i=e.sent,G(r,o,i),F(),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),e.t0&&"escape key press"!==e.t0&&s.danger(e.t0);case 11:a.$apply();case 12:case"end":return e.stop()}},e,null,[[0,8]])}))).apply(this,arguments)}function G(e,t,r){(_.get(f.features,"holdingRegisters.number.useHex",!1)&&!r.number.startsWith("0x")&&(r.number="0x".concat(r.number)),e)?t[_.indexOf(t,e)]=r:t.push(r)}function O(e,t,r){return S.apply(this,arguments)}function S(){return(S=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r,n){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,u({title:p("Delete item"),body:l.getString(n,t),labels:{ok:p("Delete")},status:"danger"});case 3:i.removeFromList(r,t),F(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),e.t0&&s.danger(e.t0);case 10:a.$apply();case 11:case"end":return e.stop()}},e,null,[[0,7]])}))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return _.get(t,"c8y_MessageIdConfiguration.source")||(r=_.get(f.features.configuration,"messageIdConfiguration[0].value"),_.set(t,"c8y_MessageIdConfiguration.source",r)),e.prev=1,e.next=4,c.save(t);case 4:s.success(p("Device type saved.")),y=!0,o.path("/deviceprotocols"),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),s.danger(e.t0.errorMessage);case 12:a.$apply();case 13:case"end":return e.stop()}},e,null,[[1,9]])}))).apply(this,arguments)}function $(){return j.apply(this,arguments)}function j(){return(j=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,u({title:p("Confirm device type change?"),body:l.getString("By changing device type, all changes will be lost. Do you really want to proceed?")});case 3:return c.removeAllElements(f.deviceType),F(),t=f.formValue.fieldbusType,f.deviceType.fieldbusType=t,e.abrupt("return",t);case 10:return e.prev=10,e.t0=e.catch(0),r=f.deviceType.fieldbusType,f.formValue.fieldbusType=r,e.abrupt("return",r);case 15:case"end":return e.stop()}},e,null,[[0,10]])}))).apply(this,arguments)}function F(){var e=f.deviceType;_.assign(f,{discreteOutputsCategorized:c.getDiscreteOutputsCategorized(e),discreteInputsCategorized:c.getDiscreteInputsCategorized(e),holdingRegistersCategorized:c.getHoldingRegistersCategorized(e),inputRegistersCategorized:c.getInputRegistersCategorized(e)})}_.assign(f,{$onInit:function(){return d.apply(this,arguments)},isNew:w,isEmpty:_.isEmpty,editDiscreteOutput:T,editDiscreteInput:x,editHoldingRegister:R,editInputRegister:E,addDiscreteOutput:T,addDiscreteInput:x,addHoldingRegister:R,addInputRegister:E,removeDiscreteOutput:function(e){return O(e,f.deviceType.c8y_Coils,p('Do you really want to remove "{{name}}"?'))},removeDiscreteInput:function(e){return O(e,f.deviceType.c8y_Coils,p('Do you really want to remove "{{name}}"?'))},removeHoldingRegister:function(e){return O(e,f.deviceType.c8y_Registers,p('Do you really want to remove "{{name}}"?'))},removeInputRegister:function(e){return O(e,f.deviceType.c8y_Registers,p('Do you really want to remove "{{name}}"?'))},save:function(e){return C.apply(this,arguments)},saveDisabled:function(){var e=f.deviceType;return _.get(f,"deviceTypeForm.$invalid")||!e||_.isEmpty(e.c8y_Coils)&&_.isEmpty(e.c8y_Registers)},changeDeviceType:function(){if(f.deviceType.fieldbusType)_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$();case 2:t=e.sent,f.features=_.find(f.deviceTypesFeatures,{fieldbusType:t}),a.$apply();case 5:case"end":return e.stop()}},e)}))();else{var e=f.formValue.fieldbusType;f.deviceType.fieldbusType=e,f.features=_.find(f.deviceTypesFeatures,{fieldbusType:e})}},messageIdSources:c.MessageIdSources,toggleMainEdit:function(){f.editingMain=!f.editingMain}}),e.$watch("vm.deviceType",function(e,t){t&&e!==t&&(y=!1)},!0),e.$on("$locationChangeStart",function(){var r=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(y){e.next=13;break}return t.preventDefault(),e.prev=2,e.next=5,u({title:p("Discard changes"),body:p("You are about to leave this page and discard the changes made. Do you want to proceed?"),status:"warning",labels:{ok:p("Discard")}});case 5:y=!0,n.location.href=r,a.$apply(),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),e.t0&&s.danger(e.t0);case 13:case"end":return e.stop()}},e,null,[[2,10]])}));return function(e,t){return r.apply(this,arguments)}}())}e.$inject=["$rootScope","$scope","$window","$location","c8yBase","c8yDeviceDatabase","c8yTitle","c8yModal","c8yAlert","gettext","gettextCatalog"],angular.module("c8y.deviceDatabase4").component("c8yDeviceTypeDetail",{templateUrl:":::PLUGIN_PATH:::/detail/device-type-detail.html",bindings:{id:"<"},controllerAs:"vm",controller:e})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}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 _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],
|
|
1
|
+
"use strict";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){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}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 _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(e,a){var o=this,i={BOTH:e("{{protocolName | translate}} devices can send messages of different types with different encodings per type.\n Depending on the device, the type can be determined by looking either\n at the FPort parameter of a message (<b>Source</b>: <i>FPort</i>)\n or at the subset of the message payload itself (<b>Source</b>: <i>Payload</i>).\n Indicate where the type information starts in the payload (<b>Start bit</b>)\n and how long this information is (<b>Number of bits</b>)."),FPORT:e("{{protocolName | translate}} devices can send messages of different types with different encodings per type.\n Type can be determined by looking at the FPort parameter of a message (<b>Source</b>: <i>FPort</i>)."),PAYLOAD:e("{{protocolName | translate}} devices can send messages of different types with different encodings per type.\n Type can be determined by looking at the subset of the message payload (<b>Source</b>: <i>Payload</i>).\n Indicate where the type information starts in the payload (<b>Start bit</b>)\n and how long this information is (<b>Number of bits</b>).")};_.assign(o,{$onChanges:function(e){if(e.featureLabel){var t=i.BOTH;if(1===_.get(o,"messageIdConfiguration.length")){var r=_slicedToArray(o.messageIdConfiguration,1),n=r[0];t=i[n.name]}o.description=a.getString(t,{protocolName:o.featureLabel})}},descriptionTemplates:i})}e.$inject=["gettext","gettextCatalog"],angular.module("c8y.deviceDatabase4").component("c8yMessageIdConfigurationDescription",{bindings:{featureLabel:"<",messageIdConfiguration:"<"},template:'\n <div ng-bind-html="vm.description">\n </div>\n ',controller:e,controllerAs:"vm"})}();
|