@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.
Files changed (116) hide show
  1. package/NOTICES +1025 -984
  2. package/administration-tfaSettings/tfa-settings.component.js +1 -1
  3. package/alarmsEventsExplorer/alarmsEventsTimelinesChart/alarmsEventsTimelinesChart.service.js +1 -1
  4. package/app-logs/app-logs/app-logs.component.js +1 -1
  5. package/app-logs/app-logs.service.js +1 -1
  6. package/assetPropertyWidget/main.controller.js +1 -1
  7. package/assetTable/assetTable2/assets.controller.js +1 -1
  8. package/cell-id-information-activator/cell-id-information-activator.config.js +1 -1
  9. package/cell-id-information-activator/cell-id-information-activator.service.js +1 -1
  10. package/cell-id-usage-statistics/cell-id-usage-statistics.component.js +1 -1
  11. package/cell-id-usage-statistics/cell-id-usage-statistics.service.js +1 -1
  12. package/commandTemplates/controllers/commandTemplates.js +1 -1
  13. package/core/core/services/alarms.js +1 -1
  14. package/core/core/services/application.js +1 -1
  15. package/core/core/services/auth.js +1 -1
  16. package/core/core/services/base.js +1 -1
  17. package/core/core/services/binary.js +1 -1
  18. package/core/core/services/dynamicGroups.js +1 -1
  19. package/core/core/services/events.js +1 -1
  20. package/core/core/services/groups.js +1 -1
  21. package/core/core/services/inventory.js +1 -1
  22. package/core/core/services/kpi.js +1 -1
  23. package/core/core/services/license.js +1 -1
  24. package/core/core/services/permissions.js +1 -1
  25. package/core/core/services/realtime.js +1 -1
  26. package/core/core/services/settings.js +1 -1
  27. package/core/core/services/tenant.js +1 -1
  28. package/core/core/services/user.js +1 -1
  29. package/core/core/services/userGroup.js +1 -1
  30. package/core/core/services/util.js +1 -1
  31. package/core/sdk/directives/repeat.js +1 -1
  32. package/core/ui/configurable-device-list-columns/configurable-columns.service.js +1 -1
  33. package/core/ui/configurable-device-list-columns/modal-columns-configure.component.js +1 -1
  34. package/core/ui/controllers/deviceList.js +1 -1
  35. package/core/ui/csvExporter/csvExporter.controller.js +1 -1
  36. package/core/ui/directives/alarmList.js +1 -1
  37. package/core/ui/directives/auditList.js +1 -1
  38. package/core/ui/directives/binaryInput.js +1 -1
  39. package/core/ui/directives/binaryOut.js +1 -1
  40. package/core/ui/directives/interval.js +1 -1
  41. package/core/ui/directives/map.js +1 -1
  42. package/core/ui/directives/map2.js +1 -1
  43. package/core/ui/directives/sunburstChart.js +1 -1
  44. package/core/ui/directives/textOut.js +1 -1
  45. package/core/ui/forms/uib-dropdown.decorator.js +1 -1
  46. package/core/ui/header/action-bar.service.js +1 -1
  47. package/core/ui/properties/lastDeviceMessage.computedProperty.js +1 -1
  48. package/core/ui/properties/propertiesLibrary.service.js +1 -1
  49. package/core/ui/providers/httpCache.js +1 -1
  50. package/core/ui/providers/views.js +1 -1
  51. package/core/ui/providers/zip.js +1 -1
  52. package/core/ui/sanitize-html/sanitize-html.service.js +1 -1
  53. package/core/ui/schemaForm/fileUpload.config.js +1 -1
  54. package/core/ui/schemaForm/overrides/decorators/decorators.decorator.js +1 -1
  55. package/core/ui/schemaForm/schemaForm.component.js +1 -1
  56. package/core/ui/services/deviceListColumns.js +1 -1
  57. package/core/ui/user/editUser.directive.html +1 -0
  58. package/core/ui/user/userPicker.html +6 -1
  59. package/dashboard2/dashboard.service.js +1 -1
  60. package/dataBroker/connectorsAlarms/connectorAlarms.component.js +1 -1
  61. package/dataPointExplorer/services/dataPoints.js +1 -1
  62. package/device-protocol-actility/actility-device.provider.js +1 -1
  63. package/device-protocol-canbus/canbus-device.provider.js +1 -1
  64. package/device-protocol-canopen/canopen-device.provider.js +1 -1
  65. package/device-protocol-deviceDatabase4/device-type-protocol-base.provider.js +1 -1
  66. package/device-protocol-lora/lora-device.provider.js +1 -1
  67. package/device-protocol-lpwan/lpwan-device.provider.js +1 -1
  68. package/device-protocol-modbus/modbus-device.provider.js +1 -1
  69. package/device-protocol-opcua/opcua-device.provider.js +1 -1
  70. package/device-protocol-profibus/profibus-device.provider.js +1 -1
  71. package/device-protocol-sigfox/sigfox-device.provider.js +1 -1
  72. package/device-protocol-snmp/snmp-device.provider.js +1 -1
  73. package/device-protocols/device-protocol-import-button.component.js +1 -1
  74. package/deviceControlRelay/relayControl/relayControl.directive.js +1 -1
  75. package/deviceDatabase4/detail/device-type-detail.component.js +1 -1
  76. package/deviceDatabase4/detail/message-id-configuration-description.component.js +1 -1
  77. package/deviceDatabase4/device-database.service.js +1 -1
  78. package/deviceDatabase4/device-type-list.component.js +1 -1
  79. package/deviceDatabase4/modals/configure-discrete-io.component.js +1 -1
  80. package/deviceDatabase4/modals/configure-register.component.js +1 -1
  81. package/deviceDatabase4/modals/import-device-type.component.js +1 -1
  82. package/deviceDatabase4/parsers/device-type-parser-eds.service.js +1 -1
  83. package/deviceDatabase4/unique.directive.js +1 -1
  84. package/deviceSelector/controllers/deviceSelectorComboCtrl.js +1 -1
  85. package/devicemanagement-alarmList/controllers/alarmList.js +1 -1
  86. package/devicemanagement-availability/controllers/availability.js +1 -1
  87. package/devicemanagement-eventList/controllers/eventList.js +1 -1
  88. package/enterpriseEdition/createFile.js +1 -1
  89. package/enterpriseEdition/customBranding/brandingConfigurationUi.provider.js +1 -1
  90. package/enterpriseEdition/customBranding/brandingDeploy.service.js +1 -1
  91. package/export/services/api.js +1 -1
  92. package/generic-ui/generic-ui-inventory-property.component.js +1 -1
  93. package/groupsHierarchy/controllers/groupsListCtrl.js +1 -1
  94. package/groupsHierarchy/groupsHierarchyUi.provider.js +1 -1
  95. package/kpi/controllers/pieChart.js +1 -1
  96. package/measurements/directives/lineChart.js +1 -1
  97. package/measurements/fragmentChart/fragmentChart.component.js +1 -1
  98. package/measurements/measurements2/axisY.service.js +1 -1
  99. package/measurements/measurements2/chart.service.js +1 -1
  100. package/measurements/measurements2/series.service.js +1 -1
  101. package/modbusConfiguration4/fieldbus-config.component.js +1 -1
  102. package/modbusConfiguration4/fieldbus-device-list.component.js +1 -1
  103. package/modbusWidget4/modbus-widget.service.js +1 -1
  104. package/modbusWidget4/widget-config.component.js +1 -1
  105. package/modbusWidget4/widget.component.js +1 -1
  106. package/package.json +2 -2
  107. package/remoteAccess/remoteAccess.service.js +1 -1
  108. package/remoteAccess/remoteAccessSettings/remoteAccessSettings.component.js +1 -1
  109. package/rotation3dWidget/components/webscene.component.js +1 -1
  110. package/scada/mapping.directive.js +1 -1
  111. package/smartRules/directives/smartRuleParamInputKpi.js +1 -1
  112. package/smartRules/services/smartRuleTemplates.js +1 -1
  113. package/tenantApplications/views/index.html +1 -0
  114. package/tenantStatistics/tenant-statistics.component.js +1 -1
  115. package/tenants/controllers/detail.js +1 -1
  116. package/userRoles/inventoryRolesTab/inventoryRolesTab.component.js +1 -1
