@c8y/ng1-modules 1018.497.8 → 1018.500.12

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.
Files changed (31) hide show
  1. package/NOTICES +1271 -2026
  2. package/administration-alarmMapping/index.js +1 -1
  3. package/app-status/app-instances/app-instances.html +1 -1
  4. package/app-status/app-tenant-subscriptions-list/app-tenant-subscriptions-list.html +21 -20
  5. package/core/core/services/dynamicGroups.js +1 -1
  6. package/core/locales/es.po +258 -36
  7. package/core/locales/fr.po +255 -33
  8. package/core/locales/ja_JP.po +255 -33
  9. package/core/locales/ko.po +270 -48
  10. package/core/locales/nl.po +255 -33
  11. package/core/locales/pl.po +257 -35
  12. package/core/locales/pt_BR.po +284 -62
  13. package/core/locales/zh_CN.po +255 -33
  14. package/core/locales/zh_TW.po +255 -33
  15. package/core/ui/configurable-device-list-columns/configurable-columns.service.js +1 -1
  16. package/core/ui/roles/roles-matrix.html +32 -12
  17. package/core/ui/schemaForm/schemaForm.component.js +1 -1
  18. package/device-protocol-modbus/modbus-device.provider.js +1 -1
  19. package/deviceDatabase4/modals/configure-discrete-io.component.js +1 -1
  20. package/deviceDatabase4/modals/configure-register.component.js +1 -1
  21. package/deviceStatusWidget/availability.html +4 -4
  22. package/deviceStatusWidget/deviceStatus.component.js +1 -1
  23. package/deviceStatusWidget/deviceStatus.html +39 -2
  24. package/deviceStatusWidget/requiredAvailabilityIntervalSetting.html +65 -25
  25. package/modbusConfiguration4/fieldbus-config.component.js +1 -1
  26. package/package.json +2 -2
  27. package/roles/detail/roleDetailGlobal.html +31 -16
  28. package/smartRules/controllers/list.js +1 -1
  29. package/smartRules/directives/smartRuleParamInputKpi.js +1 -1
  30. package/smartRules/views/list.html +1 -1
  31. package/tenantLicenses/index.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 _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var i;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o,a,s=[],u=!0,c=!1;try{if(o=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!==_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,r,t,i,o,a,n,s,u,c,d,l,y,f,p,v){var g,m=this,b=t.deviceId,A={types:[]},I={IS_REQUIRED:"required",ADDRESS_IN_USE:"address-in-use",ADDRESSES_IN_USE:"addresses-in-use",ADDRESS_INVALID:"address-invalid",POLLING_RATE_LARGER_THAN_TRANSMIT_RATE:"polling-rate-larger-than-transmit-rate",ONLY_NATURAL_NUMBERS_ALLOWED:"only-natural-numbers-allowed",IPADDRESS_INVALID_FORMAT:"ip",INVALID_URL:"invalid-url",NODE_IN_USE:"node-in-use",NODE_OUT_OF_RANGE:"node-out-of-range",IP_RANGE:"ip-range",PORT_INVALID:"port-invalid",IP_RANGE_MAXLIMIT:"ip-range-maxlimit",ENGINEID_IN_USE:"engineid-in-use",IS_MIN:"min"};_defineProperty(g={},I.IS_REQUIRED,p("This field is required.")),_defineProperty(g,I.ADDRESS_IN_USE,p("This address is already in use.")),_defineProperty(g,I.ADDRESSES_IN_USE,p("These addresses are already in use.")),_defineProperty(g,I.ADDRESS_INVALID,p("Addresses from 248 up to 254 are not allowed.")),_defineProperty(g,I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,p("Polling rate must be equal to or smaller than transmit rate.")),_defineProperty(g,I.ONLY_NATURAL_NUMBERS_ALLOWED,p("Only natural numbers allowed.")),_defineProperty(g,I.IPADDRESS_INVALID_FORMAT,p("The IP address format is invalid.")),_defineProperty(g,I.INVALID_URL,p("The URL format is invalid. The only supported protocols are http, https and opc.tcp.")),_defineProperty(g,I.NODE_IN_USE,p("This node id is already in use.")),_defineProperty(g,I.IP_RANGE,p("Invalid IP address range.")),_defineProperty(g,I.PORT_INVALID,p("Invalid port number.")),_defineProperty(g,I.IP_RANGE_MAXLIMIT,p("Max. 30 IP addresses in total allowed.")),_defineProperty(g,I.NODE_OUT_OF_RANGE,p("Only node ID(s) between 1 and 127 are allowed.")),_defineProperty(g,I.ENGINEID_IN_USE,p("This engine ID is already in use.")),_defineProperty(g,I.IS_MIN,p("Value cannot be lower than minimum."));function S(){var i=m.device,e={},t=(_.assign(m,{hasSerialConfigOperation:s.supportsOperation(i,"c8y_SerialConfiguration"),hasFieldBusConfigOperation:(t=i,O()&&s.supportsOperation(t,"c8y_CanConfiguration")||h()&&s.supportsOperation(t,"c8y_ModbusConfiguration")||L()&&s.supportsOperation(t,"c8y_OPCUAConfiguration")||M()&&s.supportsOperation(t,"c8y_ProfibusConfiguration")||U()&&s.supportsOperation(t,"c8y_CANopenConfiguration")||w()&&s.supportsOperation(t,"c8y_SNMPConfiguration")),serialConfiguration:_.get(i,"c8y_SerialConfiguration",{}),fieldbusConfiguration:function(e){var t={};e&&(h()?t=e.c8y_ModbusConfiguration:O()?t=e.c8y_CanConfiguration:L()?(e.c8y_OPCUAGateway&&(e.c8y_OPCUAGateway.transmitRate=e.c8y_OPCUAGateway.transmitRate||0,_.unset(e,"c8y_OPCUAGateway.userIdentityPassword")),t=e.c8y_OPCUAGateway):M()?(_.defaultsDeep(e,{c8y_ProfibusConfiguration:{baudRate:p("automatic")}}),t=e.c8y_ProfibusConfiguration):U()?t=e.c8y_CANopenConfiguration:w()&&(e.c8y_SNMPGateway&&(e.c8y_SNMPGateway.transmitRate=e.c8y_SNMPGateway.transmitRate||0,_.unset(e,"c8y_SNMPGateway.userIdentityPassword")),t=e.c8y_SNMPGateway));return t}(i)}),(w()||h())&&(e={pageSize:2e3}),m.tab);return d.getAvailableDeviceTypes({fieldbusType:t},e).then(function(e){var t=d.getFieldbusVersionFromDevice(i);_.set(m.fieldbusConfiguration,"maxFieldbusVersion",t),A.types=_.filter(e,function(e){return e.fieldbusVersion<=t})})}function P(){e={pageSize:1,fragmentType:"c8y_SnmpAutoDiscovery",status:"EXECUTING"},e=n.timeOrderFilter(e||{}),_.assign(e,_.pick(t,"deviceId")),e.revert=!0;var e;return a.list(e).then(D).then(T)}function D(e){var i,t,n=_slicedToArray(e,1)[0];return!!n&&(m.autoDiscoveryInProgress=!0,i=r.defer(),e="operation".concat(n.id),t="/operations/".concat(n.deviceId),l.getStatus(e,t)&&l.destroySubscription(e,t),l.addListener(e,t,"UPDATE",function(e,t){t.id===n.id&&(t.status===a.status.SUCCESSFUL||t.status===a.status.FAILED?i.resolve(t):i.notify(t))}),l.start(e,t),r.when({completed:i.promise}))}function N(){return s.childDevices(b).then(function(e){e=w()?_.orderBy(e,["name"],["asc"]):e;m.devices=_.map(e,function(e){var t,i,n,r,o,a;return h()&&e.c8y_ModbusDevice?(a=R({device:o=e,fieldbusDeviceFragment:"c8y_ModbusDevice"}),a={id:o.id,name:o.name,deviceType:_.get(a,"name"),address:o.c8y_ModbusDevice.address,ipAddress:o.c8y_ModbusDevice.ipAddress,protocol:o.c8y_ModbusDevice.protocol}):O()&&e.c8y_CanDevice?(r=R({device:o=e,fieldbusDeviceFragment:"c8y_CanDevice"}),a={id:o.id,name:o.name,deviceType:_.get(r,"name")}):L()&&e.c8y_OPCUADevice?(n=R({device:r=e,fieldbusDeviceFragment:"c8y_OPCUADevice"}),a={id:r.id,name:r.name,deviceType:_.get(n,"name"),directoryPath:r.c8y_OPCUADevice.browsePath}):M()&&e.c8y_ProfibusDevice?(i=R({device:n=e,fieldbusDeviceFragment:"c8y_ProfibusDevice"}),a={id:n.id,name:n.name,deviceType:_.get(i,"name")}):U()&&e.c8y_CANopenDevice?(t=R({device:i=e,fieldbusDeviceFragment:"c8y_CANopenDevice"}),a={id:i.id,name:i.name,deviceType:_.get(t,"name"),nodeId:i.c8y_CANopenDevice.nodeId}):w()&&e.c8y_SNMPDevice&&(e=R({device:t=e,fieldbusDeviceFragment:"c8y_SNMPDevice"}),a={id:t.id,name:t.name,deviceType:_.get(e,"name"),ipAddress:t.c8y_SNMPDevice.ipAddress,port:t.c8y_SNMPDevice.port,version:t.c8y_SNMPDevice.version,auth:_.get(t.c8y_SNMPDevice,"auth",{})}),a})})}function R(e){var t=e.device,i=e.fieldbusDeviceFragment;return _(A.types).find(function(e){e=e.id;return _.get(t,"".concat(i,".type"))==="/inventory/managedObjects/".concat(e)})}function C(){var e=m.fieldbusCommunicationForm;e.$setPristine(),e.$setUntouched()}function E(e){var t,e=e.split("-").map(function(e){return e.trim()}),i=f.validation.ip.pattern,n=f.validation.ipV6.pattern;if(2===e.length){var e=_slicedToArray(e,2),r=e[0],e=e[1],i=i.test(r)&&i.test(e),n=n.test(r)&&n.test(e);if(i||n)try{t=new o.Ip.Range(r,e)}catch(e){}}return t}function T(e){e.completed.then(function(e){e.status===a.status.SUCCESSFUL?(c.success(p("Autodiscovery completed.")),m.autoDiscoveryInProgress=!1):e.status===a.status.FAILED&&(e.failureReason?c.danger(v.getString('Autodiscovery failed due to: "{{ failureReason | translate }}".',e)):c.danger(p("Autodiscovery failed.")),m.autoDiscoveryInProgress=!1)},_.noop,function(){c.success(p("Autodiscovery in progress."))}).then(N)}function h(){return"modbus"===m.tab}function O(){return"canbus"===m.tab}function L(){return"opcua"===m.tab}function M(){return"profibus"===m.tab}function U(){return"canopen"===m.tab}function w(){return"snmp"===m.tab}_.assign(m,{$onInit:function(){s.detail(b).then(n.getResData).then(function(e){h()?_.defaults(e.c8y_SerialConfiguration,{baudRate:19200,dataBits:8,parity:"E",stopBits:1}):O()&&(m.serialConfigurationOptions.baudRates=[1e5,125e3,25e4,5e5,1e6]),m.device=e}).then(S).then(N).then(P)},shouldShowSerialPanel:function(){return h()&&_.get(m,"device.c8y_SerialConfiguration")},isModbusTab:h,isCanBusTab:O,isOPCUATab:L,isProfibusTab:M,isCanOpenTab:U,isSNMPTab:w,getFieldValidationHints:_.curryRight(n.validationHints)(g),serialConfigurationOptions:{baudRates:[110,300,600,1200,2400,4800,9600,14400,19200,38400,57600,115200,25e4,460800,5e5,921600,1e6],dataBits:[8],parities:["N","E","O"],stopBits:[1,2]},fieldbusConfigurationOptions:{baudRates:[{value:1e3,label:"1 Mbit/s"},{value:800,label:"800 kbit/s"},{value:500,label:"500 kbit/s"},{value:250,label:"250 kbit/s"},{value:125,label:"125 kbit/s"},{value:50,label:"50 kbit/s"},{value:20,label:"20 kbit/s"},{value:10,label:"10 kbit/s"}]},deviceConfigurationOptions:A,fieldErrors:I,fieldErrorsToMessages:g,saveSerialConfig:function(){!function(e){return a.create({deviceId:e.id,description:p("Set serial configuration"),c8y_SerialConfiguration:e.c8y_SerialConfiguration})}(m.device).then(function(){return c.success(p("Settings will be applied."))})},saveFieldbusConfig:function(){!function(e){var t=r.resolve();h()&&e.c8y_ModbusConfiguration?t=function(e){return a.create({deviceId:e.id,description:p("Set modbus configuration"),c8y_ModbusConfiguration:_.omit(e.c8y_ModbusConfiguration,["maxFieldbusVersion"])})}(e):O()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Bus configuration"),c8y_CanConfiguration:_.omit(e.c8y_CanConfiguration,["maxFieldbusVersion"])})}(e):L()?t=function(e){var t=e.c8y_OPCUAGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_OPCUAGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_OPCUAGateway"]))}(e):M()?t=function(e){return a.create({deviceId:e.id,description:p("Set Profibus configuration"),c8y_ProfibusConfiguration:_.pick(e.c8y_ProfibusConfiguration,["transmitRate","slaveAddress"])})}(e):U()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Open configuration"),c8y_CANopenConfiguration:_.omit(e.c8y_CANopenConfiguration,["maxFieldbusVersion"])})}(e):w()&&(t=function(e){var t=e.c8y_SNMPGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_SNMPGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_SNMPGateway"])).then(C)}(e));return t}(m.device).then(function(){return c.success(p("Settings will be applied."))})},invalid:function(e,t){(h()||L())&&!function(e){var e=m[e],t=e.pollingRate;{var i,n,r;t&&(e=e.transmitRate,n=i=!0,r=t.$modelValue<=e.$modelValue,L()&&0===e.$modelValue&&(r=!0),(!_.isInteger(e.$modelValue)||e.$modelValue<=0)&&(i=!1),(!_.isInteger(t.$modelValue)||t.$modelValue<=0)&&(n=!1),e.$setValidity(I.ONLY_NATURAL_NUMBERS_ALLOWED,i),e.$setValidity(I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r),t.$setValidity(I.ONLY_NATURAL_NUMBERS_ALLOWED,n),t.$setValidity(I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r))}}(e);L()&&!function(e){var e=m[e].OPCUAUrl,t=f.validation.opcuaBrowsePath.pattern,i=e.$modelValue;e.$setValidity(I.INVALID_URL,!i||t.test(i))}(e);w()&&!function(e){var e=m[e].ipRange,t=e.$modelValue;t&&(t=t.split(",").map(function(e){return e.trim()}),t=_.every(t,E),e.$setValidity(I.IP_RANGE,t),t)&&!function(e){var t=e.$modelValue,i=!0,n=!0,r=BigInt(30);{var o;t&&(o=BigInt(0),t=t.split(","),_.forEach(t,function(e){e=E(e);e||(i=!1),o+=BigInt(e.countIps())}),r<o||o<-r)&&(n=!1)}e.$setValidity(I.IP_RANGE,i),e.$setValidity(I.IP_RANGE_MAXLIMIT,n)}(e)}(e);return n.invalid(m,e,t)},reloadDevices:N,onClickDelete:function(e){u({title:p("Delete device"),body:v.getString('You are about to delete device "{{name}}". Do you want to proceed?',e),size:"sm",labels:{ok:p("Delete")},status:"danger"}).then(function(){return s.remove(e)}).then(function(){return U()?y.onRemove(m.device,e):r.resolve()}).then(function(){m.devices=_.without(m.devices,e),s.update({id:m.device.id}),c.success(p("Device deleted."))}).catch(function(e){e&&c.danger(e)})},navigateToDetail:function(e){i.url("device/".concat(e.id))},triggerAutodiscovery:function(e){m.autoDiscoveryInProgress=!0;e=e.ipRange.$modelValue;e&&(e={deviceId:b,description:p("Autodiscovery request"),c8y_SnmpAutoDiscovery:{ipRange:e}},a.createWithNotifications(e).then(T))},autoDiscoveryInProgress:!1,canTriggerAutodiscovery:function(e){return m.autoDiscoveryInProgress||e.ipRange.$dirty||_.isEmpty(e.ipRange.$modelValue)}})}e.$inject=["$rootScope","$q","$routeParams","$location","$window","c8yDeviceControl","c8yBase","c8yDevices","c8yModal","c8yAlert","c8yDeviceDatabase","c8yRealtime","c8yCanopenDevice","c8yConfig","gettext","gettextCatalog"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusConfig",{templateUrl:":::PLUGIN_PATH:::/fieldbus-config.html",bindings:{tab:"@"},controllerAs:"vm",controller:e})}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var i;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o,a,s=[],u=!0,c=!1;try{if(o=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!==_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,r,t,i,o,a,n,s,u,c,d,l,y,f,p,v){var g=this,m=t.deviceId,b={types:[]},A={IS_REQUIRED:"required",ADDRESS_IN_USE:"address-in-use",ADDRESSES_IN_USE:"addresses-in-use",ADDRESS_INVALID:"address-invalid",POLLING_RATE_LARGER_THAN_TRANSMIT_RATE:"polling-rate-larger-than-transmit-rate",ONLY_NATURAL_NUMBERS_ALLOWED:"only-natural-numbers-allowed",IPADDRESS_INVALID_FORMAT:"ip",INVALID_URL:"invalid-url",NODE_IN_USE:"node-in-use",NODE_OUT_OF_RANGE:"node-out-of-range",IP_RANGE:"ip-range",PORT_INVALID:"port-invalid",IP_RANGE_MAXLIMIT:"ip-range-maxlimit",ENGINEID_IN_USE:"engineid-in-use",IS_MIN:"min"},I=(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(I={},A.IS_REQUIRED,p("This field is required.")),A.ADDRESS_IN_USE,p("This address is already in use.")),A.ADDRESSES_IN_USE,p("These addresses are already in use.")),A.ADDRESS_INVALID,p("Addresses from 248 up to 254 are not allowed.")),A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,p("Polling rate must be equal to or smaller than transmit rate.")),A.ONLY_NATURAL_NUMBERS_ALLOWED,p("Only natural numbers allowed.")),A.IPADDRESS_INVALID_FORMAT,p("The IP address format is invalid.")),A.INVALID_URL,p("The URL format is invalid. The only supported protocols are http, https and opc.tcp.")),A.NODE_IN_USE,p("This node id is already in use.")),A.IP_RANGE,p("Invalid IP address range.")),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(I,A.PORT_INVALID,p("Invalid port number.")),A.IP_RANGE_MAXLIMIT,p("Max. 30 IP addresses in total allowed.")),A.NODE_OUT_OF_RANGE,p("Only node ID(s) between 1 and 127 are allowed.")),A.ENGINEID_IN_USE,p("This engine ID is already in use.")),A.IS_MIN,p("Value cannot be lower than minimum.")));function S(){var i=g.device,e={},t=(_.assign(g,{hasSerialConfigOperation:s.supportsOperation(i,"c8y_SerialConfiguration"),hasFieldBusConfigOperation:(t=i,O()&&s.supportsOperation(t,"c8y_CanConfiguration")||h()&&s.supportsOperation(t,"c8y_ModbusConfiguration")||L()&&s.supportsOperation(t,"c8y_OPCUAConfiguration")||M()&&s.supportsOperation(t,"c8y_ProfibusConfiguration")||U()&&s.supportsOperation(t,"c8y_CANopenConfiguration")||w()&&s.supportsOperation(t,"c8y_SNMPConfiguration")),serialConfiguration:_.get(i,"c8y_SerialConfiguration",{}),fieldbusConfiguration:function(e){var t={};e&&(h()?t=e.c8y_ModbusConfiguration:O()?t=e.c8y_CanConfiguration:L()?(e.c8y_OPCUAGateway&&(e.c8y_OPCUAGateway.transmitRate=e.c8y_OPCUAGateway.transmitRate||0,_.unset(e,"c8y_OPCUAGateway.userIdentityPassword")),t=e.c8y_OPCUAGateway):M()?(_.defaultsDeep(e,{c8y_ProfibusConfiguration:{baudRate:p("automatic")}}),t=e.c8y_ProfibusConfiguration):U()?t=e.c8y_CANopenConfiguration:w()&&(e.c8y_SNMPGateway&&(e.c8y_SNMPGateway.transmitRate=e.c8y_SNMPGateway.transmitRate||0,_.unset(e,"c8y_SNMPGateway.userIdentityPassword")),t=e.c8y_SNMPGateway));return t}(i)}),(w()||h())&&(e={pageSize:2e3}),g.tab);return d.getAvailableDeviceTypes({fieldbusType:t},e).then(function(e){var t=d.getFieldbusVersionFromDevice(i);_.set(g.fieldbusConfiguration,"maxFieldbusVersion",t),b.types=_.filter(e,function(e){return e.fieldbusVersion<=t})})}function P(){e={pageSize:1,fragmentType:"c8y_SnmpAutoDiscovery",status:"EXECUTING"},e=n.timeOrderFilter(e||{}),_.assign(e,_.pick(t,"deviceId")),e.revert=!0;var e;return a.list(e).then(D).then(T)}function D(e){var i,t,n=_slicedToArray(e,1)[0];return!!n&&(g.autoDiscoveryInProgress=!0,i=r.defer(),e="operation".concat(n.id),t="/operations/".concat(n.deviceId),l.getStatus(e,t)&&l.destroySubscription(e,t),l.addListener(e,t,"UPDATE",function(e,t){t.id===n.id&&(t.status===a.status.SUCCESSFUL||t.status===a.status.FAILED?i.resolve(t):i.notify(t))}),l.start(e,t),r.when({completed:i.promise}))}function N(){return s.childDevices(m).then(function(e){e=w()?_.orderBy(e,["name"],["asc"]):e;g.devices=_.map(e,function(e){var t,i,n,r,o,a;return h()&&e.c8y_ModbusDevice?(a=R({device:o=e,fieldbusDeviceFragment:"c8y_ModbusDevice"}),a={id:o.id,name:o.name,deviceType:_.get(a,"name"),address:o.c8y_ModbusDevice.address,ipAddress:o.c8y_ModbusDevice.ipAddress,protocol:o.c8y_ModbusDevice.protocol}):O()&&e.c8y_CanDevice?(r=R({device:o=e,fieldbusDeviceFragment:"c8y_CanDevice"}),a={id:o.id,name:o.name,deviceType:_.get(r,"name")}):L()&&e.c8y_OPCUADevice?(n=R({device:r=e,fieldbusDeviceFragment:"c8y_OPCUADevice"}),a={id:r.id,name:r.name,deviceType:_.get(n,"name"),directoryPath:r.c8y_OPCUADevice.browsePath}):M()&&e.c8y_ProfibusDevice?(i=R({device:n=e,fieldbusDeviceFragment:"c8y_ProfibusDevice"}),a={id:n.id,name:n.name,deviceType:_.get(i,"name")}):U()&&e.c8y_CANopenDevice?(t=R({device:i=e,fieldbusDeviceFragment:"c8y_CANopenDevice"}),a={id:i.id,name:i.name,deviceType:_.get(t,"name"),nodeId:i.c8y_CANopenDevice.nodeId}):w()&&e.c8y_SNMPDevice&&(e=R({device:t=e,fieldbusDeviceFragment:"c8y_SNMPDevice"}),a={id:t.id,name:t.name,deviceType:_.get(e,"name"),ipAddress:t.c8y_SNMPDevice.ipAddress,port:t.c8y_SNMPDevice.port,version:t.c8y_SNMPDevice.version,auth:_.get(t.c8y_SNMPDevice,"auth",{})}),a})})}function R(e){var t=e.device,i=e.fieldbusDeviceFragment;return _(b.types).find(function(e){e=e.id;return _.get(t,"".concat(i,".type"))==="/inventory/managedObjects/".concat(e)})}function C(){var e=g.fieldbusCommunicationForm;e.$setPristine(),e.$setUntouched()}function E(e){var t,e=e.split("-").map(function(e){return e.trim()}),i=f.validation.ip.pattern,n=f.validation.ipV6.pattern;if(2===e.length){var e=_slicedToArray(e,2),r=e[0],e=e[1],i=i.test(r)&&i.test(e),n=n.test(r)&&n.test(e);if(i||n)try{t=new o.Ip.Range(r,e)}catch(e){}}return t}function T(e){e.completed.then(function(e){e.status===a.status.SUCCESSFUL?(c.success(p("Autodiscovery completed.")),g.autoDiscoveryInProgress=!1):e.status===a.status.FAILED&&(e.failureReason?c.danger(v.getString('Autodiscovery failed due to: "{{ failureReason | translate }}".',e)):c.danger(p("Autodiscovery failed.")),g.autoDiscoveryInProgress=!1)},_.noop,function(){c.success(p("Autodiscovery in progress."))}).then(N)}function h(){return"modbus"===g.tab}function O(){return"canbus"===g.tab}function L(){return"opcua"===g.tab}function M(){return"profibus"===g.tab}function U(){return"canopen"===g.tab}function w(){return"snmp"===g.tab}_.assign(g,{$onInit:function(){s.detail(m).then(n.getResData).then(function(e){h()?_.defaults(e.c8y_SerialConfiguration,{baudRate:19200,dataBits:8,parity:"E",stopBits:1}):O()&&(g.serialConfigurationOptions.baudRates=[1e5,125e3,25e4,5e5,1e6]),g.device=e}).then(S).then(N).then(P)},shouldShowSerialPanel:function(){return h()&&_.get(g,"device.c8y_SerialConfiguration")},isModbusTab:h,isCanBusTab:O,isOPCUATab:L,isProfibusTab:M,isCanOpenTab:U,isSNMPTab:w,getFieldValidationHints:_.curryRight(n.validationHints)(I),serialConfigurationOptions:{baudRates:[110,300,600,1200,2400,4800,9600,14400,19200,38400,57600,115200,25e4,460800,5e5,921600,1e6],dataBits:[8],parities:["N","E","O"],stopBits:[1,2]},fieldbusConfigurationOptions:{baudRates:[{value:1e3,label:"1 Mbit/s"},{value:800,label:"800 kbit/s"},{value:500,label:"500 kbit/s"},{value:250,label:"250 kbit/s"},{value:125,label:"125 kbit/s"},{value:50,label:"50 kbit/s"},{value:20,label:"20 kbit/s"},{value:10,label:"10 kbit/s"}]},deviceConfigurationOptions:b,fieldErrors:A,fieldErrorsToMessages:I,saveSerialConfig:function(){!function(e){return a.create({deviceId:e.id,description:p("Set serial configuration"),c8y_SerialConfiguration:e.c8y_SerialConfiguration})}(g.device).then(function(){return c.success(p("Settings will be applied."))})},saveFieldbusConfig:function(){!function(e){var t=r.resolve();h()&&e.c8y_ModbusConfiguration?t=function(e){return a.create({deviceId:e.id,description:p("Set modbus configuration"),c8y_ModbusConfiguration:_.omit(e.c8y_ModbusConfiguration,["maxFieldbusVersion"])})}(e):O()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Bus configuration"),c8y_CanConfiguration:_.omit(e.c8y_CanConfiguration,["maxFieldbusVersion"])})}(e):L()?t=function(e){var t=e.c8y_OPCUAGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_OPCUAGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_OPCUAGateway"]))}(e):M()?t=function(e){return a.create({deviceId:e.id,description:p("Set Profibus configuration"),c8y_ProfibusConfiguration:_.pick(e.c8y_ProfibusConfiguration,["transmitRate","slaveAddress"])})}(e):U()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Open configuration"),c8y_CANopenConfiguration:_.omit(e.c8y_CANopenConfiguration,["maxFieldbusVersion"])})}(e):w()&&(t=function(e){var t=e.c8y_SNMPGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_SNMPGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_SNMPGateway"])).then(C)}(e));return t}(g.device).then(function(){return c.success(p("Settings will be applied."))})},invalid:function(e,t){(h()||L())&&!function(e){var e=g[e],t=e.pollingRate;{var i,n,r;t&&(e=e.transmitRate,n=i=!0,r=t.$modelValue<=e.$modelValue,L()&&0===e.$modelValue&&(r=!0),(!_.isInteger(e.$modelValue)||e.$modelValue<=0)&&(i=!1),(!_.isInteger(t.$modelValue)||t.$modelValue<=0)&&(n=!1),e.$setValidity(A.ONLY_NATURAL_NUMBERS_ALLOWED,i),e.$setValidity(A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r),t.$setValidity(A.ONLY_NATURAL_NUMBERS_ALLOWED,n),t.$setValidity(A.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r))}}(e);L()&&!function(e){var e=g[e].OPCUAUrl,t=f.validation.opcuaBrowsePath.pattern,i=e.$modelValue;e.$setValidity(A.INVALID_URL,!i||t.test(i))}(e);w()&&!function(e){var e=g[e].ipRange,t=e.$modelValue;t&&(t=t.split(",").map(function(e){return e.trim()}),t=_.every(t,E),e.$setValidity(A.IP_RANGE,t),t)&&!function(e){var t=e.$modelValue,i=!0,n=!0,r=BigInt(30);{var o;t&&(o=BigInt(0),t=t.split(","),_.forEach(t,function(e){e=E(e);e||(i=!1),o+=BigInt(e.countIps())}),r<o||o<-r)&&(n=!1)}e.$setValidity(A.IP_RANGE,i),e.$setValidity(A.IP_RANGE_MAXLIMIT,n)}(e)}(e);return n.invalid(g,e,t)},reloadDevices:N,onClickDelete:function(e){u({title:p("Delete device"),body:v.getString('You are about to delete device "{{name}}". Do you want to proceed?',e),size:"sm",labels:{ok:p("Delete")},status:"danger"}).then(function(){return s.remove(e)}).then(function(){return U()?y.onRemove(g.device,e):r.resolve()}).then(function(){g.devices=_.without(g.devices,e),s.update({id:g.device.id}),c.success(p("Device deleted."))}).catch(function(e){e&&c.danger(e)})},navigateToDetail:function(e){i.url("device/".concat(e.id))},triggerAutodiscovery:function(e){g.autoDiscoveryInProgress=!0;e=e.ipRange.$modelValue;e&&(e={deviceId:m,description:p("Autodiscovery request"),c8y_SnmpAutoDiscovery:{ipRange:e}},a.createWithNotifications(e).then(T))},autoDiscoveryInProgress:!1,canTriggerAutodiscovery:function(e){return g.autoDiscoveryInProgress||e.ipRange.$dirty||_.isEmpty(e.ipRange.$modelValue)}})}e.$inject=["$rootScope","$q","$routeParams","$location","$window","c8yDeviceControl","c8yBase","c8yDevices","c8yModal","c8yAlert","c8yDeviceDatabase","c8yRealtime","c8yCanopenDevice","c8yConfig","gettext","gettextCatalog"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusConfig",{templateUrl:":::PLUGIN_PATH:::/fieldbus-config.html",bindings:{tab:"@"},controllerAs:"vm",controller:e})}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.497.8",
