@c8y/ng1-modules 1018.503.111 → 1018.503.114
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 ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 _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 r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"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,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(
|
|
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,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 _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 r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"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,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(s,u,e,r,t,n,i){var o;s.placeholder=i("Device's name or value of any device's property"),s.isDeviceSelected=s.isDeviceSelected||function(){return!(!_.isUndefined(O())||!s.selectRequired)},s.selectRoot=s.selectRoot||function(){b(o)},s.isSelectedRoot=s.isSelectedRoot||O,s.select=s.select||b,s.clickSelect=function(e){s.select(e,s),s.form&&(s.form.$setDirty(),s.form.$setValidity("deviceSelected",!0))},s.isSelected=s.isSelected||D,s.isSelectedById=s.isSelectedById||S,s.isSelectionEmpty=s.isSelectionEmpty||function(){return!s.selectedChildDevice},s.search=l,s.searchData={},s.propagateToggle={},s.icon=function(){return s.loading?"circle-o-notch":"search"},s.checkEnter=function(e){e.keyCode===A&&l(s.searchData.text)},s.getRootName=function(e){return e||i("Root Device")},s.emptySelectionAvailable=_.result(s,"emptySelectionAvailable")||!1,s.emptySelectionIcon=_.result(s,"emptySelectionIcon")||"",s.emptySelectionLabel=_.result(s,"emptySelectionLabel")||i("None"),s.readOnlyInfoText=_.result(s,"readOnlyInfo")||i("Selection change is disabled."),s.getScope=function(){return s},s.$watch("parent",c),s.$watch("selectedChildDevice",m),s.$on("selectDevice",P);function c(e,t){!e||t&&e.id&&e.id===t||(_.isObjectLike(e)?u.when(e):n.detail(e).then(r.getResData)).then(function(e){return h(e),s.parentDevice=e,s.top&&(o=e,s.root=o,s.selectedChildDevice||!e.isDevice&&!s.groupsSelectable||(s.selectedChildDevice=e)),e}).then(y).then(v).then(a)}function a(e,t){e=(s.children||[]).concat(e);s.children=_.uniqBy(e,"id"),s.truncated=!_.isUndefined(t)&&t}function l(e){s.propagateToggle.value=!1,_.remove(s.children,function(e){return!S(e)}),s.loading=!0,s.searchData.lastText=e,d({text:e}).then(f).finally(function(){s.loading=!1})}function d(e){!s.searchOnlyChildAssetsOf||void 0!==e.ids||void 0!==e.text&&""!==e.text||(e.ids=s.searchOnlyChildAssetsOf.id);function c(e){a++;var t=e.statistics.pageSize,r=e.paging.next,n=e.length>=t;i=function(e){return _(e).map(_.property("childDevices.references")).flatten().map(_.property("managedObject.id")).uniq().value()}(o=e);var i,o=function(e){var r=[];{var n;s.searchOnlyChildAssetsOf?(n=s.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)})})):r=e}return r}(_.filter(o,function(e){return e&&(S(e)||e.c8y_IsDevice||p(e)||(r=i,function(e){return _.get(e,"deviceParents.references.length")}(t=e)&&!_.includes(r,t.id)))&&!("c8y_OpcuaNode"===e.type);var t,r})),o=(l=[].concat(_toConsumableArray(l),_toConsumableArray(o))).length>t,r=r&&n;return l.length>=t||10<=a||!r?(n=o||r,u.resolve({mos:_.take(l,t),truncated:n})):e.paging.next().then(c)}var a=0,l=[];return n.list(_objectSpread(_objectSpread({},e),{},{withParents:!0})).then(c)}function f(e){var t=e.mos,r=e.truncated;return u.resolve(t).then(v).then(function(e){return a(e,r)})}function p(e){return!!e.c8y_IsDeviceGroup}function y(e){return t[p(e)?"childAssets":"childDevices"](e)}function h(e){var t=!p(e),r=t?"childDevices":"childAssets";e.isDevice=t,e.__children=e[r]&&e[r].references||[]}function v(e){return _.map(e,function(e){return h(e),S(e)&&b(e),s.parent&&(e.openChildren=!1,Array.isArray(s.parent.idPath)?(e.idPath=_.cloneDeep(s.parent.idPath),e.idPath.push(s.parent.id)):e.idPath=[s.parent.id]),e})}function m(e){var t;e&&e.id&&(s.$parent.propagateToggle?s.propagateToggle=s.$parent.propagateToggle:s.propagateToggle={value:!0},t=e.idPath?e.idPath[0]:e.id,!s.deviceSelectorForm.$dirty&&s.selectedChildDeviceId&&s.selectedChildDeviceId!==e.id&&s.deviceSelectorForm.$setDirty(),s.idPath=e.idPath,s.selectedChildDeviceId=e.id,s.children||!s.top||s.parent||d({ids:t}).then(f))}function b(e,t){var r=["id","type","name"],n=t?[g(r,e)]:[];(t||s).$emit("selectDevice",n,r,e)}function g(e,r){return _.reduce(e,function(e,t){return e[t]=_.get(r,[t]),e},{})}function S(e){return e&&s.selectedChildDevice&&s.selectedChildDevice.id===e.id}function D(e){return S(e)}function O(){return D(o)||s.selectedChildDevice&&(o&&o.id)===s.selectedChildDevice.id}function P(e,t,r,n){var i,r=s.top?_.reduce(r,function(e,t){return e[t]="_root",e},{}):g(r,s.parentDevice);t.push(r),s.top&&(i=t.reverse(),r=_.reduce(i[0],function(e,t,r){return e["path_".concat(r)]=_.map(i,r).join("/"),e},{}),e.stopPropagation(),s.selectedChildDevice=n,s.contextPaths=r,s.onSelect({selDevice:n,contextPaths:r}))}_.assign(this,{$onInit:function(){void 0!==s.selectedChildDevice&&e(function(){s.form.$setValidity("deviceSelected",!0)},500)}});var A=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(o,c,e,i){var n=t('<div ng-include="\':::PLUGIN_PATH:::/views/deviceSelectorCombo.html\'" ng-controller="DeviceSelectorComboCtrl"></div>');o.top=!0,o.form=i,o.form&&o.selectedChildDevice&&!o.selectedChildDevice.id&&o.form.$setValidity("deviceSelected",!1),o.toggleChildren=function(e,i,t){return o._toggleChildren($(e.target),i,t)},o._toggleChildren=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:c,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:o,t=2<arguments.length?arguments[2]:void 0,l=e.hasClass("deviceRow")?e:e.parents(".deviceRow").first();t.openChildren=!t.openChildren,t.openChildren?(e=i.$new(),(t.childrenNewScope=e).openChildren=!1,e.propagateToggle=i.propagateToggle,e.parent=t,e.depth=_.isNumber(i.depth)?i.depth+1:1,e.children=[],e.top=!1,n(e,function(e){l.append(e)})):(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(o,c,e,i){var n=t('<div ng-include="\':::PLUGIN_PATH:::/views/deviceSelectorCombo.html\'" ng-controller="DeviceSelectorComboCtrl"></div>');o.top=!0,o.form=i,o.form&&o.selectedChildDevice&&!o.selectedChildDevice.id&&o.form.$setValidity("deviceSelected",!1),o.toggleChildren=function(e,i,t){return o._toggleChildren($(e.target),i,t)},o._toggleChildren=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:c,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:o,t=2<arguments.length?arguments[2]:void 0,l=e.hasClass("deviceRow")?e:e.parents(".deviceRow").first();t.openChildren=!t.openChildren,t.openChildren?(e=i.$new(),(t.childrenNewScope=e).openChildren=!1,e.propagateToggle=i.propagateToggle,e.parent=t,e.depth=_.isNumber(i.depth)?i.depth+1:1,e.children=[],e.top=!1,n(e,function(e){l.append(e)})):(l.children().last().remove(),t.childrenNewScope.$destroy(),delete t.childrenNewScope)}}}}}]);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(){function e(t,e,n,s,i,a,
|
|
1
|
+
"use strict";!function(){function e(t,e,n,s,i,l,a,r,u,o,c,d,m){var g=_.isEmpty(c)?null:c,h="smartRuleForm",y={parent:null,mo:null,withChildren:{assets:!0,devices:!1}},p={inProgres:!1};function f(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(){p.inProgress=!0}function R(){p.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(a.success),m.getString('Smart rule "{{name}}" saved.',{name:c.name}))).then(R)},t.savingStatus=p,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?f(o):u.getTemplateForRule(c).then(f),t.initialActivationCfg=y,h=_.get(c,"c8y_Context",l.getContext()),i.detail(h.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)">
|