@c8y/ng1-modules 1018.505.8 → 1018.506.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.
@@ -97,7 +97,7 @@
97
97
  </ul>
98
98
  </div>
99
99
  <div class="col-sm-4">
100
- <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_INVENTORY_CREATE']">
100
+ <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_INVENTORY_CREATE', 'ROLE_BINARY_ADMIN', 'ROLE_BINARY_CREATE']">
101
101
  <file-picker
102
102
  files="vm.appArchives"
103
103
  multiple="false"
@@ -1 +1 @@
1
- "use strict";!function(){function e(e,i,t){var a=t("Management"),t=t("Files repository"),n="files";e.addNavigation({parent:a,name:t,priority:1e3,path:n,icon:"c8y-archive",showIfPermissions:{anyRole:["ROLE_INVENTORY_READ","ROLE_INVENTORY_ADMIN"]}}),i.when("/".concat(n),{name:t,templateUrl:":::PLUGIN_PATH:::/views/list.html"})}e.$inject=["c8yNavigatorProvider","c8yViewsProvider","gettext"],angular.module("c8y.binaryArtefactsManagement",[]).config(e)}();
1
+ "use strict";!function(){function e(e,n,a){var t=a("Management"),a=a("Files repository"),i="files";e.addNavigation({parent:t,name:a,priority:1e3,path:i,icon:"c8y-archive",showIf:["$q","c8yPermissions",function(e,n){return e.all({inventoryReadRole:n.hasAnyRole(["ROLE_INVENTORY_READ"]),binaryAndMoReadRole:n.hasAllRoles(["ROLE_BINARY_READ","ROLE_MANAGED_OBJECT_READ"])}).then(function(e){var n=e.inventoryReadRole,e=e.binaryAndMoReadRole;return n||e})}]}),n.when("/".concat(i),{name:a,templateUrl:":::PLUGIN_PATH:::/views/list.html"})}e.$inject=["c8yNavigatorProvider","c8yViewsProvider","gettext"],angular.module("c8y.binaryArtefactsManagement",[]).config(e)}();
@@ -48,7 +48,7 @@
48
48
 
49
49
  <li
50
50
  c8y-if-allowed
51
- any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_INVENTORY_CREATE']"
51
+ any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_INVENTORY_CREATE', 'ROLE_BINARY_ADMIN', 'ROLE_BINARY_CREATE']"
52
52
  >
53
53
  <button
54
54
  class="btn btn-link"