3
+ "version": "1018.500.12",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",
@@ -47,7 +47,7 @@
47
47
  "ui-select": "0.19.8",
48
48
  "xterm": "5.2.1",
49
49
  "xterm-addon-fit": "0.7.0",
50
- "zip-js": "0.0.2",
50
+ "zip-js": "0.0.3",
51
51
  "dompurify": "2.2.9"
52
52
  },
53
53
  "devDependencies": {
@@ -2,35 +2,43 @@
2
2
 
3
3
  <c8y-breadcrumbs-set>
4
4
  <c8y-breadcrumbs-item
5
+ icon="connected-people"
5
6
  path="#roles/global_roles"
6
7
  label="{{ 'Global roles' | translate }}"
7
- icon="connected-people"
8
8
  ></c8y-breadcrumbs-item>
9
9
  <c8y-breadcrumbs-item
10
+ icon="c8y-users"
10
11
  path="#roles"
11
12
  label="{{ 'Roles' | translate }}"
12
- icon="c8y-users"
13
13
  ></c8y-breadcrumbs-item>
14
14
  <c8y-breadcrumbs-item
15
- label="{{ 'Accounts' | translate }}"
16
15
  icon="c8y-accounts"
16
+ label="{{ 'Accounts' | translate }}"
17
17
  ></c8y-breadcrumbs-item>
18
18
  </c8y-breadcrumbs-set>
19
19
 
20
20
  <div class="card content-fullpage card--grid grid__col--8-4--sm">
21
- <form name="vm.globalRoleDetailForm" class="d-contents">
21
+ <form
22
+ class="d-contents"
23
+ name="vm.globalRoleDetailForm"
24
+ >
22
25
  <div class="d-flex d-col inner-scroll bg-level-0">
23
26
  <div class="card-header large-padding separator">
24
- <div class="card-title" translate>Global role</div>
27
+ <div
28
+ class="card-title"
29
+ translate
30
+ >
31
+ Global role
32
+ </div>
25
33
  </div>
26
34
  <div class="card-block large-padding p-b-0 flex-no-shrink">
27
35
  <div class="form-group">
28
36
  <label translate>Name</label>
29
37
  <input
30
- name="name"
38
+ class="form-control"
31
39
  placeholder="{{ 'e.g. My global role' | translate }}"
40
+ name="name"
32
41
  required
33
- class="form-control"
34
42
  ng-maxlength="254"
35
43
  ng-model="vm.role.name"
36
44
  />
@@ -39,10 +47,10 @@
39
47
  <div class="form-group">
40
48
  <label translate>Description</label>
41
49
  <textarea
42
- aria-multiline="true"
50
+ class="form-control"
43
51
  aria-label="{{ 'Description' | translate }}"
52
+ aria-multiline="true"
44
53
  name="description"
45
- class="form-control"
46
54
  rows="3"
47
55
  ng-maxlength="1000"
48
56
  ng-model="vm.role.description"
@@ -57,14 +65,17 @@
57
65
  </div>
58
66
  <button
59
67
  class="btn-help"
60
- type="button"
61
68
  aria-label="{{ 'Help' | translate }}"
69
+ type="button"
62
70
  uib-popover-template="'helpContent.html'"
63
71
  popover-trigger="'focus'"
64
72
  popover-append-to-body="true"
65
73
  popover-placement="right"
66
74
  ></button>
67
- <script type="text/ng-template" id="helpContent.html">
75
+ <script
76
+ id="helpContent.html"
77
+ type="text/ng-template"
78
+ >
68
79
  <div>
69
80
  <p translate>
70
81
  A <strong>global role</strong> contains generally applicable permissions. For example,
@@ -82,10 +93,10 @@
82
93
  </div>
83
94
  <div class="card-block large-padding bg-inherit overflow-visible p-b-0">
84
95
  <c8y-roles-matrix
96
+ class="bg-inherit"
85
97
  available-roles="vm.permissions"
86
98
  selected-roles="vm.selectedPermissions"
87
99
  on-selected-roles-change="vm.onSelectedRolesChange(selectedRoles)"
88
- class="bg-inherit"
89
100
  ></c8y-roles-matrix>
90
101
  </div>
91
102
  </div>
@@ -98,8 +109,8 @@
98
109
 
99
110
  <button
100
111
  class="btn-help"
101
- type="button"
102
112
  aria-label="{{ 'Help' | translate }}"
113
+ type="button"
103
114
  uib-popover="{{ 'This role has access to the applications selected below' | translate }}"
104
115
  popover-trigger="'focus'"
105
116
  popover-placement="right"
@@ -107,7 +118,11 @@
107
118
  ></button>
108
119
  </div>
109
120
  <div class="card-block large-padding p-t-0">
110
- <p class="alert alert-info" ng-show="vm.hasAppPermissions()" translate>
121
+ <p
122
+ class="alert alert-info"
123
+ ng-show="vm.hasAppPermissions()"
124
+ translate
125
+ >
111
126
  This role already has access to all applications. Revoke all "Application management"
112
127
  permissions to grant access only to some applications.
113
128
  </p>
@@ -123,8 +138,8 @@
123
138
  <div class="card-footer large-padding separator-top grid__col-fullspan">
124
139
  <button
125
140
  class="btn btn-default"
126
- type="button"
127
141
  title="{{ 'Cancel' | translate }}"
142
+ type="button"
128
143
  ng-click="vm.cancel()"
129
144
  c8y-key-shortcut="Escape"
130
145
  >
@@ -132,8 +147,8 @@
132
147
  </button>
133
148
  <button
134
149
  class="btn btn-primary"
135
- type="button"
136
150
  title="{{ 'Save' | translate }}"
151
+ type="button"
137
152
  ng-click="vm.save()"
138
153
  ng-disabled="vm.saving || vm.globalRoleDetailForm.$invalid || (vm.role.id && vm.globalRoleDetailForm.$pristine)"
139
154
  c8y-key-shortcut="Enter"
@@ -1 +1 @@
1
- "use strict";!function(){function e(i,r,n,t,c,o,P,a,u,l,s,e,d,f,h,g,v){var m,p=r.deviceId||r.groupId,S={},A={},x={done:!1,inProgress:!1},y={true:{text:g("Active"),icon:"check-circle",cls:"text-success"},false:{text:g("Inactive"),icon:"ban",cls:"text-danger"}},b=s.getContext(),R=g("Global smart rules");function C(){return n.when().then(I).then(E).then(N).then(U).then(T).catch(D)}function I(){x.inProgress=!0}function T(){x.inProgress=!1,x.done=!0,x.error=!1}function D(e){e.data&&e.data.message&&l.danger(e.data.message),x.inProgress=!1,x.done=!0,x.error=!0}function E(){return f.list().then(M)}function M(e){_.forEach(e||[],function(e){S[e.name]=e})}function N(){var e=p?h.listByContext(p):n.resolve([]),t=d.hasPermissions().then(function(e){return e?h.list():n.when([])});return n.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;p&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return w(e)&&!n.test(t)}}(p)));return t}(_.concat(e.listByContext,e.list))})}function w(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function O(e){return h.hasSource(e,p)}function U(){var e;return Array.isArray(i.rules)&&0<i.rules.length&&null!==(e=s.getContext()).context?o.childAssets(e.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=L(e)})}):n.resolve()}function L(t){return _.filter(i.children,function(e){return h.hasSource(t,e)})}_.assign(i,{isOpen:{},moId:p,loadingStatus:x,refresh:C,paging:{refresh:C},ruleTemplates:S,getLinkToDM:function(){var e={deviceId:p};return t(m||"")(e)},add:function(){h.addNewWithUI().then(C)},edit:function(e){h.editWithUI(e).then(C)},clone:function(e){h.cloneWithUI(e).then(C)},remove:function(e){u({title:g("Delete smart rule"),body:v.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:g("Delete")},status:"danger"}).then(angular.bind(h,h.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return l.success(g("Smart rule deleted."))})},hasSource:O,getChildrenEnabledForSmartRule:L,toggleRuleActivationForContextMO:function(e){if(O(e))return h.deactivate(e,p,!1).then(function(){l.success(v.getString('Smart rule "{{name}}" deactivated.',e))});return h.activate(e,p,!1).then(function(){l.success(v.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(e,n){var t=_.filter(n,function(t){return!_.find(i.ruleChildren[e.id],function(e){return e.id===t.id})}),r=_.filter(i.ruleChildren[e.id],function(t){return!_.find(n,function(e){return t.id===e.id})});return h.updateSources(e,t,r,!1).then(N).then(U).then(function(){l.success(v.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":g("Activate for this group"),"for device":g("Activate for this device"),"for object":g("Activate for this object")},deactivate:{"for group":g("Deactivate for this group"),"for device":g("Deactivate for this device"),"for object":g("Deactivate for this object")}},e=e.enabled&&O(e)?"deactivate":"activate",n=r.groupId?"group":"object";return n=r.deviceId?"device":n,t[e]["for ".concat(n)]},type:function(e){var t,e=S[e.ruleTemplateName];e&&(t=e.label.full?v.getString(e.label.full):"".concat(v.getString(e.label.input)," ").concat(v.getString(e.label.output)));return t},status:function(e){return y[e.enabled].text},statusIcon:function(e){return y[e.enabled].icon},statusClass:function(e){return y[e.enabled].cls},showTitle:function(){return null!==s.getContext().context},title:R,context:b,inputIcon:function(e){var t,e=S[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=S[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:function(e){var t=_.get(S,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=A.canAddRules;e&&!t&&(n=!1);_.isUndefined(n)&&(e=i.context?{adminMOs:[i.context.id]}:{allRoles:["ROLE_INVENTORY_ADMIN"],anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]},A.canAddRules=a.isAllowed(e).then(function(e){return A.canAddRules=e,A.canAddRules}),n=!1);return n},canModify:function(t){A.rules=A.rules||{};var n=A.rules,e=n[t.id];_.isUndefined(e)&&(n[t.id]=a.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canApplyOnChildren:function(e){return!w(e)},canSeeSection:function(){var e=A.canSeeSection;_.isUndefined(e)&&(A.canSeeSection=(c.checkIfModulesExist(["c8y.cockpit.config"])?d.shouldShowLocalSmartRules():n.when(!1)).then(function(e){return A.canSeeSection=e,A.canSeeSection}),e=!1);return e}}),C(),null===s.getContext().context&&e.changeTitle({title:R}),"device"===b.context&&c.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){m=e})}e.$inject=["$scope","$routeParams","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();
1
+ "use strict";!function(){function e(i,r,e,n,t,o,c,j,a,u,l,s,d,f,h,g,v,m){var p,S=r.deviceId||r.groupId,x={},A={},b={done:!1,inProgress:!1},R={true:{text:v("Active"),icon:"check-circle",cls:"text-success"},false:{text:v("Inactive"),icon:"ban",cls:"text-danger"}},y=s.getContext(),C=v("Global smart rules");function I(){return n.when().then(T).then(M).then(w).then(L).then(D).catch(E)}function T(){b.inProgress=!0}function D(){b.inProgress=!1,b.done=!0,b.error=!1}function E(e){e.data&&e.data.message&&l.danger(e.data.message),b.inProgress=!1,b.done=!0,b.error=!0}function M(){return h.list().then(N)}function N(e){_.forEach(e||[],function(e){x[e.name]=e})}function w(){var e=S?g.listByContext(S):n.resolve([]),t=f.hasPermissions().then(function(e){return e?g.list():n.when([])});return n.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;S&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return O(e)&&!n.test(t)}}(S)));return t}(_.concat(e.listByContext,e.list))})}function O(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function U(e){return g.hasSource(e,S)}function L(){var e;return Array.isArray(i.rules)&&0<i.rules.length&&null!==(e=s.getContext()).context?c.childAssets(e.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=P(e)})}):n.resolve()}function P(t){return _.filter(i.children,function(e){return g.hasSource(t,e)})}_.assign(i,{isOpen:{},moId:S,loadingStatus:b,refresh:I,paging:{refresh:I},ruleTemplates:x,getLinkToDM:function(){var e={deviceId:S};return t(p||"")(e)},add:function(){g.addNewWithUI().then(I)},edit:function(e){g.editWithUI(e).then(I)},clone:function(e){g.cloneWithUI(e).then(I)},remove:function(e){u({title:v("Delete smart rule"),body:m.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:v("Delete")},status:"danger"}).then(angular.bind(g,g.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return l.success(v("Smart rule deleted."))})},hasSource:U,getChildrenEnabledForSmartRule:P,toggleRuleActivationForContextMO:function(e){if(U(e))return g.deactivate(e,S,!1).then(function(){l.success(m.getString('Smart rule "{{name}}" deactivated.',e))});return g.activate(e,S,!1).then(function(){l.success(m.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(e,n){var t=_.filter(n,function(t){return!_.find(i.ruleChildren[e.id],function(e){return e.id===t.id})}),r=_.filter(i.ruleChildren[e.id],function(t){return!_.find(n,function(e){return t.id===e.id})});return g.updateSources(e,t,r,!1).then(w).then(L).then(function(){l.success(m.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":v("Activate for this group"),"for device":v("Activate for this device"),"for object":v("Activate for this object")},deactivate:{"for group":v("Deactivate for this group"),"for device":v("Deactivate for this device"),"for object":v("Deactivate for this object")}},e=e.enabled&&U(e)?"deactivate":"activate",n=r.groupId?"group":"object";return n=r.deviceId?"device":n,t[e]["for ".concat(n)]},type:function(e){var t,e=x[e.ruleTemplateName];e&&(t=e.label.full?m.getString(e.label.full):"".concat(m.getString(e.label.input)," ").concat(m.getString(e.label.output)));return t},status:function(e){return R[e.enabled].text},statusIcon:function(e){return R[e.enabled].icon},statusClass:function(e){return R[e.enabled].cls},showTitle:function(){return null!==s.getContext().context},title:C,context:y,inputIcon:function(e){var t,e=x[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=x[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:function(e){var t=_.get(x,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=A.canAddRules;e&&!t&&(n=!1);_.isUndefined(n)&&(e=i.context?{adminMOs:[i.context.id]}:{allRoles:["ROLE_INVENTORY_ADMIN"],anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]},A.canAddRules=a.isAllowed(e).then(function(e){return A.canAddRules=e,A.canAddRules}),n=!1);return n},canModify:function(t){A.rules=A.rules||{};var n=A.rules,e=n[t.id];_.isUndefined(e)&&(n[t.id]=a.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canApplyOnChildren:function(e){return!O(e)},canSeeSection:function(){var e=A.canSeeSection;_.isUndefined(e)&&(A.canSeeSection=(o.checkIfModulesExist(["c8y.cockpit.config"])?f.shouldShowLocalSmartRules():n.when(!1)).then(function(e){return A.canSeeSection=e,A.canSeeSection}),e=!1);return e},isConfigurationGlobalSmartRulesContext:void 0}),i.isConfigurationGlobalSmartRulesContext=e.path().includes("/rules"),I(),null===s.getContext().context&&d.changeTitle({title:C}),"device"===y.context&&o.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){p=e})}e.$inject=["$scope","$routeParams","$location","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();
@@ -1 +1 @@
1
- "use strict";function _typeof(r){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}function _defineProperty(r,e,t){return(e=_toPropertyKey(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _toPropertyKey(r){r=_toPrimitive(r,"string");return"symbol"===_typeof(r)?r:String(r)}function _toPrimitive(r,e){if("object"!==_typeof(r)||null===r)return r;var t=r[Symbol.toPrimitive];if(void 0===t)return("string"===e?String:Number)(r);t=t.call(r,e||"default");if("object"!==_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,e){var t;if(r)return"string"==typeof r?_arrayLikeToArray(r,e):"Map"===(t="Object"===(t=Object.prototype.toString.call(r).slice(8,-1))&&r.constructor?r.constructor.name:t)||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,e):void 0}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _iterableToArrayLimit(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(r){c=!0,o=r}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}function _arrayWithHoles(r){if(Array.isArray(r))return r}angular.module("c8y.smartRules").directive("smartRuleParamInputKpi",function(){return{require:"^smartRuleParamInput",scope:{rule:"=",param:"="},restrict:"E",templateUrl:":::PLUGIN_PATH:::/views/paramInputKpi.html",link:function(r,e,t,n){r.placeholder=n.placeholder},controller:["$scope","c8yKpi","c8yDataPointSvc",function(a,r,e){function t(){var r=a.param.property;r&&(a.kpiId=a.rule.config[r])}function n(r){var e,t=a.rule,n=a.param,t=t.config,o=_.find(a.kpis,{id:r}),i=n.mapSelectedKpiToProperties,i=(o&&i&&(o=o.c8y_Kpi,_.assign(t,(_defineProperty(e={},i.fragment,o.fragment),_defineProperty(e,i.series,o.series),_defineProperty(e,i.redRangeMin,_.get(o,"redRangeMin",90)),_defineProperty(e,i.redRangeMax,_.get(o,"redRangeMax",100)),e))),n.property);i&&(t[i]=r)}_.assign(a,{getKpiLabel:function(r){r=r.c8y_Kpi;return"".concat(r.label," - ").concat(r.series)},openKpiSelector:function(){e.chooseKpiWithUI().then(function(r){r=_slicedToArray(r,1)[0];a.kpiId=r._kpiId,n(a.kpiId)})},onKpiSelectionChange:n}),r.list().then(function(r){a.kpis=r}).then(t)}]}});
1
+ "use strict";function _typeof(r){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}function _defineProperty(r,e,t){return(e=_toPropertyKey(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _toPropertyKey(r){r=_toPrimitive(r,"string");return"symbol"===_typeof(r)?r:String(r)}function _toPrimitive(r,e){if("object"!==_typeof(r)||null===r)return r;var t=r[Symbol.toPrimitive];if(void 0===t)return("string"===e?String:Number)(r);t=t.call(r,e||"default");if("object"!==_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,e){var t;if(r)return"string"==typeof r?_arrayLikeToArray(r,e):"Map"===(t="Object"===(t=Object.prototype.toString.call(r).slice(8,-1))&&r.constructor?r.constructor.name:t)||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,e):void 0}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _iterableToArrayLimit(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(r){c=!0,o=r}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}function _arrayWithHoles(r){if(Array.isArray(r))return r}angular.module("c8y.smartRules").directive("smartRuleParamInputKpi",function(){return{require:"^smartRuleParamInput",scope:{rule:"=",param:"="},restrict:"E",templateUrl:":::PLUGIN_PATH:::/views/paramInputKpi.html",link:function(r,e,t,n){r.placeholder=n.placeholder},controller:["$scope","c8yKpi","c8yDataPointSvc",function(i,r,e){function t(){var r=i.param.property;r&&(i.kpiId=i.rule.config[r])}function n(r){var e=i.rule,t=i.param,e=e.config,n=_.find(i.kpis,{id:r}),o=t.mapSelectedKpiToProperties,o=(n&&o&&(n=n.c8y_Kpi,_.assign(e,_defineProperty(_defineProperty(_defineProperty(_defineProperty({},o.fragment,n.fragment),o.series,n.series),o.redRangeMin,_.get(n,"redRangeMin",90)),o.redRangeMax,_.get(n,"redRangeMax",100)))),t.property);o&&(e[o]=r)}_.assign(i,{getKpiLabel:function(r){r=r.c8y_Kpi;return"".concat(r.label," - ").concat(r.series)},openKpiSelector:function(){e.chooseKpiWithUI().then(function(r){r=_slicedToArray(r,1)[0];i.kpiId=r._kpiId,n(i.kpiId)})},onKpiSelectionChange:n}),r.list().then(function(r){i.kpis=r}).then(t)}]}});
@@ -1,6 +1,6 @@
1
1
  <div ng-controller="SmartRulesListCtrl as vm">
2
2
  <div ng-if="canSeeSection()">
3
- <c8y-breadcrumbs-set>
3
+ <c8y-breadcrumbs-set ng-if="isConfigurationGlobalSmartRulesContext">
4
4
  <c8y-breadcrumbs-item
5
5
  icon="c8y-smart-rules"
6
6
  label="{{ 'Global smart rules' | translate }}"
@@ -1 +1 @@
1
- "use strict";!function(){function e(e,n,t){e.addNavigation({parent:t("Settings"),name:t("License management"),path:"tenantLicenses",icon:"c8y-book",priority:1e3,showIf:["c8yUserUtil",function(e){return e.canUserManageTenant({mustBeTopTenant:!0})}]}),n.when("/tenantLicenses",{template:"<c8y-license-management />"})}e.$inject=["c8yNavigatorProvider","c8yViewsProvider","gettext"],angular.module("c8y.tenantLicenses",[]).config(e)}();
1
+ "use strict";!function(){function i(t,i){return t.current().then(function(n){var e=t.isTopTenant(n.name);return i.hasAllRoles(["ROLE_TENANT_MANAGEMENT_READ","ROLE_OPTION_MANAGEMENT_READ"]).then(function(n){return n&&e})})}function n(n,e,t){n.addNavigation({parent:t("Settings"),name:t("License management"),path:"tenantLicenses",icon:"c8y-book",priority:1e3,showIf:i}),e.when("/tenantLicenses",{template:"<c8y-license-management />",showIf:i})}i.$inject=["c8yTenant","c8yPermissions"],n.$inject=["c8yNavigatorProvider","c8yViewsProvider","gettext"],angular.module("c8y.tenantLicenses",[]).config(n)}();