@c8y/ng1-modules 1018.0.273 → 1018.0.276

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.
@@ -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 _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,r[e])})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}!function(){function e(a,f,e,r,t,n,i){var o;a.placeholder=i("Device's name or value of any device's property"),a.isDeviceSelected=a.isDeviceSelected||function(){return!(!_.isUndefined(P())||!a.selectRequired)},a.selectRoot=a.selectRoot||function(){g(o)},a.isSelectedRoot=a.isSelectedRoot||P,a.select=a.select||g,a.clickSelect=function(e){a.select(e,a),a.form&&(a.form.$setDirty(),a.form.$setValidity("deviceSelected",!0))},a.isSelected=a.isSelected||D,a.isSelectedById=a.isSelectedById||S,a.isSelectionEmpty=a.isSelectionEmpty||function(){return!a.selectedChildDevice},a.search=u,a.searchData={},a.propagateToggle={},a.icon=function(){return a.loading?"circle-o-notch":"search"},a.checkEnter=function(e){e.keyCode===C&&u(a.searchData.text)},a.getRootName=function(e){return e||i("Root Device")},a.emptySelectionAvailable=_.result(a,"emptySelectionAvailable")||!1,a.emptySelectionIcon=_.result(a,"emptySelectionIcon")||"",a.emptySelectionLabel=_.result(a,"emptySelectionLabel")||i("None"),a.readOnlyInfoText=_.result(a,"readOnlyInfo")||i("Selection change is disabled."),a.getScope=function(){return a},a.$watch("parent",c),a.$watch("selectedChildDevice",m),a.$on("selectDevice",A);function c(e,t){e&&(t&&e.id&&e.id===t||(_.isObjectLike(e)?f.when(e):n.detail(e).then(r.getResData)).then(function(e){return v(e),a.parentDevice=e,a.top&&(o=e,a.root=o,a.selectedChildDevice||!e.isDevice&&!a.groupsSelectable||(a.selectedChildDevice=e)),e}).then(y).then(h).then(l))}function l(e,t){var r=(a.children||[]).concat(e);a.children=_.uniqBy(r,"id"),a.truncated=!_.isUndefined(t)&&t}function u(e){a.propagateToggle.value=!1,_.remove(a.children,function(e){return!S(e)}),a.loading=!0,d({text:a.searchData.lastText=e}).then(s).finally(function(){a.loading=!1})}function d(e){var d=0,s=[];return n.list(_objectSpread({},e,{withParents:!0})).then(function e(t){d++;var r,n=t.statistics.pageSize,i=t.paging.next,o=t.length>=n,c=function(e){var t=function(e){return _(e).map(_.property("childDevices.references")).flatten().map(_.property("managedObject.id")).uniq().value()}(e);return _.filter(e,function(e){return e&&(S(e)||e.c8y_IsDevice||p(e)||function(e,t){return function(e){return _.get(e,"deviceParents.references.length")}(e)&&!_.includes(t,e.id)}(e,t))&&!function(e){return"c8y_OpcuaNode"===e.type}(e)})}(t),a=(s=[].concat(_toConsumableArray(s),_toConsumableArray(c))).length>n,l=i&&o;if(s.length>=n||10<=d||!l){var u=a||l;r=f.resolve({mos:_.take(s,n),truncated:u})}else r=t.paging.next().then(e);return r})}function s(e){var t=e.mos,r=e.truncated;return f.resolve(t).then(h).then(function(e){return l(e,r)})}function p(e){return!!e.c8y_IsDeviceGroup}function y(e){return t[p(e)?"childAssets":"childDevices"](e)}function v(e){var t=!p(e),r=t?"childDevices":"childAssets";return e.isDevice=t,e.__children=e[r]&&e[r].references||[],e}function h(e){return _.map(e,function(e){return v(e),S(e)&&g(e),a.parent&&(e.openChildren=!1,Array.isArray(a.parent.idPath)?(e.idPath=_.cloneDeep(a.parent.idPath),e.idPath.push(a.parent.id)):e.idPath=[a.parent.id]),e})}function m(e){if(e&&e.id){a.$parent.propagateToggle?a.propagateToggle=a.$parent.propagateToggle:a.propagateToggle={value:!0};var t=e.idPath?e.idPath[0]:e.id;!a.deviceSelectorForm.$dirty&&a.selectedChildDeviceId&&a.selectedChildDeviceId!==e.id&&a.deviceSelectorForm.$setDirty(),a.idPath=e.idPath,a.selectedChildDeviceId=e.id,a.children||!a.top||a.parent||d({ids:t}).then(s)}}function g(e,t){var r=["id","type","name"],n=t?[b(r,e)]:[];(t||a).$emit("selectDevice",n,r,e)}function b(e,r){return _.reduce(e,function(e,t){return e[t]=_.get(r,[t]),e},{})}function S(e){return e&&a.selectedChildDevice&&a.selectedChildDevice.id===e.id}function D(e){return S(e)}function P(){return D(o)||a.selectedChildDevice&&(o&&o.id)===a.selectedChildDevice.id}function A(e,t,r,n){var i=a.top?_.reduce(r,function(e,t){return e[t]="_root",e},{}):b(r,a.parentDevice);if(t.push(i),a.top){var o=t.reverse(),c=_.reduce(o[0],function(e,t,r){return e["path_".concat(r)]=_.map(o,r).join("/"),e},{});e.stopPropagation(),a.selectedChildDevice=n,a.contextPaths=c,a.onSelect({selDevice:n,contextPaths:c})}}_.assign(this,{$onInit:function(){void 0!==a.selectedChildDevice&&e(function(){a.form.$setValidity("deviceSelected",!0)},500)}});var C=13}e.$inject=["$scope","$q","$timeout","c8yBase","c8yDevices","c8yInventory","gettext"],angular.module("c8y.deviceSelector").controller("DeviceSelectorComboCtrl",e)}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.forEach(function(e){_defineProperty(t,e,r[e])})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}!function(){function e(f,p,e,r,t,n,i){var o;f.placeholder=i("Device's name or value of any device's property"),f.isDeviceSelected=f.isDeviceSelected||function(){return!(!_.isUndefined(P())||!f.selectRequired)},f.selectRoot=f.selectRoot||function(){g(o)},f.isSelectedRoot=f.isSelectedRoot||P,f.select=f.select||g,f.clickSelect=function(e){f.select(e,f),f.form&&(f.form.$setDirty(),f.form.$setValidity("deviceSelected",!0))},f.isSelected=f.isSelected||D,f.isSelectedById=f.isSelectedById||S,f.isSelectionEmpty=f.isSelectionEmpty||function(){return!f.selectedChildDevice},f.search=l,f.searchData={},f.propagateToggle={},f.icon=function(){return f.loading?"circle-o-notch":"search"},f.checkEnter=function(e){e.keyCode===C&&l(f.searchData.text)},f.getRootName=function(e){return e||i("Root Device")},f.emptySelectionAvailable=_.result(f,"emptySelectionAvailable")||!1,f.emptySelectionIcon=_.result(f,"emptySelectionIcon")||"",f.emptySelectionLabel=_.result(f,"emptySelectionLabel")||i("None"),f.readOnlyInfoText=_.result(f,"readOnlyInfo")||i("Selection change is disabled."),f.getScope=function(){return f},f.$watch("parent",c),f.$watch("selectedChildDevice",m),f.$on("selectDevice",A);function c(e,t){e&&(t&&e.id&&e.id===t||(_.isObjectLike(e)?p.when(e):n.detail(e).then(r.getResData)).then(function(e){return h(e),f.parentDevice=e,f.top&&(o=e,f.root=o,f.selectedChildDevice||!e.isDevice&&!f.groupsSelectable||(f.selectedChildDevice=e)),e}).then(d).then(v).then(a))}function a(e,t){var r=(f.children||[]).concat(e);f.children=_.uniqBy(r,"id"),f.truncated=!_.isUndefined(t)&&t}function l(e){f.propagateToggle.value=!1,_.remove(f.children,function(e){return!S(e)}),f.loading=!0,u({text:f.searchData.lastText=e}).then(s).finally(function(){f.loading=!1})}function u(e){!f.searchOnlyChildAssetsOf||void 0!==e.ids||void 0!==e.text&&""!==e.text||(e.ids=f.searchOnlyChildAssetsOf.id);var s=0,d=[];return n.list(_objectSpread({},e,{withParents:!0})).then(function e(t){s++;var r,n=t.statistics.pageSize,i=t.paging.next,o=t.length>=n,c=function(e){var r=[];if(f.searchOnlyChildAssetsOf){var n=f.searchOnlyChildAssetsOf.id;_.forEach(e,function(t){t.id===n&&r.push(t),t&&t.assetParents&&t.assetParents.references&&t.assetParents.references.forEach(function(e){e.managedObject.id===n&&r.push(t)})})}else r=e;return r}(function(e){var t=function(e){return _(e).map(_.property("childDevices.references")).flatten().map(_.property("managedObject.id")).uniq().value()}(e);return _.filter(e,function(e){return e&&(S(e)||e.c8y_IsDevice||y(e)||function(e,t){return function(e){return _.get(e,"deviceParents.references.length")}(e)&&!_.includes(t,e.id)}(e,t))&&!function(e){return"c8y_OpcuaNode"===e.type}(e)})}(t)),a=(d=[].concat(_toConsumableArray(d),_toConsumableArray(c))).length>n,l=i&&o;if(d.length>=n||10<=s||!l){var u=a||l;r=p.resolve({mos:_.take(d,n),truncated:u})}else r=t.paging.next().then(e);return r})}function s(e){var t=e.mos,r=e.truncated;return p.resolve(t).then(v).then(function(e){return a(e,r)})}function y(e){return!!e.c8y_IsDeviceGroup}function d(e){return t[y(e)?"childAssets":"childDevices"](e)}function h(e){var t=!y(e),r=t?"childDevices":"childAssets";return e.isDevice=t,e.__children=e[r]&&e[r].references||[],e}function v(e){return _.map(e,function(e){return h(e),S(e)&&g(e),f.parent&&(e.openChildren=!1,Array.isArray(f.parent.idPath)?(e.idPath=_.cloneDeep(f.parent.idPath),e.idPath.push(f.parent.id)):e.idPath=[f.parent.id]),e})}function m(e){if(e&&e.id){f.$parent.propagateToggle?f.propagateToggle=f.$parent.propagateToggle:f.propagateToggle={value:!0};var t=e.idPath?e.idPath[0]:e.id;!f.deviceSelectorForm.$dirty&&f.selectedChildDeviceId&&f.selectedChildDeviceId!==e.id&&f.deviceSelectorForm.$setDirty(),f.idPath=e.idPath,f.selectedChildDeviceId=e.id,f.children||!f.top||f.parent||u({ids:t}).then(s)}}function g(e,t){var r=["id","type","name"],n=t?[b(r,e)]:[];(t||f).$emit("selectDevice",n,r,e)}function b(e,r){return _.reduce(e,function(e,t){return e[t]=_.get(r,[t]),e},{})}function S(e){return e&&f.selectedChildDevice&&f.selectedChildDevice.id===e.id}function D(e){return S(e)}function P(){return D(o)||f.selectedChildDevice&&(o&&o.id)===f.selectedChildDevice.id}function A(e,t,r,n){var i=f.top?_.reduce(r,function(e,t){return e[t]="_root",e},{}):b(r,f.parentDevice);if(t.push(i),f.top){var o=t.reverse(),c=_.reduce(o[0],function(e,t,r){return e["path_".concat(r)]=_.map(o,r).join("/"),e},{});e.stopPropagation(),f.selectedChildDevice=n,f.contextPaths=c,f.onSelect({selDevice:n,contextPaths:c})}}_.assign(this,{$onInit:function(){void 0!==f.selectedChildDevice&&e(function(){f.form.$setValidity("deviceSelected",!0)},500)}});var C=13}e.$inject=["$scope","$q","$timeout","c8yBase","c8yDevices","c8yInventory","gettext"],angular.module("c8y.deviceSelector").controller("DeviceSelectorComboCtrl",e)}();
@@ -1 +1 @@
1
- "use strict";angular.module("c8y.deviceSelector").directive("c8yDeviceSelectorComboDevices",function(){return{restrict:"A",link:function(e,i){e.__el=i;var t=e.depth||0;function l(){e.child.openChildren=e.idPath&&!!e.idPath[t]&&e.idPath[t]===e.child.id&&e.selectedChildDevice.id!==e.child.id,e.child.openChildren&&e.toggleChildren(e,e.child)}e.$evalAsync(function(){return e.propagateToggle.value&&l()})}}}).directive("c8yDeviceSelectorCombo",["$compile",function(t){return{restrict:"EA",scope:{parent:"=?",selectedChildDevice:"=?",selectedChildDeviceId:"=?",contextPaths:"=?",onSelect:"&",groupsSelectable:"=?",selectRequired:"=?",idPath:"=?",emptySelectionAvailable:"&?",emptySelectionIcon:"&?",emptySelectionLabel:"&?",readOnly:"<",readOnlyInfo:"&?"},templateUrl:":::PLUGIN_PATH:::/views/deviceSelectorCombo.html",controller:"DeviceSelectorComboCtrl",require:"?^form",link:{post:function(c,r,e,i){var n=t('<div ng-include="\':::PLUGIN_PATH:::/views/deviceSelectorCombo.html\'" ng-controller="DeviceSelectorComboCtrl"></div>');c.top=!0,c.form=i,c.form&&c.selectedChildDevice&&!c.selectedChildDevice.id&&c.form.$setValidity("deviceSelected",!1),c.toggleChildren=function(e,i,t){return c._toggleChildren($(e.target),i,t)},c._toggleChildren=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:c,t=2<arguments.length?arguments[2]:void 0,l=e.hasClass("deviceRow")?e:e.parents(".deviceRow").first();if(t.openChildren=!t.openChildren,t.openChildren){var o=i.$new();(t.childrenNewScope=o).openChildren=!1,o.propagateToggle=i.propagateToggle,o.parent=t,o.depth=_.isNumber(i.depth)?i.depth+1:1,o.children=[],o.top=!1,n(o,function(e){l.append(e)})}else l.children().last().remove(),t.childrenNewScope.$destroy(),delete t.childrenNewScope}}}}}]);
1
+ "use strict";angular.module("c8y.deviceSelector").directive("c8yDeviceSelectorComboDevices",function(){return{restrict:"A",link:function(e,i){e.__el=i;var t=e.depth||0;function l(){e.child.openChildren=e.idPath&&!!e.idPath[t]&&e.idPath[t]===e.child.id&&e.selectedChildDevice.id!==e.child.id,e.child.openChildren&&e.toggleChildren(e,e.child)}e.$evalAsync(function(){return e.propagateToggle.value&&l()})}}}).directive("c8yDeviceSelectorCombo",["$compile",function(t){return{restrict:"EA",scope:{parent:"=?",selectedChildDevice:"=?",selectedChildDeviceId:"=?",contextPaths:"=?",onSelect:"&",groupsSelectable:"=?",selectRequired:"=?",idPath:"=?",emptySelectionAvailable:"&?",emptySelectionIcon:"&?",emptySelectionLabel:"&?",readOnly:"<",readOnlyInfo:"&?",searchOnlyChildAssetsOf:"=?"},templateUrl:":::PLUGIN_PATH:::/views/deviceSelectorCombo.html",controller:"DeviceSelectorComboCtrl",require:"?^form",link:{post:function(c,r,e,i){var n=t('<div ng-include="\':::PLUGIN_PATH:::/views/deviceSelectorCombo.html\'" ng-controller="DeviceSelectorComboCtrl"></div>');c.top=!0,c.form=i,c.form&&c.selectedChildDevice&&!c.selectedChildDevice.id&&c.form.$setValidity("deviceSelected",!1),c.toggleChildren=function(e,i,t){return c._toggleChildren($(e.target),i,t)},c._toggleChildren=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:c,t=2<arguments.length?arguments[2]:void 0,l=e.hasClass("deviceRow")?e:e.parents(".deviceRow").first();if(t.openChildren=!t.openChildren,t.openChildren){var o=i.$new();(t.childrenNewScope=o).openChildren=!1,o.propagateToggle=i.propagateToggle,o.parent=t,o.depth=_.isNumber(i.depth)?i.depth+1:1,o.children=[],o.top=!1,n(o,function(e){l.append(e)})}else l.children().last().remove(),t.childrenNewScope.$destroy(),delete t.childrenNewScope}}}}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.0.273",
3
+ "version": "1018.0.276",
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(t,e,n,s,i,a,l,r,u,o,c,d,m){var g=_.isEmpty(c)?null:c,h="smartRuleForm",v={parent:null,mo:null,withChildren:{assets:!0,devices:!1}},y={inProgres:!1};function f(e){o=e,t.ruleTemplate=o,t.rule.name||(t.rule.name=m.getString(t.ruleTemplate.description))}function p(e){t.enabledSources=_.sortBy(e,"name")}function b(e){t.disabledSources=_.sortBy(e,"name")}function C(e){t.title=e}function S(){return T(),n.reject()}function R(){y.inProgress=!0}function T(){y.inProgress=!1}t.hasChildAssets=angular.bind(i,i.hasChildAssets),t.getChildAssetsCount=angular.bind(i,i.getChildAssetsCount),t.ruleTemplate=o,t.rule=c,t.save=function(){o.noTarget&&(v.withChildren={assets:!1,devices:!1}),n.when().then(R).then(angular.bind(r,r.save,c,o,v)).then(e.close,S).then(_.partial(_.unary(l.success),m.getString('Smart rule "{{name}}" saved.',{name:c.name}))).then(T)},t.savingStatus=y,t.cancel=e.dismiss,t.invalid=angular.bind(s,s.invalid,t,h);var A,E=t.$watch(h,function(e){g&&e.$setDirty(),e&&E()});c&&c.id?C(d("Edit global smart rule")):(C(d("New global smart rule")),c=_.assign(r.getEmpty(),c||{})),t.rule=c,o?f(o):u.getTemplateForRule(c).then(f),function(){t.initialActivationCfg=v;var e=_.get(c,"c8y_Context",a.getContext());i.detail(e.id).then(s.getResData).then(function(e){v.mo=e})}(),c&&c.id&&(_.isEmpty(c.enabledSources)||(A=c.enabledSources.join(","),i.list({ids:A}).then(p)),_.isEmpty(c.disabledSources)||(A=c.disabledSources.join(","),i.list({ids:A}).then(b)))}e.$inject=["$scope","$uibModalInstance","$q","c8yBase","c8yInventory","c8yUiUtil","c8yAlert","smartRulesSvc","smartRuleTemplatesSvc","ruleTemplate","rule","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRuleEditCtrl",e)}();
1
+ "use strict";!function(){function e(t,e,n,s,i,a,l,r,u,o,c,d,m){var g=_.isEmpty(c)?null:c,h="smartRuleForm",y={parent:null,mo:null,withChildren:{assets:!0,devices:!1}},f={inProgres:!1};function p(e){o=e,t.ruleTemplate=o,t.rule.name||(t.rule.name=m.getString(t.ruleTemplate.description))}function v(e){t.enabledSources=_.sortBy(e,"name")}function C(e){t.disabledSources=_.sortBy(e,"name")}function b(e){t.title=e}function S(){return R(),n.reject()}function A(){f.inProgress=!0}function R(){f.inProgress=!1}t.hasChildAssets=angular.bind(i,i.hasChildAssets),t.getChildAssetsCount=angular.bind(i,i.getChildAssetsCount),t.ruleTemplate=o,t.rule=c,t.save=function(){o.noTarget&&(y.withChildren={assets:!1,devices:!1}),n.when().then(A).then(angular.bind(r,r.save,c,o,y)).then(e.close,S).then(_.partial(_.unary(l.success),m.getString('Smart rule "{{name}}" saved.',{name:c.name}))).then(R)},t.savingStatus=f,t.cancel=e.dismiss,t.invalid=angular.bind(s,s.invalid,t,h);var T,E=t.$watch(h,function(e){g&&e.$setDirty(),e&&E()});c&&c.id?b(d("Edit global smart rule")):(b(d("New global smart rule")),c=_.assign(r.getEmpty(),c||{})),t.rule=c,o?p(o):u.getTemplateForRule(c).then(p),function(){t.initialActivationCfg=y;var e=_.get(c,"c8y_Context",a.getContext());i.detail(e.id).then(s.getResData).then(function(e){y.mo=e,y.searchOnlyChildAssetsOf=_.cloneDeep(e)})}(),c&&c.id&&(_.isEmpty(c.enabledSources)||(T=c.enabledSources.join(","),i.list({ids:T}).then(v)),_.isEmpty(c.disabledSources)||(T=c.disabledSources.join(","),i.list({ids:T}).then(C)))}e.$inject=["$scope","$uibModalInstance","$q","c8yBase","c8yInventory","c8yUiUtil","c8yAlert","smartRulesSvc","smartRuleTemplatesSvc","ruleTemplate","rule","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRuleEditCtrl",e)}();
@@ -145,6 +145,7 @@
145
145
  parent="initialActivationCfg.parent"
146
146
  selected-child-device="initialActivationCfg.mo"
147
147
  groups-selectable="true"
148
+ search-only-child-assets-of="initialActivationCfg.searchOnlyChildAssetsOf"
148
149
  ></c8y-device-selector-combo>
149
150
  </div>
150
151
  <div class="checkbox" ng-show="hasChildAssets(initialActivationCfg.mo)">