@@ -1 +1 @@
1
- "use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(){function e(r,e,a,o,t,i,l,u,s,c){var y=this,n="two-factor-authentication",d=c("TOTP requires OAI-Secure login mode."),f=c("TOTP requires Allow two-factor authentication enabled."),p=c("Messaging application is not subscribed."),g=c("The setting is enforced on the platform level."),b=c("In OAI-Secure login mode, the token's validity limit is determined by the JWT token and cannot be edited here."),m=[{systemOption:!0,key:"tenant-scope-settings.enabled",default:!1,readOnly:!0},{key:"enabled",default:!1,loader:I},{key:"token.validity",default:43200,readOnlyIfTenantScopeSettingsDisabled:!0},{key:"pin.validity",default:30,readOnlyIfTenantScopeSettingsDisabled:!0},{key:"enforced",default:!1,loader:I}],v=[{key:"enabledOnSystemLevel",default:!1},{key:"enabledOnTenantLevel",default:!1},{key:"enforcedOnSystemLevel",default:!1},{key:"enforcedUsersGroup",default:""},{key:"strategy",default:"SMS"},{key:"totpEnforcedOnTenantLevel",default:!1}];function S(t){var e=h(t),n=t.default;return(t.systemOption?o.getSystemOptionValue(e,n):"function"==typeof t.loader?t.loader():o.detailValue(e,n)).then(function(e){return A(t,e)}).catch(function(){return A(t,t.default)})}function h(e){return{category:n,key:e.key}}function A(e,t){y[T(e.key)]=t,y.previousSettings[T(e.key)]=_.cloneDeep(t)}function T(e){return _.camelCase(e)}function k(e){var t={category:n,key:e.key,value:O(e)};return function(e){var t="enabled"===e.key||L(),n=y.previousSettings[T(e.key)]!==O(e),r=e.readOnly,a=e.readOnlyIfTenantScopeSettingsDisabled&&!y.tenantScopeSettingsEnabled;return n&&t&&!e.systemOption&&!(r||a)}(e)?o.updateOption(t).then(function(){return A(e,t.value)}):r.when()}function O(e){return function(e){return _.isNumber(e)||!_.isNaN(_.toNumber(e))&&_.isString(e)?_.toNumber(e):e}(y[T(e.key)])}function I(){var t=this,n=h(this);return o.getSystemOptionValue(n,this.default).then(function(e){return!0===e||"true"===_.lowerCase(e)?t.readOnly=!0:o.detailValue(n,t.default)})}function L(){return y.enabled||y.enforcedOnSystemLevel||!_.isEmpty(y.enforcedUsersGroup)}_.assign(y,{$onInit:function(){v.forEach(function(e){_.assign(y,_defineProperty({},e.key,e.default))}),r.all([r.all([].concat(_toConsumableArray(_.map(m,S)),[void e.isAvailable({contextPath:"messaging"}).then(function(e){y.smsAppAvailable=e})])),i.current().then(function(e){return l.getTfaSettings(e)}).then(function(t){return v.forEach(function(e){t[e.key]&&A(e,t[e.key])})})]).finally(function(){y.initialized=!0})},saveSettings:function(t){y.enabled&&"TOTP"===y.strategy||(y.enforced=!1);var n=y.previousSettings.strategy!==y.strategy&&L(),e=function(){var e=[].concat(_toConsumableArray(_.map(m,k)),[n?i.current().then(function(e){return l.updateTfaSettings(e,y.strategy)}):r.resolve()]);return r.all(e).then(function(){u.success(c("TFA settings saved.")),t&&t.$setPristine()})};return(n?s.requireLogout(e):e()).catch(function(e){"canceled"!==e&&u.danger(a.getResErrorMessage(e))})},limitValidityRegex:/^[0-9]\d*$/,initialized:!1,totpPopover:d,tfaIsDisabled:f,smsWarningPopover:p,enforcedOnSystemLevelPopover:g,disabledValidityLimitPopover:b,oAuthLoginMode:function(){return y.loginMode===t.loginOptions.OAUTH2_INTERNAL.value.toUpperCase()},isReadOnly:function(r){return m.some(function(e){var t=e.key,n=e.readOnly;return t===r&&n})},isTFAEnabled:L,previousSettings:{}})}e.$inject=["$q","c8yApplication","c8yBase","c8ySettings","c8yLoginOptions","c8yTenant","c8yTfaSettings","c8yAlert","c8yUserUtil","gettext"],angular.module("c8y.parts.tfaSettings").component("c8yTfaSettings",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/tfa-settings.html",bindings:{loginMode:"<"}})}();
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 _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){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 n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);var r=n.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(r,e,o,i,t,a,u,l,s,y){var c=this,n="two-factor-authentication",f=y("TOTP requires OAI-Secure login mode."),d=y("TOTP requires Allow two-factor authentication enabled."),p=y("Messaging application is not subscribed."),m=y("The setting is enforced on the platform level."),g=y("In OAI-Secure login mode, the token's validity limit is determined by the JWT token and cannot be edited here."),b=[{systemOption:!0,key:"tenant-scope-settings.enabled",default:!1,readOnly:!0},{key:"enabled",default:!1,loader:P},{key:"token.validity",default:43200,readOnlyIfTenantScopeSettingsDisabled:!0},{key:"pin.validity",default:30,readOnlyIfTenantScopeSettingsDisabled:!0},{key:"enforced",default:!1,loader:P}],v=[{key:"enabledOnSystemLevel",default:!1},{key:"enabledOnTenantLevel",default:!1},{key:"enforcedOnSystemLevel",default:!1},{key:"enforcedUsersGroup",default:""},{key:"strategy",default:"SMS"},{key:"totpEnforcedOnTenantLevel",default:!1}];function S(t){var e=h(t),n=t.default;return(t.systemOption?i.getSystemOptionValue(e,n):"function"==typeof t.loader?t.loader():i.detailValue(e,n)).then(function(e){return A(t,e)}).catch(function(){return A(t,t.default)})}function h(e){return{category:n,key:e.key}}function A(e,t){c[T(e.key)]=t,c.previousSettings[T(e.key)]=_.cloneDeep(t)}function T(e){return _.camelCase(e)}function k(e){var t={category:n,key:e.key,value:O(e)};return function(e){var t="enabled"===e.key||I(),n=c.previousSettings[T(e.key)]!==O(e),r=e.readOnly,o=e.readOnlyIfTenantScopeSettingsDisabled&&!c.tenantScopeSettingsEnabled;return n&&t&&!e.systemOption&&!(r||o)}(e)?i.updateOption(t).then(function(){return A(e,t.value)}):r.when()}function O(e){return function(e){return _.isNumber(e)||!_.isNaN(_.toNumber(e))&&_.isString(e)?_.toNumber(e):e}(c[T(e.key)])}function P(){var t=this,n=h(this);return i.getSystemOptionValue(n,this.default).then(function(e){return!0===e||"true"===_.lowerCase(e)?t.readOnly=!0:i.detailValue(n,t.default)})}function I(){return c.enabled||c.enforcedOnSystemLevel||!_.isEmpty(c.enforcedUsersGroup)}_.assign(c,{$onInit:function(){v.forEach(function(e){_.assign(c,_defineProperty({},e.key,e.default))}),r.all([r.all([].concat(_toConsumableArray(_.map(b,S)),[void e.isAvailable({contextPath:"messaging"}).then(function(e){c.smsAppAvailable=e})])),a.current().then(function(e){return u.getTfaSettings(e)}).then(function(t){return v.forEach(function(e){t[e.key]&&A(e,t[e.key])})})]).finally(function(){c.initialized=!0})},saveSettings:function(t){c.enabled&&"TOTP"===c.strategy||(c.enforced=!1);var n=c.previousSettings.strategy!==c.strategy&&I(),e=function(){var e=[].concat(_toConsumableArray(_.map(b,k)),[n?a.current().then(function(e){return u.updateTfaSettings(e,c.strategy)}):r.resolve()]);return r.all(e).then(function(){l.success(y("TFA settings saved.")),t&&t.$setPristine()})};return(n?s.requireLogout(e):e()).catch(function(e){"canceled"!==e&&l.danger(o.getResErrorMessage(e))})},limitValidityRegex:/^[0-9]\d*$/,initialized:!1,totpPopover:f,tfaIsDisabled:d,smsWarningPopover:p,enforcedOnSystemLevelPopover:m,disabledValidityLimitPopover:g,oAuthLoginMode:function(){return c.loginMode===t.loginOptions.OAUTH2_INTERNAL.value.toUpperCase()},isReadOnly:function(r){return b.some(function(e){var t=e.key,n=e.readOnly;return t===r&&n})},isTFAEnabled:I,previousSettings:{}})}e.$inject=["$q","c8yApplication","c8yBase","c8ySettings","c8yLoginOptions","c8yTenant","c8yTfaSettings","c8yAlert","c8yUserUtil","gettext"],angular.module("c8y.parts.tfaSettings").component("c8yTfaSettings",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/tfa-settings.html",bindings:{loginMode:"<"}})}();
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,i=[],o=!0,l=!1;try{for(r=r.call(t);!(o=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);o=!0);}catch(t){l=!0,a=t}finally{try{o||null==r.return||r.return()}finally{if(l)throw a}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}!function(){function t(l,c,u,s,a,r,f){var i=u.createEnum([{name:"ALARM",value:"ALARM",label:f("Alarm")},{name:"EVENT",value:"EVENT",label:f("Event")}]);return{TIMELINE_TYPES:i,getSampleAlarmsAndEventsConfigsForDevice:function(t){return l.all([function(t){var e={source:t.id||t,pageSize:10};return s.list(e).then(function(t){return _.map(t,function(t){return{__active:!1,__target:_.pick(t.source,"id","name"),label:t.type,color:r.generateColor(),timelineType:i.ALARM.value,filters:{type:t.type}}})})}(t),function(t){var e={source:t.id||t,pageSize:10};return a.list(e).then(function(t){return _.map(t,function(t){return{__active:!1,__target:_.pick(t.source,"id","name"),label:t.type,color:r.generateColor(),timelineType:i.EVENT.value,filters:{type:t.type}}})})}(t)]).then(_.flatten).then(e)},getEmptyAlarmEventConfigForDevice:function(t){return{__active:!1,__target:_.pick(t,"id","name"),label:"",color:r.generateColor(),timelineType:i.ALARM.value,filters:{type:""}}},fetchTimelinesForAlarmsEvents:function(t,r){var e=_.filter(t,{__active:!0}),n=_.map(e,function(e){return function(t,e){var r=l.when([]),n=_.assign({},e,t.filters,{source:t.__target.id});t.timelineType===i.EVENT.value?r=function(t,e){return a.list(e).then(function(t){return l.all(_.map(t,m))})}(0,n):t.timelineType===i.ALARM.value&&(r=function(t,e){var r=_.assign({},e,{dateFrom:moment(0).format(u.dateFullFormat),dateTo:e.dateFrom,revert:!0,pageSize:1}),n=e,a=_.assign({},e,{dateFrom:e.dateTo,dateTo:moment().format(u.dateFullFormat),pageSize:1}),i=[s.list(r),s.list(n),s.list(a)];return l.all(i).then(_.flatten).then(function(t){return l.all(_.map(t,o))})}(0,n));return r}(e,r).then(function(t){return function(t,e){return{label:t.label,color:t.color,events:e,alarmsEventsConfig:t}}(e,t)})});return l.all(n)},alarmMatchesConfig:function(t,e){return _.isMatch(e,{timelineType:"ALARM",__target:{id:t.source.id},filters:{type:t.type}})},eventMatchesConfig:function(t,e){return _.isMatch(e,{timelineType:"EVENT",__target:{id:t.source.id},filters:{type:t.type}})},transformAlarmToTimelineEvent:o,transformEventToTimelineEvent:m};function e(t){return _.uniqBy(t,function(t){return[t.__target.id,t.timelineType,t.filters.type].join(":")})}function o(o){return l.all([s.alarmDurationDiff(o),function(r){var n=c("absoluteDate"),a=c("translate"),i=c("humanize2");return s.statusText(r).then(function(t){var e=r.firstOccurrenceTime||r.time;return _.flatten(['<i class="dlt-c8y-icon-bell"></i> <b>'.concat(n(e),"</b>"),"".concat(a(f("Status")),": ").concat(t),_.map(s.getStandardKeys(r),function(t,e){return"".concat(_.escape(a(t)),": <b>").concat(_.escape(r[e]),"</b>")}),_.map(s.getNonStandardKeys(r),function(t){return"".concat(_.escape(i(t)),": <b>").concat(_.escape(JSON.stringify(r[t])),"</b>")})]).join("<br />")})}(o)]).then(function(t){var e=_slicedToArray(t,2),r=e[0],n=e[1],a=o.firstOccurrenceTime||o.time||o.creationTime,i=o.status!==s.status.ACTIVE&&r?moment(a).subtract(r).format(u.dateFullFormat):void 0;return{id:o.id,dateFrom:a,dateTo:i,tooltip:n}})}function m(e){return function(r){var t=c("absoluteDate"),n=c("translate"),e=c("humanize2");return l.when(_.flatten(['<i class="dlt-c8y-icon-rss"></i> <b>'.concat(t(r.time),"</b>"),_.map(a.getStandardKeys(r),function(t,e){return"".concat(_.escape(n(t)),": <b>").concat(_.escape(r[e]),"</b>")}),_.map(a.getNonStandardKeys(r),function(t){return"".concat(_.escape(e(t)),": <b>").concat(_.escape(JSON.stringify(r[t])),"</b>")})]).join("<br />"))}(e).then(function(t){return{id:e.id,date:e.time,tooltip:t}})}}t.$inject=["$q","$filter","c8yBase","c8yAlarms","c8yEvents","c8yUiUtil","gettext"],angular.module("c8y.alarmsEventsExplorer").factory("c8yAlarmsEventsTimelinesChartService",t)}();
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,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(l,c,u,s,a,r,f){var i=u.createEnum([{name:"ALARM",value:"ALARM",label:f("Alarm")},{name:"EVENT",value:"EVENT",label:f("Event")}]);return{TIMELINE_TYPES:i,getSampleAlarmsAndEventsConfigsForDevice:function(e){return l.all([function(e){var t={source:e.id||e,pageSize:10};return s.list(t).then(function(e){return _.map(e,function(e){return{__active:!1,__target:_.pick(e.source,"id","name"),label:e.type,color:r.generateColor(),timelineType:i.ALARM.value,filters:{type:e.type}}})})}(e),function(e){var t={source:e.id||e,pageSize:10};return a.list(t).then(function(e){return _.map(e,function(e){return{__active:!1,__target:_.pick(e.source,"id","name"),label:e.type,color:r.generateColor(),timelineType:i.EVENT.value,filters:{type:e.type}}})})}(e)]).then(_.flatten).then(t)},getEmptyAlarmEventConfigForDevice:function(e){return{__active:!1,__target:_.pick(e,"id","name"),label:"",color:r.generateColor(),timelineType:i.ALARM.value,filters:{type:""}}},fetchTimelinesForAlarmsEvents:function(e,r){var t=_.filter(e,{__active:!0}),n=_.map(t,function(t){return function(e,t){var r=l.when([]),n=_.assign({},t,e.filters,{source:e.__target.id});e.timelineType===i.EVENT.value?r=function(e,t){return a.list(t).then(function(e){return l.all(_.map(e,m))})}(0,n):e.timelineType===i.ALARM.value&&(r=function(e,t){var r=_.assign({},t,{dateFrom:moment(0).format(u.dateFullFormat),dateTo:t.dateFrom,revert:!0,pageSize:1}),n=t,a=_.assign({},t,{dateFrom:t.dateTo,dateTo:moment().format(u.dateFullFormat),pageSize:1}),i=[s.list(r),s.list(n),s.list(a)];return l.all(i).then(_.flatten).then(function(e){return l.all(_.map(e,o))})}(0,n));return r}(t,r).then(function(e){return function(e,t){return{label:e.label,color:e.color,events:t,alarmsEventsConfig:e}}(t,e)})});return l.all(n)},alarmMatchesConfig:function(e,t){return _.isMatch(t,{timelineType:"ALARM",__target:{id:e.source.id},filters:{type:e.type}})},eventMatchesConfig:function(e,t){return _.isMatch(t,{timelineType:"EVENT",__target:{id:e.source.id},filters:{type:e.type}})},transformAlarmToTimelineEvent:o,transformEventToTimelineEvent:m};function t(e){return _.uniqBy(e,function(e){return[e.__target.id,e.timelineType,e.filters.type].join(":")})}function o(o){return l.all([s.alarmDurationDiff(o),function(r){var n=c("absoluteDate"),a=c("translate"),i=c("humanize2");return s.statusText(r).then(function(e){var t=r.firstOccurrenceTime||r.time;return _.flatten(['<i class="dlt-c8y-icon-bell"></i> <b>'.concat(n(t),"</b>"),"".concat(a(f("Status")),": ").concat(e),_.map(s.getStandardKeys(r),function(e,t){return"".concat(_.escape(a(e)),": <b>").concat(_.escape(r[t]),"</b>")}),_.map(s.getNonStandardKeys(r),function(e){return"".concat(_.escape(i(e)),": <b>").concat(_.escape(JSON.stringify(r[e])),"</b>")})]).join("<br />")})}(o)]).then(function(e){var t=_slicedToArray(e,2),r=t[0],n=t[1],a=o.firstOccurrenceTime||o.time||o.creationTime,i=o.status!==s.status.ACTIVE&&r?moment(a).subtract(r).format(u.dateFullFormat):void 0;return{id:o.id,dateFrom:a,dateTo:i,tooltip:n}})}function m(t){return function(r){var e=c("absoluteDate"),n=c("translate"),t=c("humanize2");return l.when(_.flatten(['<i class="dlt-c8y-icon-rss"></i> <b>'.concat(e(r.time),"</b>"),_.map(a.getStandardKeys(r),function(e,t){return"".concat(_.escape(n(e)),": <b>").concat(_.escape(r[t]),"</b>")}),_.map(a.getNonStandardKeys(r),function(e){return"".concat(_.escape(t(e)),": <b>").concat(_.escape(JSON.stringify(r[e])),"</b>")})]).join("<br />"))}(t).then(function(e){return{id:t.id,date:t.time,tooltip:e}})}}e.$inject=["$q","$filter","c8yBase","c8yAlarms","c8yEvents","c8yUiUtil","gettext"],angular.module("c8y.alarmsEventsExplorer").factory("c8yAlarmsEventsTimelinesChartService",e)}();
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _iterableToArrayLimit(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o=[],i=!0,c=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);i=!0);}catch(t){c=!0,a=t}finally{try{i||null==n.return||n.return()}finally{if(c)throw a}}return o}}function _arrayWithHoles(t){if(Array.isArray(t))return t}!function(){function t(t,e,o,i,c){var s=10,l=this;function n(t){return l.mo=t,l.mo}function r(t){var e=_.get(t,"c8y_Status.instances"),n=_.map(e,function(t,e){return e});_.isEmpty(n)||(l.instances=function(t){var n=moment().format();return t.reduce(function(t,e){return t[e]={name:e,dateFrom:n},t},{})}(n))}function a(){var t=_slicedToArray(Object.keys(l.instances),1)[0];l.selectedInstance=_.cloneDeep(_.get(l,["instances",t]))}function u(){return m(!0),d(l.mo.applicationId,l.selectedInstance.name).then(function(t){return f(t)})}function m(t){l.isRequestPending=t}function d(t,e,n,r){return o.getLogs(t,e,{dateFrom:n,dateTo:r}).finally(function(){m(!1)})}function f(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]&&arguments[3];if(m(!1),_.isEmpty(t.logs)){var a=o.getWarningMessageForMissingLogs(e,n);i.info(a)}else r&&function(t,e){var n=e,r=t.dateFrom;r&&moment(r).diff(n,"minutes")>s&&i.add({text:c.getString("No logs available from {{ expectedDateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000' }},\n instead loaded closest logs from {{ actualDateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000' }}.",{expectedDateFrom:n,actualDateFrom:r}),type:"info",timeout:5e3})}(t,e),_.assign(l.selectedInstance,t)}_.assign(l,{$onInit:function(){e.getApplicationMO(t.applicationId).then(n).then(r).then(a).then(u)},selectedInstance:void 0,nextBtnClick:function(){m(!0);var t=l.mo.applicationId,e=l.selectedInstance.name,n=moment(_.get(l,"selectedInstance.dateTo")).format();return d(t,e,n,void 0).then(function(t){return f(t,n)})},backBtnClick:function(){m(!0);var t=l.mo.applicationId,e=l.selectedInstance.name,n=moment(_.get(l,"selectedInstance.dateFrom")).format();return d(t,e,void 0,n).then(function(t){return f(t,void 0,n)})},loadLatestLogs:u,onInstanceChange:function(t){l.selectedInstance=_.cloneDeep(t),u()},loadLogsFromDate:function(t){m(!0);var e=o.formatDateChosenByUser(moment(t)),n=l.mo.applicationId,r=l.selectedInstance.name;return d(n,r,e).then(function(t){return f(t,e,t.dateTo,!0)})},beginningBtnClick:function(){m(!0);var t=l.mo.applicationId,e=l.selectedInstance.name;return d(t,e,"1970-01-01T00:00:00+00:00").then(function(t){return f(t,t.dateFrom,t.dateTo)})},isRequestPending:void 0})}t.$inject=["$routeParams","c8yApplication","c8yApplicationLogs","c8yAlert","gettextCatalog"],angular.module("c8y.appLogs").component("c8yAppLogs",{bindings:{basePath:"@"},templateUrl:":::PLUGIN_PATH:::/app-logs/app-logs.html",controller:t,controllerAs:"vm"})}();
1
+ "use strict";function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _iterableToArrayLimit(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,s=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==e);l=!0);}catch(t){s=!0,a=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}!function(){function t(t,e,o,i,c){var l=10,s=this;function n(t){return s.mo=t,s.mo}function r(t){var e=_.get(t,"c8y_Status.instances"),n=_.map(e,function(t,e){return e});_.isEmpty(n)||(s.instances=function(t){var n=moment().format();return t.reduce(function(t,e){return t[e]={name:e,dateFrom:n},t},{})}(n))}function a(){var t=_slicedToArray(Object.keys(s.instances),1)[0];s.selectedInstance=_.cloneDeep(_.get(s,["instances",t]))}function u(){return m(!0),d(s.mo.applicationId,s.selectedInstance.name).then(function(t){return f(t)})}function m(t){s.isRequestPending=t}function d(t,e,n,r){return o.getLogs(t,e,{dateFrom:n,dateTo:r}).finally(function(){m(!1)})}function f(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]&&arguments[3];if(m(!1),_.isEmpty(t.logs)){var a=o.getWarningMessageForMissingLogs(e,n);i.info(a)}else r&&function(t,e){var n=e,r=t.dateFrom;r&&moment(r).diff(n,"minutes")>l&&i.add({text:c.getString("No logs available from {{ expectedDateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000' }},\n instead loaded closest logs from {{ actualDateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000' }}.",{expectedDateFrom:n,actualDateFrom:r}),type:"info",timeout:5e3})}(t,e),_.assign(s.selectedInstance,t)}_.assign(s,{$onInit:function(){e.getApplicationMO(t.applicationId).then(n).then(r).then(a).then(u)},selectedInstance:void 0,nextBtnClick:function(){m(!0);var t=s.mo.applicationId,e=s.selectedInstance.name,n=moment(_.get(s,"selectedInstance.dateTo")).format();return d(t,e,n,void 0).then(function(t){return f(t,n)})},backBtnClick:function(){m(!0);var t=s.mo.applicationId,e=s.selectedInstance.name,n=moment(_.get(s,"selectedInstance.dateFrom")).format();return d(t,e,void 0,n).then(function(t){return f(t,void 0,n)})},loadLatestLogs:u,onInstanceChange:function(t){s.selectedInstance=_.cloneDeep(t),u()},loadLogsFromDate:function(t){m(!0);var e=o.formatDateChosenByUser(moment(t)),n=s.mo.applicationId,r=s.selectedInstance.name;return d(n,r,e).then(function(t){return f(t,e,t.dateTo,!0)})},beginningBtnClick:function(){m(!0);var t=s.mo.applicationId,e=s.selectedInstance.name;return d(t,e,"1970-01-01T00:00:00+00:00").then(function(t){return f(t,t.dateFrom,t.dateTo)})},isRequestPending:void 0})}t.$inject=["$routeParams","c8yApplication","c8yApplicationLogs","c8yAlert","gettextCatalog"],angular.module("c8y.appLogs").component("c8yAppLogs",{bindings:{basePath:"@"},templateUrl:":::PLUGIN_PATH:::/app-logs/app-logs.html",controller:t,controllerAs:"vm"})}();
@@ -1 +1 @@
1
- "use strict";function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})),n.forEach(function(t){_defineProperty(e,t,o[t])})}return e}function _defineProperty(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}!function(){function t(c,i,l,n,a,r){var s="application/applications",u="application/vnd.com.nsn.cumulocity.applicationLogs+json;charset=UTF-8;ver=0.9";return{downloadAndSaveAs:function(t,o,n,a){return e(t,o,n,a).then(function(t){var e=t.logs;_.isEmpty(e)?r.info(d(n,a)):function(t,e){var o="".concat(t,".log"),n=new Blob([e],{type:"text/plain"});window.saveAs(n,o)}(o,e)})},shouldShowLogsTab:function(t){var e="c8y_Application_".concat(t),o=new Date;return n.list({type:e,nocache:o.getTime()}).then(function(t){var e;if(_.isEqual(_.get(t,"length"),1)){var o=_.head(t),n=_.get(o,"c8y_SupportedLogs"),a=_.get(o,"c8y_Status.instances");e=_.some(n,function(t){return"syslog"===t})&&!_.isEmpty(a)}return e})},getAllLogs:e,getLogs:g,formatDateChosenByUser:function(t){var e=moment(t).format("YYYY-MM-DDTHH:mm:ss.SSS");return moment("".concat(e,"Z")).toISOString()},getWarningMessageForMissingLogs:d};function e(n,a,e,r){var i=[];return g(n,a,{dateFrom:e,dateTo:r}).then(function t(e){var o=m(e.dateTo);return i.push(e.logs),moment(o).isValid()&&e.truncated&&e.dateFrom!==e.dateTo?g(n,a,{dateFrom:o,dateTo:r}).then(t):c.resolve(i)}).then(function(t){return function(t,e,o){var n=o.join("");return{dateFrom:t,dateTo:e,logs:n}}(e,r,t)})}function g(t,e){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=3<arguments.length?arguments[3]:void 0,a=l.url("".concat(s,"/").concat(t,"/logs/").concat(e)),r=_objectSpread({headers:{Accept:u},params:o},n);return o.dateFrom&&(o.dateFrom=m(o.dateFrom)),o.dateTo&&(o.dateTo=m(o.dateTo)),i.get(a,r).then(l.getResData)}function m(t){return moment(t).format(l.dateFullFormatWithMs)}function d(t,e){var o;return!t&&e&&(o=a.getString("No logs available before {{dateTo | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateTo:e})),t&&e&&(o=a.getString("No logs available in time range {{dateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000'}} - {{dateTo | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateFrom:t,dateTo:e})),t&&!e&&(o=a.getString("No logs available after {{dateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateFrom:t})),t||e||(o=a.getString("No logs available.")),o}}t.$inject=["$q","$http","c8yBase","c8yInventory","gettextCatalog","c8yAlert"],angular.module("c8y.appLogs").factory("c8yApplicationLogs",t)}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})),n.forEach(function(t){_defineProperty(e,t,o[t])})}return e}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);var n=o.call(t,e||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(c,i,u,n,r,a){var l="application/applications",s="application/vnd.com.nsn.cumulocity.applicationLogs+json;charset=UTF-8;ver=0.9";return{downloadAndSaveAs:function(t,o,n,r){return e(t,o,n,r).then(function(t){var e=t.logs;_.isEmpty(e)?a.info(g(n,r)):function(t,e){var o="".concat(t,".log"),n=new Blob([e],{type:"text/plain"});window.saveAs(n,o)}(o,e)})},shouldShowLogsTab:function(t){var e="c8y_Application_".concat(t),o=new Date;return n.list({type:e,nocache:o.getTime()}).then(function(t){var e;if(_.isEqual(_.get(t,"length"),1)){var o=_.head(t),n=_.get(o,"c8y_SupportedLogs"),r=_.get(o,"c8y_Status.instances");e=_.some(n,function(t){return"syslog"===t})&&!_.isEmpty(r)}return e})},getAllLogs:e,getLogs:m,formatDateChosenByUser:function(t){var e=moment(t).format("YYYY-MM-DDTHH:mm:ss.SSS");return moment("".concat(e,"Z")).toISOString()},getWarningMessageForMissingLogs:g};function e(n,r,e,a){var i=[];return m(n,r,{dateFrom:e,dateTo:a}).then(function t(e){var o=f(e.dateTo);return i.push(e.logs),moment(o).isValid()&&e.truncated&&e.dateFrom!==e.dateTo?m(n,r,{dateFrom:o,dateTo:a}).then(t):c.resolve(i)}).then(function(t){return function(t,e,o){var n=o.join("");return{dateFrom:t,dateTo:e,logs:n}}(e,a,t)})}function m(t,e){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=3<arguments.length?arguments[3]:void 0,r=u.url("".concat(l,"/").concat(t,"/logs/").concat(e)),a=_objectSpread({headers:{Accept:s},params:o},n);return o.dateFrom&&(o.dateFrom=f(o.dateFrom)),o.dateTo&&(o.dateTo=f(o.dateTo)),i.get(r,a).then(u.getResData)}function f(t){return moment(t).format(u.dateFullFormatWithMs)}function g(t,e){var o;return!t&&e&&(o=r.getString("No logs available before {{dateTo | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateTo:e})),t&&e&&(o=r.getString("No logs available in time range {{dateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000'}} - {{dateTo | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateFrom:t,dateTo:e})),t&&!e&&(o=r.getString("No logs available after {{dateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateFrom:t})),t||e||(o=r.getString("No logs available.")),o}}t.$inject=["$q","$http","c8yBase","c8yInventory","gettextCatalog","c8yAlert"],angular.module("c8y.appLogs").factory("c8yApplicationLogs",t)}();
@@ -1 +1 @@
1
- "use strict";function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?Object(arguments[e]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.forEach(function(e){_defineProperty(t,e,n[e])})}return t}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(c)throw i}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(r,e,t,n,i,o,a,c,u,l){var f=_.memoize(function(){return e.all({configProperties:function(){var e=P("properties",[]);return _.filter(e,"__active").map(function(e){return angular.copy(e)})}(),discoveredProperties:function(){if(P("allowDisplayAndEditKnownProperties",!1))return i.list().then(function(e){return _.filter(e,y)}).then(function(e){return _.filter(e,h)});return[]}()}).then(function(e){var t=e.configProperties,n=e.discoveredProperties;return _(t).concat(n).uniqBy(function(e){return"".concat(_.get(e,"id"),"_").concat(_.get(e,"config._id"))}).reject(j).value()})});function s(){f.cache.clear(),r.$emit("stopRealtime"),function(){var e=r.child.config.device.id;return n.detailRealtime(e,r,void 0,{withChildren:!0}).then(function(e){r.managedObject=e})}().then(d).then(p).then(g)}function d(){return f().then(function(e){o.attach(r.managedObject,e)})}function p(){return f().then(function(e){return i.getSchema(e)}).then(function(e){r.schema=e})}function y(e){return 1===e.keyPath.length}function h(e){return _.has(r.managedObject,e.keyPath[0])}function g(){b(!0)}function b(t){return e.all({properties:f(),options:function(e){var t={};e&&(t.readonly=e,t.feedback=!1,t.disableSuccessState=!0,t.disableErrorState=!0);return t}(t)}).then(function(e){var t=e.properties,n=e.options;return i.getForm(t,n)}).then(function(e){r.form=e,r.editable=!t})}function m(e){!function(e){_.forEach(e,function(e){var t=_slicedToArray(e.keyPath,1),n=t[0];_.isUndefined(r.managedObject[n])&&(r.managedObject[n]=null)})}(e),f.cache.clear(),p().then(function(){return b(!1)})}function v(){t.getContext().id===r.child.config.device.id&&c.changeTitle({title:_.get(r,"managedObject.name")||""},{skipTitleTranslation:!0})}function P(e,t){return _.get(r.child.config.options,e,t)}function j(e){var t=P("hiddenPropertiesKeyPaths",[]);return!!_.includes(t,e.keyPath[0])}r.$watch("child.config.options",s),_.assign(r,{startEdit:function(){r.managedObject=_.cloneDeep(r.managedObject),d(),b(!1)},canAddProperties:function(){return P("allowDisplayAndEditKnownProperties",!1)},addProperties:function(){var e={includeTree:!1,includeTreeChildren:!1,showComputed:!1,showRootPropertiesOnly:!0,managedObject:r.managedObject,hideExistingInMO:!0};return l.openSelector(e).then(m)},save:function(){return f().then(function(e){return _.reject(e,{computed:!0})}).then(function(e){return _objectSpread({id:r.managedObject.id},_.pick(r.managedObject,_.map(e,"keyPath[0]")))}).then(n.save).then(v).then(function(){return a.success(u("Changes saved."))}).then(s)},cancelEdit:function(){s()}})}e.$inject=["$scope","$q","c8yUiUtil","c8yInventory","c8yPropertiesLibrary","c8yComputedProperties","c8yAlert","c8yTitle","gettext","SchemaPropertiesSvc"],angular.module("c8y.parts.assetPropertyWidget").controller("assetPropertyWidgetCtrl",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 _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 _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,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(n,e,t,r,o,i,a,c,u,l){var f=_.memoize(function(){return e.all({configProperties:function(){var e=P("properties",[]);return _.filter(e,"__active").map(function(e){return angular.copy(e)})}(),discoveredProperties:function(){if(P("allowDisplayAndEditKnownProperties",!1))return o.list().then(function(e){return _.filter(e,p)}).then(function(e){return _.filter(e,h)});return[]}()}).then(function(e){var t=e.configProperties,r=e.discoveredProperties;return _(t).concat(r).uniqBy(function(e){return"".concat(_.get(e,"id"),"_").concat(_.get(e,"config._id"))}).reject(j).value()})});function s(){f.cache.clear(),n.$emit("stopRealtime"),function(){var e=n.child.config.device.id;return r.detailRealtime(e,n,void 0,{withChildren:!0}).then(function(e){n.managedObject=e})}().then(y).then(d).then(m)}function y(){return f().then(function(e){i.attach(n.managedObject,e)})}function d(){return f().then(function(e){return o.getSchema(e)}).then(function(e){n.schema=e})}function p(e){return 1===e.keyPath.length}function h(e){return _.has(n.managedObject,e.keyPath[0])}function m(){b(!0)}function b(t){return e.all({properties:f(),options:function(e){var t={};e&&(t.readonly=e,t.feedback=!1,t.disableSuccessState=!0,t.disableErrorState=!0);return t}(t)}).then(function(e){var t=e.properties,r=e.options;return o.getForm(t,r)}).then(function(e){n.form=e,n.editable=!t})}function g(e){!function(e){_.forEach(e,function(e){var t=_slicedToArray(e.keyPath,1),r=t[0];_.isUndefined(n.managedObject[r])&&(n.managedObject[r]=null)})}(e),f.cache.clear(),d().then(function(){return b(!1)})}function v(){t.getContext().id===n.child.config.device.id&&c.changeTitle({title:_.get(n,"managedObject.name")||""},{skipTitleTranslation:!0})}function P(e,t){return _.get(n.child.config.options,e,t)}function j(e){var t=P("hiddenPropertiesKeyPaths",[]);return!!_.includes(t,e.keyPath[0])}n.$watch("child.config.options",s),_.assign(n,{startEdit:function(){n.managedObject=_.cloneDeep(n.managedObject),y(),b(!1)},canAddProperties:function(){return P("allowDisplayAndEditKnownProperties",!1)},addProperties:function(){var e={includeTree:!1,includeTreeChildren:!1,showComputed:!1,showRootPropertiesOnly:!0,managedObject:n.managedObject,hideExistingInMO:!0};return l.openSelector(e).then(g)},save:function(){return f().then(function(e){return _.reject(e,{computed:!0})}).then(function(e){return _objectSpread({id:n.managedObject.id},_.pick(n.managedObject,_.map(e,"keyPath[0]")))}).then(r.save).then(v).then(function(){return a.success(u("Changes saved."))}).then(s)},cancelEdit:function(){s()}})}e.$inject=["$scope","$q","c8yUiUtil","c8yInventory","c8yPropertiesLibrary","c8yComputedProperties","c8yAlert","c8yTitle","gettext","SchemaPropertiesSvc"],angular.module("c8y.parts.assetPropertyWidget").controller("assetPropertyWidgetCtrl",e)}();
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_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,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o=[],c=!0,a=!1;try{for(t=t.call(e);!(c=(n=t.next()).done)&&(o.push(n.value),!r||o.length!==r);c=!0);}catch(e){a=!0,i=e}finally{try{c||null==t.return||t.return()}finally{if(a)throw i}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}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(){function e(c,n,i,o,r,t,a,s,u){var l=20,f={};function d(e){c.properties=[],f={},c.renderedDevices=f,c.parentId=e.device&&e.device.id||e.options&&e.options.parentId,s.list().then(angular.bind(u,u.filterAndExtendWithStoredProperties,c.child.config.options.properties)).then(p).then(function(e){c.properties=e,c.parentId?function(e){return i.detailRealtime(e,c)}(c.parentId).then(y).then(h):c.devices=_.map(c.devices,b)})}function p(e){return _.filter(e,"__active")}function y(e){r.isGroup(e)||(c.devices||(c.devices=[]),c.devices.push(e))}function h(){return function(e){var r={pageSize:l},t=o.createListMapper(function(e){return e.managedObject});return n.all([v(e,"childAssets",r).then(t),v(e,"childDevices",r).then(t)]).then(o.combineLists)}(c.parentId).then(e)}function v(r,t,e){var n=o.cleanListCallback("references",function(e){return v(r,t,e)},e,!0);return i.children(r,t,{params:e}).then(n)}function e(e){c.devices||(c.devices=[]),e.forEach(function(e){i.detailRealtime(e,c),c.devices.push(e)}),c.paging=e.paging}function g(e){var r=e;_.isArray(r)&&(r=r.join("."));var t=_slicedToArray(r.match(/^(-?)(.*)$/),3),n=t[1],i=t[2],o="-"===n?"desc":"asc";-1<i.indexOf("lastMeasurement")?c.devices=_.orderBy(c.devices,[function(t){return function(e){if("object"!==_typeof(e[t])&&""!==e[t]){var r=String(e[t]).split("|");if(2===r.length)return moment(r[0],"L, LTS").toDate()}}}(i),function(t){return function(e){if("object"!==_typeof(e[t])&&""!==e[t]){var r=String(e[t]).split("|");return 2===r.length?parseFloat(r[1]):parseFloat(r[0])}}}(i)],[o,o]):c.devices=_.orderBy(c.devices,i,o),c.$broadcast("c8yScrollLoad::refresh")}function b(e){return a.attach(e),t.attach(e,c.properties),e}c.$watch("child.config",function(e,r){e&&!_.isEqual(e,r)&&d(c.child.config)}),_.assign(c,{getArrows:function(e){return!!c.child.config.options.arrows[e]},orderBy:g,orderDownBy:function(e){var r=e;_.isArray(r)&&(r=r.join("."));g("-".concat(r))},loadNext:function(){c.paging.loading=!0,c.paging.next().then(e).finally(function(){c.paging.loading=!1})},buildFields:function(e,r){return function(e,r){for(var t=e,n=0;n<(r||[]).length&&null!=t;n++)t=t[r[n]];return t}(e,r)},getAssetLinkIfNeeded:function(e,r){var t=null;(function(e){return e===_.findIndex(c.properties,function(e){var r=e.renderType;return _.isUndefined(r)})})(r)&&(t=u.getAssetLink(e));return t},setArrows:function(e){c.child.config.options.arrows[e]=!c.child.config.options.arrows[e]},renderedDevices:f,renderDevice:function(e){var r=e.id;f[r]||(b(e),f[r]=!0)},renderedAllDevices:function(){return Boolean(c.devices&&c.devices.length===_.keys(f).length)}}),d(c.child.config)}e.$inject=["$scope","$q","c8yInventory","c8yBase","c8yGroups","c8yComputedProperties","c8yObjectActions","c8yPropertiesLibrary","assetsSvc"],angular.module("c8y.assets").controller("AssetsCtrl",e)}();
1
+ "use strict";function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_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,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,c,a=[],s=!0,u=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=o.call(t)).done)&&(a.push(n.value),a.length!==r);s=!0);}catch(e){u=!0,i=e}finally{try{if(!s&&null!=t.return&&(c=t.return(),Object(c)!==c))return}finally{if(u)throw i}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}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(){function e(c,n,i,o,r,t,a,s,u){var l=20,f={};function d(e){c.properties=[],f={},c.renderedDevices=f,c.parentId=e.device&&e.device.id||e.options&&e.options.parentId,s.list().then(angular.bind(u,u.filterAndExtendWithStoredProperties,c.child.config.options.properties)).then(p).then(function(e){c.properties=e,c.parentId?function(e){return i.detailRealtime(e,c)}(c.parentId).then(y).then(h):c.devices=_.map(c.devices,b)})}function p(e){return _.filter(e,"__active")}function y(e){r.isGroup(e)||(c.devices||(c.devices=[]),c.devices.push(e))}function h(){return function(e){var r={pageSize:l},t=o.createListMapper(function(e){return e.managedObject});return n.all([v(e,"childAssets",r).then(t),v(e,"childDevices",r).then(t)]).then(o.combineLists)}(c.parentId).then(e)}function v(r,t,e){var n=o.cleanListCallback("references",function(e){return v(r,t,e)},e,!0);return i.children(r,t,{params:e}).then(n)}function e(e){c.devices||(c.devices=[]),e.forEach(function(e){i.detailRealtime(e,c),c.devices.push(e)}),c.paging=e.paging}function g(e){var r=e;_.isArray(r)&&(r=r.join("."));var t=_slicedToArray(r.match(/^(-?)(.*)$/),3),n=t[1],i=t[2],o="-"===n?"desc":"asc";-1<i.indexOf("lastMeasurement")?c.devices=_.orderBy(c.devices,[function(t){return function(e){if("object"!==_typeof(e[t])&&""!==e[t]){var r=String(e[t]).split("|");if(2===r.length)return moment(r[0],"L, LTS").toDate()}}}(i),function(t){return function(e){if("object"!==_typeof(e[t])&&""!==e[t]){var r=String(e[t]).split("|");return 2===r.length?parseFloat(r[1]):parseFloat(r[0])}}}(i)],[o,o]):c.devices=_.orderBy(c.devices,i,o),c.$broadcast("c8yScrollLoad::refresh")}function b(e){return a.attach(e),t.attach(e,c.properties),e}c.$watch("child.config",function(e,r){e&&!_.isEqual(e,r)&&d(c.child.config)}),_.assign(c,{getArrows:function(e){return!!c.child.config.options.arrows[e]},orderBy:g,orderDownBy:function(e){var r=e;_.isArray(r)&&(r=r.join("."));g("-".concat(r))},loadNext:function(){c.paging.loading=!0,c.paging.next().then(e).finally(function(){c.paging.loading=!1})},buildFields:function(e,r){return function(e,r){for(var t=e,n=0;n<(r||[]).length&&null!=t;n++)t=t[r[n]];return t}(e,r)},getAssetLinkIfNeeded:function(e,r){var t=null;(function(e){return e===_.findIndex(c.properties,function(e){var r=e.renderType;return _.isUndefined(r)})})(r)&&(t=u.getAssetLink(e));return t},setArrows:function(e){c.child.config.options.arrows[e]=!c.child.config.options.arrows[e]},renderedDevices:f,renderDevice:function(e){var r=e.id;f[r]||(b(e),f[r]=!0)},renderedAllDevices:function(){return Boolean(c.devices&&c.devices.length===_.keys(f).length)}}),d(c.child.config)}e.$inject=["$scope","$q","c8yInventory","c8yBase","c8yGroups","c8yComputedProperties","c8yObjectActions","c8yPropertiesLibrary","assetsSvc"],angular.module("c8y.assets").controller("AssetsCtrl",e)}();
@@ -1 +1 @@
1
- "use strict";function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})),n.forEach(function(t){_defineProperty(e,t,o[t])})}return e}function _defineProperty(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}!function(){function t(t,e){var o={path:"/device/:deviceId/*",actionBar:!0};t.addUrlAction(_objectSpread({},o,{text:e("Activate Cell ID information"),showIf:["$q","$routeParams","cellIdInformationActivator",function(t,e,o){return t.all({shown:o.shouldShowActivator(),activated:o.isActivatedFor(e.deviceId)}).then(function(t){var e=t.shown,o=t.activated;return e&&!o})}],action:["$routeParams","cellIdInformationActivator",function(t,e){e.activate(t.deviceId)}]})),t.addUrlAction(_objectSpread({},o,{text:e("Deactivate Cell ID information"),showIf:["$q","$routeParams","cellIdInformationActivator",function(t,e,o){return t.all({shown:o.shouldShowActivator(),activated:o.isActivatedFor(e.deviceId)}).then(function(t){var e=t.shown,o=t.activated;return e&&o})}],action:["$routeParams","cellIdInformationActivator",function(t,e){e.deactivate(t.deviceId)}]}))}t.$inject=["c8yActionsProvider","gettext"],angular.module("c8y.cellIdInformationActivator").config(t)}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})),r.forEach(function(t){_defineProperty(e,t,o[t])})}return e}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);var r=o.call(t,e||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(t,e){var o={path:"/device/:deviceId/*",actionBar:!0};t.addUrlAction(_objectSpread({},o,{text:e("Activate Cell ID information"),showIf:["$q","$routeParams","cellIdInformationActivator",function(t,e,o){return t.all({shown:o.shouldShowActivator(),activated:o.isActivatedFor(e.deviceId)}).then(function(t){var e=t.shown,o=t.activated;return e&&!o})}],action:["$routeParams","cellIdInformationActivator",function(t,e){e.activate(t.deviceId)}]})),t.addUrlAction(_objectSpread({},o,{text:e("Deactivate Cell ID information"),showIf:["$q","$routeParams","cellIdInformationActivator",function(t,e,o){return t.all({shown:o.shouldShowActivator(),activated:o.isActivatedFor(e.deviceId)}).then(function(t){var e=t.shown,o=t.activated;return e&&o})}],action:["$routeParams","cellIdInformationActivator",function(t,e){e.deactivate(t.deviceId)}]}))}t.$inject=["c8yActionsProvider","gettext"],angular.module("c8y.cellIdInformationActivator").config(t)}();
@@ -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,l=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 c(t,e,r,n){var i,a,c,u,o=e&&e.prototype instanceof p?e:p,s=Object.create(o.prototype),l=new L(n||[]);return s._invoke=(i=t,a=r,c=l,u="suspendedStart",function(t,e){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return E()}for(c.method=t,c.arg=e;;){var r=c.delegate;if(r){var n=b(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(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var h={};function p(){}function u(){}function s(){}var y={};i(y,o,function(){return this});var v=Object.getPrototypeOf,d=v&&v(v(S([])));d&&d!==t&&l.call(d,o)&&(y=d);var g=s.prototype=p.prototype=Object.create(y);function m(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function w(u,s){var e;this._invoke=function(r,n){function t(){return new s(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)&&l.call(c,"__await")?s.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):s.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 b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function x(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 L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,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(l.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: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(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===u||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,i(t,n,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},m(w.prototype),i(w.prototype,r,function(){return this}),a.AsyncIterator=w,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new w(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.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 t in r)n.push(t);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,L.prototype={constructor:L,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)&&l.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=l.call(o,"catchLoc"),c=l.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&&l.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,h):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),h},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),h}},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),h}},a}!function(){function t(n,o,r,i,a,c,u,s){var l={true:{title:s.getString("Activate Cell ID information"),body:s.getString("Activating this feature will result in automatically updating the GPS position of the device when it sends new Cell ID data. Using this feature can result in additional costs."),status:"danger",labels:{ok:s.getString("Activate")}},false:{title:s.getString("Deactivate Cell ID information"),body:s.getString("Are you sure you want to deactivate Cell ID information for this device?"),status:"info",labels:{ok:s.getString("Deactivate")}}};return{shouldShowActivator:function(){var e;return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_regeneratorRuntime().awrap(r.detailValue({category:"cellid",key:"operation.mode"}));case 2:return e=t.sent,t.abrupt("return","manual"===e);case 4:case"end":return t.stop()}},null,null,null,Promise)},isActivatedFor:function(e){var r;return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=_.isString(e),t.t0)return t.t1=a,t.next=5,_regeneratorRuntime().awrap(i.detail(e));t.next=7;break;case 5:t.t2=t.sent,t.t0=t.t1.getResData.call(t.t1,t.t2);case 7:return r=t.t0,t.abrupt("return",!!_.get(r,"c8y_CellIdFeatureActive"));case 9:case"end":return t.stop()}},null,null,null,Promise)},activate:_.curry(t)(!0),deactivate:_.curry(t)(!1)};function t(e,r){return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,_regeneratorRuntime().awrap(f(e));case 3:if(t.sent)return t.next=7,_regeneratorRuntime().awrap(o.post(a.url("service/cellid/devices/".concat(r)),{active:e}));t.next=10;break;case 7:n.$broadcast("$routeChangeStart"),n.$broadcast("$routeChangeSuccess"),u.success(e?s.getString("Cell ID information activated"):s.getString("Cell ID information deactivated"));case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),console.error(t.t0.data.message);case 15:case"end":return t.stop()}},null,null,[[0,12]],Promise)}function f(e){return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,_regeneratorRuntime().awrap(c(l[e]));case 3:return t.abrupt("return",t.sent);case 6:return t.prev=6,t.t0=t.catch(0),t.abrupt("return",0);case 9:case"end":return t.stop()}},null,null,[[0,6]],Promise)}}t.$inject=["$rootScope","$http","c8ySettings","c8yDevices","c8yBase","c8yModal","c8yAlert","gettextCatalog"],angular.module("c8y.cellIdInformationActivator").factory("cellIdInformationActivator",t)}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,l=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 L(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 k()}for(c.method=t,c.arg=e;;){var r=c.delegate;if(r){var n=x(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)}}}(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 s={};function h(){}function p(){}function y(){}var v={};i(v,o,function(){return this});var d=Object.getPrototypeOf,g=d&&d(d(E([])));g&&g!==t&&l.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,s){var e;c(this,"_invoke",{value:function(r,n){function t(){return new s(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)&&l.call(c,"__await")?s.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):s.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")),s;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,s;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,s):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function E(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(l.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:k}}function k(){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=E,L.prototype={constructor:L,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(S),!t)for(var e in this)"t"===e.charAt(0)&&l.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=l.call(o,"catchLoc"),c=l.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&&l.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,s):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),s},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),s}},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;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},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(n,o,r,i,a,c,u,s){var l={true:{title:s.getString("Activate Cell ID information"),body:s.getString("Activating this feature will result in automatically updating the GPS position of the device when it sends new Cell ID data. Using this feature can result in additional costs."),status:"danger",labels:{ok:s.getString("Activate")}},false:{title:s.getString("Deactivate Cell ID information"),body:s.getString("Are you sure you want to deactivate Cell ID information for this device?"),status:"info",labels:{ok:s.getString("Deactivate")}}};return{shouldShowActivator:function(){return t.apply(this,arguments)},isActivatedFor:function(t){return e.apply(this,arguments)},activate:_.curry(f)(!0),deactivate:_.curry(f)(!1)};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.next=2,r.detailValue({category:"cellid",key:"operation.mode"});case 2:return e=t.sent,t.abrupt("return","manual"===e);case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}function e(){return(e=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=_.isString(e),t.t0)return t.t1=a,t.next=5,i.detail(e);t.next=7;break;case 5:t.t2=t.sent,t.t0=t.t1.getResData.call(t.t1,t.t2);case 7:return r=t.t0,t.abrupt("return",!!_.get(r,"c8y_CellIdFeatureActive"));case 9:case"end":return t.stop()}},t)}))).apply(this,arguments)}function f(t,e){return h.apply(this,arguments)}function h(){return(h=_asyncToGenerator(_regeneratorRuntime().mark(function t(e,r){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,p(e);case 3:if(t.sent)return t.next=7,o.post(a.url("service/cellid/devices/".concat(r)),{active:e});t.next=10;break;case 7:n.$broadcast("$routeChangeStart"),n.$broadcast("$routeChangeSuccess"),u.success(e?s.getString("Cell ID information activated"):s.getString("Cell ID information deactivated"));case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),console.error(t.t0.data.message);case 15:case"end":return t.stop()}},t,null,[[0,12]])}))).apply(this,arguments)}function p(t){return y.apply(this,arguments)}function y(){return(y=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,c(l[e]);case 3:return t.abrupt("return",t.sent);case 6:return t.prev=6,t.t0=t.catch(0),t.abrupt("return",0);case 9:case"end":return t.stop()}},t,null,[[0,6]])}))).apply(this,arguments)}}t.$inject=["$rootScope","$http","c8ySettings","c8yDevices","c8yBase","c8yModal","c8yAlert","gettextCatalog"],angular.module("c8y.cellIdInformationActivator").factory("cellIdInformationActivator",t)}();
@@ -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 _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,l=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 c(t,e,r,n){var i,a,c,s,o=e&&e.prototype instanceof y?e:y,u=Object.create(o.prototype),l=new L(n||[]);return u._invoke=(i=t,a=r,c=l,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return T()}for(c.method=t,c.arg=e;;){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"===s)throw s="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);s="executing";var o=f(i,a,c);if("normal"===o.type){if(s=c.done?"completed":"suspendedYield",o.arg===h)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(s="completed",c.method="throw",c.arg=o.arg)}}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var h={};function y(){}function s(){}function u(){}var p={};i(p,o,function(){return this});var d=Object.getPrototypeOf,m=d&&d(d(x([])));m&&m!==t&&l.call(m,o)&&(p=m);var v=u.prototype=y.prototype=Object.create(p);function g(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function b(s,u){var e;this._invoke=function(r,n){function t(){return new u(function(t,e){!function e(t,r,n,o){var i=f(s[t],s,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?u.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):u.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 w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function S(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 L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function x(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(l.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:T}}function T(){return{value:void 0,done:!0}}return i(v,"constructor",s.prototype=u),i(u,"constructor",s),s.displayName=i(u,n,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===s||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,i(t,n,"GeneratorFunction")),t.prototype=Object.create(v),t},a.awrap=function(t){return{__await:t}},g(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(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},g(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 t in r)n.push(t);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=x,L.prototype={constructor:L,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)&&l.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=l.call(o,"catchLoc"),c=l.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&&l.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,h):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),h},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),h}},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:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},a}!function(){function t(e,i,o,r,n,a,c,s,u){var l=this;function f(){return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return h(),t.next=3,_regeneratorRuntime().awrap(y());case 3:l.subtenantList.columns=s.getSubtenantListColumns(),l.subtenantList.csvHeaders=_.map(l.subtenantList.columns,function(t){return _.get(t,"header.csv")||_.get(t,"header.text")||_.get(t,"header")}),l.subtenantList.filteredSortedStatisticsItems=d(),e.$apply();case 7:case"end":return t.stop()}},null,null,null,Promise)}function h(){var t=o.dateFrom,e=o.dateTo,r=moment().startOf("month").toDate(),n=moment().add(1,"day").toDate();l.dateFrom=c.stringToDate(t)||r,l.dateTo=c.stringToDate(e)||n}function y(){var e,r,n,o;return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return e=p(),t.next=3,_regeneratorRuntime().awrap(i.all({tenantStatistics:s.getTenantStatisticsFor(e),subtenantsStatistics:s.getSubtenantsStatisticsFor(e)}));case 3:r=t.sent,n=r.tenantStatistics,o=r.subtenantsStatistics,l.tenantStatistics=n,l.subtenantList.statisticsItems=o;case 8:case"end":return t.stop()}},null,null,null,Promise)}function p(){return{dateFrom:c.dateToString(l.dateFrom),dateTo:c.dateToString(l.dateTo)}}function d(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:l.subtenantList.columnsConfig;l.subtenantList.columnsConfig=t;var e=l.subtenantList,r=e.statisticsItems,n=e.columns;return a.filterSort(r,n,t)}_.assign(l,{$onInit:function(){return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return n.changeTitle({title:u("Cell ID usage statistics")}),t.next=3,_regeneratorRuntime().awrap(f());case 3:case"end":return t.stop()}},null,null,null,Promise)},refresh:f,doFilter:function(){var t=p();t.dateFrom&&t.dateTo&&r.search(t)},clearFilter:function(){r.search({})},tenantStatistics:{tenantId:void 0,apiRequests:0,activeDevices:0},subtenantList:{csvHeaders:[],csvData:function(){return _.map([l.tenantStatistics].concat(_toConsumableArray(l.subtenantList.filteredSortedStatisticsItems)),function(t){return _.at(t,["tenantId","apiRequests","activeDevices"])})},columns:[],columnsConfig:{},onColumnsConfigChanged:function(t){l.subtenantList.filteredSortedStatisticsItems=d(t)},statisticsItems:[],filteredSortedStatisticsItems:[],goToSubtenant:function(t){var e=t.tenantId;r.path("/tenants/".concat(e))}}})}t.$inject=["$rootScope","$q","$routeParams","$location","c8yTitle","c8yFilteringSortingCollections","c8yUtil","cellIdUsageStatisticsService","gettext"],angular.module("c8y.cellIdUsageStatistics").component("c8yCellIdUsageStatistics",{templateUrl:":::PLUGIN_PATH:::/cell-id-usage-statistics.html",controllerAs:"vm",controller:t})}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,l=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 s(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new x(n||[]);return c(i,"_invoke",{value:function(i,a,c){var s="suspendedStart";return function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return I()}for(c.method=t,c.arg=e;;){var r=c.delegate;if(r){var n=_(r,c);if(n){if(n===u)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===s)throw s="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);s="executing";var o=f(i,a,c);if("normal"===o.type){if(s=c.done?"completed":"suspendedYield",o.arg===u)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(s="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=s;var u={};function h(){}function p(){}function y(){}var d={};i(d,o,function(){return this});var v=Object.getPrototypeOf,m=v&&v(v(T([])));m&&m!==t&&l.call(m,o)&&(d=m);var g=y.prototype=h.prototype=Object.create(d);function b(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function w(s,u){var e;c(this,"_invoke",{value:function(r,n){function t(){return new u(function(t,e){!function e(t,r,n,o){var i=f(s[t],s,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?u.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):u.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 _(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,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,u;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,u):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function S(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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(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(l.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:I}}function I(){return{value:void 0,done:!0}}return c(g,"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(g),t},a.awrap=function(t){return{__await:t}},b(w.prototype),i(w.prototype,r,function(){return this}),a.AsyncIterator=w,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new w(s(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.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(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=T,x.prototype={constructor:x,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(L),!t)for(var e in this)"t"===e.charAt(0)&&l.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=l.call(o,"catchLoc"),c=l.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&&l.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,u):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),u},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),L(r),u}},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;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},a}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}!function(){function t(e,i,o,r,n,a,c,s,u){var l=this;function t(){return(t=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n.changeTitle({title:u("Cell ID usage statistics")}),t.next=3,f();case 3:case"end":return t.stop()}},t)}))).apply(this,arguments)}function f(){return h.apply(this,arguments)}function h(){return(h=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return p(),t.next=3,y();case 3:l.subtenantList.columns=s.getSubtenantListColumns(),l.subtenantList.csvHeaders=_.map(l.subtenantList.columns,function(t){return _.get(t,"header.csv")||_.get(t,"header.text")||_.get(t,"header")}),l.subtenantList.filteredSortedStatisticsItems=m(),e.$apply();case 7:case"end":return t.stop()}},t)}))).apply(this,arguments)}function p(){var t=o.dateFrom,e=o.dateTo,r=moment().startOf("month").toDate(),n=moment().add(1,"day").toDate();l.dateFrom=c.stringToDate(t)||r,l.dateTo=c.stringToDate(e)||n}function y(){return d.apply(this,arguments)}function d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark(function t(){var e,r,n,o;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=v(),t.next=3,i.all({tenantStatistics:s.getTenantStatisticsFor(e),subtenantsStatistics:s.getSubtenantsStatisticsFor(e)});case 3:r=t.sent,n=r.tenantStatistics,o=r.subtenantsStatistics,l.tenantStatistics=n,l.subtenantList.statisticsItems=o;case 8:case"end":return t.stop()}},t)}))).apply(this,arguments)}function v(){return{dateFrom:c.dateToString(l.dateFrom),dateTo:c.dateToString(l.dateTo)}}function m(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:l.subtenantList.columnsConfig;l.subtenantList.columnsConfig=t;var e=l.subtenantList,r=e.statisticsItems,n=e.columns;return a.filterSort(r,n,t)}_.assign(l,{$onInit:function(){return t.apply(this,arguments)},refresh:f,doFilter:function(){var t=v();t.dateFrom&&t.dateTo&&r.search(t)},clearFilter:function(){r.search({})},tenantStatistics:{tenantId:void 0,apiRequests:0,activeDevices:0},subtenantList:{csvHeaders:[],csvData:function(){return _.map([l.tenantStatistics].concat(_toConsumableArray(l.subtenantList.filteredSortedStatisticsItems)),function(t){return _.at(t,["tenantId","apiRequests","activeDevices"])})},columns:[],columnsConfig:{},onColumnsConfigChanged:function(t){l.subtenantList.filteredSortedStatisticsItems=m(t)},statisticsItems:[],filteredSortedStatisticsItems:[],goToSubtenant:function(t){var e=t.tenantId;r.path("/tenants/".concat(e))}}})}t.$inject=["$rootScope","$q","$routeParams","$location","c8yTitle","c8yFilteringSortingCollections","c8yUtil","cellIdUsageStatisticsService","gettext"],angular.module("c8y.cellIdUsageStatistics").component("c8yCellIdUsageStatistics",{templateUrl:":::PLUGIN_PATH:::/cell-id-usage-statistics.html",controllerAs:"vm",controller:t})}();
@@ -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,l=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 c(t,e,r,n){var i,a,c,u,o=e&&e.prototype instanceof p?e:p,s=Object.create(o.prototype),l=new E(n||[]);return s._invoke=(i=t,a=r,c=l,u="suspendedStart",function(t,e){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return L()}for(c.method=t,c.arg=e;;){var r=c.delegate;if(r){var n=_(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(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var h={};function p(){}function u(){}function s(){}var y={};i(y,o,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(x([])));g&&g!==t&&l.call(g,o)&&(y=g);var d=s.prototype=p.prototype=Object.create(y);function m(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function w(u,s){var e;this._invoke=function(r,n){function t(){return new s(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)&&l.call(c,"__await")?s.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):s.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 _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function x(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(l.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:L}}function L(){return{value:void 0,done:!0}}return i(d,"constructor",u.prototype=s),i(s,"constructor",u),u.displayName=i(s,n,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===u||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,i(t,n,"GeneratorFunction")),t.prototype=Object.create(d),t},a.awrap=function(t){return{__await:t}},m(w.prototype),i(w.prototype,r,function(){return this}),a.AsyncIterator=w,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new w(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},m(d),i(d,n,"Generator"),i(d,o,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),a.keys=function(r){var n=[];for(var t in r)n.push(t);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=x,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(S),!t)for(var e in this)"t"===e.charAt(0)&&l.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=l.call(o,"catchLoc"),c=l.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&&l.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,h):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),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),h}},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;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},a}!function(){function t(n,o,t,e){var i=e.TENANT_STATS_SERVICE_ENDPOINT,a=e.SUBTENANTS_STATS_SERVICE_ENDPOINT,r=e.SUBTENANT_STATS_COLUMNS;return{getSubtenantListColumns:function(){return[t.getColumn(r.tenantId),t.getColumn(r.apiRequests),t.getColumn(r.activeDevices)]},getTenantStatisticsFor:function(e){var r;return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=o,t.next=4,_regeneratorRuntime().awrap(n.get(o.url(i),{params:o.timeOrderFilter(o.pageSizeNoTotalFilter(e)),silentError:!0}));case 4:return t.t1=t.sent,r=t.t0.getResData.call(t.t0,t.t1),t.abrupt("return",c(r));case 9:return t.prev=9,t.t2=t.catch(0),t.abrupt("return",c({}));case 12:case"end":return t.stop()}},null,null,[[0,9]],Promise)},getSubtenantsStatisticsFor:function(e){var r;return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=o,t.next=4,_regeneratorRuntime().awrap(n.get(o.url(a),{params:o.timeOrderFilter(o.pageSizeNoTotalFilter(e)),silentError:!0}));case 4:return t.t1=t.sent,r=t.t0.getResData.call(t.t0,t.t1),t.abrupt("return",_.map(r,c));case 9:return t.prev=9,t.t2=t.catch(0),t.abrupt("return",[]);case 12:case"end":return t.stop()}},null,null,[[0,9]],Promise)},isCellIDMicroserviceAvailable:function(){return _regeneratorRuntime().async(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,_regeneratorRuntime().awrap(n.get(o.url(i),{params:{dateFrom:moment().format(o.dateFormat)},silentError:!0}));case 3:return t.abrupt("return",!0);case 6:return t.prev=6,t.t0=t.catch(0),t.abrupt("return",!1);case 9:case"end":return t.stop()}},null,null,[[0,6]],Promise)}};function c(t){return{tenantId:_.get(t,"tenant"),apiRequests:_.get(t,"statistics.apiRequests",0),activeDevices:_.get(t,"statistics.activeDevices",0)}}}t.$inject=["$http","c8yBase","c8yFilteringSortingCollections","cellIdUsageStatisticsConstants"],angular.module("c8y.cellIdUsageStatistics").factory("cellIdUsageStatisticsService",t)}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,l=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 x(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 T()}for(c.method=t,c.arg=e;;){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=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)}}}(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 s={};function h(){}function p(){}function y(){}var v={};i(v,o,function(){return this});var d=Object.getPrototypeOf,g=d&&d(d(L([])));g&&g!==t&&l.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 _(u,s){var e;c(this,"_invoke",{value:function(r,n){function t(){return new s(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)&&l.call(c,"__await")?s.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):s.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 b(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,b(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,s;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,s):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function S(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 E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function L(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(l.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:T}}function T(){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(_.prototype),i(_.prototype,r,function(){return this}),a.AsyncIterator=_,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new _(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=L,x.prototype={constructor:x,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(E),!t)for(var e in this)"t"===e.charAt(0)&&l.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=l.call(o,"catchLoc"),c=l.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&&l.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,s):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),s},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),E(r),s}},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;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},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(n,o,t,e){var i=e.TENANT_STATS_SERVICE_ENDPOINT,a=e.SUBTENANTS_STATS_SERVICE_ENDPOINT,r=e.SUBTENANT_STATS_COLUMNS;return{getSubtenantListColumns:function(){return[t.getColumn(r.tenantId),t.getColumn(r.apiRequests),t.getColumn(r.activeDevices)]},getTenantStatisticsFor:function(t){return c.apply(this,arguments)},getSubtenantsStatisticsFor:function(t){return u.apply(this,arguments)},isCellIDMicroserviceAvailable:function(){return l.apply(this,arguments)}};function c(){return(c=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=o,t.next=4,n.get(o.url(i),{params:o.timeOrderFilter(o.pageSizeNoTotalFilter(e)),silentError:!0});case 4:return t.t1=t.sent,r=t.t0.getResData.call(t.t0,t.t1),t.abrupt("return",s(r));case 9:return t.prev=9,t.t2=t.catch(0),t.abrupt("return",s({}));case 12:case"end":return t.stop()}},t,null,[[0,9]])}))).apply(this,arguments)}function u(){return(u=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=o,t.next=4,n.get(o.url(a),{params:o.timeOrderFilter(o.pageSizeNoTotalFilter(e)),silentError:!0});case 4:return t.t1=t.sent,r=t.t0.getResData.call(t.t0,t.t1),t.abrupt("return",_.map(r,s));case 9:return t.prev=9,t.t2=t.catch(0),t.abrupt("return",[]);case 12:case"end":return t.stop()}},t,null,[[0,9]])}))).apply(this,arguments)}function s(t){return{tenantId:_.get(t,"tenant"),apiRequests:_.get(t,"statistics.apiRequests",0),activeDevices:_.get(t,"statistics.activeDevices",0)}}function l(){return(l=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n.get(o.url(i),{params:{dateFrom:moment().format(o.dateFormat)},silentError:!0});case 3:return t.abrupt("return",!0);case 6:return t.prev=6,t.t0=t.catch(0),t.abrupt("return",!1);case 9:case"end":return t.stop()}},t,null,[[0,6]])}))).apply(this,arguments)}}t.$inject=["$http","c8yBase","c8yFilteringSortingCollections","cellIdUsageStatisticsConstants"],angular.module("c8y.cellIdUsageStatistics").factory("cellIdUsageStatisticsService",t)}();
@@ -1 +1 @@
1
- "use strict";function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(){function e(e,t,n,r,a,l,o,i){var m,c,d=this,y=[],s=r.getDeliveryTypes().defaultDeliveryType,u=r.getDeliveryTypes().standardDeliveryTypes;function p(e){y.length=0,_.forEach(e,function(e){var t=!!e.id;y.push({name:t?e.name:i.getString(e.name),command:e.command,category:t?e.category:i.getString(e.category),deliveryTypes:e.deliveryTypes,id:e.id})})}function T(e){d.result.commandTemplate=e,_.difference(e.deliveryTypes,u)||d.standardDeliveryTypes.push(e.deliveryType),d.commandDeliveryType=_.first(e.deliveryTypes)||s}_.assign(d,{commandTemplates:y,standardDeliveryTypes:u,defaultDeliveryType:s,commandDeliveryTypesSelected:{},validateSelectedDeliveryTypes:function(){return _.isEmpty(_.pickBy(d.commandDeliveryTypesSelected))},result:{action:null,commandTemplate:null},forms:{},onTemplateSelected:T,use:function(e){d.result.action="USE",d.result.deliveryType=e!==s&&e,d.result.commandTemplate=_.clone(d.result.commandTemplate);var t=d.result.commandTemplate;t.text=t.text||t.command,d.close(d.result)},execute:function(e){d.result.action="EXECUTE",d.result.deliveryType=e!==s&&e,d.result.commandTemplate=_.clone(d.result.commandTemplate);var t=d.result.commandTemplate;t.text=t.command,d.close(d.result)},cancel:function(){d.newCommandTemplate?delete d.newCommandTemplate:d.dismiss()},save:function(){d.newCommandTemplate.deliveryTypes=_.keys(_.pickBy(d.commandDeliveryTypesSelected)),r.saveTemplate(d.newCommandTemplate).then(t.getResData).then(function(e){var t=_.pick(e,["id","name","category","command","text","deliveryTypes"]),n=_.find(y,{id:t.id});n?_.assign(n,t):y.unshift(t),T(d.result.commandTemplate=t),delete d.newCommandTemplate})},addNew:function(){d.newCommandTemplate={deviceType:m},d.commandDeliveryTypesSelected=_defineProperty({},s,!0)},hideAddButton:function(){return!!d.newCommandTemplate},edit:function(e){var t;t=_.isEmpty(e.deliveryTypes)?u:e.deliveryTypes;_.forEach(t,function(e){_.assign(d.commandDeliveryTypesSelected,_defineProperty({},e,!0))}),d.newCommandTemplate=e},remove:function(e){d.result.commandTemplate===e&&delete d.result.commandTemplate;r.removeTemplate(e).then(function(){_.pull(y,e)}).then(function(){l.success(o("Shell command template deleted."))})},isDeliveryTypeSupported:function(e,t){var n=_.get(t,"deliveryTypes");return _.isEmpty(n)||_.includes(n,e)},getExecuteButtonLabel:function(e){return e!==s?i.getString("Execute (via {{ deliveryType | translate }})",{deliveryType:e}):i.getString("Execute")},appendToEl:document.getElementsByClassName("modal"),getCommandPlaceholder:function(){return i.getString("e.g. {{ example }}",{example:"ls"})}}),(c=e.deviceId,n.detailCached(c).then(t.getResData).then(function(e){return m=_.concat(e.type,e.c8y_DeviceTypes||[]),r.getCommandTemplatesForDeviceType.apply(r,_toConsumableArray(m))})).then(p),r.canSendCommandsViaSMS().then(function(e){d.smsEnabled=e}),a.hasAnyRole(["ROLE_INVENTORY_ADMIN"]).then(function(e){d.canWrite=e})}e.$inject=["$routeParams","c8yBase","c8yDevices","c8yDeviceShell","c8yPermissions","c8yAlert","gettext","gettextCatalog"],angular.module("c8y.commandTemplates").controller("commandTemplatesCtrl",e)}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){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 _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){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 _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}!function(){function e(e,t,r,n,a,o,i,l){var m,y,c=this,u=[],d=n.getDeliveryTypes().defaultDeliveryType,s=n.getDeliveryTypes().standardDeliveryTypes;function p(e){u.length=0,_.forEach(e,function(e){var t=!!e.id;u.push({name:t?e.name:l.getString(e.name),command:e.command,category:t?e.category:l.getString(e.category),deliveryTypes:e.deliveryTypes,id:e.id})})}function f(e){c.result.commandTemplate=e,_.difference(e.deliveryTypes,s)||c.standardDeliveryTypes.push(e.deliveryType),c.commandDeliveryType=_.first(e.deliveryTypes)||d}_.assign(c,{commandTemplates:u,standardDeliveryTypes:s,defaultDeliveryType:d,commandDeliveryTypesSelected:{},validateSelectedDeliveryTypes:function(){return _.isEmpty(_.pickBy(c.commandDeliveryTypesSelected))},result:{action:null,commandTemplate:null},forms:{},onTemplateSelected:f,use:function(e){c.result.action="USE",c.result.deliveryType=e!==d&&e,c.result.commandTemplate=_.clone(c.result.commandTemplate);var t=c.result.commandTemplate;t.text=t.text||t.command,c.close(c.result)},execute:function(e){c.result.action="EXECUTE",c.result.deliveryType=e!==d&&e,c.result.commandTemplate=_.clone(c.result.commandTemplate);var t=c.result.commandTemplate;t.text=t.command,c.close(c.result)},cancel:function(){c.newCommandTemplate?delete c.newCommandTemplate:c.dismiss()},save:function(){c.newCommandTemplate.deliveryTypes=_.keys(_.pickBy(c.commandDeliveryTypesSelected)),n.saveTemplate(c.newCommandTemplate).then(t.getResData).then(function(e){var t=_.pick(e,["id","name","category","command","text","deliveryTypes"]),r=_.find(u,{id:t.id});r?_.assign(r,t):u.unshift(t),f(c.result.commandTemplate=t),delete c.newCommandTemplate})},addNew:function(){c.newCommandTemplate={deviceType:m},c.commandDeliveryTypesSelected=_defineProperty({},d,!0)},hideAddButton:function(){return!!c.newCommandTemplate},edit:function(e){var t;t=_.isEmpty(e.deliveryTypes)?s:e.deliveryTypes;_.forEach(t,function(e){_.assign(c.commandDeliveryTypesSelected,_defineProperty({},e,!0))}),c.newCommandTemplate=e},remove:function(e){c.result.commandTemplate===e&&delete c.result.commandTemplate;n.removeTemplate(e).then(function(){_.pull(u,e)}).then(function(){o.success(i("Shell command template deleted."))})},isDeliveryTypeSupported:function(e,t){var r=_.get(t,"deliveryTypes");return _.isEmpty(r)||_.includes(r,e)},getExecuteButtonLabel:function(e){return e!==d?l.getString("Execute (via {{ deliveryType | translate }})",{deliveryType:e}):l.getString("Execute")},appendToEl:document.getElementsByClassName("modal"),getCommandPlaceholder:function(){return l.getString("e.g. {{ example }}",{example:"ls"})}}),(y=e.deviceId,r.detailCached(y).then(t.getResData).then(function(e){return m=_.concat(e.type,e.c8y_DeviceTypes||[]),n.getCommandTemplatesForDeviceType.apply(n,_toConsumableArray(m))})).then(p),n.canSendCommandsViaSMS().then(function(e){c.smsEnabled=e}),a.hasAnyRole(["ROLE_INVENTORY_ADMIN"]).then(function(e){c.canWrite=e})}e.$inject=["$routeParams","c8yBase","c8yDevices","c8yDeviceShell","c8yPermissions","c8yAlert","gettext","gettextCatalog"],angular.module("c8y.commandTemplates").controller("commandTemplatesCtrl",e)}();
@@ -1 +1 @@
1
- "use strict";function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})),n.forEach(function(t){_defineProperty(e,t,r[t])})}return e}function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}!function(){function t(a,u,o,i,n,t,e,c){var s=u.cleanFields,f="alarm/alarms",l="".concat(f,"/reports"),m={headers:u.contentHeaders("alarm")},r={WARNING:e("WARNING"),MINOR:e("MINOR"),MAJOR:e("MAJOR"),CRITICAL:e("CRITICAL")},p=[r.CRITICAL,r.MAJOR,r.MINOR,r.WARNING],g=_.keys(r),y={ACTIVE:e("ACTIVE"),ACKNOWLEDGED:e("ACKNOWLEDGED"),CLEARED:e("CLEARED")},h=_.keys(y),d=["id"],v=["id","self","creationTime","type","time","count","history","firstOccurence","firstOccurrenceTime"],E={},C="status",A={type:e("Type"),text:e("Text")};function D(t){var e=t.id||t;return u.url("".concat(f,"/").concat(e))}function O(t){var e=u.url(f),r=u.timeOrderFilter(u.pageSizeNoTotalFilter(t)),n={params:r},i=u.cleanListCallback("alarms",O,r);return a.get(e,n).then(i)}function w(t){var e=u.url(f),r=s(t,d);return a.post(e,r,m)}function N(t){var e=D(t),r=s(t,v);return a.put(e,r,m)}function T(e,t){return t?r(t):n.list({source:e.id,pageSize:1e3}).then(r);function r(t){var n="--";return e.status!==y.ACKNOWLEDGED||_.isEmpty(t)||(n=_.last(t).user),t.forEach(function(t){var e=t.changes||[],r=!1;if(e.forEach(function(t){if(t.attribute===C&&t.newValue===y.ACKNOWLEDGED)return!(r=!0)}),r)return n=t.user||n,!1}),n}}function b(t,e){function r(t){var e=t||[],n=e.length?e[e.length-1].creationTime:void 0;return e.forEach(function(e){var t=e.changes||[],r=!1;if(t.forEach(function(t){if(t.attribute===C&&t.newValue===y.ACKNOWLEDGED)return n=e.creationTime,!(r=!0)}),r)return!1}),n}return e?r(e):n.list({source:t.id,pageSize:1e3}).then(r)}function L(t,e){var r=R(t,e);return r.humanize?r.humanize():r.then(function(t){return t.humanize?t.humanize():""})}function R(o,t){function e(t){var e=t||[],r=o.creationTime,n=e.length?e[e.length-1].creationTime:void 0,i="";if(_.forEach(e,function(e){var t=e.changes||[],r=!1;if(t.forEach(function(t){if(t.attribute===C&&t.newValue===y.CLEARED)return n=e.creationTime,!(r=!0)}),r)return!1}),r&&n){var a=moment(r),u=moment(n);i=moment.duration(a.diff(u))}return i}return t?e(t):n.list({source:o.id,pageSize:1e3}).then(e)}function I(t,e){var r=[l,t];return e.id&&r.push(e.id),u.url(r.join("/"))}function S(t){var r=_.memoize(t,function(t,e){return[t.id,t.status,t.count,e&&e.length].join(":")});return function(t,e){return r(t,e)}}function k(t,e){var r=i.when(T(t,e)),n=i.when(b(t,e));return i.all([r,n]).then(function(t){return c.getString("ACKNOWLEDGED`alarm` by: {{ackBy}} {{ackTimeFromNow}}",{ackBy:t[0],ackTimeFromNow:moment(t[1]).fromNow()})})}function W(t,e){return i.when(L(t,e)).then(function(t){return c.getString("CLEARED`alarm`: was active for {{alarmDuration}}",{alarmDuration:t})})}function j(t){return i.when(c.getString("ACTIVE`alarm`: triggered {{alarmTimeFromNow}}",{alarmTimeFromNow:moment(t.time).fromNow()}))}E[r.WARNING]="circle",E[r.MINOR]="high-priority",E[r.MAJOR]="warning",E[r.CRITICAL]="exclamation-circle",E[y.CLEARED]="c8y-alert-idle",E[y.ACKNOWLEDGED]="bell-slash",E[y.ACTIVE]="bell";var G={list:O,listByStatus:function(t,e){var r=_.compact(_.map(t,function(t,e){return t?e:void 0})),n=_.map(r,function(t){return O(_objectSpread({},e,{status:t}))});return i.all(n).then(u.combineLists)},listByDevices:function(t,e){return i.all(_.map(t,function(t){return e.source=t,O(e)})).then(u.combineLists)},getSeverityCount:function(t,e){return _.filter(t,{severity:e}).length},detail:function(t){var e=D(t);return a.get(e)},update:N,updateBulk:function(t,e){var r=u.url(f);return a.put(r,e,{params:t})},create:w,save:function(t){return t.id?N(t):w(t)},acknowledgedBy:S(T),ackTime:S(b),alarmDuration:S(L),alarmDurationDiff:S(R),severity:r,severityList:g,getHighestSeverityFromAlarmsStatus:function(e){var t=_.map(p,function(t){return{severity:t,count:_.get(e,_.toLower(t),0)}}),r=_.find(t,function(t){return 0<t.count});return _.get(r,"severity",null)},status:y,statusList:h,statusText:S(function(t,e){var r;switch((t.status||"").toUpperCase()){case y.ACKNOWLEDGED:r=k;break;case y.CLEARED:r=W;break;case y.ACTIVE:r=j}return r&&r(t,e)}),icon:function(t){var e=(_.isObjectLike(t)?t.severity:t).toUpperCase();return E[e]},reports:{downtimeDuration:function(t){var e=u.timeOrderFilter(t),r=I("downtimeDuration",e),n={params:e};return a.get(r,n)},downtimeDurationAggregation:function(t){var e=u.timeOrderFilter(t),r=I("downtimeDuration/aggregation",e),n={params:e};return a.get(r,n)}},getDisplayCount:function(t){var e=u.url("".concat(f,"/count")),r={params:t};return a.get(e,r).then(u.getResData).then(function(t){return 99<t?"99+":t})},createCounter:function(t){var e=_.get(t,"source"),r="/alarms/".concat(e||"*"),n=new o.Counter(O,r);if(t){var i=[o.defaultPropertyMaps.date,o.defaultPropertyMaps.source];if(t.type){var a=t.type;i.push([function(t){return a===t.type}])}delete t.type,n.filter(t,i)}return n}};return t.enhanceWithKeysUtil({target:G,reservedKeys:["history","id","severity","self","source","creationTime","time","text","firstOccurrence","count","firstOccurrenceTime","status"],standardKeys:A})}t.$inject=["$http","c8yBase","c8yCounter","$q","c8yAudits","c8yUtil","gettext","gettextCatalog"],angular.module("c8y.core").factory("c8yAlarms",t)}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})),n.forEach(function(t){_defineProperty(e,t,r[t])})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);var n=r.call(t,e||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(o,a,u,i,n,t,e,c){var s=a.cleanFields,f="alarm/alarms",l="".concat(f,"/reports"),m={headers:a.contentHeaders("alarm")},r={WARNING:e("WARNING"),MINOR:e("MINOR"),MAJOR:e("MAJOR"),CRITICAL:e("CRITICAL")},y=[r.CRITICAL,r.MAJOR,r.MINOR,r.WARNING],p=_.keys(r),v={ACTIVE:e("ACTIVE"),ACKNOWLEDGED:e("ACKNOWLEDGED"),CLEARED:e("CLEARED")},g=_.keys(v),h=["id"],d=["id","self","creationTime","type","time","count","history","firstOccurence","firstOccurrenceTime"],E={},b="status",C={type:e("Type"),text:e("Text")};function A(t){var e=t.id||t;return a.url("".concat(f,"/").concat(e))}function D(t){var e=a.url(f),r=a.timeOrderFilter(a.pageSizeNoTotalFilter(t)),n={params:r},i=a.cleanListCallback("alarms",D,r);return o.get(e,n).then(i)}function O(t){var e=a.url(f),r=s(t,h);return o.post(e,r,m)}function w(t){var e=A(t),r=s(t,d);return o.put(e,r,m)}function N(e,t){return t?r(t):n.list({source:e.id,pageSize:1e3}).then(r);function r(t){var n="--";return e.status!==v.ACKNOWLEDGED||_.isEmpty(t)||(n=_.last(t).user),t.forEach(function(t){var e=t.changes||[],r=!1;if(e.forEach(function(t){if(t.attribute===b&&t.newValue===v.ACKNOWLEDGED)return!(r=!0)}),r)return n=t.user||n,!1}),n}}function T(t,e){function r(t){var e=t||[],n=e.length?e[e.length-1].creationTime:void 0;return e.forEach(function(e){var t=e.changes||[],r=!1;if(t.forEach(function(t){if(t.attribute===b&&t.newValue===v.ACKNOWLEDGED)return n=e.creationTime,!(r=!0)}),r)return!1}),n}return e?r(e):n.list({source:t.id,pageSize:1e3}).then(r)}function L(t,e){var r=R(t,e);return r.humanize?r.humanize():r.then(function(t){return t.humanize?t.humanize():""})}function R(u,t){function e(t){var e=t||[],r=u.creationTime,n=e.length?e[e.length-1].creationTime:void 0,i="";if(_.forEach(e,function(e){var t=e.changes||[],r=!1;if(t.forEach(function(t){if(t.attribute===b&&t.newValue===v.CLEARED)return n=e.creationTime,!(r=!0)}),r)return!1}),r&&n){var o=moment(r),a=moment(n);i=moment.duration(o.diff(a))}return i}return t?e(t):n.list({source:u.id,pageSize:1e3}).then(e)}function S(t,e){var r=[l,t];return e.id&&r.push(e.id),a.url(r.join("/"))}function I(t){var r=_.memoize(t,function(t,e){return[t.id,t.status,t.count,e&&e.length].join(":")});return function(t,e){return r(t,e)}}function j(t,e){var r=i.when(N(t,e)),n=i.when(T(t,e));return i.all([r,n]).then(function(t){return c.getString("ACKNOWLEDGED`alarm` by: {{ackBy}} {{ackTimeFromNow}}",{ackBy:t[0],ackTimeFromNow:moment(t[1]).fromNow()})})}function k(t,e){return i.when(L(t,e)).then(function(t){return c.getString("CLEARED`alarm`: was active for {{alarmDuration}}",{alarmDuration:t})})}function P(t){return i.when(c.getString("ACTIVE`alarm`: triggered {{alarmTimeFromNow}}",{alarmTimeFromNow:moment(t.time).fromNow()}))}E[r.WARNING]="circle",E[r.MINOR]="high-priority",E[r.MAJOR]="warning",E[r.CRITICAL]="exclamation-circle",E[v.CLEARED]="c8y-alert-idle",E[v.ACKNOWLEDGED]="bell-slash",E[v.ACTIVE]="bell";var K={list:D,listByStatus:function(t,e){var r=_.compact(_.map(t,function(t,e){return t?e:void 0})),n=_.map(r,function(t){return D(_objectSpread({},e,{status:t}))});return i.all(n).then(a.combineLists)},listByDevices:function(t,e){return i.all(_.map(t,function(t){return e.source=t,D(e)})).then(a.combineLists)},getSeverityCount:function(t,e){return _.filter(t,{severity:e}).length},detail:function(t){var e=A(t);return o.get(e)},update:w,updateBulk:function(t,e){var r=a.url(f);return o.put(r,e,{params:t})},create:O,save:function(t){return t.id?w(t):O(t)},acknowledgedBy:I(N),ackTime:I(T),alarmDuration:I(L),alarmDurationDiff:I(R),severity:r,severityList:p,getHighestSeverityFromAlarmsStatus:function(e){var t=_.map(y,function(t){return{severity:t,count:_.get(e,_.toLower(t),0)}}),r=_.find(t,function(t){return 0<t.count});return _.get(r,"severity",null)},status:v,statusList:g,statusText:I(function(t,e){var r;switch((t.status||"").toUpperCase()){case v.ACKNOWLEDGED:r=j;break;case v.CLEARED:r=k;break;case v.ACTIVE:r=P}return r&&r(t,e)}),icon:function(t){var e=(_.isObjectLike(t)?t.severity:t).toUpperCase();return E[e]},reports:{downtimeDuration:function(t){var e=a.timeOrderFilter(t),r=S("downtimeDuration",e),n={params:e};return o.get(r,n)},downtimeDurationAggregation:function(t){var e=a.timeOrderFilter(t),r=S("downtimeDuration/aggregation",e),n={params:e};return o.get(r,n)}},getDisplayCount:function(t){var e=a.url("".concat(f,"/count")),r={params:t};return o.get(e,r).then(a.getResData).then(function(t){return 99<t?"99+":t})},createCounter:function(t){var e=_.get(t,"source"),r="/alarms/".concat(e||"*"),n=new u.Counter(D,r);if(t){var i=[u.defaultPropertyMaps.date,u.defaultPropertyMaps.source];if(t.type){var o=t.type;i.push([function(t){return o===t.type}])}delete t.type,n.filter(t,i)}return n}};return t.enhanceWithKeysUtil({target:K,reservedKeys:["history","id","severity","self","source","creationTime","time","text","firstOccurrence","count","firstOccurrenceTime","status"],standardKeys:C})}t.$inject=["$http","c8yBase","c8yCounter","$q","c8yAudits","c8yUtil","gettext","gettextCatalog"],angular.module("c8y.core").factory("c8yAlarms",t)}();
@@ -1 +1 @@
1
- "use strict";function _objectSpread(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.forEach(function(t){_defineProperty(n,t,e[t])})}return n}function _defineProperty(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}!function(){function t(c,u,e,p,o,t,s,l,n,f,r,g,h,d,i,m){var v,a=i("humanizeAppName"),y="application/",S="".concat(y,"applications"),E={headers:f.contentHeaders("application",!0)},A=this,b={HOSTED:"cloud",EXTERNAL:"external-link",SMARTAPP:"puzzle-piece",MICROSERVICE:"microchip",APAMA_CEP_RULE:"file-code-o"},O=["HOSTED","EXTERNAL","REPOSITORY"],P=["HOSTED","EXTERNAL","REPOSITORY"],x={HOSTED:d("Hosted application"),REPOSITORY:d("Repository"),EXTERNAL:d("External application"),MICROSERVICE:d("Microservice"),APAMA_CEP_RULE:d("Apama CEP rule")},D=f.createEnum([{name:"UP",label:d("Up"),value:"Up",icon:"check-circle text-success"},{name:"DOWN",label:d("Down"),value:"Down",icon:"warning status critical"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealth",icon:"exclamation-circle status major"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealthy",icon:"exclamation-circle status major"}]),R=1e3,C=10;try{v=n.get("gettextCatalog")}catch(t){v={getString:_.identity}}function T(c,o){return r.current().then(function(t){var n=t.tenant,e=f.pageSizeFilter(o),r={params:e},i="".concat(f.url(c),"/").concat(n),a=f.cleanListCallback("applications",angular.bind(A,T,c),e);return u.get(i,r).then(a).then(rt).then(j)})}function w(t){var n=t.desired,e=t.active;return{active:e,unhealthy:function(t,n){return _.isNumber(n)?t-n:t}(n,e),desired:n}}function M(c,o){return r.current().then(function(t){var n=c||t,e=f.pageSizeFilter(o),r={params:_.defaults(e,{noPaging:!0,dropOverwrittenApps:!0})},i=f.url("".concat(y,"applicationsByUser/").concat(encodeURIComponent(n.id))),a=f.cleanListCallback("applications",angular.bind(A,M,n),e);return u.get(i,r).then(a).then(rt).then(j)})}function j(t){var n=_.sortBy(t,[function(t){return a(t)}]);return _.assign(n,_.pick(t,["statistics","paging"])),n}function L(t){return T("".concat(y,"applicationsByTenant"),t)}function U(t){var n=f.url("".concat(S,"/").concat(t.contextPath,"/manifest")),e={params:f.pageSizeNoTotalFilter()};return u.get(n,e).then(function(t){return _.map(t.data.imports,N)})}function k(t){var n=k.cache,e=t.id||t,r=f.url("".concat(S,"/").concat(e,"/binaries/plugins")),i={params:f.pageSizeNoTotalFilter()};function a(){delete n[e]}return n[e]||(n[e]=s(_.noop,2e3).then(function(){return u.get(r,i).then(f.getResData).finally(a)})),n[e]}function N(t){return{id:t.id,contextPath:t.rootContextPath,directoryName:t.directoryName,manifest:t}}function I(t){var n=t.id||t;return f.url("".concat(S,"/").concat(n))}function B(t){var n=I(t);return u.get(n)}function H(n,t){var e=I(n),r=function(t){var n=_.cloneDeep(t);return delete n.type,n}(n),i=_.defaults(t||{},E),a=u.put(e,r,i).finally(function(){o.localStorage.setItem("refresh",n.contextPath)});return a.then(function(t){c.$emit("c8yApplication:update",{app:n,res:t})}),a}function F(n,t){var e=f.url(S),r=_.defaults(t||{},E),i=u.post(e,n,r);return i.then(function(t){return c.$emit("c8yApplication:create",{app:n,res:t})}).catch(function(){l.error("Could not emit c8yApplication:create for:",{app:n})}),i}function $(t,n){return t.id?H(t,n):F(t,n)}function z(i){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0,c=C,o=n||p.defer(),u=t||0,e=0===u?"":"-".concat(u);return $(function(t,n){var e=function(t){return"".concat(t).concat(n)};return _objectSpread({},t,{name:e(t.name),key:e(t.key),contextPath:e(t.contextPath)})}(i,e),_objectSpread({silentError:!0},a)).then(function(t){o.resolve(f.getResData(t))},function(t){if(409===t.status&&u<c)z(i,a,u+1,o);else{var n=_.get(t,"data.message")||_.get(t,"data.details.exceptionMessage"),e=n?v.getString(n):d("Could not create application."),r=t.data;o.reject({errorMessage:e,errorDetails:r})}}),o.promise}function Y(r){var t=B(r).then(f.getResData);return p.all({appDetails:t,appPlugins:t.then(k).then(q),appManifest:t.then(J),appIndex:t.then(K)}).then(function(t){t.appDetails;var n=t.appPlugins,e=t.appManifest,r=t.appIndex,i=function(n,t){return _(t.imports).map(function(t){return _.find(n,{pluginName:t})}).compact().concat(n).uniq().value()}(n,e);return p.all({newAppManifest:function(t,n){var e=_.cloneDeep(n);return e.imports=_.map(t,"pluginName"),e}(i,e),newAppIndex:function(t,n,e){var r=e;return r=function(t,n,e){var r=e,i=_(n).map(function(t){var n=_.get(t,"pluginPackage.css",[]);return!!(n=n.length?n:_.get(t,"pluginPackage.less",[])).length&&"".concat(t.pluginName,"/style.css")}).filter(_.identity).value(),a=_.flattenDeep(["\x3c!--MODULES_CSS--\x3e",_.map(i.slice(0,1),function(t){return'<link rel="stylesheet" href="'.concat(t,'"></link>')}),"\x3c!--/MODULES_CSS--\x3e"]).join("\n"),c=_.flattenDeep(["\x3c!--MODULES_CSS_DEFER--\x3e","<script>",["[",'"'.concat(i.slice(1).join('", "'),'"'),"].forEach(function(f){loadCSS(f)})"].join(""),"<\/script>","\x3c!--/MODULES_CSS_DEFER--\x3e"]).join("\n");return r=(r=r.replace(new RegExp("\x3c!--MODULES_CSS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS--\x3e","gm"),a)).replace(new RegExp("\x3c!--MODULES_CSS_DEFER--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS_DEFER--\x3e","gm"),c)}(0,n,r),r=function(t,n,e){var r=_.flattenDeep(["\x3c!--MODULES_JS--\x3e",_(n).map(function(t){var n=_.get(t,"pluginPackage.js",[]);return!!n.length&&"".concat(t.pluginName,"/main.js")}).filter(_.identity).map(function(t){return'<script defer src="'.concat(t,'"><\/script>')}).value(),"\x3c!--/MODULES_JS--\x3e"]).join("\n");return e.replace(new RegExp("\x3c!--MODULES_JS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_JS--\x3e","gm"),r)}(0,n,r),r=function(t,n,e){var r=['C8Y_NG_MODULES=["',_.uniq(_.flattenDeep(_.map(n,function(t){return _.get(t,"pluginPackage.ngModules",[])}))).join('","'),'"];'].join("");return e.replace(new RegExp("C8Y_NG_MODULES=\\[(.|\\n|\\r)*?\\];","gm"),r)}(0,n,r)}(0,i,r)})}).then(function(t){var n=t.newAppManifest,e=t.newAppIndex;return X(r,[{path:"cumulocity.json",file:new Blob([JSON.stringify(n)],{type:"application/json"})},{path:"index.html",file:new Blob([e],{type:"text/html"})}])})}function q(t){var n=[],e=_.sortBy(t,function(t){return-1*_.get(t,"pluginPackage.priority",0)});return _.forEach(e,function(t){!function e(t,r,i){var n=V(r,_.get(t,"pluginPackage.contextPath"));if(n)return;var a=_.get(t,"pluginPackage.imports",[]);_.forEach(a,function(t){var n=V(i,t);n?e(n,r,i):l.error("Plugin with context path ".concat(t," is missing."))});r.push(t)}(t,n,e)}),n}function V(t,n){var e=function(t){var n=t;(function(t){return/^core\//.test(t)||/^administration\//.test(t)||/^devicemanagement\//.test(t)||/^cockpit\//.test(t)||/^platformadmin\//.test(t)||/^fieldbus4\//.test(t)||/^fieldbus3\//.test(t)||/^fieldbus2\//.test(t)||/^fieldbus\//.test(t)||/^demoboard\//.test(t)||/^vendme_plugins\//.test(t)})(n)&&(n=n.replace(/\//g,"_"));return n}(n);return _.find(t,function(t){return t&&t.pluginPackage&&t.pluginPackage.contextPath===e})}function J(t){var n="".concat(W(t),"/cumulocity.json");return u.get(n).then(f.getResData)}function K(t){var n="".concat(W(t),"/index.html");return u.get(n).then(f.getResData)}function W(t){return f.url("apps/".concat(t.contextPath))}function X(t,n){var e="".concat(I(t),"/binaries/files"),r=new FormData;return _.forEach(n,function(t){r.append(t.path,new File([t.file],t.path))}),u.post(e,r,{transformRequest:_.identity,headers:{"Content-Type":void 0}})}function G(){var t=o.location.pathname.match(/\/apps\/(public\/){0,1}(.+?)(\/|\?|#|$)/);return t&&t[2]}function Q(){var t=o.location.pathname.match(/\/apps\/(public\/([^/]+)|([^/]+))/);return t&&-1!==t[1].indexOf("public")}function Z(){var e=G(),r=!!Q();function n(t){var n="MARKET"===t.availability;return t.contextPath===e&&(!r||n)}return M(null,{dropOverwrittenApps:!1}).then(function(t){return _.find(t,n)})}function tt(n){return g.list({type:"c8y_SmartAppApplication"}).then(function(t){return _.find(t,{appId:n.id})||null})}function nt(t){var n;return(t?p.resolve(t):Z()).then(function(t){return n=t}).then(tt).then(function(t){return n.config=t,n})}function et(t){return _(t).uniq("id").filter(function(t){var n=t.manifest,e=!1;return n&&(e=n.noAppSwitcher),!e&&_.includes(["HOSTED","EXTERNAL"],t.type)}).value()}function rt(t){var n=_.reject(t,function(t){return"management"===t.name&&"management"===t.owner.tenant.id});return _.assign(n,_.pick(t,_.filter(_.keys(t),function(t){return _.isNaN(_.toNumber(t))}))),n}function it(t,n){var e=_.isString(n)?function(n){return function(t){return t.name===n||t.contextPath===n||t.key===n}}(n):n;return _.some(t,e)}function at(t){return"HOSTED"===t.type||"REPOSITORY"===t.type}function ct(){if(ct.cache)return ct.cache;function n(t){return{url:t,noAppKey:!0}}return u(n([f.url(S),(Q()?"public/":"")+G(),"manifest"].join("/"))).then(function(t){return u(n([f.url(S),t.data.application.id].join("/")))}).then(f.getResData).then(function(t){return ct.cache=p.when(t)})}return d("Administration"),d("Cockpit"),d("Device management"),d("Fieldbus4"),d("Streaming Analytics"),k.cache={},f.getFlag("test")&&(ct.cache=p.when({name:"app",manifest:{}})),{list:L,listByUser:M,listByTenant:L,listByOwner:function(t){return T("".concat(y,"applicationsByOwner"),t)},listPlugins:function(){var t=f.url("".concat(y,"plugins")),n={params:{pageSize:R}};return u.get(t,n).then(function(t){return _.uniqBy(t.data.plugins,"id")})},listPluginsByTenant:function(){return L().then(function(t){var n=_.uniqBy(t,"id"),e=[];return _.forEach(n,function(t){at(t)&&e.push(U(t))}),p.all(e).then(_.flattenDeep).then(function(t){return _.uniqBy(t,"id")})})},listPluginsByApplication:U,listPluginsByPaasApp:k,listByVisibleLinks:function(){return M().then(et).then(function(t){return p.when(t)})},listApplications:function t(n){var e=f.url("".concat(S)),r={params:f.pageSizeFilter(n)},i=f.cleanListCallback("applications",t,n);return u.get(e,r).then(i).then(j)},getApplicationMO:function(t){var n="c8y_Application_".concat(t);return g.list({type:n}).then(function(t){return _.head(t)})},getApplicationMOs:function(t){var n=t||{},e=n.tenantId,r=n.filters,i=void 0===r?{}:r,a={type:"c8y_Application_*"};return e&&(a=m.addAndFilter(a,{__has:"c8y_Subscriptions.".concat(e)})),g.listQuery(a,i,!0)},getInstanceCounts:w,getSubscriptionsList:function(t){var n=_.get(t,"c8y_Subscriptions");return _.reduce(n,function(t,n,e){var r=_.get(n,"details"),i=_.get(n,"status"),a=w(r);return t.concat(_objectSpread({},a,{tenantName:e,status:i}))},[])},getApplicationStatusForTenant:function(t,n){return _.get(t,["c8y_Subscriptions",n])},status:D,isAvailable:function(n){return M().then(function(t){return it(t,n)})},areAllAvailable:function(t){return M().then(function(n){return _.every(t,function(t){return it(n,t)})})},isAnyAvailable:function(t){return M().then(function(n){return _.some(t,function(t){return it(n,t)})})},detail:B,update:H,create:F,remove:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=I(e),r=nt(_.isObjectLike(e)?e:{id:e}).then(function(t){return!_.get(t,"config.id")||g.remove(t.config)}),i=u.delete(n,{params:t}),a=p.all({cfg:r,res:i});return a.then(function(t){var n=t.res;c.$emit("c8yApplication:delete",{app:e,res:n})}),a},save:$,trySave:z,clone:function(t,n){var e="".concat(I(t),"/clone");return u.post(e).then(f.getResData).then(function(t){return _.isObjectLike(n)?(_.assign(t,n),z(t).then(f.getResData)):t})},getHref:function(t){return at(t)?function(t){var n=e.port();return n=80===n||443===n?"":":".concat(n),"".concat(e.protocol(),"://").concat(e.host()).concat(n,"/apps/").concat(t.public?"public/":"").concat(t.contextPath)}(t):t.externalUrl},isHosted:function(t){return"HOSTED"===t.type},isApamaCepRule:function(t){return"APAMA_CEP_RULE"===_.get(t,"type")},isMicroserviceWithManifest:function(n){return g.list({type:"c8y_microservice_manifest_".concat(n.id)}).then(function(t){return"MICROSERVICE"===n.type&&0<t.length})},canOpenInBrowser:function(t){return(_.isObjectLike(t)?p.resolve(t):B(t).then(f.getResData)).then(function(t){var n=!t.name.match(/feature-/),e=_.includes(O,t.type);return n&&e})},canAddPlugin:function(t){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),(_.isObjectLike(t)?p.resolve(t):B(t).then(function(t){return t.data})).then(function(t){return!_.isEmpty(t.manifest)&&_.includes(P,_.get(t,"type"))})},icon:function(t){var n=_.isString(t)?t:t.type;return t.manifest&&"MICROSERVICE"!==n&&(n="SMARTAPP"),b[n]},typeLabel:function(t){var n=_.isString(t)?t:t.type;return x[n]},getCurrent:Z,getConfig:nt,pollRefreshMessages:function(){t(function(){!function(t){o.localStorage.getItem("refresh")===G()&&(o.localStorage.setItem("refresh",void 0),t||o.location.reload())}()},1e3,0,!1)},getCurrentContextPath:G,updateManifest:function(t,e){return B(t).then(function(t){var n=t.data;return n.manifest=e,n}).then(H)},listArchives:function(t,n){var e="".concat(I(t),"/binaries"),r={params:f.pageSizeNoTotalFilter(n),silentError:!0};return u.get(e,r).then(f.getResData)},uploadArchive:function(t,n){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r={url:"".concat(I(t),"/binaries"),method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:n,fileName:function(t){return t.replace(/\s+/g,"_")}(n.name)};return _.assign(r,e),h.upload(r)},deleteArchive:function(t,n){var e=n.id||n,r=[I(t),"binaries",e].join("/");return u.delete(r)},setActiveArchive:function(t,n){return $({id:t.id,activeVersionId:n.id})},addPaasAppPlugin:function(t,n){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var e=function(t){var n=t.name.split(".");return n.pop(),n.join(".")}(n),r="".concat(I(t),"/binaries/plugins/").concat(e),i=h.upload({url:r,method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:n}),a=i.then(_.partial(Y,t));return a.progress=i.progress,a},removePaasAppPlugin:function(t,n){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var e=n.pluginName||n,r="".concat(I(t),"/binaries/plugins/").concat(e);return u.delete(r).then(_.partial(Y,t))},uploadPaasAppFiles:X,getPaasAppManifest:J,refreshPaasApp:Y,refreshHostedApp:function(t){var n="".concat(I(t),"/refresh");return u.post(n)},isPaasApp:function(t){return J(t).then(function(t){return t._webpaas},function(){return!1})},convertType:function(t){var n=_.cloneDeep(t);return void 0===n.type||(n.type=function(t){return"HOSTED"===t.type&&t.resourcesUrl&&"/"!==t.resourcesUrl.charAt(0)}(n)?"REPOSITORY":n.type),n},revertType:function(t){var n=_.cloneDeep(t);return"HOSTED"===n.type&&(n.resourcesUrl="/"),"REPOSITORY"===n.type&&(n.type="HOSTED"),n},parseAppName:function(t){return t&&"devicemanagement"===t.toLowerCase()?"Device management":t||"Cumulocity"},currentAppCached:ct,sortApps:j,isAppOnTheList:it}}t.$inject=["$rootScope","$http","$location","$q","$window","$interval","$timeout","$log","$injector","c8yBase","c8yUser","c8yInventory","$upload","gettext","$filter","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yApplication",t)}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),r.forEach(function(t){_defineProperty(e,t,n[t])})}return e}function _defineProperty(t,e,n){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);var r=n.call(t,e||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(c,u,n,p,o,t,s,l,e,f,r,g,h,d,i,m){var v,a=i("humanizeAppName"),y="application/",S="".concat(y,"applications"),E={headers:f.contentHeaders("application",!0)},b=this,A={HOSTED:"cloud",EXTERNAL:"external-link",SMARTAPP:"puzzle-piece",MICROSERVICE:"microchip",APAMA_CEP_RULE:"file-code-o"},P=["HOSTED","EXTERNAL","REPOSITORY"],O=["HOSTED","EXTERNAL","REPOSITORY"],x={HOSTED:d("Hosted application"),REPOSITORY:d("Repository"),EXTERNAL:d("External application"),MICROSERVICE:d("Microservice"),APAMA_CEP_RULE:d("Apama CEP rule")},D=f.createEnum([{name:"UP",label:d("Up"),value:"Up",icon:"check-circle text-success"},{name:"DOWN",label:d("Down"),value:"Down",icon:"warning status critical"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealth",icon:"exclamation-circle status major"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealthy",icon:"exclamation-circle status major"}]),R=1e3,C=10;try{v=e.get("gettextCatalog")}catch(t){v={getString:_.identity}}function T(c,o){return r.current().then(function(t){var e=t.tenant,n=f.pageSizeFilter(o),r={params:n},i="".concat(f.url(c),"/").concat(e),a=f.cleanListCallback("applications",angular.bind(b,T,c),n);return u.get(i,r).then(a).then(rt).then(M)})}function w(t){var e=t.desired,n=t.active;return{active:n,unhealthy:function(t,e){return _.isNumber(e)?t-e:t}(e,n),desired:e}}function j(c,o){return r.current().then(function(t){var e=c||t,n=f.pageSizeFilter(o),r={params:_.defaults(n,{noPaging:!0,dropOverwrittenApps:!0})},i=f.url("".concat(y,"applicationsByUser/").concat(encodeURIComponent(e.id))),a=f.cleanListCallback("applications",angular.bind(b,j,e),n);return u.get(i,r).then(a).then(rt).then(M)})}function M(t){var e=_.sortBy(t,[function(t){return a(t)}]);return _.assign(e,_.pick(t,["statistics","paging"])),e}function L(t){return T("".concat(y,"applicationsByTenant"),t)}function U(t){var e=f.url("".concat(S,"/").concat(t.contextPath,"/manifest")),n={params:f.pageSizeNoTotalFilter()};return u.get(e,n).then(function(t){return _.map(t.data.imports,N)})}function k(t){var e=k.cache,n=t.id||t,r=f.url("".concat(S,"/").concat(n,"/binaries/plugins")),i={params:f.pageSizeNoTotalFilter()};function a(){delete e[n]}return e[n]||(e[n]=s(_.noop,2e3).then(function(){return u.get(r,i).then(f.getResData).finally(a)})),e[n]}function N(t){return{id:t.id,contextPath:t.rootContextPath,directoryName:t.directoryName,manifest:t}}function I(t){var e=t.id||t;return f.url("".concat(S,"/").concat(e))}function B(t){var e=I(t);return u.get(e)}function H(e,t){var n=I(e),r=function(t){var e=_.cloneDeep(t);return delete e.type,e}(e),i=_.defaults(t||{},E),a=u.put(n,r,i).finally(function(){o.localStorage.setItem("refresh",e.contextPath)});return a.then(function(t){c.$emit("c8yApplication:update",{app:e,res:t})}),a}function F(e,t){var n=f.url(S),r=_.defaults(t||{},E),i=u.post(n,e,r);return i.then(function(t){return c.$emit("c8yApplication:create",{app:e,res:t})}).catch(function(){l.error("Could not emit c8yApplication:create for:",{app:e})}),i}function $(t,e){return t.id?H(t,e):F(t,e)}function z(i){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length?arguments[2]:void 0,e=3<arguments.length?arguments[3]:void 0,c=C,o=e||p.defer(),u=t||0,n=0===u?"":"-".concat(u);return $(function(t,e){var n=function(t){return"".concat(t).concat(e)};return _objectSpread({},t,{name:n(t.name),key:n(t.key),contextPath:n(t.contextPath)})}(i,n),_objectSpread({silentError:!0},a)).then(function(t){o.resolve(f.getResData(t))},function(t){if(409===t.status&&u<c)z(i,a,u+1,o);else{var e=_.get(t,"data.message")||_.get(t,"data.details.exceptionMessage"),n=e?v.getString(e):d("Could not create application."),r=t.data;o.reject({errorMessage:n,errorDetails:r})}}),o.promise}function Y(r){var t=B(r).then(f.getResData);return p.all({appDetails:t,appPlugins:t.then(k).then(q),appManifest:t.then(V),appIndex:t.then(J)}).then(function(t){t.appDetails;var e=t.appPlugins,n=t.appManifest,r=t.appIndex,i=function(e,t){return _(t.imports).map(function(t){return _.find(e,{pluginName:t})}).compact().concat(e).uniq().value()}(e,n);return p.all({newAppManifest:function(t,e){var n=_.cloneDeep(e);return n.imports=_.map(t,"pluginName"),n}(i,n),newAppIndex:function(t,e,n){var r=n;return r=function(t,e,n){var r=n,i=_(e).map(function(t){var e=_.get(t,"pluginPackage.css",[]);return!!(e=e.length?e:_.get(t,"pluginPackage.less",[])).length&&"".concat(t.pluginName,"/style.css")}).filter(_.identity).value(),a=_.flattenDeep(["\x3c!--MODULES_CSS--\x3e",_.map(i.slice(0,1),function(t){return'<link rel="stylesheet" href="'.concat(t,'"></link>')}),"\x3c!--/MODULES_CSS--\x3e"]).join("\n"),c=_.flattenDeep(["\x3c!--MODULES_CSS_DEFER--\x3e","<script>",["[",'"'.concat(i.slice(1).join('", "'),'"'),"].forEach(function(f){loadCSS(f)})"].join(""),"<\/script>","\x3c!--/MODULES_CSS_DEFER--\x3e"]).join("\n");return r=(r=r.replace(new RegExp("\x3c!--MODULES_CSS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS--\x3e","gm"),a)).replace(new RegExp("\x3c!--MODULES_CSS_DEFER--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS_DEFER--\x3e","gm"),c)}(0,e,r),r=function(t,e,n){var r=_.flattenDeep(["\x3c!--MODULES_JS--\x3e",_(e).map(function(t){var e=_.get(t,"pluginPackage.js",[]);return!!e.length&&"".concat(t.pluginName,"/main.js")}).filter(_.identity).map(function(t){return'<script defer src="'.concat(t,'"><\/script>')}).value(),"\x3c!--/MODULES_JS--\x3e"]).join("\n");return n.replace(new RegExp("\x3c!--MODULES_JS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_JS--\x3e","gm"),r)}(0,e,r),r=function(t,e,n){var r=['C8Y_NG_MODULES=["',_.uniq(_.flattenDeep(_.map(e,function(t){return _.get(t,"pluginPackage.ngModules",[])}))).join('","'),'"];'].join("");return n.replace(new RegExp("C8Y_NG_MODULES=\\[(.|\\n|\\r)*?\\];","gm"),r)}(0,e,r)}(0,i,r)})}).then(function(t){var e=t.newAppManifest,n=t.newAppIndex;return X(r,[{path:"cumulocity.json",file:new Blob([JSON.stringify(e)],{type:"application/json"})},{path:"index.html",file:new Blob([n],{type:"text/html"})}])})}function q(t){var e=[],n=_.sortBy(t,function(t){return-1*_.get(t,"pluginPackage.priority",0)});return _.forEach(n,function(t){!function n(t,r,i){var e=K(r,_.get(t,"pluginPackage.contextPath"));if(e)return;var a=_.get(t,"pluginPackage.imports",[]);_.forEach(a,function(t){var e=K(i,t);e?n(e,r,i):l.error("Plugin with context path ".concat(t," is missing."))});r.push(t)}(t,e,n)}),e}function K(t,e){var n=function(t){var e=t;(function(t){return/^core\//.test(t)||/^administration\//.test(t)||/^devicemanagement\//.test(t)||/^cockpit\//.test(t)||/^platformadmin\//.test(t)||/^fieldbus4\//.test(t)||/^fieldbus3\//.test(t)||/^fieldbus2\//.test(t)||/^fieldbus\//.test(t)||/^demoboard\//.test(t)||/^vendme_plugins\//.test(t)})(e)&&(e=e.replace(/\//g,"_"));return e}(e);return _.find(t,function(t){return t&&t.pluginPackage&&t.pluginPackage.contextPath===n})}function V(t){var e="".concat(W(t),"/cumulocity.json");return u.get(e).then(f.getResData)}function J(t){var e="".concat(W(t),"/index.html");return u.get(e).then(f.getResData)}function W(t){return f.url("apps/".concat(t.contextPath))}function X(t,e){var n="".concat(I(t),"/binaries/files"),r=new FormData;return _.forEach(e,function(t){r.append(t.path,new File([t.file],t.path))}),u.post(n,r,{transformRequest:_.identity,headers:{"Content-Type":void 0}})}function G(){var t=o.location.pathname.match(/\/apps\/(public\/){0,1}(.+?)(\/|\?|#|$)/);return t&&t[2]}function Q(){var t=o.location.pathname.match(/\/apps\/(public\/([^/]+)|([^/]+))/);return t&&-1!==t[1].indexOf("public")}function Z(){var n=G(),r=!!Q();function e(t){var e="MARKET"===t.availability;return t.contextPath===n&&(!r||e)}return j(null,{dropOverwrittenApps:!1}).then(function(t){return _.find(t,e)})}function tt(e){return g.list({type:"c8y_SmartAppApplication"}).then(function(t){return _.find(t,{appId:e.id})||null})}function et(t){var e;return(t?p.resolve(t):Z()).then(function(t){return e=t}).then(tt).then(function(t){return e.config=t,e})}function nt(t){return _(t).uniq("id").filter(function(t){var e=t.manifest,n=!1;return e&&(n=e.noAppSwitcher),!n&&_.includes(["HOSTED","EXTERNAL"],t.type)}).value()}function rt(t){var e=_.reject(t,function(t){return"management"===t.name&&"management"===t.owner.tenant.id});return _.assign(e,_.pick(t,_.filter(_.keys(t),function(t){return _.isNaN(_.toNumber(t))}))),e}function it(t,e){var n=_.isString(e)?function(e){return function(t){return t.name===e||t.contextPath===e||t.key===e}}(e):e;return _.some(t,n)}function at(t){return"HOSTED"===t.type||"REPOSITORY"===t.type}function ct(){if(ct.cache)return ct.cache;function e(t){return{url:t,noAppKey:!0}}return u(e([f.url(S),(Q()?"public/":"")+G(),"manifest"].join("/"))).then(function(t){return u(e([f.url(S),t.data.application.id].join("/")))}).then(f.getResData).then(function(t){return ct.cache=p.when(t)})}return d("Administration"),d("Cockpit"),d("Device management"),d("Fieldbus4"),d("Streaming Analytics"),k.cache={},f.getFlag("test")&&(ct.cache=p.when({name:"app",manifest:{}})),{list:L,listByUser:j,listByTenant:L,listByOwner:function(t){return T("".concat(y,"applicationsByOwner"),t)},listPlugins:function(){var t=f.url("".concat(y,"plugins")),e={params:{pageSize:R}};return u.get(t,e).then(function(t){return _.uniqBy(t.data.plugins,"id")})},listPluginsByTenant:function(){return L().then(function(t){var e=_.uniqBy(t,"id"),n=[];return _.forEach(e,function(t){at(t)&&n.push(U(t))}),p.all(n).then(_.flattenDeep).then(function(t){return _.uniqBy(t,"id")})})},listPluginsByApplication:U,listPluginsByPaasApp:k,listByVisibleLinks:function(){return j().then(nt).then(function(t){return p.when(t)})},listApplications:function t(e){var n=f.url("".concat(S)),r={params:f.pageSizeFilter(e)},i=f.cleanListCallback("applications",t,e);return u.get(n,r).then(i).then(M)},getApplicationMO:function(t){var e="c8y_Application_".concat(t);return g.list({type:e}).then(function(t){return _.head(t)})},getApplicationMOs:function(t){var e=t||{},n=e.tenantId,r=e.filters,i=void 0===r?{}:r,a={type:"c8y_Application_*"};return n&&(a=m.addAndFilter(a,{__has:"c8y_Subscriptions.".concat(n)})),g.listQuery(a,i,!0)},getInstanceCounts:w,getSubscriptionsList:function(t){var e=_.get(t,"c8y_Subscriptions");return _.reduce(e,function(t,e,n){var r=_.get(e,"details"),i=_.get(e,"status"),a=w(r);return t.concat(_objectSpread({},a,{tenantName:n,status:i}))},[])},getApplicationStatusForTenant:function(t,e){return _.get(t,["c8y_Subscriptions",e])},status:D,isAvailable:function(e){return j().then(function(t){return it(t,e)})},areAllAvailable:function(t){return j().then(function(e){return _.every(t,function(t){return it(e,t)})})},isAnyAvailable:function(t){return j().then(function(e){return _.some(t,function(t){return it(e,t)})})},detail:B,update:H,create:F,remove:function(n){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=I(n),r=et(_.isObjectLike(n)?n:{id:n}).then(function(t){return!_.get(t,"config.id")||g.remove(t.config)}),i=u.delete(e,{params:t}),a=p.all({cfg:r,res:i});return a.then(function(t){var e=t.res;c.$emit("c8yApplication:delete",{app:n,res:e})}),a},save:$,trySave:z,clone:function(t,e){var n="".concat(I(t),"/clone");return u.post(n).then(f.getResData).then(function(t){return _.isObjectLike(e)?(_.assign(t,e),z(t).then(f.getResData)):t})},getHref:function(t){return at(t)?function(t){var e=n.port();return e=80===e||443===e?"":":".concat(e),"".concat(n.protocol(),"://").concat(n.host()).concat(e,"/apps/").concat(t.public?"public/":"").concat(t.contextPath)}(t):t.externalUrl},isHosted:function(t){return"HOSTED"===t.type},isApamaCepRule:function(t){return"APAMA_CEP_RULE"===_.get(t,"type")},isMicroserviceWithManifest:function(e){return g.list({type:"c8y_microservice_manifest_".concat(e.id)}).then(function(t){return"MICROSERVICE"===e.type&&0<t.length})},canOpenInBrowser:function(t){return(_.isObjectLike(t)?p.resolve(t):B(t).then(f.getResData)).then(function(t){var e=!t.name.match(/feature-/),n=_.includes(P,t.type);return e&&n})},canAddPlugin:function(t){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),(_.isObjectLike(t)?p.resolve(t):B(t).then(function(t){return t.data})).then(function(t){return!_.isEmpty(t.manifest)&&_.includes(O,_.get(t,"type"))})},icon:function(t){var e=_.isString(t)?t:t.type;return t.manifest&&"MICROSERVICE"!==e&&(e="SMARTAPP"),A[e]},typeLabel:function(t){var e=_.isString(t)?t:t.type;return x[e]},getCurrent:Z,getConfig:et,pollRefreshMessages:function(){t(function(){!function(t){o.localStorage.getItem("refresh")===G()&&(o.localStorage.setItem("refresh",void 0),t||o.location.reload())}()},1e3,0,!1)},getCurrentContextPath:G,updateManifest:function(t,n){return B(t).then(function(t){var e=t.data;return e.manifest=n,e}).then(H)},listArchives:function(t,e){var n="".concat(I(t),"/binaries"),r={params:f.pageSizeNoTotalFilter(e),silentError:!0};return u.get(n,r).then(f.getResData)},uploadArchive:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r={url:"".concat(I(t),"/binaries"),method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:e,fileName:function(t){return t.replace(/\s+/g,"_")}(e.name)};return _.assign(r,n),h.upload(r)},deleteArchive:function(t,e){var n=e.id||e,r=[I(t),"binaries",n].join("/");return u.delete(r)},setActiveArchive:function(t,e){return $({id:t.id,activeVersionId:e.id})},addPaasAppPlugin:function(t,e){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var n=function(t){var e=t.name.split(".");return e.pop(),e.join(".")}(e),r="".concat(I(t),"/binaries/plugins/").concat(n),i=h.upload({url:r,method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:e}),a=i.then(_.partial(Y,t));return a.progress=i.progress,a},removePaasAppPlugin:function(t,e){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var n=e.pluginName||e,r="".concat(I(t),"/binaries/plugins/").concat(n);return u.delete(r).then(_.partial(Y,t))},uploadPaasAppFiles:X,getPaasAppManifest:V,refreshPaasApp:Y,refreshHostedApp:function(t){var e="".concat(I(t),"/refresh");return u.post(e)},isPaasApp:function(t){return V(t).then(function(t){return t._webpaas},function(){return!1})},convertType:function(t){var e=_.cloneDeep(t);return void 0===e.type||(e.type=function(t){return"HOSTED"===t.type&&t.resourcesUrl&&"/"!==t.resourcesUrl.charAt(0)}(e)?"REPOSITORY":e.type),e},revertType:function(t){var e=_.cloneDeep(t);return"HOSTED"===e.type&&(e.resourcesUrl="/"),"REPOSITORY"===e.type&&(e.type="HOSTED"),e},parseAppName:function(t){return t&&"devicemanagement"===t.toLowerCase()?"Device management":t||"Cumulocity"},currentAppCached:ct,sortApps:M,isAppOnTheList:it}}t.$inject=["$rootScope","$http","$location","$q","$window","$interval","$timeout","$log","$injector","c8yBase","c8yUser","c8yInventory","$upload","gettext","$filter","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yApplication",t)}();
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _iterableToArrayLimit(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,a=[],i=!0,u=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(u)throw o}}return a}}function _arrayWithHoles(t){if(Array.isArray(t))return t}!function(){function t(a,e,n,i,o,u,r,s){var c,l,p,f,h,d,g,y,v,m,k="_tcy8",w="_ocy8",T="TFAToken",A="Basic",S=i.defer(),I=i.defer(),b=/\.html$/,F=/\.json$/,$=document.createElement("a"),L={hasAuth:!1},P=s.appKey,C=A,E=A,O=!1;function U(t){var e=t;t.startsWith(A)&&(e=t.replace(A,"").trim());var n=r(e).match(/(([^/]*)\/)?([^/:]+):(.+)/);return{tenant:n[2],user:n[3],password:n[4]}}function j(t,e,n){var r="".concat((n?"".concat(n,"/"):"")+t,":").concat(e);return u(r)}function z(t){return t.headers||(t.headers={}),_.defaults(t.headers,tt.headers()),t}function B(){return h.post(d.url("user/logout"),{},{silentError:!0}).then(function(t){return R(),t.data},function(){return R()})}function R(){H(),_.isFunction(s.logout)&&s.logout()}function K(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:A,n={token:e,type:function(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}(t)},r=d.url("user/currentUser?auth");if(p=n.token,E=n.type,window.c8y_testing)return i.when(W(n));s.tokenType=t;var o={url:r,silentError:!0,skipInterceptor:!0,headers:{Authorization:n.token?"".concat(n.type," ").concat(n.token):void 0,tfatoken:f,UseXBasic:!0,Accept:"application/vnd.com.nsn.cumulocity.user+json;"}};return h(o).then(d.getResData).then(function(t){return e?function(t,e){var n=U(t.token);return t.token=j(function(t,e){var n=_slicedToArray(t.user.match(/^(.+\$)?(.+)?$/),3),r=n[1],o=n[2];return"".concat(r||"").concat(o?e.id:"")}(n,e),n.password,function(t){return t.self.match(/\/user\/([\w-]+)\//)[1]}(e)),t}(n,t):q()}).then(W)}function W(t){var e=t.token,n=t.type;s.token=e,c=s.token,C=n,D(s.appKey);var r=!(P||s.isLocal)?g.currentAppCached().then(function(t){s.appConfig=_.defaults(s.appConfig||{},t),D(t.key)}):i.when();return function(){o.sessionStorage&&o.sessionStorage.setItem(k,c);o.localStorage.getItem(k)&&o.localStorage.setItem(k,c)}(),r.then(q)}function q(){S.resolve(),t({hasAuth:!0})}function t(t){_.isEqual(t,L)||(L=t,e.$emit("authStateChange",L))}function x(){f=void 0,delete s.TFAToken,J()}function G(t){s.TFAToken=t,X(f=s.TFAToken,!1,T),function(t,e){return n.get("c8ySettings").getSystemOptionValue({category:t,key:e},!1)}("two-factor-authentication","logout-on-browser-termination").then(function(t){X(f,!t,T)})}function H(){x(),delete s.token,S.promise.$$state.status&&(S=i.defer()),t({hasAuth:!1}),V()}function X(t,e,n){o["".concat(e?"local":"session","Storage")].setItem(n,t)}function M(t){return o.localStorage.getItem(t)||o.sessionStorage.getItem(t)||void 0}function D(t){s.appKey=t,P=s.appKey}function V(){o.localStorage.removeItem(k),o.sessionStorage.removeItem(k),o.localStorage.removeItem(w),o.sessionStorage.removeItem(w)}function J(){o.localStorage.removeItem(T),o.sessionStorage.removeItem(T)}function N(){var t=s.token||M(k),e=s.TFAToken||M(T),n=s.tokenType||M(w);return D(s.appKey),e&&G(e),K(t,n).catch(V)}function Q(t){l=t}function Y(t){var e=t.headers("tfatoken");return e&&G(e),K(p,E)}function Z(t){var e=_.map(t,function(n){var t={};return t[n.prop]=!1,h({url:d.url("tenant/".concat(n.path)),silentError:!0}).then(function(t){var e={};return e[n.prop]=n.checkFn(t),e}).catch(function(){return t})});return i.all(e).then(function(t){return _.reduce(t,function(t,e){return _.assign(t,e)},{})})}I.resolve(),Q(s.passResetToken||function(){if(a.search)return a.search();return{}}().token);var tt={decodeToken:U,encodeToken:j,logout:B,updatePassword:function(t){if(c){var e=U(c),n=j(e.user,t,e.tenant);return m&&m.updateBasicAuth({user:e.user,password:t,tenant:e.tenant}),W({token:n,type:s.tokenType||A})}return i.resolve()},request:function(t){var e,n=t.url,r=function(t){var e=s.baseUrl||"/";if(!t)return!0;$.href=t||"";var n=$.host;return 1<e.length&&-1<t.indexOf(e)||!n||n===function(){var t=a.host(),e=a.port();return 80!==e&&443!==e?[t,e].join(":"):t}()}(n);if(!r||b.test(n)||F.test(n)||t.skipInterceptor)return t;e=r&&!function(t){return!(!t.headers||!t.headers.Authorization)}(t)&&function(t){return!c||!t.noAppKey}(t)?tt.initializing.done?S.promise:i.all([tt.initializing,S.promise]):I.promise;var o=r?_.partial(z,t):function(){return t};return c&&window.c8y_testing?o():e.then(o)},responseError:function(t){_.isFunction(t.headers)&&t.headers("tfatokenexpired")&&L.hasAuth&&B();var e=Boolean(s.token);return 401!==t.status||e||O||function(){var t=d.url("user/currentUser");return h.get(t,{headers:d.contentHeaders("user",!0),silentError:!0}).then(function(){return!0},function(t){return 401!==t.status})}().then(function(t){t||(O=!0,B())}),i.reject(t)},setAuthToken:K,clearTokens:H,setTFAToken:G,clearTFAToken:x,saveAuthToken:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:A;X(c,t,k),X(e,t,w)},checkSavedTokens:N,setAppKey:D,headers:function(){var t={Authorization:c?"".concat(C," ").concat(c):void 0,tfatoken:f,UseXBasic:!0};return t["X-Cumulocity-Application-Key"]=P,t},resetPasword:function(t){var e={method:"POST",url:d.url("user/passwordReset"),params:{tenantId:t.tenant},data:{email:t.email},silentError:!0};return h(e)},changePasswordWithResetToken:function(t){var e={method:"PUT",url:d.url("user/passwordReset"),params:{tenantId:t.tenant},data:{email:t.email,token:l,newPassword:t.newPassword,passwordStrength:(t.passwordStrength||"").toUpperCase()},silentError:!0};return h(e).then(function(t){return l=void 0,a.url(a.path()),t})},setRecoverPassToken:Q,verifyTFACode:function(t){J();var e={url:d.url("user/pin"),data:{pin:t},method:"POST",silentError:!0,headers:{Authorization:"".concat(E||A," ").concat(p),"Content-Type":"application/vnd.com.nsn.cumulocity.user+json;"}};return h(e).then(Y)},getPassword:function(){return c&&U(c).password},getUserFromToken:function(){return U(c).user},getTenantFromToken:function(){return U(c).tenant},mustEnforcePasswordStrength:function(t){return Z([{path:"system/options/password/enforce.strength",prop:"systemLevel",checkFn:function(t){return"true"===(t.data||{}).value}},{path:"security-options/password/strength.validity",prop:"tenantLevel",checkFn:function(t){return"true"===(t.data||{}).value}}]).then(function(t){return t.systemLevel||t.tenantLevel})},getPasswordMinGreenLength:function(t){return Z([{path:"system/options/password/green.min-length",prop:"minGreenLength",checkFn:function(t){return _.parseInt((t.data||{}).value)}}]).then(function(t){return t.minGreenLength})},onSetToken:W,authReady:q,isSupportUser:function(){var t=U(p);return(t?t.user:"").includes("$")},getLoginOptions:function(){return y},whenAuthorized:function(){return S.promise}};return tt.initializing=i.resolve().then(function(){h=n.get("$http"),d=n.get("c8yBase"),g=n.get("c8yApplication"),n.has("c8yAuthBridgeService")&&(m=n.get("c8yAuthBridgeService"))}).then(window.preventInit?function(){}:function(){if(window.c8y_testing)return i.when();var t=[{type:(v=n.get("c8yLoginOptions",[h,d])).loginOptions.BASIC.value}];return v.list({skipInterceptor:!0,silentError:!0,params:{tenantId:d.getParamFromUrl("tenantId",window.location.search)}}).then(function(t){y=t.data.loginOptions},function(){y=t})}).then(function(){return window.c8y_testing?(W({token:s.token,type:s.tokenType||A}),{testing:!0}):s.oauthCode?function(t){V();var e={silentError:!1,url:d.url("tenant/oauth"+"?grant_type=authorization_code".concat(_.get(d.appOption("oauth"),"uriAddition",""))+"&code=".concat(t)),method:"POST",skipInterceptor:!0};return h(e).then(q)}(s.oauthCode):l?(a.search("token",l),H(),{recoverPassword:!0}):s.noSavedTokens?{noSavedTokens:!0}:N()}).finally(function(){tt.initializing.done=!0}),window.c8y_testing&&(o.localStorage||(o.localStorage=window.localStorage),o.sessionStorage||(o.sessionStorage=window.sessionStorage)),tt}t.$inject=["$location","$rootScope","$injector","$q","$window","utoa","atou","info"],angular.module("c8y.core").factory("c8yAuth",t).config(["$httpProvider",function(t){t.interceptors.push("c8yAuth")}])}();
1
+ "use strict";function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _iterableToArrayLimit(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,a,i,u=[],s=!0,c=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);s=!0);}catch(t){c=!0,o=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return u}}function _arrayWithHoles(t){if(Array.isArray(t))return t}!function(){function t(a,e,n,i,o,u,r,s){var c,l,p,f,h,d,g,y,v,m,k="_tcy8",w="_ocy8",T="TFAToken",A="Basic",S=i.defer(),I=i.defer(),b=/\.html$/,F=/\.json$/,$=document.createElement("a"),L={hasAuth:!1},P=s.appKey,C=A,E=A,O=!1;function j(t){var e=t;t.startsWith(A)&&(e=t.replace(A,"").trim());var n=r(e).match(/(([^/]*)\/)?([^/:]+):(.+)/);return{tenant:n[2],user:n[3],password:n[4]}}function U(t,e,n){var r="".concat((n?"".concat(n,"/"):"")+t,":").concat(e);return u(r)}function z(t){return t.headers||(t.headers={}),_.defaults(t.headers,tt.headers()),t}function B(){return h.post(d.url("user/logout"),{},{silentError:!0}).then(function(t){return R(),t.data},function(){return R()})}function R(){H(),_.isFunction(s.logout)&&s.logout()}function K(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:A,n={token:e,type:function(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}(t)},r=d.url("user/currentUser?auth");if(p=n.token,E=n.type,window.c8y_testing)return i.when(W(n));s.tokenType=t;var o={url:r,silentError:!0,skipInterceptor:!0,headers:{Authorization:n.token?"".concat(n.type," ").concat(n.token):void 0,tfatoken:f,UseXBasic:!0,Accept:"application/vnd.com.nsn.cumulocity.user+json;"}};return h(o).then(d.getResData).then(function(t){return e?function(t,e){var n=j(t.token);return t.token=U(function(t,e){var n=_slicedToArray(t.user.match(/^(.+\$)?(.+)?$/),3),r=n[1],o=n[2];return"".concat(r||"").concat(o?e.id:"")}(n,e),n.password,function(t){return t.self.match(/\/user\/([\w-]+)\//)[1]}(e)),t}(n,t):q()}).then(W)}function W(t){var e=t.token,n=t.type;s.token=e,c=s.token,C=n,D(s.appKey);var r=!(P||s.isLocal)?g.currentAppCached().then(function(t){s.appConfig=_.defaults(s.appConfig||{},t),D(t.key)}):i.when();return function(){o.sessionStorage&&o.sessionStorage.setItem(k,c);o.localStorage.getItem(k)&&o.localStorage.setItem(k,c)}(),r.then(q)}function q(){S.resolve(),t({hasAuth:!0})}function t(t){_.isEqual(t,L)||(L=t,e.$emit("authStateChange",L))}function x(){f=void 0,delete s.TFAToken,J()}function G(t){s.TFAToken=t,X(f=s.TFAToken,!1,T),function(t,e){return n.get("c8ySettings").getSystemOptionValue({category:t,key:e},!1)}("two-factor-authentication","logout-on-browser-termination").then(function(t){X(f,!t,T)})}function H(){x(),delete s.token,S.promise.$$state.status&&(S=i.defer()),t({hasAuth:!1}),V()}function X(t,e,n){o["".concat(e?"local":"session","Storage")].setItem(n,t)}function M(t){return o.localStorage.getItem(t)||o.sessionStorage.getItem(t)||void 0}function D(t){s.appKey=t,P=s.appKey}function V(){o.localStorage.removeItem(k),o.sessionStorage.removeItem(k),o.localStorage.removeItem(w),o.sessionStorage.removeItem(w)}function J(){o.localStorage.removeItem(T),o.sessionStorage.removeItem(T)}function N(){var t=s.token||M(k),e=s.TFAToken||M(T),n=s.tokenType||M(w);return D(s.appKey),e&&G(e),K(t,n).catch(V)}function Q(t){l=t}function Y(t){var e=t.headers("tfatoken");return e&&G(e),K(p,E)}function Z(t){var e=_.map(t,function(n){var t={};return t[n.prop]=!1,h({url:d.url("tenant/".concat(n.path)),silentError:!0}).then(function(t){var e={};return e[n.prop]=n.checkFn(t),e}).catch(function(){return t})});return i.all(e).then(function(t){return _.reduce(t,function(t,e){return _.assign(t,e)},{})})}I.resolve(),Q(s.passResetToken||function(){if(a.search)return a.search();return{}}().token);var tt={decodeToken:j,encodeToken:U,logout:B,updatePassword:function(t){if(c){var e=j(c),n=U(e.user,t,e.tenant);return m&&m.updateBasicAuth({user:e.user,password:t,tenant:e.tenant}),W({token:n,type:s.tokenType||A})}return i.resolve()},request:function(t){var e,n=t.url,r=function(t){var e=s.baseUrl||"/";if(!t)return!0;$.href=t||"";var n=$.host;return 1<e.length&&-1<t.indexOf(e)||!n||n===function(){var t=a.host(),e=a.port();return 80!==e&&443!==e?[t,e].join(":"):t}()}(n);if(!r||b.test(n)||F.test(n)||t.skipInterceptor)return t;e=r&&!function(t){return!(!t.headers||!t.headers.Authorization)}(t)&&function(t){return!c||!t.noAppKey}(t)?tt.initializing.done?S.promise:i.all([tt.initializing,S.promise]):I.promise;var o=r?_.partial(z,t):function(){return t};return c&&window.c8y_testing?o():e.then(o)},responseError:function(t){_.isFunction(t.headers)&&t.headers("tfatokenexpired")&&L.hasAuth&&B();var e=Boolean(s.token);return 401!==t.status||e||O||function(){var t=d.url("user/currentUser");return h.get(t,{headers:d.contentHeaders("user",!0),silentError:!0}).then(function(){return!0},function(t){return 401!==t.status})}().then(function(t){t||(O=!0,B())}),i.reject(t)},setAuthToken:K,clearTokens:H,setTFAToken:G,clearTFAToken:x,saveAuthToken:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:A;X(c,t,k),X(e,t,w)},checkSavedTokens:N,setAppKey:D,headers:function(){var t={Authorization:c?"".concat(C," ").concat(c):void 0,tfatoken:f,UseXBasic:!0};return t["X-Cumulocity-Application-Key"]=P,t},resetPasword:function(t){var e={method:"POST",url:d.url("user/passwordReset"),params:{tenantId:t.tenant},data:{email:t.email},silentError:!0};return h(e)},changePasswordWithResetToken:function(t){var e={method:"PUT",url:d.url("user/passwordReset"),params:{tenantId:t.tenant},data:{email:t.email,token:l,newPassword:t.newPassword,passwordStrength:(t.passwordStrength||"").toUpperCase()},silentError:!0};return h(e).then(function(t){return l=void 0,a.url(a.path()),t})},setRecoverPassToken:Q,verifyTFACode:function(t){J();var e={url:d.url("user/pin"),data:{pin:t},method:"POST",silentError:!0,headers:{Authorization:"".concat(E||A," ").concat(p),"Content-Type":"application/vnd.com.nsn.cumulocity.user+json;"}};return h(e).then(Y)},getPassword:function(){return c&&j(c).password},getUserFromToken:function(){return j(c).user},getTenantFromToken:function(){return j(c).tenant},mustEnforcePasswordStrength:function(t){return Z([{path:"system/options/password/enforce.strength",prop:"systemLevel",checkFn:function(t){return"true"===(t.data||{}).value}},{path:"security-options/password/strength.validity",prop:"tenantLevel",checkFn:function(t){return"true"===(t.data||{}).value}}]).then(function(t){return t.systemLevel||t.tenantLevel})},getPasswordMinGreenLength:function(t){return Z([{path:"system/options/password/green.min-length",prop:"minGreenLength",checkFn:function(t){return _.parseInt((t.data||{}).value)}}]).then(function(t){return t.minGreenLength})},onSetToken:W,authReady:q,isSupportUser:function(){var t=j(p);return(t?t.user:"").includes("$")},getLoginOptions:function(){return y},whenAuthorized:function(){return S.promise}};return tt.initializing=i.resolve().then(function(){h=n.get("$http"),d=n.get("c8yBase"),g=n.get("c8yApplication"),n.has("c8yAuthBridgeService")&&(m=n.get("c8yAuthBridgeService"))}).then(window.preventInit?function(){}:function(){if(window.c8y_testing)return i.when();var t=[{type:(v=n.get("c8yLoginOptions",[h,d])).loginOptions.BASIC.value}];return v.list({skipInterceptor:!0,silentError:!0,params:{tenantId:d.getParamFromUrl("tenantId",window.location.search)}}).then(function(t){y=t.data.loginOptions},function(){y=t})}).then(function(){return window.c8y_testing?(W({token:s.token,type:s.tokenType||A}),{testing:!0}):s.oauthCode?function(t){V();var e={silentError:!1,url:d.url("tenant/oauth"+"?grant_type=authorization_code".concat(_.get(d.appOption("oauth"),"uriAddition",""))+"&code=".concat(t)),method:"POST",skipInterceptor:!0};return h(e).then(q)}(s.oauthCode):l?(a.search("token",l),H(),{recoverPassword:!0}):s.noSavedTokens?{noSavedTokens:!0}:N()}).finally(function(){tt.initializing.done=!0}),window.c8y_testing&&(o.localStorage||(o.localStorage=window.localStorage),o.sessionStorage||(o.sessionStorage=window.sessionStorage)),tt}t.$inject=["$location","$rootScope","$injector","$q","$window","utoa","atou","info"],angular.module("c8y.core").factory("c8yAuth",t).config(["$httpProvider",function(t){t.interceptors.push("c8yAuth")}])}();