@@ -1 +1 @@
1
- "use strict";!function(){a.$inject=["c8yUiUtil","c8yNavigator"],e.$inject=["c8yNavigatorProvider","c8yViewsProvider","c8yTitleProvider","c8yBreadcrumbsProvider","smartRulesTemplateBasePath","gettext"],angular.module("c8y.smartRulesUI",["c8y.smartRules"]).config(e).run(a);var d="rules";function e(e,a,t,n,i,r){u.$inject=["$q","c8yPermissions","c8ySmartRulesAvailability"];var l=i,i="/device/:deviceId",o=[i];function c(e){return{title:e}}function s(e){a.when(e,{priority:1e3,name:r("Smart rules"),icon:"c8y-smart-rules",showIf:["c8ySmartRulesAvailability",function(e){return e.shouldShowLocalSmartRules()}],templateUrl:"".concat(l,"list.html"),featureId:"smartRules"})}function u(e,a,t){a={hasInventoryReadAdminCreate:a.isAllowed({anyRole:["ROLE_INVENTORY_READ","ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE"]}),hasSmartRuleReadAdmin:a.isAllowed({anyRole:["ROLE_SMARTRULE_READ","ROLE_SMARTRULE_ADMIN"]}),hasCepManagementAdmin:a.isAllowed({anyRole:["ROLE_CEP_MANAGEMENT_ADMIN"]}),isApplicationAvailable:t.isApplicationAvailable()};return e.all(a).then(function(e){return e.hasInventoryReadAdminCreate&&e.isApplicationAvailable&&(e.hasSmartRuleReadAdmin||e.hasCepManagementAdmin)})}t.addTitle(i,{data:["$routeParams","c8yBase","c8yDevices",function(e,a,t){e=e.deviceId;return e?t.detailCached(e).then(a.getResData).then(t.properName).then(c):{}}]}),a.when("/".concat(d),{templateUrl:"".concat(l,"list.html")}),o.forEach(s),e.addNavigation({parent:{name:r("Configuration"),icon:"c8y-tools"},name:r("Global smart rules"),path:d,icon:"c8y-smart-rules",showIf:u,featureId:"globalSmartRules"}),n.addBreadcrumbs(i,{data:["$routeParams","c8yDevices",function(e,a){e=e.deviceId;return a.getBreadcrumbsData(e)}]})}function a(e,a){e.shouldShowSmartRules().then(function(e){e||a.removeNavigation(a.findNode(function(e){return e.path===d}))})}}();
1
+ "use strict";!function(){a.$inject=["c8yUiUtil","c8yNavigator"],e.$inject=["c8yNavigatorProvider","c8yViewsProvider","c8yTitleProvider","c8yBreadcrumbsProvider","smartRulesTemplateBasePath","gettext"],angular.module("c8y.smartRulesUI",["c8y.smartRules"]).config(e).run(a);var d="rules";function e(e,a,t,n,i,r){u.$inject=["$q","c8yPermissions","c8ySmartRulesAvailability"];var l=i,i="/device/:deviceId",o=[i];function c(e){return{title:e}}function s(e){a.when(e,{priority:1e3,name:r("Smart rules"),icon:"c8y-smart-rules",showIf:["c8ySmartRulesAvailability",function(e){return e.shouldShowLocalSmartRules()}],templateUrl:"".concat(l,"list.html"),featureId:"smartRules"})}function u(e,a,t){a={hasInventoryReadAdminCreate:a.isAllowed({anyRole:["ROLE_INVENTORY_READ","ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE","ROLE_MANAGED_OBJECT_READ"]}),hasSmartRuleReadAdmin:a.isAllowed({anyRole:["ROLE_SMARTRULE_READ","ROLE_SMARTRULE_ADMIN"]}),hasCepManagementAdmin:a.isAllowed({anyRole:["ROLE_CEP_MANAGEMENT_ADMIN"]}),isApplicationAvailable:t.isApplicationAvailable()};return e.all(a).then(function(e){return e.hasInventoryReadAdminCreate&&e.isApplicationAvailable&&(e.hasSmartRuleReadAdmin||e.hasCepManagementAdmin)})}t.addTitle(i,{data:["$routeParams","c8yBase","c8yDevices",function(e,a,t){e=e.deviceId;return e?t.detailCached(e).then(a.getResData).then(t.properName).then(c):{}}]}),a.when("/".concat(d),{templateUrl:"".concat(l,"list.html")}),o.forEach(s),e.addNavigation({parent:{name:r("Configuration"),icon:"c8y-tools"},name:r("Global smart rules"),path:d,icon:"c8y-smart-rules",showIf:u,featureId:"globalSmartRules"}),n.addBreadcrumbs(i,{data:["$routeParams","c8yDevices",function(e,a){e=e.deviceId;return a.getBreadcrumbsData(e)}]})}function a(e,a){e.shouldShowSmartRules().then(function(e){e||a.removeNavigation(a.findNode(function(e){return e.path===d}))})}}();
@@ -1 +1 @@
1
- "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}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);n=n.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){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name: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,o,a,i,l){var m,y=this,c=[],u=r.getDeliveryTypes().defaultDeliveryType,d=r.getDeliveryTypes().standardDeliveryTypes;function s(e){c.length=0,_.forEach(e,function(e){var t=!!e.id;c.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 p(e){y.result.commandTemplate=e,_.difference(e.deliveryTypes,d)||y.standardDeliveryTypes.push(e.deliveryType),y.commandDeliveryType=_.first(e.deliveryTypes)||u}_.assign(y,{commandTemplates:c,standardDeliveryTypes:d,defaultDeliveryType:u,commandDeliveryTypesSelected:{},validateSelectedDeliveryTypes:function(){return _.isEmpty(_.pickBy(y.commandDeliveryTypesSelected))},result:{action:null,commandTemplate:null},forms:{},onTemplateSelected:p,use:function(e){y.result.action="USE",y.result.deliveryType=e!==u&&e,y.result.commandTemplate=_.clone(y.result.commandTemplate);e=y.result.commandTemplate;e.text=e.text||e.command,y.close(y.result)},execute:function(e){y.result.action="EXECUTE",y.result.deliveryType=e!==u&&e,y.result.commandTemplate=_.clone(y.result.commandTemplate);e=y.result.commandTemplate;e.text=e.command,y.close(y.result)},cancel:function(){y.newCommandTemplate?delete y.newCommandTemplate:y.dismiss()},save:function(){y.newCommandTemplate.deliveryTypes=_.keys(_.pickBy(y.commandDeliveryTypesSelected)),r.saveTemplate(y.newCommandTemplate).then(t.getResData).then(function(e){var e=_.pick(e,["id","name","category","command","text","deliveryTypes"]),t=_.find(c,{id:e.id});t?_.assign(t,e):c.unshift(e),y.result.commandTemplate=e,p(e),delete y.newCommandTemplate})},addNew:function(){y.newCommandTemplate={deviceType:m},y.commandDeliveryTypesSelected=_defineProperty({},u,!0)},hideAddButton:function(){return!!y.newCommandTemplate},edit:function(e){var t;t=_.isEmpty(e.deliveryTypes)?d:e.deliveryTypes;_.forEach(t,function(e){_.assign(y.commandDeliveryTypesSelected,_defineProperty({},e,!0))}),y.newCommandTemplate=e},remove:function(e){y.result.commandTemplate===e&&delete y.result.commandTemplate;r.removeTemplate(e).then(function(){_.pull(c,e)}).then(function(){a.success(i("Shell command template deleted."))})},isDeliveryTypeSupported:function(e,t){t=_.get(t,"deliveryTypes");return _.isEmpty(t)||_.includes(t,e)},getExecuteButtonLabel:function(e){return e!==u?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"})}}),function(e){return n.detailCached(e).then(t.getResData).then(function(e){return m=_.concat(e.type,e.c8y_DeviceTypes||[]),r.getCommandTemplatesForDeviceType.apply(r,_toConsumableArray(m))})}(e.deviceId).then(s),r.canSendCommandsViaSMS().then(function(e){y.smsEnabled=e}),o.hasAnyRole(["ROLE_INVENTORY_ADMIN"]).then(function(e){y.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,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}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);n=n.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){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name: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,o,a,i,l){var m,y=this,c=[],u=r.getDeliveryTypes().defaultDeliveryType,d=r.getDeliveryTypes().standardDeliveryTypes;function s(e){c.length=0,_.forEach(e,function(e){var t=!!e.id;c.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 p(e){y.result.commandTemplate=e,_.difference(e.deliveryTypes,d)||y.standardDeliveryTypes.push(e.deliveryType),y.commandDeliveryType=_.first(e.deliveryTypes)||u}_.assign(y,{commandTemplates:c,standardDeliveryTypes:d,defaultDeliveryType:u,commandDeliveryTypesSelected:{},validateSelectedDeliveryTypes:function(){return _.isEmpty(_.pickBy(y.commandDeliveryTypesSelected))},result:{action:null,commandTemplate:null},forms:{},onTemplateSelected:p,use:function(e){y.result.action="USE",y.result.deliveryType=e!==u&&e,y.result.commandTemplate=_.clone(y.result.commandTemplate);e=y.result.commandTemplate;e.text=e.text||e.command,y.close(y.result)},execute:function(e){y.result.action="EXECUTE",y.result.deliveryType=e!==u&&e,y.result.commandTemplate=_.clone(y.result.commandTemplate);e=y.result.commandTemplate;e.text=e.command,y.close(y.result)},cancel:function(){y.newCommandTemplate?delete y.newCommandTemplate:y.dismiss()},save:function(){y.newCommandTemplate.deliveryTypes=_.keys(_.pickBy(y.commandDeliveryTypesSelected)),r.saveTemplate(y.newCommandTemplate).then(t.getResData).then(function(e){var e=_.pick(e,["id","name","category","command","text","deliveryTypes"]),t=_.find(c,{id:e.id});t?_.assign(t,e):c.unshift(e),y.result.commandTemplate=e,p(e),delete y.newCommandTemplate})},addNew:function(){y.newCommandTemplate={deviceType:m},y.commandDeliveryTypesSelected=_defineProperty({},u,!0)},hideAddButton:function(){return!!y.newCommandTemplate},edit:function(e){var t;t=_.isEmpty(e.deliveryTypes)?d:e.deliveryTypes;_.forEach(t,function(e){_.assign(y.commandDeliveryTypesSelected,_defineProperty({},e,!0))}),y.newCommandTemplate=e},remove:function(e){y.result.commandTemplate===e&&delete y.result.commandTemplate;r.removeTemplate(e).then(function(){_.pull(c,e)}).then(function(){a.success(i("Shell command template deleted."))})},isDeliveryTypeSupported:function(e,t){t=_.get(t,"deliveryTypes");return _.isEmpty(t)||_.includes(t,e)},getExecuteButtonLabel:function(e){return e!==u?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"})}}),function(e){return n.detailCached(e).then(t.getResData).then(function(e){return m=_.concat(e.type,e.c8y_DeviceTypes||[]),r.getCommandTemplatesForDeviceType.apply(r,_toConsumableArray(m))})}(e.deviceId).then(s),r.canSendCommandsViaSMS().then(function(e){y.smsEnabled=e}),o.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"]).then(function(e){y.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 _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}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);r=r.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,u,o,r,n,i,p){var y={c8y_BrokerSourceInactive:{icon:"c8y-group-remote-inactive",iconOpen:"c8y-group-remote-inactive"},c8y_BrokerSource:{icon:"c8y-group-remote",iconOpen:"c8y-group-remote-open"},c8y_DeviceGroup:{icon:"c8y-group",iconOpen:"c8y-group-open"},c8y_DynamicGroup:{icon:"c8y-group-smart",iconOpen:"c8y-group-smart-open"},other:{icon:"circle",iconClass:"statusUnknown"}};return{getGroupItems:c,getItemsCount:function(e){return r.children(e,"childAssets",{skipDetail:!0,params:{pageSize:1,withTotalPages:!0,withChildren:!1}}).then(function(e){return e.data.statistics.totalPages})},getGroupAssetsAndDevices:function(r){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=o.createListFilter(function(e){var e=e.id,t=_.map(_.get(r,"childAdditions.references"),_.property("managedObject.id"));return!_.includes(t,e)});return c(r,e).then(t)},getGroupTypeItems:function(t){return n.getLookup().then(function(e){return[e[t]]}).then(s)},getTopLevelGroups:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=e||!1;return t.onlyRoots=!0,i.mustHaveAllRoles(["ROLE_INVENTORY_READ"]).then(function(){return n.get().then(_.property("groups")).then(function(e){return(r?function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=(e.push({type:p.getType()}),s(e,t));t.skipChildCount||(e=e.then(function(e){return p.addChildCountProperty(e,t)}));return e}:s)(e,t)})},a)},isGroup:f,getGroupInfo:t,getIconSpecs:function(e){return t(e).iconSpecs},getIconSpecsForType:function(e){return _.get(y,e,{})}};function c(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return r.listQuery((e=e,{__bygroupid:o.getId(e)}),_objectSpread({withParents:!0},t),!0)}function s(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e={__filter:{__and:[{__not:{__has:"c8y_IsDynamicGroup.invisible"}},{type:{__in:_.map(e,"type")}}]}};return r.listQuery(e,t,!0)}function a(){return r.list({fragmentType:"c8y_IsDeviceGroup",pageSize:1e3,onlyRoots:!0})}function f(e){return!!e.c8y_IsDeviceGroup||"c8y_DeviceGroup"===e.type}function t(e){var t,r=f(e),o=u.get("c8yDevices").isDevice(e),n=p.isDynamicGroup(e),i=u.get("c8yDeviceGroup"),c=i.hasBrokerSource(e);return r?t=c?i.isBrokerSourceActive(e)?"c8y_BrokerSource":"c8y_BrokerSourceInactive":p.isDynamicGroup(e)?"c8y_DynamicGroup":"c8y_DeviceGroup":n?t="c8y_DynamicGroup":o||(t="other"),{isGroup:r,isDynamicGroup:n,hasBrokerSource:c,iconSpecs:_.get(y,t,{})}}}e.$inject=["$q","$injector","c8yBase","c8yInventory","c8yGroupTypesConfig","c8yPermissions","c8yDynamicGroups"],angular.module("c8y.core").factory("c8yGroups",e)}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}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);r=r.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,u,o,r,n,i,p){var y={c8y_BrokerSourceInactive:{icon:"c8y-group-remote-inactive",iconOpen:"c8y-group-remote-inactive"},c8y_BrokerSource:{icon:"c8y-group-remote",iconOpen:"c8y-group-remote-open"},c8y_DeviceGroup:{icon:"c8y-group",iconOpen:"c8y-group-open"},c8y_DynamicGroup:{icon:"c8y-group-smart",iconOpen:"c8y-group-smart-open"},other:{icon:"circle",iconClass:"statusUnknown"}};return{getGroupItems:c,getItemsCount:function(e){return r.children(e,"childAssets",{skipDetail:!0,params:{pageSize:1,withTotalPages:!0,withChildren:!1}}).then(function(e){return e.data.statistics.totalPages})},getGroupAssetsAndDevices:function(r){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=o.createListFilter(function(e){var e=e.id,t=_.map(_.get(r,"childAdditions.references"),_.property("managedObject.id"));return!_.includes(t,e)});return c(r,e).then(t)},getGroupTypeItems:function(t){return n.getLookup().then(function(e){return[e[t]]}).then(s)},getTopLevelGroups:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=e||!1;return t.onlyRoots=!0,i.mustHaveAnyRole(["ROLE_INVENTORY_READ","ROLE_MANAGED_OBJECT_READ"]).then(function(){return n.get().then(_.property("groups")).then(function(e){return(r?function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=(e.push({type:p.getType()}),s(e,t));t.skipChildCount||(e=e.then(function(e){return p.addChildCountProperty(e,t)}));return e}:s)(e,t)})},a)},isGroup:f,getGroupInfo:t,getIconSpecs:function(e){return t(e).iconSpecs},getIconSpecsForType:function(e){return _.get(y,e,{})}};function c(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return r.listQuery((e=e,{__bygroupid:o.getId(e)}),_objectSpread({withParents:!0},t),!0)}function s(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e={__filter:{__and:[{__not:{__has:"c8y_IsDynamicGroup.invisible"}},{type:{__in:_.map(e,"type")}}]}};return r.listQuery(e,t,!0)}function a(){return r.list({fragmentType:"c8y_IsDeviceGroup",pageSize:1e3,onlyRoots:!0})}function f(e){return!!e.c8y_IsDeviceGroup||"c8y_DeviceGroup"===e.type}function t(e){var t,r=f(e),o=u.get("c8yDevices").isDevice(e),n=p.isDynamicGroup(e),i=u.get("c8yDeviceGroup"),c=i.hasBrokerSource(e);return r?t=c?i.isBrokerSourceActive(e)?"c8y_BrokerSource":"c8y_BrokerSourceInactive":p.isDynamicGroup(e)?"c8y_DynamicGroup":"c8y_DeviceGroup":n?t="c8y_DynamicGroup":o||(t="other"),{isGroup:r,isDynamicGroup:n,hasBrokerSource:c,iconSpecs:_.get(y,t,{})}}}e.$inject=["$q","$injector","c8yBase","c8yInventory","c8yGroupTypesConfig","c8yPermissions","c8yDynamicGroups"],angular.module("c8y.core").factory("c8yGroups",e)}();
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(e,n){return _arrayWithHoles(e)||_iterableToArrayLimit(e,n)||_unsupportedIterableToArray(e,n)||_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,n){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,n):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,n):void 0}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function _iterableToArrayLimit(e,n){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,i,u,o,a=[],s=!0,c=!1;try{if(u=(r=r.call(e)).next,0===n){if(Object(r)!==r)return;s=!1}else for(;!(s=(t=u.call(r)).done)&&(a.push(t.value),a.length!==n);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(r,a,i,u,s,e,c,n){var o="user/devicePermissions",t=u.createEnum([{name:"ALARM",value:"ALARM",label:n("Alarms")},{name:"AUDIT",value:"AUDIT",label:n("Audits")},{name:"EVENT",value:"EVENT",label:n("Events")},{name:"MANAGED_OBJECT",value:"MANAGED_OBJECT",label:n("Inventory")},{name:"MEASUREMENT",value:"MEASUREMENT",label:n("Measurements")},{name:"OPERATION",value:"OPERATION",label:n("Device control")},{name:"SUPPORT",value:"SUPPORT",label:n("Support")},{name:"ALL",value:"*",label:n("Full access")}]),n=u.createEnum([{name:"READ",value:"READ",label:n("Read")},{name:"CHANGE",value:"ADMIN",label:n("Change")},{name:"ALL",value:"*",label:n("All")}]);function l(e,n){return function(e,n){var r=!1;e.roles&&e.roles.references&&_.forEach(e.roles.references,function(e){e.role.id===n&&(r=!0)});return r}(e,n)||function(e,n){var r=!1;e.groups&&e.groups.references&&_.forEach(e.groups.references,function(e){_.forEach(e.group.roles.references,function(e){e.role.id===n&&(r=!0)})});return r}(e,n)}function f(e,n,r,t,i){return function(e,n,r,t,i){var u=!1;e.devicePermissions&&e.devicePermissions[n]&&(u=p(e.devicePermissions[n],r,t,i));return u}(e,n,r,t,i)||function(e,n,r,t,i){var u=!1;e.groups&&e.groups.references&&_.forEach(e.groups.references,function(e){e.group.devicePermissions&&e.group.devicePermissions[n]&&(u=p(e.group.devicePermissions[n],r,t,i))});return u}(e,n,r,t,i)}function p(e,n,r,t){return _.some(e,_.partial(m,n,r,t))}function m(e,n,r,t){var i=!1,t=_slicedToArray(t.split(":"),3),u=t[0],o=t[1],t=t[2];return i=d(u,e)&&d(o,n)&&d(t,r)?!0:i}function d(e,n){return"*"===e||e===n}function h(n,e){return(e?a.when(e):s.current()).then(function(e){return _.some(n,_.partial(l,e))})}function v(n,e){return(e?a.when(e):s.current()).then(function(e){return _.every(n,_.partial(l,e))})}function y(e,n){return a.all(_.map(_.filter(e,_.identity),_.partialRight(A,n))).then(M)}function A(t,e){var i=t.id||t,u=!e;function o(e){return e||E(i,"read")}return(u?s.current():a.when(e)).then(function(e){return h(["ROLE_INVENTORY_READ"],e).then((r=e,function(e){return e||f(r,i,"MANAGED_OBJECT","*","READ")})).then((n=e,function(e){return e||c.isOwnerCached(t,n)})).then(u?o:_.identity);var n,r})}var E=_.memoize(function(e,n){e=u.url("inventory/managedObjects/".concat(e)),n=g(n);return i({method:n,data:"PUT"===n?{}:void 0,headers:{"content-type":"application/json",accept:void 0},silentError:!0,url:e}).then(_.constant(!0),_.constant(!1))},function(e,n){return e+g(n)});function g(e){return"admin"===e?"PUT":"HEAD"}function R(e,n){return a.all(_.map(_.filter(e,_.identity),_.partialRight(O,n))).then(M)}function O(t,e){var i=t.id||t,u=!e;function o(e){return e||E(i,"admin")}return(u?s.current():a.when(e)).then(function(e){return h(["ROLE_INVENTORY_ADMIN"],e).then((r=e,function(e){return e||f(r,i,"MANAGED_OBJECT","*","ADMIN")})).then((n=e,function(e){return e||c.isOwnerCached(t,n)})).then(u?o:_.identity);var n,r})}function b(e,n){var r=[];return e.anyRole&&r.push(h(e.anyRole,n)),e.allRoles&&r.push(v(e.allRoles,n)),e.readMOs&&r.push(y(T(e.readMOs),n)),e.adminMOs&&r.push(R(T(e.adminMOs),n)),a.all(r).then(M)}function T(e){return _.filter(_.map(e,function(e){return n=e,_.isString(n)&&/^:/.test(n)?r[e.replace(/^:/,"")]:e;var n}),_.identity)}function P(e){return e.then(function(e){return e?a.when(e):a.reject(e)})}function M(e){return _.every(e)}function N(e,n){var r={groups:[],users:[]};return _.forEach(n.groups,_.partial(I,r,e)),_.forEach(n.users,_.partial(D,r,e)),r}function I(n,e,r){_.forEach(r.devicePermissions[e],function(e){e=S(e),e={group:{id:r.id,name:r.name},scope:e.scope,type:e.type,access:e.access};n.groups.push(e)})}function D(n,e,r){_.forEach(r.devicePermissions[e],function(e){e=S(e),e={username:r.userName,scope:e.scope,type:e.type,access:e.access};n.users.push(e)})}function S(e){e=e.split(":");return{scope:e[0],type:e[1],access:e[2]}}function L(e){return[e.scope,e.type,e.access].join(":")}function w(e){return _.map(e,function(e){var n=e.id.split("_").filter(function(e,n,r){return!("ROLE"===e&&0===n&&1<r.length)}),r=1<n.length?n.pop():void 0,n=n.join("_");return{id:e.id,category:n,access:r}})}return{hasRole:l,hasDevicePermission:f,hasAnyRole:h,mustHaveAnyRole:function(e,n){return P(h(e,n))},hasAllRoles:v,mustHaveAllRoles:function(e,n){return P(v(e,n))},canReadMOs:y,mustHaveReadMOs:function(e,n){return P(y(e,n))},canAdminMOs:R,mustHaveAdminMOs:function(e,n){return P(R(e,n))},isAllowed:b,mustBeAllowed:function(e,n){return P(b(e,n))},getMOPermissions:function(e){var e=e.id||e,n=u.url("".concat(o,"/").concat(e));return _.isObjectLike(e)?a.when({groups:[],users:[]}):i.get(n).then(u.getResData).then(_.partial(N,e))},setMOPermissions:function(e,n){var r,e=e.id||e,t=u.url("".concat(o,"/").concat(e)),e=(function(r,t,e){e=_.groupBy(e,function(e){return e.group.id});_.forEach(e,function(e,n){n={id:n,devicePermissions:{}};n.devicePermissions[t]=_.map(e,L),r.push(n)})}((r={groups:[],users:[]}).groups,e=e,(n=n).groups),function(r,t,e){e=_.groupBy(e,function(e){return e.userName});_.forEach(e,function(e,n){n={userName:n,devicePermissions:{}};n.devicePermissions[t]=_.map(e,L),r.push(n)})}(r.users,e,n.users),r);return i.put(t,e)},getAccessTypes:function(){return["READ","ADMIN","*"]},convertServerPermissionsToUI:w,listGlobal:function(){return e.listRoles({pageSize:2e3}).then(w)},SCOPES:t,ACCESS_TYPES:n}}e.$inject=["$routeParams","$q","$http","c8yBase","c8yUser","c8yUserGroup","c8yInventory","gettext"],angular.module("c8y.core").factory("c8yPermissions",e)}();
1
+ "use strict";function _slicedToArray(e,n){return _arrayWithHoles(e)||_iterableToArrayLimit(e,n)||_unsupportedIterableToArray(e,n)||_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,n){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,n):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,n):void 0}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function _iterableToArrayLimit(e,n){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,i,u,o,a=[],s=!0,c=!1;try{if(u=(r=r.call(e)).next,0===n){if(Object(r)!==r)return;s=!1}else for(;!(s=(t=u.call(r)).done)&&(a.push(t.value),a.length!==n);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(r,a,i,u,s,e,c,n){var o="user/devicePermissions",t=u.createEnum([{name:"ALARM",value:"ALARM",label:n("Alarms")},{name:"AUDIT",value:"AUDIT",label:n("Audits")},{name:"EVENT",value:"EVENT",label:n("Events")},{name:"MANAGED_OBJECT",value:"MANAGED_OBJECT",label:n("Inventory")},{name:"MEASUREMENT",value:"MEASUREMENT",label:n("Measurements")},{name:"OPERATION",value:"OPERATION",label:n("Device control")},{name:"SUPPORT",value:"SUPPORT",label:n("Support")},{name:"ALL",value:"*",label:n("Full access")}]),n=u.createEnum([{name:"READ",value:"READ",label:n("Read")},{name:"CHANGE",value:"ADMIN",label:n("Change")},{name:"ALL",value:"*",label:n("All")}]);function l(e,n){return function(e,n){var r=!1;e.roles&&e.roles.references&&_.forEach(e.roles.references,function(e){e.role.id===n&&(r=!0)});return r}(e,n)||function(e,n){var r=!1;e.groups&&e.groups.references&&_.forEach(e.groups.references,function(e){_.forEach(e.group.roles.references,function(e){e.role.id===n&&(r=!0)})});return r}(e,n)}function f(e,n,r,t,i){return function(e,n,r,t,i){var u=!1;e.devicePermissions&&e.devicePermissions[n]&&(u=p(e.devicePermissions[n],r,t,i));return u}(e,n,r,t,i)||function(e,n,r,t,i){var u=!1;e.groups&&e.groups.references&&_.forEach(e.groups.references,function(e){e.group.devicePermissions&&e.group.devicePermissions[n]&&(u=p(e.group.devicePermissions[n],r,t,i))});return u}(e,n,r,t,i)}function p(e,n,r,t){return _.some(e,_.partial(m,n,r,t))}function m(e,n,r,t){var i=!1,t=_slicedToArray(t.split(":"),3),u=t[0],o=t[1],t=t[2];return i=d(u,e)&&d(o,n)&&d(t,r)?!0:i}function d(e,n){return"*"===e||e===n}function h(n,e){return(e?a.when(e):s.current()).then(function(e){return _.some(n,_.partial(l,e))})}function v(n,e){return(e?a.when(e):s.current()).then(function(e){return _.every(n,_.partial(l,e))})}function A(e,n){return a.all(_.map(_.filter(e,_.identity),_.partialRight(y,n))).then(P)}function y(t,e){var i=t.id||t,u=!e;function o(e){return e||E(i,"read")}return(u?s.current():a.when(e)).then(function(e){return h(["ROLE_INVENTORY_READ","ROLE_MANAGED_OBJECT_READ"],e).then((r=e,function(e){return e||f(r,i,"MANAGED_OBJECT","*","READ")})).then((n=e,function(e){return e||c.isOwnerCached(t,n)})).then(u?o:_.identity);var n,r})}var E=_.memoize(function(e,n){e=u.url("inventory/managedObjects/".concat(e)),n=g(n);return i({method:n,data:"PUT"===n?{}:void 0,headers:{"content-type":"application/json",accept:void 0},silentError:!0,url:e}).then(_.constant(!0),_.constant(!1))},function(e,n){return e+g(n)});function g(e){return"admin"===e?"PUT":"HEAD"}function R(e,n){return a.all(_.map(_.filter(e,_.identity),_.partialRight(O,n))).then(P)}function O(t,e){var i=t.id||t,u=!e;function o(e){return e||E(i,"admin")}return(u?s.current():a.when(e)).then(function(e){return h(["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"],e).then((r=e,function(e){return e||f(r,i,"MANAGED_OBJECT","*","ADMIN")})).then((n=e,function(e){return e||c.isOwnerCached(t,n)})).then(u?o:_.identity);var n,r})}function T(e,n){var r=[];return e.anyRole&&r.push(h(e.anyRole,n)),e.allRoles&&r.push(v(e.allRoles,n)),e.readMOs&&r.push(A(b(e.readMOs),n)),e.adminMOs&&r.push(R(b(e.adminMOs),n)),a.all(r).then(P)}function b(e){return _.filter(_.map(e,function(e){return n=e,_.isString(n)&&/^:/.test(n)?r[e.replace(/^:/,"")]:e;var n}),_.identity)}function M(e){return e.then(function(e){return e?a.when(e):a.reject(e)})}function P(e){return _.every(e)}function N(e,n){var r={groups:[],users:[]};return _.forEach(n.groups,_.partial(D,r,e)),_.forEach(n.users,_.partial(I,r,e)),r}function D(n,e,r){_.forEach(r.devicePermissions[e],function(e){e=S(e),e={group:{id:r.id,name:r.name},scope:e.scope,type:e.type,access:e.access};n.groups.push(e)})}function I(n,e,r){_.forEach(r.devicePermissions[e],function(e){e=S(e),e={username:r.userName,scope:e.scope,type:e.type,access:e.access};n.users.push(e)})}function S(e){e=e.split(":");return{scope:e[0],type:e[1],access:e[2]}}function L(e){return[e.scope,e.type,e.access].join(":")}function w(e){return _.map(e,function(e){var n=e.id.split("_").filter(function(e,n,r){return!("ROLE"===e&&0===n&&1<r.length)}),r=1<n.length?n.pop():void 0,n=n.join("_");return{id:e.id,category:n,access:r}})}return{hasRole:l,hasDevicePermission:f,hasAnyRole:h,mustHaveAnyRole:function(e,n){return M(h(e,n))},hasAllRoles:v,mustHaveAllRoles:function(e,n){return M(v(e,n))},canReadMOs:A,mustHaveReadMOs:function(e,n){return M(A(e,n))},canAdminMOs:R,mustHaveAdminMOs:function(e,n){return M(R(e,n))},isAllowed:T,mustBeAllowed:function(e,n){return M(T(e,n))},getMOPermissions:function(e){var e=e.id||e,n=u.url("".concat(o,"/").concat(e));return _.isObjectLike(e)?a.when({groups:[],users:[]}):i.get(n).then(u.getResData).then(_.partial(N,e))},setMOPermissions:function(e,n){var r,e=e.id||e,t=u.url("".concat(o,"/").concat(e)),e=(function(r,t,e){e=_.groupBy(e,function(e){return e.group.id});_.forEach(e,function(e,n){n={id:n,devicePermissions:{}};n.devicePermissions[t]=_.map(e,L),r.push(n)})}((r={groups:[],users:[]}).groups,e=e,(n=n).groups),function(r,t,e){e=_.groupBy(e,function(e){return e.userName});_.forEach(e,function(e,n){n={userName:n,devicePermissions:{}};n.devicePermissions[t]=_.map(e,L),r.push(n)})}(r.users,e,n.users),r);return i.put(t,e)},getAccessTypes:function(){return["READ","ADMIN","*"]},convertServerPermissionsToUI:w,listGlobal:function(){return e.listRoles({pageSize:2e3}).then(w)},SCOPES:t,ACCESS_TYPES:n}}e.$inject=["$routeParams","$q","$http","c8yBase","c8yUser","c8yUserGroup","c8yInventory","gettext"],angular.module("c8y.core").factory("c8yPermissions",e)}();
@@ -1 +1 @@
1
- "use strict";!function(){function e(c,u,n){var a="userPreferences";function r(e,r){e=t(e,r);return o(r,e).then(_.partial(i,e))}function t(e,r){return e+r.userName.replace(/\./g,"__")}function o(e,r){var n;return l(e)?u.list({fragmentType:r}).then(function(e){return e.length?e[0]:{type:"c8y_UserPreference"}}):(e=y(),(n={})[r]=e[r],c.when(n))}function i(e,r){return r[e]}function f(e,r,n){e=t(e,n);return o(n,e).then(_.partial(s,e,r,n))}function s(e,r,n,t){return l(n)?(t[e]=r,u.save(t)):((n=y())[e]=r,window.localStorage.setItem(a,JSON.stringify(n)),c.resolve())}function l(e){return n.hasRole(e,"ROLE_INVENTORY_READ")&&n.hasRole(e,"ROLE_INVENTORY_ADMIN")}function y(){var r=window.localStorage.getItem(a);try{r=JSON.parse(r)}catch(e){r={}}return r||{}}return{get:function(e){return n.current().then(_.partial(r,e))},set:function(e,r){return n.current().then(_.partial(f,e,r))}}}e.$inject=["$q","c8yInventory","c8yUser"],angular.module("c8y.core").factory("c8yUserPreferences",e)}();
1
+ "use strict";!function(){function e(c,u,n){var a="userPreferences";function r(e,r){e=t(e,r);return o(r,e).then(_.partial(i,e))}function t(e,r){return e+r.userName.replace(/\./g,"__")}function o(e,r){var n;return l(e)?u.list({fragmentType:r}).then(function(e){return e.length?e[0]:{type:"c8y_UserPreference"}}):(e=h(),(n={})[r]=e[r],c.when(n))}function i(e,r){return r[e]}function s(e,r,n){e=t(e,n);return o(n,e).then(_.partial(f,e,r,n))}function f(e,r,n,t){return l(n)?(t[e]=r,u.save(t)):((n=h())[e]=r,window.localStorage.setItem(a,JSON.stringify(n)),c.resolve())}function l(e){return n.hasRole(e,"ROLE_INVENTORY_READ")&&n.hasRole(e,"ROLE_INVENTORY_ADMIN")||n.hasRole(e,"ROLE_MANAGED_OBJECT_READ")&&n.hasRole(e,"ROLE_MANAGED_OBJECT_ADMIN")}function h(){var r=window.localStorage.getItem(a);try{r=JSON.parse(r)}catch(e){r={}}return r||{}}return{get:function(e){return n.current().then(_.partial(r,e))},set:function(e,r){return n.current().then(_.partial(s,e,r))}}}e.$inject=["$q","c8yInventory","c8yUser"],angular.module("c8y.core").factory("c8yUserPreferences",e)}();
@@ -1 +1 @@
1
- "use strict";!function(){function e(t,e,n,i){var s,r=this,a=e.createEnum([{name:"NO_CONVERSION",label:i("No conversion"),value:""},{name:"IMPERIAL",label:i("Imperial"),value:"imperial"},{name:"METRIC",label:i("Metric"),value:"metric"}]);_.assign(r,{UNIT_TYPES:a.values(),$doCheck:function(){_.isEqual(r.user,s)||(r.loading=!0,t.current().then(function(e){var n=_.isEqual(e.userName,_.get(r,"user.userName"));_.set(r,"visible",(e=e,t.hasRole(e,"ROLE_INVENTORY_READ")&&t.hasRole(e,"ROLE_INVENTORY_ADMIN")&&n))}),n.get("unit",r.user).then(function(e){_.isUndefined(e)?_.set(r.user,"measurementUnit",a.NO_CONVERSION):_.set(r.user,"measurementUnit",_.find(a.values(),{value:e}))}).finally(function(){r.loading=!1}),s=r.user)},tooltip:i('Selected unit conversion will be used for displaying data. Select "No conversion" to see original units sent by devices.'),loading:!1})}e.$inject=["c8yUser","c8yBase","c8yUserPreferences","gettext"],angular.module("c8y.ui").component("c8yMeasurementUnitPreference",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/ui/user/measurementUnitPreference.html",bindings:{user:"="}})}();
1
+ "use strict";!function(){function e(t,e,n,i){var s,r=this,a=e.createEnum([{name:"NO_CONVERSION",label:i("No conversion"),value:""},{name:"IMPERIAL",label:i("Imperial"),value:"imperial"},{name:"METRIC",label:i("Metric"),value:"metric"}]);_.assign(r,{UNIT_TYPES:a.values(),$doCheck:function(){_.isEqual(r.user,s)||(r.loading=!0,t.current().then(function(e){var n=_.isEqual(e.userName,_.get(r,"user.userName"));_.set(r,"visible",(e=e,(t.hasRole(e,"ROLE_INVENTORY_READ")&&t.hasRole(e,"ROLE_INVENTORY_ADMIN")||t.hasRole(e,"ROLE_MANAGED_OBJECT_READ")&&t.hasRole(e,"ROLE_MANAGED_OBJECT_ADMIN"))&&n))}),n.get("unit",r.user).then(function(e){_.isUndefined(e)?_.set(r.user,"measurementUnit",a.NO_CONVERSION):_.set(r.user,"measurementUnit",_.find(a.values(),{value:e}))}).finally(function(){r.loading=!1}),s=r.user)},tooltip:i('Selected unit conversion will be used for displaying data. Select "No conversion" to see original units sent by devices.'),loading:!1})}e.$inject=["c8yUser","c8yBase","c8yUserPreferences","gettext"],angular.module("c8y.ui").component("c8yMeasurementUnitPreference",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/ui/user/measurementUnitPreference.html",bindings:{user:"="}})}();
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(e,n){return _arrayWithHoles(e)||_iterableToArrayLimit(e,n)||_unsupportedIterableToArray(e,n)||_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,n){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,n):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function _iterableToArrayLimit(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,a,c=[],u=!0,d=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;u=!1}else for(;!(u=(r=i.call(t)).done)&&(c.push(r.value),c.length!==n);u=!0);}catch(e){d=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(d)throw o}}return c}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function ue(e,n,W,o,$,a,i,c,u,j,t,d,G,l,s,f){var h=e("dashboards"),p=e("dashboardLists"),g="c8y_Dashboard",M={welcome:{icon:"cloud",name:s.getString("Welcome")},home:{icon:"home",name:s.getString("Home")}};function z(e){return _.map(e,function(e){return _.assign(_.get(e,g,{}),{id:e.id})})}function m(e){var t,n,r,e=e||{},o=_.assign(_.get(e,g,{}),{id:e.id},(t=/^c8y_Dashboard!(.+)$/,_.pickBy(e,function(e,n){return t.test(n)})));return _.set(o,"global",!!_.get(e,"c8y_Global")),n=o,r=["templateUrl","configTemplateUrl"],e=_.map(n.children,function(e){return a.all(_.map(r,_.partial(K,e)))}),a.all(e).then(function(){return n}).then(H)}function H(n){return n.children?(e=n.children,t.list().then(function(n){return _(e).mapValues(function(e){return V(e,n,!1)}).value()}).then(function(e){return n.children=e,n})):n;var e}function V(e,n,t){var r,o=_.cloneDeep(e),e=_.find(n,function(e){var n=e.name&&e.name===o.name,e=e.templateUrl&&e.templateUrl===o.templateUrl;return n||e});return e?((r=e.replaceWith)&&(o.config=i.invoke(r.config,void 0,{oldConfig:o.config}),e=_.find(n,{name:r.component})),o.name=e.name,e.transformConfigWithContext&&(o.componentTransformConfigWithContext=e.transformConfigWithContext),e.widgetComponent?(o.widgetComponent=e.widgetComponent,delete o.templateUrl):o.templateUrl=e.templateUrl,e.configComponent?(o.configComponent=e.configComponent,delete o.configTemplateUrl):o.configTemplateUrl=e.configTemplateUrl,o):t?null:o}function F(n){return d.canAdminMOs([n]).then(function(e){return e||(n.isFrozen=!e),n.readOnly=!e,n})}function B(e){return _.get(e,"isFrozen")}function Y(e){return J(e,!0)}function q(e){return J(e,!1)}function J(e,n){return e.isFrozen=n,k.saveAndWait(e).then(ue.clearCacheList)}function K(n,t){var e=n[t];return G.verifyPluginViewPath(e).then(function(e){return n[t]=e,n})}function r(n){return function(e){e=_.isObjectLike(e)?e.id:e;return[g,n,e].join("!")}}var v=r("device"),e=r("group"),Q=r("name"),b=r("type");function X(e){return h.put(y(e),_.cloneDeep(e))}function y(e){return _.isObjectLike(e)?e.id:e}function C(e,n){var t,r=_.assign(e||{},{fragmentType:n||g}),r=u.list(r).then(z);return n&&!e&&(t=p.get(n),r.then(function(e){0<e.length&&p.put(n,e)})),t?a.when(t):r}function Z(){p.removeAll(),n.$emit("dashboard:refresh")}function x(e,n,t){var r=h.get(y(e)),t=!(t&&r)&&u.detail(e).then(c.getResData).then(m).then(F).then(X);return(r?a.when(r):t).then(re).then(ee(n))}function ee(t){return function(e){var n;return(e.deviceType||t)&&(n=_.cloneDeep(e),e=S().then(_.partial(ne,n))),e}}function ne(e,n){return a.all(_.map(e.children,function(e){return te(n,e.config)})).then(_.constant(e))}function te(n,e){function t(e){e.__target={id:n.id,name:n.name}}return e&&(e.device={id:n.id,name:n.name},e.datapoints&&_.forEach(e.datapoints,t),e.alarmsEventsConfigs&&_.forEach(e.alarmsEventsConfigs,t),e.options&&e.options.dataPoints&&_.forEach(e.options.dataPoints,t),e.datapointsGauge&&_.forEach(e.datapointsGauge,t),e.datapointsLabels)&&_.forEach(e.datapointsLabels,t),e}function re(t){return S().then(function(n){return a.all(_.map(t.children,function(e){return T(n,t,e)}))}).then(_.constant(t))}function T(t,r,n){var e=n.config||{},o=_.compact([n.transformConfigWithContext,n.componentTransformConfigWithContext]);return _.reduce(o,function(e,n){return e.then(function(e){return i.invoke(n,null,{config:e,context:t,dashboard:r})})},a.resolve(e)).then(function(e){return _.assign(n,{config:e})})}function R(e){return t.list().then(function(n){return _(e).map(function(e){return V(e,n,!0)}).compact().value()})}function oe(t,e){_.forEach(e,function(e,n){t[n]&&(t[n]=e(t[n]))})}function A(e,n,t){return _.forEach(e,function(e){e.__target=ie(e.__target,n,t)}),e}function ie(e,n,t){return e&&e.id===t.id&&_.assign(e,_.pick(n,["id","name"])),e}function D(e){var t=["id","creationContext","readOnly"],r=/^c8y_Dashboard!/,n=_.cloneDeep(e),o=(n.global=!!n.deviceType||n.global,n.id),i={id:o},o=o?"update":"createConfirm",a=(i[g]=_.pickBy(n,function(e,n){return!r.test(n)&&!_.includes(t,n)}),(a=i)[g].global&&_.assign(a,{c8y_Global:{}}),n.deviceType?{}:n.creationContext),n=u[o](i,a);return"update"==o&&(n=n.then(function(){return e})),(n="createConfirm"==o?n.then(c.getResData).then(m):n).then(X)}function I(e,n,t,r){t={id:t.id},e=e(n);return t[e]=r?null:{},h.get(e)&&h.remove(e),u.save(t)}function E(e,n){return C(null,e(n))}function O(){var t,r;return k.forcedContext||(r=t=null,_.forEach(["report","device","group"],function(e){var n=_.get(W,"".concat(e,"Id"));n&&(t=e,r=n)}),{context:t,id:r})}function ae(e,n){return o.open({templateUrl:":::PLUGIN_PATH:::/dashboardWidget/config.html",controller:"DashboardWidgetConfigController",size:"lg",resolve:{dashboard:function(){return n||{}},component:function(){return e||{}},hideTarget:function(){return n&&n.deviceType}}}).result}function ce(e,r){e={template:'<div ng-include="\':::PLUGIN_PATH:::/dashboard/new.html\'" ng-controller="DashboardEditCtrl"></div>',controller:["$scope","$uibModalInstance","config",function(e,n,t){e.dashboardId="new",e.modalInstance=n,e.config=t||{},e.creationContext=r}],size:"lg",resolve:{config:_.constant(e)}};return o.open(e).result}function L(e,n){var t,n=angular.extend({title:l("Select dashboard"),preventNew:!0,selectLabel:l("Select"),useReports:!0},n);return t=n,t={templateUrl:":::PLUGIN_PATH:::/dashboard/select.html",controller:"DashboardSelectController",size:"lg",resolve:{config:_.constant(n)}},o.open(t).result.then(function(n){return e.templateUrl?U(n,e):R([e]).then(function(e){e=_slicedToArray(e,1)[0];return U(n,e)})})}var w={};function U(e,n,t){var r=e.id||e,o=(w[r]=w[r]||{children:[]},w[r]),i=o.promise;return o.children.push({child:n,remove:t}),i||(o.promise=$(function(){return a.all({dashboard:x(e,!1,!0),contextObject:S()}).then(function(e){var t=e.dashboard,r=e.contextObject;return a.all(_.map(o.children,function(n){return(n.remove?a.resolve(n.child):T(r,t,n.child)).then(function(e){t.children=P(t.children||{},e,n.remove)})})).then(_.constant(t))}).then(D)}),(i=o.promise).finally(function(){delete w[r]})),i}function P(e,n,t){return n.id||(n.id=String(Math.random()).substr(2)),t?delete e[n.id]:e[n.id]=n,t=e,r=0,_(t).sortBy("position").forEach(function(e){e.position=r,r+=1}),_.cloneDeep(t);var r}function S(){var n=O();return n.id?j.detailCached(n.id,{withChildren:!1}).then(c.getResData).then(function(e){return e||{id:n.id}}):a.when({})}var N=[];var k={list:C,save:D,saveAndWait:_.partialRight(D,!0),detail:x,detailPredefinedReadOnly:function(e,n){var t={children:{},isFrozen:!0,readOnly:!0};return R(e).then(function(e){return _.forEach(e,function(e){P(t.children,e)}),t}).then(re).then(ee(n))},named:function(n,t,r){function o(e){return D(e).then(_.partial(I,Q,n)).then(c.getResData).then(function(e){return x(e,r)})}return C(null,Q(n)).then(function(e){var n;return e.length?x(_.head(e).id,r):(n={children:{}},R(t).then(function(e){return _.forEach(e,function(e){P(n.children,e)}),d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE"]).then(function(e){return!!e||a.reject()}).then(_.partial(o,n)).catch(_.partial(_.identity,n))}))})},isNamed:function(e){return _.some(_.keys(e),function(e){return/^c8y_Dashboard!name!/.test(e)})},remove:function(e){return h.remove(y(e)),n.$emit("dashboard:remove",y(e)),u.remove(e)},isLocked:B,toggleLock:function(e){return(B(e)?q:Y)(e)},lock:Y,unlock:q,deviceAdd:_.partial(I,v),deviceRemove:_.partialRight(_.partial(I,v),!0),deviceList:_.partial(E,v),deviceTypeAdd:_.partial(I,b),deviceTypeRemove:_.partialRight(_.partial(I,b),!0),deviceTypeList:function(e){return a.all([E(v,e.id),E(b,e.type)]).then(_.flattenDeep)},groupAdd:_.partial(I,e),groupRemove:_.partialRight(_.partial(I,e),!0),groupList:_.partial(E,e),getContextObject:S,transformChildWithContext:T,updateConfigTargetsWithContext:te,addDashboard:ce,copyDashboard:function(e){var n,t=function(e){var n=O(),t=n.id;function r(e){return e.__target.id!==t}if("device"!==n.context&&"group"!==n.context)return l("Only dashboards from devices or groups can be copied");if(!_.every(e.children,function(e){var e=e.config||{},n=!0;return e.device&&e.device.id!==t&&(n=!1),n=e.datapoints&&_.some(e.datapoints,r)?!1:n})){if("device"===n.context)return l("Only dashboards with widgets referencing the current device can be copied.");if("group"===n.context)return l("Only dashboards with widgets referencing the current group can be copied.")}return!1}(e);return t?(f.warning(t),!1):(N=[],t=O(),N.push({dashboard:_.cloneDeep(e),context:t}),"device"===t.context&&(n=l('Dashboard copied. Navigate to the desired device and select "Paste dashboard"')),"group"===t.context&&(n=l('Dashboard copied. Navigate to the desired group and select "Paste dashboard"')),f.success(n),!0)},pasteDashboard:function(){if(N&&N.length)return S().then(function(e){var n,t,r,o,i,a,c,u;return u=_.last(N),n=O(),u=u.context.context,(i=n.context!==u&&("device"===u&&(i=l("Device dashboards can only be copied into a device.")),"group"===u)?l("Group dashboards can only be copied into a group."):i)&&f.warning(i),!i&&(n=N.pop(),t=n.dashboard,(r=O()).name=e.name,o=k["".concat(r.context,"Add")],_.forEach(t,function(e,n){n.match(/!/)&&delete t[n]}),u=r.context,r.context===n.context.context&&["device","group"].includes(u)&&(i=t,a=r,c=n.context,e=_.reduce(i.children,function(e,n){var t=n.id,r=n.config,o={device:function(e){return ie(e,a,c)},datapoints:function(e){return A(e,a,c)},dataPoints:function(e){return A(e,a,c)},datapointsGauge:function(e){return A(e,a,c)},datapointsLabels:function(e){return A(e,a,c)}};return r&&(oe(r,o),r.options)&&oe(r.options,o),e[t]=n,e},{}),i.children=e,t=i),t.creationContext=r,delete t.id,(u=D(t)).then(function(e){return o(r.id,e)}).finally(Z),u)})},dashboardToPaste:function(){var e=N&&N[0];return e&&e.dashboard},selectDashboard:ce,editCurrentDashboard:function(t){return o.open({template:'<div ng-include="\':::PLUGIN_PATH:::/dashboard/new.html\'" ng-controller="DashboardEditCtrl"></div>',controller:["$scope","$uibModalInstance",function(e,n){e.modalInstance=n,e.dashboardId=_.get(t,"dashboardId")}],size:"lg"}).result},editChildUI:ae,addChildUI:_.partial(ae,null),restoreDefaultChildren:function(t,e,r){return R(e).then(function(e){var n=t.children;return _.forEach(_.keys(n),function(e){P(n,n[e],!0)}),_.forEach(e,function(e){P(n,e)}),D(t).then(function(e){return x(e,r)})})},getContext:O,getContextPath:function(){var e=O(),n="";return"group"===e.context&&(n="/group/".concat(e.id)),n="device"===e.context?"/device/".concat(e.id):n},appendChild:_.partialRight(U,!1),updateChild:_.partialRight(U,!1),removeChild:_.partialRight(U,!0),clearCacheList:Z,addWidgetToSelectedDashboard:L,addWidgetToSelectedDashboardInContext:function(e){return L(e,{inContext:!0,preventCreate:!0,useReports:!1})},addWidgetToSelectedReport:function(e){return L(e,{onlyReports:!0,useReports:!0,title:l("Select report"),preventCreate:!0})},getIconNameObj:function(e){var n,t={icon:e.icon||"th",name:e.name||s.getString("Dashboard")},r=function(e){var t=/^c8y_Dashboard!name!(.+?)[-_].+$/,e=_.pickBy(e,function(e,n){return t.test(n)}),e=_.keys(e);if(0<e.length)return e[0].match(t)[1];return null}(e),o=c.getPluginService("c8yReports");return r&&(n=M[r])&&(t.icon=n.icon||t.icon,t.name=n.name||t.name),"report"===r&&o&&(t=o.getReportFromDashboard(e).then(function(e){return _.pick(e,["icon","name"])})),a.resolve(t)},hasWritePermissions:function(e){return e=c.hasId(e)?d.canAdminMOs([e]):d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE"])},VERSION:2};return _.assign(k)}ue.$inject=["$cacheFactory","$rootScope","$routeParams","$uibModal","$timeout","$q","$injector","c8yBase","dashboardInventorySvc","c8yInventory","c8yComponents","c8yPermissions","c8yUiUtil","gettext","gettextCatalog","c8yAlert"],angular.module("c8y.parts.dashboard2").factory("dashboardSvc",ue)}();
1
+ "use strict";function _slicedToArray(e,n){return _arrayWithHoles(e)||_iterableToArrayLimit(e,n)||_unsupportedIterableToArray(e,n)||_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,n){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,n):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function _iterableToArrayLimit(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,a,c=[],u=!0,d=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;u=!1}else for(;!(u=(r=i.call(t)).done)&&(c.push(r.value),c.length!==n);u=!0);}catch(e){d=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(d)throw o}}return c}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function ue(e,n,W,o,$,a,i,c,u,j,t,d,M,l,s,f){var h=e("dashboards"),p=e("dashboardLists"),g="c8y_Dashboard",G={welcome:{icon:"cloud",name:s.getString("Welcome")},home:{icon:"home",name:s.getString("Home")}};function B(e){return _.map(e,function(e){return _.assign(_.get(e,g,{}),{id:e.id})})}function m(e){var t,n,r,e=e||{},o=_.assign(_.get(e,g,{}),{id:e.id},(t=/^c8y_Dashboard!(.+)$/,_.pickBy(e,function(e,n){return t.test(n)})));return _.set(o,"global",!!_.get(e,"c8y_Global")),n=o,r=["templateUrl","configTemplateUrl"],e=_.map(n.children,function(e){return a.all(_.map(r,_.partial(K,e)))}),a.all(e).then(function(){return n}).then(z)}function z(n){return n.children?(e=n.children,t.list().then(function(n){return _(e).mapValues(function(e){return H(e,n,!1)}).value()}).then(function(e){return n.children=e,n})):n;var e}function H(e,n,t){var r,o=_.cloneDeep(e),e=_.find(n,function(e){var n=e.name&&e.name===o.name,e=e.templateUrl&&e.templateUrl===o.templateUrl;return n||e});return e?((r=e.replaceWith)&&(o.config=i.invoke(r.config,void 0,{oldConfig:o.config}),e=_.find(n,{name:r.component})),o.name=e.name,e.transformConfigWithContext&&(o.componentTransformConfigWithContext=e.transformConfigWithContext),e.widgetComponent?(o.widgetComponent=e.widgetComponent,delete o.templateUrl):o.templateUrl=e.templateUrl,e.configComponent?(o.configComponent=e.configComponent,delete o.configTemplateUrl):o.configTemplateUrl=e.configTemplateUrl,o):t?null:o}function V(n){return d.canAdminMOs([n]).then(function(e){return e||(n.isFrozen=!e),n.readOnly=!e,n})}function F(e){return _.get(e,"isFrozen")}function J(e){return q(e,!0)}function Y(e){return q(e,!1)}function q(e,n){return e.isFrozen=n,k.saveAndWait(e).then(ue.clearCacheList)}function K(n,t){var e=n[t];return M.verifyPluginViewPath(e).then(function(e){return n[t]=e,n})}function r(n){return function(e){e=_.isObjectLike(e)?e.id:e;return[g,n,e].join("!")}}var v=r("device"),e=r("group"),Q=r("name"),b=r("type");function X(e){return h.put(y(e),_.cloneDeep(e))}function y(e){return _.isObjectLike(e)?e.id:e}function C(e,n){var t,r=_.assign(e||{},{fragmentType:n||g}),r=u.list(r).then(B);return n&&!e&&(t=p.get(n),r.then(function(e){0<e.length&&p.put(n,e)})),t?a.when(t):r}function Z(){p.removeAll(),n.$emit("dashboard:refresh")}function E(e,n,t){var r=h.get(y(e)),t=!(t&&r)&&u.detail(e).then(c.getResData).then(m).then(V).then(X);return(r?a.when(r):t).then(re).then(ee(n))}function ee(t){return function(e){var n;return(e.deviceType||t)&&(n=_.cloneDeep(e),e=P().then(_.partial(ne,n))),e}}function ne(e,n){return a.all(_.map(e.children,function(e){return te(n,e.config)})).then(_.constant(e))}function te(n,e){function t(e){e.__target={id:n.id,name:n.name}}return e&&(e.device={id:n.id,name:n.name},e.datapoints&&_.forEach(e.datapoints,t),e.alarmsEventsConfigs&&_.forEach(e.alarmsEventsConfigs,t),e.options&&e.options.dataPoints&&_.forEach(e.options.dataPoints,t),e.datapointsGauge&&_.forEach(e.datapointsGauge,t),e.datapointsLabels)&&_.forEach(e.datapointsLabels,t),e}function re(t){return P().then(function(n){return a.all(_.map(t.children,function(e){return A(n,t,e)}))}).then(_.constant(t))}function A(t,r,n){var e=n.config||{},o=_.compact([n.transformConfigWithContext,n.componentTransformConfigWithContext]);return _.reduce(o,function(e,n){return e.then(function(e){return i.invoke(n,null,{config:e,context:t,dashboard:r})})},a.resolve(e)).then(function(e){return _.assign(n,{config:e})})}function T(e){return t.list().then(function(n){return _(e).map(function(e){return H(e,n,!0)}).compact().value()})}function oe(t,e){_.forEach(e,function(e,n){t[n]&&(t[n]=e(t[n]))})}function x(e,n,t){return _.forEach(e,function(e){e.__target=ie(e.__target,n,t)}),e}function ie(e,n,t){return e&&e.id===t.id&&_.assign(e,_.pick(n,["id","name"])),e}function R(e){var t=["id","creationContext","readOnly"],r=/^c8y_Dashboard!/,n=_.cloneDeep(e),o=(n.global=!!n.deviceType||n.global,n.id),i={id:o},o=o?"update":"createConfirm",a=(i[g]=_.pickBy(n,function(e,n){return!r.test(n)&&!_.includes(t,n)}),(a=i)[g].global&&_.assign(a,{c8y_Global:{}}),n.deviceType?{}:n.creationContext),n=u[o](i,a);return"update"==o&&(n=n.then(function(){return e})),(n="createConfirm"==o?n.then(c.getResData).then(m):n).then(X)}function D(e,n,t,r){t={id:t.id},e=e(n);return t[e]=r?null:{},h.get(e)&&h.remove(e),u.save(t)}function O(e,n){return C(null,e(n))}function I(){var t,r;return k.forcedContext||(r=t=null,_.forEach(["report","device","group"],function(e){var n=_.get(W,"".concat(e,"Id"));n&&(t=e,r=n)}),{context:t,id:r})}function ae(e,n){return o.open({templateUrl:":::PLUGIN_PATH:::/dashboardWidget/config.html",controller:"DashboardWidgetConfigController",size:"lg",resolve:{dashboard:function(){return n||{}},component:function(){return e||{}},hideTarget:function(){return n&&n.deviceType}}}).result}function ce(e,r){e={template:'<div ng-include="\':::PLUGIN_PATH:::/dashboard/new.html\'" ng-controller="DashboardEditCtrl"></div>',controller:["$scope","$uibModalInstance","config",function(e,n,t){e.dashboardId="new",e.modalInstance=n,e.config=t||{},e.creationContext=r}],size:"lg",resolve:{config:_.constant(e)}};return o.open(e).result}function L(e,n){var t,n=angular.extend({title:l("Select dashboard"),preventNew:!0,selectLabel:l("Select"),useReports:!0},n);return t=n,t={templateUrl:":::PLUGIN_PATH:::/dashboard/select.html",controller:"DashboardSelectController",size:"lg",resolve:{config:_.constant(n)}},o.open(t).result.then(function(n){return e.templateUrl?w(n,e):T([e]).then(function(e){e=_slicedToArray(e,1)[0];return w(n,e)})})}var N={};function w(e,n,t){var r=e.id||e,o=(N[r]=N[r]||{children:[]},N[r]),i=o.promise;return o.children.push({child:n,remove:t}),i||(o.promise=$(function(){return a.all({dashboard:E(e,!1,!0),contextObject:P()}).then(function(e){var t=e.dashboard,r=e.contextObject;return a.all(_.map(o.children,function(n){return(n.remove?a.resolve(n.child):A(r,t,n.child)).then(function(e){t.children=U(t.children||{},e,n.remove)})})).then(_.constant(t))}).then(R)}),(i=o.promise).finally(function(){delete N[r]})),i}function U(e,n,t){return n.id||(n.id=String(Math.random()).substr(2)),t?delete e[n.id]:e[n.id]=n,t=e,r=0,_(t).sortBy("position").forEach(function(e){e.position=r,r+=1}),_.cloneDeep(t);var r}function P(){var n=I();return n.id?j.detailCached(n.id,{withChildren:!1}).then(c.getResData).then(function(e){return e||{id:n.id}}):a.when({})}var S=[];var k={list:C,save:R,saveAndWait:_.partialRight(R,!0),detail:E,detailPredefinedReadOnly:function(e,n){var t={children:{},isFrozen:!0,readOnly:!0};return T(e).then(function(e){return _.forEach(e,function(e){U(t.children,e)}),t}).then(re).then(ee(n))},named:function(n,t,r){function o(e){return R(e).then(_.partial(D,Q,n)).then(c.getResData).then(function(e){return E(e,r)})}return C(null,Q(n)).then(function(e){var n;return e.length?E(_.head(e).id,r):(n={children:{}},T(t).then(function(e){return _.forEach(e,function(e){U(n.children,e)}),d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"]).then(function(e){return!!e||a.reject()}).then(_.partial(o,n)).catch(_.partial(_.identity,n))}))})},isNamed:function(e){return _.some(_.keys(e),function(e){return/^c8y_Dashboard!name!/.test(e)})},remove:function(e){return h.remove(y(e)),n.$emit("dashboard:remove",y(e)),u.remove(e)},isLocked:F,toggleLock:function(e){return(F(e)?Y:J)(e)},lock:J,unlock:Y,deviceAdd:_.partial(D,v),deviceRemove:_.partialRight(_.partial(D,v),!0),deviceList:_.partial(O,v),deviceTypeAdd:_.partial(D,b),deviceTypeRemove:_.partialRight(_.partial(D,b),!0),deviceTypeList:function(e){return a.all([O(v,e.id),O(b,e.type)]).then(_.flattenDeep)},groupAdd:_.partial(D,e),groupRemove:_.partialRight(_.partial(D,e),!0),groupList:_.partial(O,e),getContextObject:P,transformChildWithContext:A,updateConfigTargetsWithContext:te,addDashboard:ce,copyDashboard:function(e){var n,t=function(e){var n=I(),t=n.id;function r(e){return e.__target.id!==t}if("device"!==n.context&&"group"!==n.context)return l("Only dashboards from devices or groups can be copied");if(!_.every(e.children,function(e){var e=e.config||{},n=!0;return e.device&&e.device.id!==t&&(n=!1),n=e.datapoints&&_.some(e.datapoints,r)?!1:n})){if("device"===n.context)return l("Only dashboards with widgets referencing the current device can be copied.");if("group"===n.context)return l("Only dashboards with widgets referencing the current group can be copied.")}return!1}(e);return t?(f.warning(t),!1):(S=[],t=I(),S.push({dashboard:_.cloneDeep(e),context:t}),"device"===t.context&&(n=l('Dashboard copied. Navigate to the desired device and select "Paste dashboard"')),"group"===t.context&&(n=l('Dashboard copied. Navigate to the desired group and select "Paste dashboard"')),f.success(n),!0)},pasteDashboard:function(){if(S&&S.length)return P().then(function(e){var n,t,r,o,i,a,c,u;return u=_.last(S),n=I(),u=u.context.context,(i=n.context!==u&&("device"===u&&(i=l("Device dashboards can only be copied into a device.")),"group"===u)?l("Group dashboards can only be copied into a group."):i)&&f.warning(i),!i&&(n=S.pop(),t=n.dashboard,(r=I()).name=e.name,o=k["".concat(r.context,"Add")],_.forEach(t,function(e,n){n.match(/!/)&&delete t[n]}),u=r.context,r.context===n.context.context&&["device","group"].includes(u)&&(i=t,a=r,c=n.context,e=_.reduce(i.children,function(e,n){var t=n.id,r=n.config,o={device:function(e){return ie(e,a,c)},datapoints:function(e){return x(e,a,c)},dataPoints:function(e){return x(e,a,c)},datapointsGauge:function(e){return x(e,a,c)},datapointsLabels:function(e){return x(e,a,c)}};return r&&(oe(r,o),r.options)&&oe(r.options,o),e[t]=n,e},{}),i.children=e,t=i),t.creationContext=r,delete t.id,(u=R(t)).then(function(e){return o(r.id,e)}).finally(Z),u)})},dashboardToPaste:function(){var e=S&&S[0];return e&&e.dashboard},selectDashboard:ce,editCurrentDashboard:function(t){return o.open({template:'<div ng-include="\':::PLUGIN_PATH:::/dashboard/new.html\'" ng-controller="DashboardEditCtrl"></div>',controller:["$scope","$uibModalInstance",function(e,n){e.modalInstance=n,e.dashboardId=_.get(t,"dashboardId")}],size:"lg"}).result},editChildUI:ae,addChildUI:_.partial(ae,null),restoreDefaultChildren:function(t,e,r){return T(e).then(function(e){var n=t.children;return _.forEach(_.keys(n),function(e){U(n,n[e],!0)}),_.forEach(e,function(e){U(n,e)}),R(t).then(function(e){return E(e,r)})})},getContext:I,getContextPath:function(){var e=I(),n="";return"group"===e.context&&(n="/group/".concat(e.id)),n="device"===e.context?"/device/".concat(e.id):n},appendChild:_.partialRight(w,!1),updateChild:_.partialRight(w,!1),removeChild:_.partialRight(w,!0),clearCacheList:Z,addWidgetToSelectedDashboard:L,addWidgetToSelectedDashboardInContext:function(e){return L(e,{inContext:!0,preventCreate:!0,useReports:!1})},addWidgetToSelectedReport:function(e){return L(e,{onlyReports:!0,useReports:!0,title:l("Select report"),preventCreate:!0})},getIconNameObj:function(e){var n,t={icon:e.icon||"th",name:e.name||s.getString("Dashboard")},r=function(e){var t=/^c8y_Dashboard!name!(.+?)[-_].+$/,e=_.pickBy(e,function(e,n){return t.test(n)}),e=_.keys(e);if(0<e.length)return e[0].match(t)[1];return null}(e),o=c.getPluginService("c8yReports");return r&&(n=G[r])&&(t.icon=n.icon||t.icon,t.name=n.name||t.name),"report"===r&&o&&(t=o.getReportFromDashboard(e).then(function(e){return _.pick(e,["icon","name"])})),a.resolve(t)},hasWritePermissions:function(e){return e=c.hasId(e)?d.canAdminMOs([e]):d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"])},VERSION:2};return _.assign(k)}ue.$inject=["$cacheFactory","$rootScope","$routeParams","$uibModal","$timeout","$q","$injector","c8yBase","dashboardInventorySvc","c8yInventory","c8yComponents","c8yPermissions","c8yUiUtil","gettext","gettextCatalog","c8yAlert"],angular.module("c8y.parts.dashboard2").factory("dashboardSvc",ue)}();
@@ -1,5 +1,5 @@
1
1
  <c8y-ui-action-bar-set>
2
- <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_INVENTORY_CREATE']">
2
+ <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_INVENTORY_CREATE', 'ROLE_MANAGED_OBJECT_ADMIN', 'ROLE_MANAGED_OBJECT_CREATE']">
3
3
  <button
4
4
  title="{{ 'Import' | translate }}"
5
5
  class="btn btn-link"
@@ -1 +1 @@
1
- "use strict";!function(){function e(e,n,t,r,o,i,c,u,s,a,d,p,l,g){var f,h=this,m="c8y_DeviceGroup",v="c8y_IsDeviceGroup";function y(){return o.directParentAssets(f,m,v,{withChildren:!1}).then(G)}function G(e){h.currentGroups=e,o.clearBreadcrumbsCache(f),i.$emit("update")}function A(){return y().then(function(){return c.success(a("Device added to group"))})}_.assign(h,{group:{},$onInit:function(){_.get(h.config,"device.id")&&(f=_.get(h.config,"device.id"),y(),d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE"]).then(function(e){h.isCreateNewGroupAllowed=e}))},addToGroup:function(e){return function(e){return function(e){return!_.isUndefined(e.newGroup)}(e)?function(n){return t({title:a("Create new group and assign device"),body:l.getString('You are about to create a new group "{{name}}" and assign the device to it. Do you want to proceed?',{name:n}),labels:{ok:a("Create and assign")},status:"warning",size:"sm"}).then(function(){return e={name:n},p.create(e).then(u.getResData);var e}).then(function(e){return g.addGroupNavigation(e),e})}(e.name):n.resolve(e)}(e).then(function(e){return n=e,o.detailCached(f).then(function(e){e=e.data;return r.addChildAsset(n,e)});var n}).then(A)},removeFromGroup:function(n){return o.detailCached(f).then(function(e){e=e.data;return s.unassignDevice(n,e)}).then(y).then(function(){return c.success(a("Device removed from group."))})},isCreateNewGroupAllowed:!1})}function n(t,e,n,r,o){var i=[];function c(e){return n.detail(e).then(function(e){var n=e.data;return r.getGroupItems(n).then(function(e){t.items=e,i.push(n)})})}t.title=o("Select group"),t.drillDown=c,t.upToGroup=function(e){for(;i[i.length-1]!==e;)i.pop();i.pop(),c(e.id)},t.select=e.close,t.dismiss=e.dismiss,t.isGroup=r.isGroup,r.getTopLevelGroups().then(function(e){t.items=e}),t.breadcrumbs=i,t.currentManagedObjectId=t.device.id}e.$inject=["$scope","$q","c8yModal","c8yInventory","c8yDevices","c8yBreadcrumbs","c8yAlert","c8yBase","groupsHierarchySvc","gettext","c8yPermissions","c8yDeviceGroup","gettextCatalog","groupTypesHierarchyNavigator"],n.$inject=["$scope","$uibModalInstance","c8yInventory","c8yGroups","gettext"],angular.module("c8y.deviceGroupAssignment").controller("GroupSelectModalCtrl",n).component("groupAssignment",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/groupAssignment.component.html",bindings:{config:"<"}})}();
1
+ "use strict";!function(){function e(e,n,t,r,o,i,c,u,s,a,d,p,l,g){var f,h=this,m="c8y_DeviceGroup",v="c8y_IsDeviceGroup";function y(){return o.directParentAssets(f,m,v,{withChildren:!1}).then(G)}function G(e){h.currentGroups=e,o.clearBreadcrumbsCache(f),i.$emit("update")}function A(){return y().then(function(){return c.success(a("Device added to group"))})}_.assign(h,{group:{},$onInit:function(){_.get(h.config,"device.id")&&(f=_.get(h.config,"device.id"),y(),d.hasAnyRole(["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"]).then(function(e){h.isCreateNewGroupAllowed=e}))},addToGroup:function(e){return function(e){return function(e){return!_.isUndefined(e.newGroup)}(e)?function(n){return t({title:a("Create new group and assign device"),body:l.getString('You are about to create a new group "{{name}}" and assign the device to it. Do you want to proceed?',{name:n}),labels:{ok:a("Create and assign")},status:"warning",size:"sm"}).then(function(){return e={name:n},p.create(e).then(u.getResData);var e}).then(function(e){return g.addGroupNavigation(e),e})}(e.name):n.resolve(e)}(e).then(function(e){return n=e,o.detailCached(f).then(function(e){e=e.data;return r.addChildAsset(n,e)});var n}).then(A)},removeFromGroup:function(n){return o.detailCached(f).then(function(e){e=e.data;return s.unassignDevice(n,e)}).then(y).then(function(){return c.success(a("Device removed from group."))})},isCreateNewGroupAllowed:!1})}function n(t,e,n,r,o){var i=[];function c(e){return n.detail(e).then(function(e){var n=e.data;return r.getGroupItems(n).then(function(e){t.items=e,i.push(n)})})}t.title=o("Select group"),t.drillDown=c,t.upToGroup=function(e){for(;i[i.length-1]!==e;)i.pop();i.pop(),c(e.id)},t.select=e.close,t.dismiss=e.dismiss,t.isGroup=r.isGroup,r.getTopLevelGroups().then(function(e){t.items=e}),t.breadcrumbs=i,t.currentManagedObjectId=t.device.id}e.$inject=["$scope","$q","c8yModal","c8yInventory","c8yDevices","c8yBreadcrumbs","c8yAlert","c8yBase","groupsHierarchySvc","gettext","c8yPermissions","c8yDeviceGroup","gettextCatalog","groupTypesHierarchyNavigator"],n.$inject=["$scope","$uibModalInstance","c8yInventory","c8yGroups","gettext"],angular.module("c8y.deviceGroupAssignment").controller("GroupSelectModalCtrl",n).component("groupAssignment",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/groupAssignment.component.html",bindings:{config:"<"}})}();
@@ -1 +1 @@
1
- "use strict";angular.module("c8y.parts.availability",["nvd3ChartDirectives"]).config(["c8yViewsProvider","c8yNavigatorProvider","c8yTitleProvider","gettext",function(i,e,a,t){var l="signal",n={name:t("Availability"),icon:l,templateUrl:"".concat(":::PLUGIN_PATH:::/views/","detail.html"),controller:"availabilityReportCtrl",showIfPermissions:{allRoles:["ROLE_ALARM_READ","ROLE_INVENTORY_READ"]}},o="availability";e.addNavigation({parent:t("Devices"),name:t("Availability"),icon:l,path:o,showIfPermissions:{allRoles:["ROLE_ALARM_READ","ROLE_INVENTORY_READ"]}}),i.when("/device/:deviceId",_.cloneDeep(n)),i.when("/".concat(o),_.cloneDeep(n)),a.addTitle("/".concat(o),{data:function(){return{title:t("Availability")}}})}]);
1
+ "use strict";angular.module("c8y.parts.availability",["nvd3ChartDirectives"]).config(["c8yViewsProvider","c8yNavigatorProvider","c8yTitleProvider","gettext",function(i,e,a,t){var l="signal",n={name:t("Availability"),icon:l,templateUrl:"".concat(":::PLUGIN_PATH:::/views/","detail.html"),controller:"availabilityReportCtrl",showIfPermissions:{allRoles:["ROLE_ALARM_READ"],anyRole:["ROLE_INVENTORY_READ","ROLE_MANAGED_OBJECT_READ"]}},o="availability";e.addNavigation({parent:t("Devices"),name:t("Availability"),icon:l,path:o,showIfPermissions:{allRoles:["ROLE_ALARM_READ"],anyRole:["ROLE_INVENTORY_READ","ROLE_MANAGED_OBJECT_READ"]}}),i.when("/device/:deviceId",_.cloneDeep(n)),i.when("/".concat(o),_.cloneDeep(n)),a.addTitle("/".concat(o),{data:function(){return{title:t("Availability")}}})}]);
@@ -256,6 +256,7 @@
256
256
  >
257
257
  <button
258
258
  class="dropdown-toggle c8y-dropdown btn-link"
259
+ data-cy="index--dropdown-toggle--Action"
259
260
  title="{{ 'Actions' | translate }}"
260
261
  aria-haspopup="true"
261
262
  type="button"
@@ -1 +1 @@
1
- "use strict";!function(){function n(t,n,e){c.$inject=["manageCertificateSvc"],s.$inject=["c8yEnterpriseEditionAvailability"],a.$inject=["$scope"];var i=["ROLE_INVENTORY_ADMIN","ROLE_OPTION_MANAGEMENT_ADMIN","ROLE_APPLICATION_MANAGEMENT_ADMIN","ROLE_APPLICATION_MANAGEMENT_READ"];function r(i){return["c8yTenant",function(n){var t=this;n.isEnterpriseEditionTenant().then(function(n){t.title=n?e("Enterprise tenant"):i})}]}function o(i){return["c8yTenant","c8yApplication",function(n,t){return n.isEnterpriseEditionTenant().then(function(n){return!n&&t.isAnyAvailable(i)})}]}function a(n){n.optionsGroups=["twoFactorAuthenticationOptions","supportLinkOptions","passwordResetOptions","emailServerOptions","dataExportOptions","storageLimitOptions","suspendingTenantsOptions"]}function s(n){return n.isAvailable()}function c(n){return n.hasCustomLoadBalancer().then(function(n){return!n})}_.each(["/enterprise","/branding"],function(n){return t.when(n,{template:'\n <c8y-ui-title-set title="vm.title"></c8y-ui-title-set>\n <c8y-branding-configuration-form></c8y-branding-configuration-form>\n ',name:n=e("Branding"),icon:"paint-brush",controller:r(n),controllerAs:"vm"})}),_.each(["/enterprise","/domain_name"],function(n){return t.when(n,{template:'\n <c8y-ui-title-set title="vm.title"></c8y-ui-title-set>\n <c8y-manage-certificate-form></c8y-manage-certificate-form>\n ',name:n=e("Domain name"),icon:"certificate",controller:r(n),controllerAs:"vm",showIf:c})}),n.addNavigation({name:e("Enterprise tenant"),parent:e("Settings"),icon:"enterprise-resource-planning",priority:1e3,path:"enterprise",routerLinkExact:!1,showIf:s,showIfPermissions:{allRoles:i}}),n.addNavigation({name:e("Branding"),parent:e("Settings"),icon:"paint-brush",priority:1e3,path:"branding",showIf:o([{name:"branding"},{name:"feature-branding"}]),showIfPermissions:{allRoles:i}}),n.addNavigation({name:e("Domain name"),parent:e("Settings"),icon:"certificate",priority:1e3,path:"domain_name",showIf:o([{name:"sslmanagement"}]),showIfPermissions:{allRoles:i}}),t.when("/enterprise",{template:'<c8y-platform-configuration options-groups="optionsGroups"></c8y-platform-configuration>',name:e("Configuration"),icon:"cog",controller:a})}n.$inject=["c8yViewsProvider","c8yNavigatorProvider","gettext"],angular.module("c8y.enterpriseEdition",["c8y.custom-branding"]).config(n)}();
1
+ "use strict";!function(){function n(t,n,i){l.$inject=["manageCertificateSvc"],c.$inject=["c8yEnterpriseEditionAvailability"],s.$inject=["$scope"];var e=["ROLE_OPTION_MANAGEMENT_ADMIN","ROLE_APPLICATION_MANAGEMENT_ADMIN","ROLE_APPLICATION_MANAGEMENT_READ"],r=["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"];function o(e){return["c8yTenant",function(n){var t=this;n.isEnterpriseEditionTenant().then(function(n){t.title=n?i("Enterprise tenant"):e})}]}function a(e){return["c8yTenant","c8yApplication",function(n,t){return n.isEnterpriseEditionTenant().then(function(n){return!n&&t.isAnyAvailable(e)})}]}function s(n){n.optionsGroups=["twoFactorAuthenticationOptions","supportLinkOptions","passwordResetOptions","emailServerOptions","dataExportOptions","storageLimitOptions","suspendingTenantsOptions"]}function c(n){return n.isAvailable()}function l(n){return n.hasCustomLoadBalancer().then(function(n){return!n})}_.each(["/enterprise","/branding"],function(n){return t.when(n,{template:'\n <c8y-ui-title-set title="vm.title"></c8y-ui-title-set>\n <c8y-branding-configuration-form></c8y-branding-configuration-form>\n ',name:n=i("Branding"),icon:"paint-brush",controller:o(n),controllerAs:"vm"})}),_.each(["/enterprise","/domain_name"],function(n){return t.when(n,{template:'\n <c8y-ui-title-set title="vm.title"></c8y-ui-title-set>\n <c8y-manage-certificate-form></c8y-manage-certificate-form>\n ',name:n=i("Domain name"),icon:"certificate",controller:o(n),controllerAs:"vm",showIf:l})}),n.addNavigation({name:i("Enterprise tenant"),parent:i("Settings"),icon:"enterprise-resource-planning",priority:1e3,path:"enterprise",routerLinkExact:!1,showIf:c,showIfPermissions:{allRoles:e,anyRole:r}}),n.addNavigation({name:i("Branding"),parent:i("Settings"),icon:"paint-brush",priority:1e3,path:"branding",showIf:a([{name:"branding"},{name:"feature-branding"}]),showIfPermissions:{allRoles:e,anyRole:r}}),n.addNavigation({name:i("Domain name"),parent:i("Settings"),icon:"certificate",priority:1e3,path:"domain_name",showIf:a([{name:"sslmanagement"}]),showIfPermissions:{allRoles:e,anyRole:r}}),t.when("/enterprise",{template:'<c8y-platform-configuration options-groups="optionsGroups"></c8y-platform-configuration>',name:i("Configuration"),icon:"cog",controller:s})}n.$inject=["c8yViewsProvider","c8yNavigatorProvider","gettext"],angular.module("c8y.enterpriseEdition",["c8y.custom-branding"]).config(n)}();
@@ -1 +1 @@
1
- "use strict";angular.module("c8y.cockpit.export").directive("c8yExportTimespan",["gettext",function(e){return{restrict:"AE",link:function(t){t.types={LAST_24HOURS:e("Last 24 hours"),LAST_7DAYS:e("Last 7 days"),LAST_30DAYS:e("Last 30 days"),LAST_WEEK:e("Last week"),LAST_MONTH:e("Last month"),LAST_YEAR:e("Last year"),CUSTOM:e("Custom")}},scope:{timespan:"=c8yExportTimespan"},templateUrl:":::PLUGIN_PATH:::/views/timespan.html"}}]);
1
+ "use strict";!function(){function t(e,s){return{restrict:"AE",link:function(t){t.types={LAST_24HOURS:s("Last 24 hours"),LAST_7DAYS:s("Last 7 days"),LAST_30DAYS:s("Last 30 days"),LAST_WEEK:s("Last week"),LAST_MONTH:s("Last month"),LAST_YEAR:s("Last year"),CUSTOM:s("Custom")},t.helpLink=e.getUserGuideLink("/docs/cockpit/managing-exports/#to-add-an-export")},scope:{timespan:"=c8yExportTimespan"},templateUrl:":::PLUGIN_PATH:::/views/timespan.html"}}t.$inject=["c8yDocs","gettext"],angular.module("c8y.cockpit.export").directive("c8yExportTimespan",t)}();
@@ -12,38 +12,23 @@
12
12
  </div>
13
13
  </div>
14
14
  <button
15
- ng-show="timespan.dateType === 'LAST_MONTH'"
16
- class="btn-help btn-help--sm"
15
+ data-cy="c8y-export-details--timerange-help-btn"
16
+ class="btn-help btn-help--sm m-t-8"
17
17
  type="button"
18
18
  aria-label="{{ 'Help' | translate }}"
19
- uib-popover="{{
20
- 'From midnight last month to now. For details refer to the user documentation.' | translate
21
- }}"
22
- popover-placement="right"
23
- popover-trigger="'focus'"
24
- ></button>
25
- <button
26
- ng-show="timespan.dateType === 'LAST_WEEK'"
27
- class="btn-help btn-help--sm"
28
- type="button"
29
- aria-label="{{ 'Help' | translate }}"
30
- uib-popover="{{
31
- 'From midnight last week to now. For details refer to the user documentation.' | translate
32
- }}"
33
- popover-placement="right"
34
- popover-trigger="'focus'"
35
- ></button>
36
- <button
37
- ng-show="timespan.dateType === 'LAST_YEAR'"
38
- class="btn-help btn-help--sm"
39
- type="button"
40
- aria-label="{{ 'Help' | translate }}"
41
- uib-popover="{{
42
- 'From midnight last year to now. For details refer to the user documentation.' | translate
43
- }}"
19
+ uib-popover-template="'helpContent.html'"
44
20
  popover-placement="right"
45
21
  popover-trigger="'focus'"
46
22
  ></button>
23
+ <script
24
+ id="helpContent.html"
25
+ type="text/ng-template"
26
+ >
27
+ <div translate>
28
+ Find out more about each option in the
29
+ <a ng-href="{{ ::helpLink }}" target="_blank" rel="noopener noreferrer">user documentation</a>.
30
+ </div>
31
+ </script>
47
32
  </div>
48
33
  <div
49
34
  class="col-xs-12"
@@ -16,7 +16,7 @@
16
16
 
17
17
  <div ng-repeat="m in measurementsByFragment[measurement]">
18
18
  {{m.fragment}} <span class="text-muted">{{m.series}}</span>
19
- <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN']">
19
+ <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_MANAGED_OBJECT_ADMIN']">
20
20
  <a class="btn btn-link btn-xs" ng-href="/apps/administration/#kpi/new?fragment={{m.fragment}}&series={{m.series}}">
21
21
  <i c8y-icon="plus"></i>
22
22
  <translate>Create KPI</translate>
@@ -35,7 +35,7 @@
35
35
  <translate>Edit KPI</translate>
36
36
  </a>
37
37
  </c8y-if-allowed>
38
- <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN']">
38
+ <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_MANAGED_OBJECT_ADMIN']">
39
39
  <a class="btn btn-link btn-xs" ng-href="/apps/administration/#kpi/new?fragment={{kpi.c8y_Kpi.fragment}}&series={{kpi.c8y_Kpi.series}}">
40
40
  <i c8y-icon="plus"></i>
41
41
  <translate>Create new KPI</translate>
@@ -1,7 +1,7 @@
1
1
  <div ng-controller="kpiSetupCtrl">
2
2
  <div class="nav">
3
3
  <div class="navbar-right">
4
- <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN']">
4
+ <c8y-if-allowed any-role="['ROLE_INVENTORY_ADMIN', 'ROLE_MANAGED_OBJECT_ADMIN']">
5
5
  <button
6
6
  title="{{ 'Add KPI' | translate }}"
7
7
  ng-if="false"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.505.8",
3
+ "version": "1018.506.0",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",
@@ -1 +1 @@
1
- "use strict";!function(){function e(i,r,e,n,t,o,c,j,a,u,l,s,d,f,h,g,v,m){var p,S=r.deviceId||r.groupId,x={},A={},b={done:!1,inProgress:!1},R={true:{text:v("Active"),icon:"check-circle",cls:"text-success"},false:{text:v("Inactive"),icon:"ban",cls:"text-danger"}},y=s.getContext(),C=v("Global smart rules");function I(){return n.when().then(T).then(M).then(w).then(L).then(D).catch(E)}function T(){b.inProgress=!0}function D(){b.inProgress=!1,b.done=!0,b.error=!1}function E(e){e.data&&e.data.message&&l.danger(e.data.message),b.inProgress=!1,b.done=!0,b.error=!0}function M(){return h.list().then(N)}function N(e){_.forEach(e||[],function(e){x[e.name]=e})}function w(){var e=S?g.listByContext(S):n.resolve([]),t=f.hasPermissions().then(function(e){return e?g.list():n.when([])});return n.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;S&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return O(e)&&!n.test(t)}}(S)));return t}(_.concat(e.listByContext,e.list))})}function O(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function U(e){return g.hasSource(e,S)}function L(){var e;return Array.isArray(i.rules)&&0<i.rules.length&&null!==(e=s.getContext()).context?c.childAssets(e.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=P(e)})}):n.resolve()}function P(t){return _.filter(i.children,function(e){return g.hasSource(t,e)})}_.assign(i,{isOpen:{},moId:S,loadingStatus:b,refresh:I,paging:{refresh:I},ruleTemplates:x,getLinkToDM:function(){var e={deviceId:S};return t(p||"")(e)},add:function(){g.addNewWithUI().then(I)},edit:function(e){g.editWithUI(e).then(I)},clone:function(e){g.cloneWithUI(e).then(I)},remove:function(e){u({title:v("Delete smart rule"),body:m.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:v("Delete")},status:"danger"}).then(angular.bind(g,g.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return l.success(v("Smart rule deleted."))})},hasSource:U,getChildrenEnabledForSmartRule:P,toggleRuleActivationForContextMO:function(e){if(U(e))return g.deactivate(e,S,!1).then(function(){l.success(m.getString('Smart rule "{{name}}" deactivated.',e))});return g.activate(e,S,!1).then(function(){l.success(m.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(e,n){var t=_.filter(n,function(t){return!_.find(i.ruleChildren[e.id],function(e){return e.id===t.id})}),r=_.filter(i.ruleChildren[e.id],function(t){return!_.find(n,function(e){return t.id===e.id})});return g.updateSources(e,t,r,!1).then(w).then(L).then(function(){l.success(m.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":v("Activate for this group"),"for device":v("Activate for this device"),"for object":v("Activate for this object")},deactivate:{"for group":v("Deactivate for this group"),"for device":v("Deactivate for this device"),"for object":v("Deactivate for this object")}},e=e.enabled&&U(e)?"deactivate":"activate",n=r.groupId?"group":"object";return n=r.deviceId?"device":n,t[e]["for ".concat(n)]},type:function(e){var t,e=x[e.ruleTemplateName];e&&(t=e.label.full?m.getString(e.label.full):"".concat(m.getString(e.label.input)," ").concat(m.getString(e.label.output)));return t},status:function(e){return R[e.enabled].text},statusIcon:function(e){return R[e.enabled].icon},statusClass:function(e){return R[e.enabled].cls},showTitle:function(){return null!==s.getContext().context},title:C,context:y,inputIcon:function(e){var t,e=x[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=x[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:function(e){var t=_.get(x,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=A.canAddRules;e&&!t&&(n=!1);_.isUndefined(n)&&(e=i.context?{adminMOs:[i.context.id]}:{allRoles:["ROLE_INVENTORY_ADMIN"],anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]},A.canAddRules=a.isAllowed(e).then(function(e){return A.canAddRules=e,A.canAddRules}),n=!1);return n},canModify:function(t){A.rules=A.rules||{};var n=A.rules,e=n[t.id];_.isUndefined(e)&&(n[t.id]=a.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canApplyOnChildren:function(e){return!O(e)},canSeeSection:function(){var e=A.canSeeSection;_.isUndefined(e)&&(A.canSeeSection=(o.checkIfModulesExist(["c8y.cockpit.config"])?f.shouldShowLocalSmartRules():n.when(!1)).then(function(e){return A.canSeeSection=e,A.canSeeSection}),e=!1);return e},isConfigurationGlobalSmartRulesContext:void 0}),i.isConfigurationGlobalSmartRulesContext=e.path().includes("/rules"),I(),null===s.getContext().context&&d.changeTitle({title:C}),"device"===y.context&&o.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){p=e})}e.$inject=["$scope","$routeParams","$location","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();
1
+ "use strict";!function(){function e(i,r,e,o,t,n,c,j,a,u,l,s,d,f,h,g,v,m){var p,S=r.deviceId||r.groupId,A={},R={},y={done:!1,inProgress:!1},x={true:{text:v("Active"),icon:"check-circle",cls:"text-success"},false:{text:v("Inactive"),icon:"ban",cls:"text-danger"}},b=s.getContext(),C=v("Global smart rules");function I(){return o.when().then(w).then(M).then(N).then(U).then(E).catch(D)}function w(){y.inProgress=!0}function E(){y.inProgress=!1,y.done=!0,y.error=!1}function D(e){e.data&&e.data.message&&l.danger(e.data.message),y.inProgress=!1,y.done=!0,y.error=!0}function M(){return h.list().then(T)}function T(e){_.forEach(e||[],function(e){A[e.name]=e})}function N(){var e=S?g.listByContext(S):o.resolve([]),t=f.hasPermissions().then(function(e){return e?g.list():o.when([])});return o.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;S&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return O(e)&&!n.test(t)}}(S)));return t}(_.concat(e.listByContext,e.list))})}function O(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function L(e){return g.hasSource(e,S)}function U(){var e;return Array.isArray(i.rules)&&0<i.rules.length&&null!==(e=s.getContext()).context?c.childAssets(e.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=P(e)})}):o.resolve()}function P(t){return _.filter(i.children,function(e){return g.hasSource(t,e)})}_.assign(i,{isOpen:{},moId:S,loadingStatus:y,refresh:I,paging:{refresh:I},ruleTemplates:A,getLinkToDM:function(){var e={deviceId:S};return t(p||"")(e)},add:function(){g.addNewWithUI().then(I)},edit:function(e){g.editWithUI(e).then(I)},clone:function(e){g.cloneWithUI(e).then(I)},remove:function(e){u({title:v("Delete smart rule"),body:m.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:v("Delete")},status:"danger"}).then(angular.bind(g,g.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return l.success(v("Smart rule deleted."))})},hasSource:L,getChildrenEnabledForSmartRule:P,toggleRuleActivationForContextMO:function(e){if(L(e))return g.deactivate(e,S,!1).then(function(){l.success(m.getString('Smart rule "{{name}}" deactivated.',e))});return g.activate(e,S,!1).then(function(){l.success(m.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(e,n){var t=_.filter(n,function(t){return!_.find(i.ruleChildren[e.id],function(e){return e.id===t.id})}),r=_.filter(i.ruleChildren[e.id],function(t){return!_.find(n,function(e){return t.id===e.id})});return g.updateSources(e,t,r,!1).then(N).then(U).then(function(){l.success(m.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":v("Activate for this group"),"for device":v("Activate for this device"),"for object":v("Activate for this object")},deactivate:{"for group":v("Deactivate for this group"),"for device":v("Deactivate for this device"),"for object":v("Deactivate for this object")}},e=e.enabled&&L(e)?"deactivate":"activate",n=r.groupId?"group":"object";return n=r.deviceId?"device":n,t[e]["for ".concat(n)]},type:function(e){var t,e=A[e.ruleTemplateName];e&&(t=e.label.full?m.getString(e.label.full):"".concat(m.getString(e.label.input)," ").concat(m.getString(e.label.output)));return t},status:function(e){return x[e.enabled].text},statusIcon:function(e){return x[e.enabled].icon},statusClass:function(e){return x[e.enabled].cls},showTitle:function(){return null!==s.getContext().context},title:C,context:b,inputIcon:function(e){var t,e=A[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=A[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:function(e){var t=_.get(A,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=R.canAddRules;e&&!t&&(n=!1);_.isUndefined(n)&&(e=i.context?a.isAllowed({adminMOs:[i.context.id]}):o.all({isAllowedInventory:a.isAllowed({anyRole:["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"]}),isAllowedSmartRules:a.isAllowed({anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]})}).then(function(e){var t=e.isAllowedInventory,e=e.isAllowedSmartRules;return t&&e}),R.canAddRules=e.then(function(e){return R.canAddRules=e,R.canAddRules}),n=!1);return n},canModify:function(t){R.rules=R.rules||{};var n=R.rules,e=n[t.id];_.isUndefined(e)&&(n[t.id]=a.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canApplyOnChildren:function(e){return!O(e)},canSeeSection:function(){var e=R.canSeeSection;_.isUndefined(e)&&(R.canSeeSection=(n.checkIfModulesExist(["c8y.cockpit.config"])?f.shouldShowLocalSmartRules():o.when(!1)).then(function(e){return R.canSeeSection=e,R.canSeeSection}),e=!1);return e},isConfigurationGlobalSmartRulesContext:void 0}),i.isConfigurationGlobalSmartRulesContext=e.path().includes("/rules"),I(),null===s.getContext().context&&d.changeTitle({title:C}),"device"===b.context&&n.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){p=e})}e.$inject=["$scope","$routeParams","$location","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();
@@ -1 +1 @@
1
- "use strict";!function(){function e(e,r,i,t,n,o,a,c,u,l,s,d,f,h){var m=this,g={},v={},p={done:!1,inProgress:!1},S={true:{text:f("Active`rule`"),icon:"check-circle",cls:"text-success"},false:{text:f("Inactive`rule`"),icon:"ban",cls:"text-warning"}};function A(){return i.when().then(R).then(C).then(E).then(M).then(b).catch(y)}function R(){p.inProgress=!0}function b(){p.inProgress=!1,p.done=!0,p.error=!1}function y(e){e.data&&e.data.message&&c.danger(e.data.message),p.inProgress=!1,p.done=!0,p.error=!0}function C(){return s.list().then(x)}function x(e){_.forEach(e,function(e){g[e.name]=e})}function E(){var e=m.mo?d.listByContext(m.mo):i.resolve([]),t=l.hasPermissions().then(function(e){return e?d.list():i.when([])});return i.all({listByContext:e,list:t}).then(function(e){m.rules=function(e){m.mo&&(e=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return I(e)&&!n.test(t)}}(m.mo)));m.filter&&(e=_.filter(e,m.filter));return e}(_.concat(e.listByContext,e.list)),"function"==typeof m.onRules&&m.onRules()(m.rules)})}function I(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function N(e){return d.hasSource(e,m.mo)}function M(){var e,t;return Array.isArray(m.rules)&&0<m.rules.length&&(e=u.getContext(),t=function(e){e=e.id;return m.mo?_.get(m,"mo.id")||m.mo:e}(e),null!==e.context)?n.childAssets(t,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}).then(function(e){m.children=e}).then(function(){m.ruleChildren={},_.forEach(m.rules,function(e){m.ruleChildren[e.id]=D(e)})}):i.resolve()}function D(t){return _.filter(m.children,function(e){return t.enabled&&d.hasSource(t,e)})}_.assign(m,{ruleTemplates:g,loadingStatus:p,isOpen:{},listClass:"interact-list",$onInit:function(){e.$on("smartRulesListReload",A),A()},add:function(){d.addNewWithUI().then(A)},edit:function(e){d.editWithUI(e).then(A)},clone:function(e){d.cloneWithUI(e).then(A)},remove:function(e){t({title:f("Delete smart rule"),body:h.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),status:"danger",labels:{ok:f("Delete")}}).then(d.remove.bind(d,e)).then(function(){return _.pull(m.rules,e)}).then(function(){return c.success(f("Smart rule deleted."))})},hasSource:N,getChildrenEnabledForSmartRule:D,toggleRuleActivationForContextMO:function(e){if(e.enabled&&N(e))return d.deactivate(e,m.mo,!1).then(function(){c.success(h.getString('Smart rule "{{name}}" deactivated.',e))});return d.activate(e,m.mo,!1).then(function(){c.success(h.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(t,n){var r=[];return _.forEach(n,function(e){_.find(m.ruleChildren[t.id],{id:e.id})||r.push(d.activate(t,e,!1))}),_.forEach(m.ruleChildren[t.id],function(e){_.find(n,{id:e.id})||r.push(d.deactivate(t,e,!1))}),i.all(r).then(E).then(M).then(function(){c.success(h.getString('Smart rule "{{name}}" activated/deactivated for children.',t))})},tooltip:function(e){var t,n={activate:{"for group":f("Activate for this group."),"for device":f("Activate for this device."),"for object":f("Activate for this object.")},deactivate:{"for group":f("Deactivate for this group."),"for device":f("Deactivate for this device."),"for object":f("Deactivate for this object.")}},e=e.enabled&&N(e)?"deactivate":"activate";t=r.deviceId?"device":r.groupId?"group":"object";return n[e]["for ".concat(t)]},type:function(e){var t,e=g[e.ruleTemplateName];e&&(t=e.label.full?h.getString(e.label.full):"".concat(h.getString(e.label.input)," ").concat(h.getString(e.label.output)));return t},status:function(e){return S[e.enabled].text},statusIcon:function(e){return S[e.enabled].icon},statusClass:function(e){return S[e.enabled].cls},context:u.getContext(),inputIcon:function(e){var t,e=g[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=g[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:function(){var e,t=v.canAddRules;_.isUndefined(t)&&(e=m.context?{adminMOs:[m.context.id]}:{allRoles:["ROLE_INVENTORY_ADMIN"],anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]},v.canAddRules=a.isAllowed(e).then(function(e){return v.canAddRules=e,v.canAddRules}),t=!1);return t},canModify:function(t){v.rules=v.rules||{};var n=v.rules,e=n[t.id];_.isUndefined(e)&&(n[t.id]=a.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canApplyOnChildren:function(e){return!I(e)},canSeeSection:function(){var e=v.canSeeSection;_.isUndefined(e)&&(v.canSeeSection=l.shouldShowLocalSmartRules().then(function(e){return v.canSeeSection=e,v.canSeeSection}),e=!1);return e}}),_.assign(e,{refresh:A,paging:{refresh:A}})}e.$inject=["$scope","$routeParams","$q","c8yModal","c8yInventory","c8yApplication","c8yPermissions","c8yAlert","c8yUiUtil","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").component("smartRulesList",{bindings:{mo:"<?",filter:"<?",disableEditAndCreate:"<?",onRules:"&?"},templateUrl:":::PLUGIN_PATH:::/list/smartRulesList.html",controller:e,controllerAs:"vm"})}();
1
+ "use strict";!function(){function e(e,r,i,t,n,o,a,c,u,l,s,d,f,h){var m=this,v={},g={},p={done:!1,inProgress:!1},A={true:{text:f("Active`rule`"),icon:"check-circle",cls:"text-success"},false:{text:f("Inactive`rule`"),icon:"ban",cls:"text-warning"}};function S(){return i.when().then(R).then(C).then(I).then(N).then(b).catch(y)}function R(){p.inProgress=!0}function b(){p.inProgress=!1,p.done=!0,p.error=!1}function y(e){e.data&&e.data.message&&c.danger(e.data.message),p.inProgress=!1,p.done=!0,p.error=!0}function C(){return s.list().then(E)}function E(e){_.forEach(e,function(e){v[e.name]=e})}function I(){var e=m.mo?d.listByContext(m.mo):i.resolve([]),t=l.hasPermissions().then(function(e){return e?d.list():i.when([])});return i.all({listByContext:e,list:t}).then(function(e){m.rules=function(e){m.mo&&(e=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return x(e)&&!n.test(t)}}(m.mo)));m.filter&&(e=_.filter(e,m.filter));return e}(_.concat(e.listByContext,e.list)),"function"==typeof m.onRules&&m.onRules()(m.rules)})}function x(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function w(e){return d.hasSource(e,m.mo)}function N(){var e,t;return Array.isArray(m.rules)&&0<m.rules.length&&(e=u.getContext(),t=function(e){e=e.id;return m.mo?_.get(m,"mo.id")||m.mo:e}(e),null!==e.context)?n.childAssets(t,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}).then(function(e){m.children=e}).then(function(){m.ruleChildren={},_.forEach(m.rules,function(e){m.ruleChildren[e.id]=M(e)})}):i.resolve()}function M(t){return _.filter(m.children,function(e){return t.enabled&&d.hasSource(t,e)})}_.assign(m,{ruleTemplates:v,loadingStatus:p,isOpen:{},listClass:"interact-list",$onInit:function(){e.$on("smartRulesListReload",S),S()},add:function(){d.addNewWithUI().then(S)},edit:function(e){d.editWithUI(e).then(S)},clone:function(e){d.cloneWithUI(e).then(S)},remove:function(e){t({title:f("Delete smart rule"),body:h.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),status:"danger",labels:{ok:f("Delete")}}).then(d.remove.bind(d,e)).then(function(){return _.pull(m.rules,e)}).then(function(){return c.success(f("Smart rule deleted."))})},hasSource:w,getChildrenEnabledForSmartRule:M,toggleRuleActivationForContextMO:function(e){if(e.enabled&&w(e))return d.deactivate(e,m.mo,!1).then(function(){c.success(h.getString('Smart rule "{{name}}" deactivated.',e))});return d.activate(e,m.mo,!1).then(function(){c.success(h.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(t,n){var r=[];return _.forEach(n,function(e){_.find(m.ruleChildren[t.id],{id:e.id})||r.push(d.activate(t,e,!1))}),_.forEach(m.ruleChildren[t.id],function(e){_.find(n,{id:e.id})||r.push(d.deactivate(t,e,!1))}),i.all(r).then(I).then(N).then(function(){c.success(h.getString('Smart rule "{{name}}" activated/deactivated for children.',t))})},tooltip:function(e){var t,n={activate:{"for group":f("Activate for this group."),"for device":f("Activate for this device."),"for object":f("Activate for this object.")},deactivate:{"for group":f("Deactivate for this group."),"for device":f("Deactivate for this device."),"for object":f("Deactivate for this object.")}},e=e.enabled&&w(e)?"deactivate":"activate";t=r.deviceId?"device":r.groupId?"group":"object";return n[e]["for ".concat(t)]},type:function(e){var t,e=v[e.ruleTemplateName];e&&(t=e.label.full?h.getString(e.label.full):"".concat(h.getString(e.label.input)," ").concat(h.getString(e.label.output)));return t},status:function(e){return A[e.enabled].text},statusIcon:function(e){return A[e.enabled].icon},statusClass:function(e){return A[e.enabled].cls},context:u.getContext(),inputIcon:function(e){var t,e=v[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=v[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:function(){var e,t=g.canAddRules;_.isUndefined(t)&&(e=m.context?a.isAllowed({adminMOs:[m.context.id]}):i.all({isAllowedInventory:a.isAllowed({anyRole:["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"]}),isAllowedSmartRules:a.isAllowed({anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]})}).then(function(e){var t=e.isAllowedInventory,e=e.isAllowedSmartRules;return t&&e}),g.canAddRules=e.then(function(e){return g.canAddRules=e,g.canAddRules}),t=!1);return t},canModify:function(t){g.rules=g.rules||{};var n=g.rules,e=n[t.id];_.isUndefined(e)&&(n[t.id]=a.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canApplyOnChildren:function(e){return!x(e)},canSeeSection:function(){var e=g.canSeeSection;_.isUndefined(e)&&(g.canSeeSection=l.shouldShowLocalSmartRules().then(function(e){return g.canSeeSection=e,g.canSeeSection}),e=!1);return e}}),_.assign(e,{refresh:S,paging:{refresh:S}})}e.$inject=["$scope","$routeParams","$q","c8yModal","c8yInventory","c8yApplication","c8yPermissions","c8yAlert","c8yUiUtil","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").component("smartRulesList",{bindings:{mo:"<?",filter:"<?",disableEditAndCreate:"<?",onRules:"&?"},templateUrl:":::PLUGIN_PATH:::/list/smartRulesList.html",controller:e,controllerAs:"vm"})}();
@@ -1 +1 @@
1
- "use strict";!function(){function e(i,u,o,r,n,a,t,c,l,s){var d=o.url("service/smartrule"),f="".concat(d,"/smartrules"),h=["id","self","cepModuleId","lastUpdated","creationTime"],p=["type","cepModuleId","creationTime","lastUpdated"];return{permissionsCfgs:{create:[{anyRole:["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE"]},{anyRole:["ROLE_CEP_MANAGEMENT_ADMIN","ROLE_SMARTRULE_ADMIN"]}]},getEmpty:function(e){var e=e||n.getContext(),t={type:"c8y_SmartRule",name:"",enabled:!0,config:{}};e.context&&e.id&&(t.c8y_Context=e,t.type="c8y_PrivateSmartRule");return t},list:function(){return u.get(f).then(o.getResData).then(_.property("rules")).then(m)},listByContext:function(e){return u.get(S({moId:e})).then(o.getResData).then(_.property("rules")).then(m)},detail:function(e){e=v({id:e});return u.get(e).then(o.getResData)},save:function(e,t,n){e=e.id?g(e):function(e,t,n){var r=v(e,!0);return function(e,t,n){return e.ruleTemplateName=t.name,function(e,t){var n=i.when(e);e.c8y_Context||t.mo?(e.enabledSources=[],e.disabledSources=void 0,n=y(e,t.mo,t.withChildren)):(e.enabledSources=void 0,e.disabledSources=[]);return n}(e,n)}(e,t,n).then(_.partial(u.post,r)).then(o.getResData)}(e,t,n);return e},remove:function(e){e=v(e,!0);return u.delete(e)},hasSource:function(e,t){t=t&&t.id||t;if(!t)return!1;if(e.disabledSources)return!R(e.disabledSources,t);if(e.enabledSources)return R(e.enabledSources,t);return!0},activate:function(e,t,n){return y(e,t,n).then(g)},deactivate:function(e,t,n){return b(e,t,n).then(g)},updateSources:function(e,t,r,u){return function(e,t,n){return t.reduce(function(e,t){return e.then(function(e){return y(e,t,n)})},i.resolve(e))}(e,t,u).then(function(e){return n=u,r.reduce(function(e,t){return e.then(function(e){return b(e,t,n)})},i.resolve(e));var n}).then(g)},addNewWithUI:U,addNewForInputAlarmAndOutputUserWithUI:function(e,t){return U({inputAlarm:e,outputUser:t})},addNewForInputDataPointWithUI:function(e){return U({inputDataPoint:e})},addNewForOutputOperationWithUI:function(e){return U({outputOperation:{template:function(e){return o.cleanFields(e,["id","self","status","deviceId","creationTime","failureReason"])}(e)}})},createInstanceWithUI:A,createInstanceWithUIByName:function(e,t){return c.getTemplateByName(e).then(function(e){return A(e,t)})},editWithUI:function(e){return N(e,void 0)},cloneWithUI:function(e){return t.current().then(_.partial(D,e)).then(N)}};function m(e){return i.all(_.map(e,function(t){return c.getTemplateForRule(t).then(function(e){return _.isUndefined(e)?null:t})})).then(_.flatten).then(_.filter)}function v(e,t){var n=_.get(e,"c8y_Context.id"),t=t&&n?S({moId:n}):f;return e.id&&(t+="/".concat(e.id)),t}function S(e){return"".concat(d,"/managedObjects/").concat(e.moId,"/smartrules")}function g(e){var t=v(e,!0),e=o.cleanFields(e,p);return u.put(t,e)}function y(n,e,t){return I(e,t).then(function(e){return _.forEach(e,function(t){_.isArray(n.enabledSources)&&!R(n.enabledSources,t)&&n.enabledSources.push(t),_.isArray(n.disabledSources)&&R(n.disabledSources,t)&&_.remove(n.disabledSources,function(e){return _.toString(e)===_.toString(t)})}),n})}function b(n,e,t){return I(e,t).then(function(e){return _.forEach(e,function(t){_.isArray(n.enabledSources)&&R(n.enabledSources,t)&&_.remove(n.enabledSources,function(e){return _.toString(e)===_.toString(t)}),_.isArray(n.disabledSources)&&!R(n.disabledSources,t)&&n.disabledSources.push(t)}),n})}function I(e,t){var e=e&&e.id||e,n=[];return e&&(n.push(i.when(e)),n.push(function(e,t){var n=[];!0!==t&&!0!==t.assets||n.push(r.childAssets(e));!0!==t&&!0!==t.devices||n.push(r.childDevices(e));return i.all(n).then(_.flattenDeep).then(_.partialRight(_.map,"id"))}(e,t))),i.all(n).then(_.flattenDeep)}function R(e,t){var n=t.id||t;return _.some(e,function(e){return _.toString(e)===_.toString(n)})}function U(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length?arguments[1]:void 0,n=2<arguments.length?arguments[2]:void 0;return a({title:l("Add global smart rule"),templateUrl:":::PLUGIN_PATH:::/views/add.html",controller:"SmartRuleAddCtrl",ariaLabelledBy:"modal-title",ariaDescribedBy:"modal-body",size:"lg",keyboard:!1,resolve:{context:function(){return _.cloneDeep(e)},ruleInitialObj:function(){return _.cloneDeep(n)},ruleTemplatesFilterFn:function(){return t}}})}function A(e,t){return N(t,e)}function D(e,t){e=_.cloneDeep(e);return(e=o.cleanFields(e,h)).name=s.getString("Duplicate of {{name}}",e),t&&(e.owner=t.id),e}function N(e,t){return a({templateUrl:":::PLUGIN_PATH:::/views/edit.html",controller:"SmartRuleEditCtrl",size:"sm",keyboard:!1,resolve:{ruleTemplate:function(){return _.cloneDeep(t)},rule:function(){return _.cloneDeep(e)}}})}}e.$inject=["$q","$http","c8yBase","c8yInventory","c8yUiUtil","c8yModal","c8yUser","smartRuleTemplatesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").factory("smartRulesSvc",e)}();
1
+ "use strict";!function(){function e(i,u,o,r,n,a,t,c,l,s){var d=o.url("service/smartrule"),f="".concat(d,"/smartrules"),h=["id","self","cepModuleId","lastUpdated","creationTime"],p=["type","cepModuleId","creationTime","lastUpdated"];return{permissionsCfgs:{create:[{anyRole:["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"]},{anyRole:["ROLE_CEP_MANAGEMENT_ADMIN","ROLE_SMARTRULE_ADMIN"]}]},getEmpty:function(e){var e=e||n.getContext(),t={type:"c8y_SmartRule",name:"",enabled:!0,config:{}};e.context&&e.id&&(t.c8y_Context=e,t.type="c8y_PrivateSmartRule");return t},list:function(){return u.get(f).then(o.getResData).then(_.property("rules")).then(m)},listByContext:function(e){return u.get(S({moId:e})).then(o.getResData).then(_.property("rules")).then(m)},detail:function(e){e=v({id:e});return u.get(e).then(o.getResData)},save:function(e,t,n){e=e.id?g(e):function(e,t,n){var r=v(e,!0);return function(e,t,n){return e.ruleTemplateName=t.name,function(e,t){var n=i.when(e);e.c8y_Context||t.mo?(e.enabledSources=[],e.disabledSources=void 0,n=y(e,t.mo,t.withChildren)):(e.enabledSources=void 0,e.disabledSources=[]);return n}(e,n)}(e,t,n).then(_.partial(u.post,r)).then(o.getResData)}(e,t,n);return e},remove:function(e){e=v(e,!0);return u.delete(e)},hasSource:function(e,t){t=t&&t.id||t;if(!t)return!1;if(e.disabledSources)return!R(e.disabledSources,t);if(e.enabledSources)return R(e.enabledSources,t);return!0},activate:function(e,t,n){return y(e,t,n).then(g)},deactivate:function(e,t,n){return b(e,t,n).then(g)},updateSources:function(e,t,r,u){return function(e,t,n){return t.reduce(function(e,t){return e.then(function(e){return y(e,t,n)})},i.resolve(e))}(e,t,u).then(function(e){return n=u,r.reduce(function(e,t){return e.then(function(e){return b(e,t,n)})},i.resolve(e));var n}).then(g)},addNewWithUI:A,addNewForInputAlarmAndOutputUserWithUI:function(e,t){return A({inputAlarm:e,outputUser:t})},addNewForInputDataPointWithUI:function(e){return A({inputDataPoint:e})},addNewForOutputOperationWithUI:function(e){return A({outputOperation:{template:function(e){return o.cleanFields(e,["id","self","status","deviceId","creationTime","failureReason"])}(e)}})},createInstanceWithUI:E,createInstanceWithUIByName:function(e,t){return c.getTemplateByName(e).then(function(e){return E(e,t)})},editWithUI:function(e){return N(e,void 0)},cloneWithUI:function(e){return t.current().then(_.partial(D,e)).then(N)}};function m(e){return i.all(_.map(e,function(t){return c.getTemplateForRule(t).then(function(e){return _.isUndefined(e)?null:t})})).then(_.flatten).then(_.filter)}function v(e,t){var n=_.get(e,"c8y_Context.id"),t=t&&n?S({moId:n}):f;return e.id&&(t+="/".concat(e.id)),t}function S(e){return"".concat(d,"/managedObjects/").concat(e.moId,"/smartrules")}function g(e){var t=v(e,!0),e=o.cleanFields(e,p);return u.put(t,e)}function y(n,e,t){return I(e,t).then(function(e){return _.forEach(e,function(t){_.isArray(n.enabledSources)&&!R(n.enabledSources,t)&&n.enabledSources.push(t),_.isArray(n.disabledSources)&&R(n.disabledSources,t)&&_.remove(n.disabledSources,function(e){return _.toString(e)===_.toString(t)})}),n})}function b(n,e,t){return I(e,t).then(function(e){return _.forEach(e,function(t){_.isArray(n.enabledSources)&&R(n.enabledSources,t)&&_.remove(n.enabledSources,function(e){return _.toString(e)===_.toString(t)}),_.isArray(n.disabledSources)&&!R(n.disabledSources,t)&&n.disabledSources.push(t)}),n})}function I(e,t){var e=e&&e.id||e,n=[];return e&&(n.push(i.when(e)),n.push(function(e,t){var n=[];!0!==t&&!0!==t.assets||n.push(r.childAssets(e));!0!==t&&!0!==t.devices||n.push(r.childDevices(e));return i.all(n).then(_.flattenDeep).then(_.partialRight(_.map,"id"))}(e,t))),i.all(n).then(_.flattenDeep)}function R(e,t){var n=t.id||t;return _.some(e,function(e){return _.toString(e)===_.toString(n)})}function A(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length?arguments[1]:void 0,n=2<arguments.length?arguments[2]:void 0;return a({title:l("Add global smart rule"),templateUrl:":::PLUGIN_PATH:::/views/add.html",controller:"SmartRuleAddCtrl",ariaLabelledBy:"modal-title",ariaDescribedBy:"modal-body",size:"lg",keyboard:!1,resolve:{context:function(){return _.cloneDeep(e)},ruleInitialObj:function(){return _.cloneDeep(n)},ruleTemplatesFilterFn:function(){return t}}})}function E(e,t){return N(t,e)}function D(e,t){e=_.cloneDeep(e);return(e=o.cleanFields(e,h)).name=s.getString("Duplicate of {{name}}",e),t&&(e.owner=t.id),e}function N(e,t){return a({templateUrl:":::PLUGIN_PATH:::/views/edit.html",controller:"SmartRuleEditCtrl",size:"sm",keyboard:!1,resolve:{ruleTemplate:function(){return _.cloneDeep(t)},rule:function(){return _.cloneDeep(e)}}})}}e.$inject=["$q","$http","c8yBase","c8yInventory","c8yUiUtil","c8yModal","c8yUser","smartRuleTemplatesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").factory("smartRulesSvc",e)}();