@c8y/ng1-modules 1019.13.5 → 1019.19.2
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.
- package/NOTICES +0 -24
- package/app-logs/app-logs.service.js +1 -1
- package/asset-notes/assetNotes.component.js +1 -1
- package/assetPropertyWidget/main.controller.js +1 -1
- package/cell-id-information-activator/cell-id-information-activator.config.js +1 -1
- package/commandTemplates/controllers/commandTemplates.js +1 -1
- package/core/core/services/alarms.js +1 -1
- package/core/core/services/application.js +1 -1
- package/core/core/services/base.js +1 -1
- package/core/core/services/deviceShell.js +1 -1
- package/core/core/services/dynamicGroups.js +1 -1
- package/core/core/services/groups.js +1 -1
- package/core/core/services/inventory.js +1 -1
- package/core/core/services/kpi.js +1 -1
- package/core/core/services/measurements.js +1 -1
- package/core/core/services/settings.js +1 -1
- package/core/core/services/tenant.js +1 -1
- package/core/core/services/user.js +1 -1
- package/core/core/services/util.js +1 -1
- package/core/ui/configurable-device-list-columns/configurable-columns.service.js +1 -1
- package/core/ui/configurable-device-list-columns/modal-columns-configure.component.js +1 -1
- package/core/ui/controllers/deviceList.js +1 -1
- package/core/ui/csvExporter/csvExporter.controller.js +1 -1
- package/core/ui/directives/alarmList.js +1 -1
- package/core/ui/directives/map2.js +1 -1
- package/core/ui/properties/lastDeviceMessage.computedProperty.js +1 -1
- package/core/ui/schemaForm/schemaForm.component.js +1 -1
- package/core/ui/services/deviceListColumns.js +1 -1
- package/dataBroker/connectorsAlarms/connectorAlarms.component.js +1 -1
- package/device-protocol-actility/actility-device.provider.js +1 -1
- package/device-protocol-canbus/canbus-device.provider.js +1 -1
- package/device-protocol-canopen/canopen-device.provider.js +1 -1
- package/device-protocol-deviceDatabase4/device-type-protocol-base.provider.js +1 -1
- package/device-protocol-lora/lora-device.provider.js +1 -1
- package/device-protocol-lpwan/lpwan-device.provider.js +1 -1
- package/device-protocol-modbus/modbus-device.provider.js +1 -1
- package/device-protocol-opcua/opcua-device.provider.js +1 -1
- package/device-protocol-profibus/profibus-device.provider.js +1 -1
- package/device-protocol-sigfox/sigfox-device.provider.js +1 -1
- package/device-protocol-snmp/snmp-device.provider.js +1 -1
- package/deviceDatabase4/device-database.service.js +1 -1
- package/deviceDatabase4/modals/configure-discrete-io.component.js +1 -1
- package/deviceDatabase4/modals/configure-register.component.js +1 -1
- package/deviceDatabase4/unique.directive.js +1 -1
- package/deviceSelector/controllers/deviceSelectorComboCtrl.js +1 -1
- package/devicemanagement-alarmList/controllers/alarmList.js +1 -1
- package/devicemanagement-eventList/controllers/eventList.js +1 -1
- package/enterpriseEdition/customBranding/brandingConfigurationUi.provider.js +1 -1
- package/eventList/eventList.controller.js +1 -1
- package/generic-ui/generic-ui-inventory-property.component.js +1 -1
- package/groupsHierarchy/controllers/groupsListCtrl.js +1 -1
- package/kpi/controllers/list.js +1 -1
- package/kpi/controllers/pieChart.js +1 -1
- package/kpi/views/list.html +45 -11
- package/measurements/fragmentChart/fragmentChart.component.js +1 -1
- package/modbusConfiguration4/fieldbus-config.component.js +1 -1
- package/modbusWidget4/modbus-widget.service.js +1 -1
- package/package.json +1 -1
- package/remoteAccess/remoteAccess.service.js +1 -1
- package/remoteAccess/remoteAccessSettings/remoteAccessSettings.component.js +1 -1
- package/scada/mapping.directive.js +1 -1
- package/smartRules/directives/smartRuleParamInputKpi.js +1 -1
- package/tenantStatistics/tenant-statistics.component.js +1 -1
- package/userRoles/inventoryRolesTab/inventoryRolesTab.component.js +1 -1
package/NOTICES
CHANGED
|
@@ -9810,30 +9810,6 @@ THE SOFTWARE.**
|
|
|
9810
9810
|
|
|
9811
9811
|
The following software may be included in this product: core-js-compat. A copy of the source code may be downloaded from https://github.com/zloirock/core-js.git. This software contains the following license and notice below:
|
|
9812
9812
|
|
|
9813
|
-
Copyright (c) 2014-2023 Denis Pushkarev
|
|
9814
|
-
|
|
9815
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9816
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
9817
|
-
in the Software without restriction, including without limitation the rights
|
|
9818
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9819
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
9820
|
-
furnished to do so, subject to the following conditions:
|
|
9821
|
-
|
|
9822
|
-
The above copyright notice and this permission notice shall be included in
|
|
9823
|
-
all copies or substantial portions of the Software.
|
|
9824
|
-
|
|
9825
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
9826
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
9827
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
9828
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
9829
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
9830
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
9831
|
-
THE SOFTWARE.
|
|
9832
|
-
|
|
9833
|
-
-----
|
|
9834
|
-
|
|
9835
|
-
The following software may be included in this product: core-js-compat. A copy of the source code may be downloaded from https://github.com/zloirock/core-js.git. This software contains the following license and notice below:
|
|
9836
|
-
|
|
9837
9813
|
Copyright (c) 2014-2024 Denis Pushkarev
|
|
9838
9814
|
|
|
9839
9815
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var o,r=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)),r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach(function(t){_defineProperty(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var o,r=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)),r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach(function(t){_defineProperty(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(u,n,a,o,r,i){var c="application/applications",s="application/vnd.com.nsn.cumulocity.applicationLogs+json;charset=UTF-8;ver=0.9";return{downloadAndSaveAs:function(t,o,r,n){return e(t,o,r,n).then(function(t){var e,t=t.logs;_.isEmpty(t)?i.info(p(r,n)):(t=t,e="".concat(e=o,".log"),t=new Blob([t],{type:"text/plain"}),window.saveAs(t,e))})},shouldShowLogsTab:function(t){var t="c8y_Application_".concat(t),e=new Date;return o.list({type:t,nocache:e.getTime()}).then(function(t){var e;return _.isEqual(_.get(t,"length"),1)&&(t=_.head(t),e=_.get(t,"c8y_SupportedLogs"),t=_.get(t,"c8y_Status.instances"),e=_.some(e,function(t){return"syslog"===t})&&!_.isEmpty(t)),e})},getAllLogs:e,getLogs:l,formatDateChosenByUser:function(t){t=moment(t).format("YYYY-MM-DDTHH:mm:ss.SSS");return moment("".concat(t,"Z")).toISOString()},getWarningMessageForMissingLogs:p};function e(o,r,n,a){function i(t){var e=m(t.dateTo);return c.push(t.logs),moment(e).isValid()&&t.truncated&&t.dateFrom!==t.dateTo?l(o,r,{dateFrom:e,dateTo:a}).then(i):u.resolve(c)}var c=[];return l(o,r,{dateFrom:n,dateTo:a}).then(i).then(function(t){var e=n,o=a,r=t;return r=t.join(""),{dateFrom:e,dateTo:o,logs:r}})}function l(t,e){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0,t=a.url("".concat(c,"/").concat(t,"/logs/").concat(e)),e=_objectSpread({headers:{Accept:s},params:o},r);return o.dateFrom&&(o.dateFrom=m(o.dateFrom)),o.dateTo&&(o.dateTo=m(o.dateTo)),n.get(t,e).then(a.getResData)}function m(t){return moment(t).format(a.dateFullFormatWithMs)}function p(t,e){var o;return!t&&e&&(o=r.getString("No logs available before {{dateTo | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateTo:e})),t&&e&&(o=r.getString("No logs available in time range {{dateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000'}} - {{dateTo | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateFrom:t,dateTo:e})),t&&!e&&(o=r.getString("No logs available after {{dateFrom | absoluteDateTimeFormat:'LL, LTS':'+0000'}}.",{dateFrom:t})),o=t||e?o:r.getString("No logs available.")}}t.$inject=["$q","$http","c8yBase","c8yInventory","gettextCatalog","c8yAlert"],angular.module("c8y.appLogs").factory("c8yApplicationLogs",t)}();
|
|
@@ -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 n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}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"
|
|
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 n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}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)||!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(){function e(e,t,n,o){var r=this;function i(e){return _objectSpread(_objectSpread({},e),{},{htmlContent:o(e.htmlContent)})}_.assign(r,{$onInit:function(){return t.get(r.config.device).then(function(e){r.notes=i(e)})},edit:function(){r.editable=!0,r.editedNotes=_.cloneDeep(r.notes)},save:function(){t.save(r.config.device,r.editedNotes).then(function(e){r.editable=!1,r.notes=i(e)}).then(function(){return e.success(n("Notes saved."))})},cancel:function(){r.editable=!1,r.editedNotes=void 0}})}e.$inject=["c8yAlert","assetNotesSvc","gettext","$sanitize"],angular.module("c8y.assetNotes").component("c8yAssetNotes",{bindings:{config:"<"},templateUrl:":::PLUGIN_PATH:::/assetNotes.html",controller:e,controllerAs:"vm"})}();
|
|
@@ -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"
|
|
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)||!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 _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var 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 _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,c,a=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(c=r.return(),Object(c)!==c))return}finally{if(l)throw o}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(r,e,t,n,o,i,c,a,u,l){var f=_.memoize(function(){return e.all({configProperties:function(){var e=P("properties",[]);return _.filter(e,"__active").map(function(e){return angular.copy(e)})}(),discoveredProperties:function(){if(P("allowDisplayAndEditKnownProperties",!1))return o.list().then(function(e){return _.filter(e,d)}).then(function(e){return _.filter(e,b)});return[]}()}).then(function(e){var t=e.configProperties,e=e.discoveredProperties;return _(t).concat(e).uniqBy(function(e){return"".concat(_.get(e,"id"),"_").concat(_.get(e,"config._id"))}).reject(j).value()})});function s(){var e;f.cache.clear(),r.$emit("stopRealtime"),e=r.child.config.device.id,n.detailRealtime(e,r,void 0,{withChildren:!0}).then(function(e){r.managedObject=e}).then(y).then(p).then(h)}function y(){return f().then(function(e){i.attach(r.managedObject,e)})}function p(){return f().then(function(e){return o.getSchema(e)}).then(function(e){r.schema=e})}function d(e){return 1===e.keyPath.length}function b(e){return _.has(r.managedObject,e.keyPath[0])}function h(){m(!0)}function m(t){return e.all({properties:f(),options:function(e){var t={};e&&(t.readonly=e,t.feedback=!1,t.disableSuccessState=!0,t.disableErrorState=!0);return t}(t)}).then(function(e){var t=e.properties,e=e.options;return o.getForm(t,e)}).then(function(e){r.form=e,r.editable=!t})}function g(e){_.forEach(e,function(e){e=_slicedToArray(e.keyPath,1)[0];_.isUndefined(r.managedObject[e])&&(r.managedObject[e]=null)}),f.cache.clear(),p().then(function(){return m(!1)})}function v(){t.getContext().id===r.child.config.device.id&&a.changeTitle({title:_.get(r,"managedObject.name")||""},{skipTitleTranslation:!0})}function P(e,t){return _.get(r.child.config.options,e,t)}function j(e){var t=P("hiddenPropertiesKeyPaths",[]);return!!_.includes(t,e.keyPath[0])}r.$watch("child.config.options",s),_.assign(r,{startEdit:function(){r.managedObject=_.cloneDeep(r.managedObject),y(),m(!1)},canAddProperties:function(){return P("allowDisplayAndEditKnownProperties",!1)},addProperties:function(){var e={includeTree:!1,includeTreeChildren:!1,showComputed:!1,showRootPropertiesOnly:!0,managedObject:r.managedObject,hideExistingInMO:!0};return l.openSelector(e).then(g)},save:function(){return f().then(function(e){return _.reject(e,{computed:!0})}).then(function(e){return _objectSpread({id:r.managedObject.id},_.pick(r.managedObject,_.map(e,"keyPath[0]")))}).then(n.save).then(v).then(function(){return c.success(u("Changes saved."))}).then(s)},cancelEdit:function(){s()}})}e.$inject=["$scope","$q","c8yUiUtil","c8yInventory","c8yPropertiesLibrary","c8yComputedProperties","c8yAlert","c8yTitle","gettext","SchemaPropertiesSvc"],angular.module("c8y.parts.assetPropertyWidget").controller("assetPropertyWidgetCtrl",e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var r,o=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)),o}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var r,o=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)),o}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(t,e){var r={path:"/device/:deviceId/*",actionBar:!0};t.addUrlAction(_objectSpread(_objectSpread({},r),{},{text:e("Activate Cell ID information"),showIf:["$q","$routeParams","cellIdInformationActivator",function(t,e,r){return t.all({shown:r.shouldShowActivator(),activated:r.isActivatedFor(e.deviceId)}).then(function(t){var e=t.shown,t=t.activated;return e&&!t})}],action:["$routeParams","cellIdInformationActivator",function(t,e){e.activate(t.deviceId)}]})),t.addUrlAction(_objectSpread(_objectSpread({},r),{},{text:e("Deactivate Cell ID information"),showIf:["$q","$routeParams","cellIdInformationActivator",function(t,e,r){return t.all({shown:r.shouldShowActivator(),activated:r.isActivatedFor(e.deviceId)}).then(function(t){var e=t.shown,t=t.activated;return e&&t})}],action:["$routeParams","cellIdInformationActivator",function(t,e){e.deactivate(t.deviceId)}]}))}t.$inject=["c8yActionsProvider","gettext"],angular.module("c8y.cellIdInformationActivator").config(t)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(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"
|
|
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)||!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(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(n,i,o,u,a,t,e,c){var r=i.cleanFields,s="alarm/alarms",f="".concat(s,"/reports"),l={headers:i.contentHeaders("alarm")},m={WARNING:e("WARNING"),MINOR:e("MINOR"),MAJOR:e("MAJOR"),CRITICAL:e("CRITICAL")},y=[m.CRITICAL,m.MAJOR,m.MINOR,m.WARNING],p=_.keys(m),g={ACTIVE:e("ACTIVE"),ACKNOWLEDGED:e("ACKNOWLEDGED"),CLEARED:e("CLEARED")},d=_.keys(g),h=["id"],v=["id","self","creationTime","type","time","count","history","firstOccurence","firstOccurrenceTime"],b={},E="status",e={type:e("Type"),text:e("Text"),lastUpdated:e("Last updated")};function O(t){t=t.id||t;return i.url("".concat(s,"/").concat(t))}function D(t){var e=i.url(s),t=i.timeOrderFilter(i.pageSizeNoTotalFilter(t)),r={params:t},t=i.cleanListCallback("alarms",D,t);return n.get(e,r).then(t)}function C(t){var e=i.url(s),t=r(t,h);return n.post(e,t,l)}function w(t){var e=O(t),t=r(t,v);return n.put(e,t,l)}function A(e,t){t=t?r(t):a.list({source:e.id,pageSize:1e3}).then(r);return t;function r(t){var n="--";return e.status!==g.ACKNOWLEDGED||_.isEmpty(t)||(n=_.last(t).user),t.forEach(function(t){var e=t.changes||[],r=!1;if(e.forEach(function(t){if(t.attribute===E&&t.newValue===g.ACKNOWLEDGED)return!(r=!0)}),r)return n=t.user||n,!1}),n}}function T(t,e){function r(t){var t=t||[],n=t.length?t[t.length-1].creationTime:void 0;return t.forEach(function(e){var t=e.changes||[],r=!1;if(t.forEach(function(t){if(t.attribute===E&&t.newValue===g.ACKNOWLEDGED)return n=e.creationTime,!(r=!0)}),r)return!1}),n}return e?r(e):a.list({source:t.id,pageSize:1e3}).then(r)}function N(t,e){t=L(t,e);return t.humanize?t.humanize():t.then(function(t){return t.humanize?t.humanize():""})}function L(i,t){function e(t){var t=t||[],e=i.firstOccurrenceTime||i.time||i.creationTime,n=t.length?t[t.length-1].creationTime:void 0,r="";return _.forEach(t,function(e){var t=e.changes||[],r=!1;if(t.forEach(function(t){if(t.attribute===E&&t.newValue===g.CLEARED)return n=e.creationTime,!(r=!0)}),r)return!1}),e&&n&&(t=moment(e),e=moment(n),r=moment.duration(t.diff(e))),r}return t?e(t):a.list({source:i.id,pageSize:1e3}).then(e)}function S(t,e){t=[f,t];return e.id&&t.push(e.id),i.url(t.join("/"))}function R(t){var r=_.memoize(t,function(t,e){return[t.id,t.status,t.count,e&&e.length].join(":")});return function(t,e){return r(t,e)}}function j(t,e){var r=u.when(A(t,e)),t=u.when(T(t,e));return u.all([r,t]).then(function(t){return c.getString("ACKNOWLEDGED`alarm` by: {{ackBy}} {{ackTimeFromNow}}",{ackBy:t[0],ackTimeFromNow:moment(t[1]).fromNow()})})}function I(t,e){return u.when(N(t,e)).then(function(t){return c.getString("CLEARED`alarm`: was active for {{alarmDuration}}",{alarmDuration:t})})}function P(t){return u.when(c.getString("ACTIVE`alarm`: triggered {{alarmTimeFromNow}}",{alarmTimeFromNow:moment(t.time).fromNow()}))}b[m.WARNING]="circle",b[m.MINOR]="high-priority",b[m.MAJOR]="warning",b[m.CRITICAL]="exclamation-circle",b[g.CLEARED]="c8y-alert-idle",b[g.ACKNOWLEDGED]="bell-slash",b[g.ACTIVE]="bell";m={list:D,listByStatus:function(t,e){return t=_.compact(_.map(t,function(t,e){return t?e:void 0})),t=_.map(t,function(t){return D(_objectSpread(_objectSpread({},e),{},{status:t}))}),u.all(t).then(i.combineLists)},listByDevices:function(t,e){return u.all(_.map(t,function(t){return e.source=t,D(e)})).then(i.combineLists)},getSeverityCount:function(t,e){return _.filter(t,{severity:e}).length},detail:function(t){return t=O(t),n.get(t)},update:w,updateBulk:function(t,e){var r=i.url(s);return n.put(r,e,{params:t})},create:C,save:function(t){return(t.id?w:C)(t)},acknowledgedBy:R(A),ackTime:R(T),alarmDuration:R(N),alarmDurationDiff:R(L),severity:m,severityList:p,getHighestSeverityFromAlarmsStatus:function(e){var t=_.map(y,function(t){return{severity:t,count:_.get(e,_.toLower(t),0)}}),t=_.find(t,function(t){return 0<t.count});return _.get(t,"severity",null)},status:g,statusList:d,statusText:R(function(t,e){var r;switch((t.status||"").toUpperCase()){case g.ACKNOWLEDGED:r=j;break;case g.CLEARED:r=I;break;case g.ACTIVE:r=P}return r&&r(t,e)}),icon:function(t){return t=(_.isObjectLike(t)?t.severity:t).toUpperCase(),b[t]},reports:{downtimeDuration:function(t){var e=S("downtimeDuration",t=i.timeOrderFilter(t));return n.get(e,{params:t})},downtimeDurationAggregation:function(t){var e=S("downtimeDuration/aggregation",t=i.timeOrderFilter(t));return n.get(e,{params:t})}},getDisplayCount:function(t){var e=i.url("".concat(s,"/count"));return n.get(e,{params:t}).then(i.getResData).then(function(t){return 99<t?"99+":t})},createCounter:function(t){var e,r,n=_.get(t,"source"),n="/alarms/".concat(n||"*"),n=new o.Counter(D,n);return t&&(e=[o.defaultPropertyMaps.date,o.defaultPropertyMaps.source],t.type&&(r=t.type,e.push([function(t){return r===t.type}])),delete t.type,n.filter(t,e)),n}};return t.enhanceWithKeysUtil({target:m,reservedKeys:["history","id","severity","self","source","creationTime","time","text","firstOccurrence","count","firstOccurrenceTime","status"],standardKeys:e})}t.$inject=["$http","c8yBase","c8yCounter","$q","c8yAudits","c8yUtil","gettext","gettextCatalog"],angular.module("c8y.core").factory("c8yAlarms",t)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(t,e,n){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(i,o,r,u,a,k,I,c,B,p,t,s,l,f,e,F){var g,H=e("humanizeAppName"),d="application/",h="".concat(d,"applications"),m={headers:p.contentHeaders("application",!0)},y=this,$={HOSTED:"cloud",EXTERNAL:"external-link",SMARTAPP:"puzzle-piece",MICROSERVICE:"microchip",APAMA_CEP_RULE:"file-code-o"},z=["HOSTED","EXTERNAL"],K=["HOSTED","EXTERNAL"],q={HOSTED:f("Hosted application"),EXTERNAL:f("External application"),MICROSERVICE:f("Microservice"),APAMA_CEP_RULE:f("Apama CEP rule")},e=p.createEnum([{name:"UP",label:f("Up"),value:"Up",icon:"check-circle text-success"},{name:"DOWN",label:f("Down"),value:"Down",icon:"warning status critical"},{name:"UNHEALTHY",label:f("Unhealthy"),value:"Unhealth",icon:"exclamation-circle status major"},{name:"UNHEALTHY",label:f("Unhealthy"),value:"Unhealthy",icon:"exclamation-circle status major"}]),V=1e3,J=10;try{g=B.get("gettextCatalog")}catch(t){g={getString:_.identity}}function v(r,i){return t.current().then(function(t){var t=t.tenant,e=p.pageSizeFilter(i),n={params:e},t="".concat(p.url(r),"/").concat(t),e=p.cleanListCallback("applications",angular.bind(y,v,r),e);return o.get(t,n).then(e).then(it).then(E)})}function S(t){var e,n=t.desired,t=t.active;return e=n,{active:t=t,unhealthy:_.isNumber(t)?e-t:e,desired:n}}function b(i,a){return t.current().then(function(t){var t=i||t,e=p.pageSizeFilter(a),n={params:_.defaults(e,{noPaging:!0,dropOverwrittenApps:!0})},r=p.url("".concat(d,"applicationsByUser/").concat(encodeURIComponent(t.id))),t=p.cleanListCallback("applications",angular.bind(y,b,t),e);return o.get(r,n).then(t).then(it).then(E)})}function E(t){var e=_.sortBy(t,[function(t){return H(t)}]);return _.assign(e,_.pick(t,["statistics","paging"])),e}function n(t){return v("".concat(d,"applicationsByTenant"),t)}function A(t){var t=p.url("".concat(h,"/").concat(t.contextPath,"/manifest")),e={params:p.pageSizeNoTotalFilter()};return o.get(t,e).then(function(t){return _.map(t.data.imports,W)})}function P(t){var e=P.cache,n=t.id||t,r=p.url("".concat(h,"/").concat(n,"/binaries/plugins")),i={params:p.pageSizeNoTotalFilter()};function a(){delete e[n]}return e[n]||(e[n]=I(_.noop,2e3).then(function(){return o.get(r,i).then(p.getResData).finally(a)})),e[n]}function W(t){return{id:t.id,contextPath:t.rootContextPath,directoryName:t.directoryName,manifest:t}}function O(t){t=t.id||t;return p.url("".concat(h,"/").concat(t))}function D(t){t=O(t);return o.get(t)}function w(e,t){var n,r=O(e),t=(n=e,delete(n=_.cloneDeep(n)).type,_.defaults(t||{},m)),r=o.put(r,n,t).finally(function(){a.localStorage.setItem("refresh",e.contextPath)});return r.then(function(t){i.$emit("c8yApplication:update",{app:e,res:t})}),r}function j(e,t){var n=p.url(h),t=_.defaults(t||{},m),n=o.post(n,e,t);return n.then(function(t){return i.$emit("c8yApplication:create",{app:e,res:t})}).catch(function(){c.error("Could not emit c8yApplication:create for:",{app:e})}),n}function C(t,e){return(t.id?w:j)(t,e)}function R(n){var e,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length?arguments[2]:void 0,i=J,a=(3<arguments.length?arguments[3]:void 0)||u.defer(),o=t||0,t=0===o?"":"-".concat(o);function c(t){return"".concat(t).concat(e)}return e=t,C(_objectSpread(_objectSpread({},t=n),{},{name:c(t.name),key:c(t.key),contextPath:c(t.contextPath)}),_objectSpread({silentError:!0},r)).then(function(t){a.resolve(p.getResData(t))},function(t){var e;409===t.status&&o<i?R(n,r,o+1,a):(e=(e=_.get(t,"data.message")||_.get(t,"data.details.exceptionMessage"))?g.getString(e):f("Could not create application."),t=t.data,a.reject({errorMessage:e,errorDetails:t}))}),a.promise}function M(n){var t=D(n).then(p.getResData);return u.all({appDetails:t,appPlugins:t.then(P).then(X),appManifest:t.then(L),appIndex:t.then(Y)}).then(function(t){t.appDetails;var e,n=t.appPlugins,r=t.appManifest,t=t.appIndex,n=(e=n,_(r.imports).map(function(t){return _.find(e,{pluginName:t})}).compact().concat(e).uniq().value());return u.all({newAppManifest:function(t,e){e=_.cloneDeep(e);return e.imports=_.map(t,"pluginName"),e}(n,r),newAppIndex:(n=function(t,e){var t=_(t).map(function(t){var e=_.get(t,"pluginPackage.css",[]);return!!(e.length?e:_.get(t,"pluginPackage.less",[])).length&&"".concat(t.pluginName,"/style.css")}).filter(_.identity).value(),n=_.flattenDeep(["\x3c!--MODULES_CSS--\x3e",_.map(t.slice(0,1),function(t){return'<link rel="stylesheet" href="'.concat(t,'"></link>')}),"\x3c!--/MODULES_CSS--\x3e"]).join("\n"),t=_.flattenDeep(["\x3c!--MODULES_CSS_DEFER--\x3e","<script>",["[",'"'.concat(t.slice(1).join('", "'),'"'),"].forEach(function(f){loadCSS(f)})"].join(""),"<\/script>","\x3c!--/MODULES_CSS_DEFER--\x3e"]).join("\n");return e=(e=e.replace(new RegExp("\x3c!--MODULES_CSS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS--\x3e","gm"),n)).replace(new RegExp("\x3c!--MODULES_CSS_DEFER--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS_DEFER--\x3e","gm"),t)}(r=n,n=t),n=function(t,e){t=_.flattenDeep(["\x3c!--MODULES_JS--\x3e",_(t).map(function(t){return!!_.get(t,"pluginPackage.js",[]).length&&"".concat(t.pluginName,"/main.js")}).filter(_.identity).map(function(t){return'<script defer src="'.concat(t,'"><\/script>')}).value(),"\x3c!--/MODULES_JS--\x3e"]).join("\n");return e.replace(new RegExp("\x3c!--MODULES_JS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_JS--\x3e","gm"),t)}(r,n),n=function(t,e){t=['C8Y_NG_MODULES=["',_.uniq(_.flattenDeep(_.map(t,function(t){return _.get(t,"pluginPackage.ngModules",[])}))).join('","'),'"];'].join("");return e.replace(new RegExp("C8Y_NG_MODULES=\\[(.|\\n|\\r)*?\\];","gm"),t)}(r,n))})}).then(function(t){var e=t.newAppManifest,t=t.newAppIndex;return Q(n,[{path:"cumulocity.json",file:new Blob([JSON.stringify(e)],{type:"application/json"})},{path:"index.html",file:new Blob([t],{type:"text/html"})}])})}function X(t){var e=[],n=_.sortBy(t,function(t){return-1*_.get(t,"pluginPackage.priority",0)});return _.forEach(n,function(t){!function n(t,r,i){var e=x(r,_.get(t,"pluginPackage.contextPath"));if(e)return;e=_.get(t,"pluginPackage.imports",[]);_.forEach(e,function(t){var e=x(i,t);e?n(e,r,i):c.error("Plugin with context path ".concat(t," is missing."))});r.push(t)}(t,e,n)}),e}function x(t,e){var n=function(t){!function(t){return/^core\//.test(t)||/^administration\//.test(t)||/^devicemanagement\//.test(t)||/^cockpit\//.test(t)||/^platformadmin\//.test(t)||/^fieldbus4\//.test(t)||/^fieldbus3\//.test(t)||/^fieldbus2\//.test(t)||/^fieldbus\//.test(t)||/^demoboard\//.test(t)||/^vendme_plugins\//.test(t)}(t)||(t=t.replace(/\//g,"_"));return t}(e);return _.find(t,function(t){return t&&t.pluginPackage&&t.pluginPackage.contextPath===n})}function L(t){t="".concat(G(t),"/cumulocity.json");return o.get(t).then(p.getResData)}function Y(t){t="".concat(G(t),"/index.html");return o.get(t).then(p.getResData)}function G(t){return p.url("apps/".concat(t.contextPath))}function Q(t,e){var t="".concat(O(t),"/binaries/files"),n=new FormData;return _.forEach(e,function(t){n.append(t.path,new File([t.file],t.path))}),o.post(t,n,{transformRequest:_.identity,headers:{"Content-Type":void 0}})}function T(){var t=a.location.pathname.match(/\/apps\/(public\/){0,1}(.+?)(\/|\?|#|$)/);return t&&t[2]}function Z(){var t=a.location.pathname.match(/\/apps\/(public\/([^/]+)|([^/]+))/);return t&&-1!==t[1].indexOf("public")}function tt(){var n=T(),r=!!Z();function e(t){var e="MARKET"===t.availability;return t.contextPath===n&&(!r||e)}return b(null,{dropOverwrittenApps:!1}).then(function(t){return _.find(t,e)})}function et(e){return s.list({type:"c8y_SmartAppApplication"}).then(function(t){return _.find(t,{appId:e.id})||null})}function nt(t){var e;return(t?u.resolve(t):tt()).then(function(t){return e=t}).then(et).then(function(t){return e.config=t,e})}function rt(t){return _(t).uniq("id").filter(function(t){var e=t.manifest,n=!1;return!(n=e?e.noAppSwitcher:n)&&_.includes(["HOSTED","EXTERNAL"],t.type)}).value()}function it(t){var e=_.reject(t,function(t){return"management"===t.name&&"management"===t.owner.tenant.id});return _.assign(e,_.pick(t,_.filter(_.keys(t),function(t){return _.isNaN(_.toNumber(t))}))),e}function U(t,e){var n,e=_.isString(e)?(n=e,function(t){return t.name===n||t.contextPath===n||t.key===n}):e;return _.some(t,e)}function at(t){return"HOSTED"===t.type}function N(){return N.cache||o(e([p.url(h),(Z()?"public/":"")+T(),"manifest"].join("/"))).then(function(t){return o(e([p.url(h),t.data.application.id].join("/")))}).then(p.getResData).then(function(t){return N.cache=u.when(t),N.cache});function e(t){return{url:t,noAppKey:!0}}}return P.cache={},p.getFlag("test")&&(N.cache=u.when({name:"app",manifest:{}})),{list:n,listByUser:b,listByTenant:n,listByOwner:function(t){return v("".concat(d,"applicationsByOwner"),t)},listPlugins:function(){var t=p.url("".concat(d,"plugins"));return o.get(t,{params:{pageSize:V}}).then(function(t){return _.uniqBy(t.data.plugins,"id")})},listPluginsByTenant:function(){return n().then(function(t){var t=_.uniqBy(t,"id"),e=[];return _.forEach(t,function(t){at(t)&&e.push(A(t))}),u.all(e).then(_.flattenDeep).then(function(t){return _.uniqBy(t,"id")})})},listPluginsByApplication:A,listPluginsByPaasApp:P,listByVisibleLinks:function(){return b().then(rt).then(function(t){return u.when(t)})},listApplications:function t(e){var n=p.url("".concat(h)),r={params:p.pageSizeFilter(e)},e=p.cleanListCallback("applications",t,e);return o.get(n,r).then(e).then(E)},getApplicationMO:function(t){return t="c8y_Application_".concat(t),s.list({type:t}).then(function(t){return _.head(t)})},getApplicationMOs:function(t){var e=(t=t||{}).tenantId,t=void 0===(t=t.filters)?{}:t,n={type:"c8y_Application_*"};return e&&(n=F.addAndFilter(n,{__has:"c8y_Subscriptions.".concat(e)})),s.listQuery(n,t,!0)},getInstanceCounts:S,getSubscriptionsList:function(t){return t=_.get(t,"c8y_Subscriptions"),_.reduce(t,function(t,e,n){var r=_.get(e,"details"),e=_.get(e,"status"),r=S(r);return t.concat(_objectSpread(_objectSpread({},r),{},{tenantName:n,status:e}))},[])},getApplicationStatusForTenant:function(t,e){return _.get(t,["c8y_Subscriptions",e])},status:e,isAvailable:function(e){return b().then(function(t){return U(t,e)})},areAllAvailable:function(t){return b().then(function(e){return _.every(t,function(t){return U(e,t)})})},isAnyAvailable:function(t){return b().then(function(e){return _.some(t,function(t){return U(e,t)})})},detail:D,update:w,create:j,remove:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=O(e),r=nt(_.isObjectLike(e)?e:{id:e}).then(function(t){return!_.get(t,"config.id")||s.remove(t.config)}),n=o.delete(n,{params:t});return(t=u.all({cfg:r,res:n})).then(function(t){t=t.res;i.$emit("c8yApplication:delete",{app:e,res:t})}),t},save:C,trySave:R,clone:function(t,e){return t="".concat(O(t),"/clone"),o.post(t).then(p.getResData).then(function(t){return _.isObjectLike(e)?(_.assign(t,e),R(t).then(p.getResData)):t})},getHref:function(t){return at(t)?(e=t,n=80===(n=r.port())||443===n?"":":".concat(n),"".concat(r.protocol(),"://").concat(r.host()).concat(n,"/apps/").concat(e.public?"public/":"").concat(e.contextPath)):t.externalUrl;var e,n},isHosted:function(t){return"HOSTED"===t.type},isApamaCepRule:function(t){return"APAMA_CEP_RULE"===_.get(t,"type")},isMicroserviceWithManifest:function(e){return s.list({type:"c8y_microservice_manifest_".concat(e.id)}).then(function(t){return"MICROSERVICE"===e.type&&0<t.length})},canOpenInBrowser:function(t){return(_.isObjectLike(t)?u.resolve(t):D(t).then(p.getResData)).then(function(t){var e=!t.name.match(/feature-/),t=_.includes(z,t.type);return e&&t})},canAddPlugin:function(t){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),(_.isObjectLike(t)?u.resolve(t):D(t).then(function(t){return t.data})).then(function(t){return!_.isEmpty(t.manifest)&&_.includes(K,_.get(t,"type"))})},icon:function(t){var e=_.isString(t)?t:t.type;return t.manifest&&"MICROSERVICE"!==e&&(e="SMARTAPP"),$[e]},typeLabel:function(t){return t=_.isString(t)?t:t.type,q[t]},getCurrent:tt,getConfig:nt,pollRefreshMessages:function(){k(function(){var t;a.localStorage.getItem("refresh")===T()&&(a.localStorage.setItem("refresh",void 0),t||a.location.reload())},1e3,0,!1)},getCurrentContextPath:T,updateManifest:function(t,e){return D(t).then(function(t){t=t.data;return t.manifest=e,t}).then(w)},listArchives:function(t,e){return t="".concat(O(t),"/binaries"),e=p.pageSizeNoTotalFilter(e),o.get(t,{params:e,silentError:!0}).then(p.getResData)},uploadArchive:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},t={url:"".concat(O(t),"/binaries"),method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:e,fileName:e.name.replace(/\s+/g,"_")};return _.assign(t,n),l.upload(t)},deleteArchive:function(t,e){return e=e.id||e,t=[O(t),"binaries",e].join("/"),o.delete(t)},setActiveArchive:function(t,e){return C({id:t.id,activeVersionId:e.id})},addPaasAppPlugin:function(t,e){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var n=function(t){t=t.name.split(".");return t.pop(),t.join(".")}(e),n="".concat(O(t),"/binaries/plugins/").concat(n),n=l.upload({url:n,method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:e});return(e=n.then(_.partial(M,t))).progress=n.progress,e},removePaasAppPlugin:function(t,e){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),e=e.pluginName||e,e="".concat(O(t),"/binaries/plugins/").concat(e),o.delete(e).then(_.partial(M,t))},uploadPaasAppFiles:Q,getPaasAppManifest:L,refreshPaasApp:M,refreshHostedApp:function(t){return t="".concat(O(t),"/refresh"),o.post(t)},isPaasApp:function(t){return L(t).then(function(t){return t._webpaas},function(){return!1})},parseAppName:function(t){var e=t&&t.toLowerCase();return"devicemanagement"===e?"Device management":"digital-twin-manager"===e?"Digital twin manager":t||"Cumulocity"},currentAppCached:N,sortApps:E,isAppOnTheList:U}}t.$inject=["$rootScope","$http","$location","$q","$window","$interval","$timeout","$log","$injector","c8yBase","c8yUser","c8yInventory","$upload","gettext","$filter","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yApplication",t)}();
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(t,e,n){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(i,o,r,u,a,k,I,c,B,p,t,s,l,f,e,F){var g,H=e("humanizeAppName"),d="application/",h="".concat(d,"applications"),m={headers:p.contentHeaders("application",!0)},y=this,$={HOSTED:"cloud",EXTERNAL:"external-link",SMARTAPP:"puzzle-piece",MICROSERVICE:"microchip",APAMA_CEP_RULE:"file-code-o"},z=["HOSTED","EXTERNAL"],K=["HOSTED","EXTERNAL"],q={HOSTED:f("Hosted application"),EXTERNAL:f("External application"),MICROSERVICE:f("Microservice"),APAMA_CEP_RULE:f("Apama CEP rule")},e=p.createEnum([{name:"UP",label:f("Up"),value:"Up",icon:"check-circle text-success"},{name:"DOWN",label:f("Down"),value:"Down",icon:"warning status critical"},{name:"UNHEALTHY",label:f("Unhealthy"),value:"Unhealth",icon:"exclamation-circle status major"},{name:"UNHEALTHY",label:f("Unhealthy"),value:"Unhealthy",icon:"exclamation-circle status major"}]),V=1e3,J=10;try{g=B.get("gettextCatalog")}catch(t){g={getString:_.identity}}function v(r,i){return t.current().then(function(t){var t=t.tenant,e=p.pageSizeFilter(i),n={params:e},t="".concat(p.url(r),"/").concat(t),e=p.cleanListCallback("applications",angular.bind(y,v,r),e);return o.get(t,n).then(e).then(it).then(E)})}function S(t){var e,n=t.desired,t=t.active;return e=n,{active:t=t,unhealthy:_.isNumber(t)?e-t:e,desired:n}}function b(i,a){return t.current().then(function(t){var t=i||t,e=p.pageSizeFilter(a),n={params:_.defaults(e,{noPaging:!0,dropOverwrittenApps:!0})},r=p.url("".concat(d,"applicationsByUser/").concat(encodeURIComponent(t.id))),t=p.cleanListCallback("applications",angular.bind(y,b,t),e);return o.get(r,n).then(t).then(it).then(E)})}function E(t){var e=_.sortBy(t,[function(t){return H(t)}]);return _.assign(e,_.pick(t,["statistics","paging"])),e}function n(t){return v("".concat(d,"applicationsByTenant"),t)}function A(t){var t=p.url("".concat(h,"/").concat(t.contextPath,"/manifest")),e={params:p.pageSizeNoTotalFilter()};return o.get(t,e).then(function(t){return _.map(t.data.imports,W)})}function P(t){var e=P.cache,n=t.id||t,r=p.url("".concat(h,"/").concat(n,"/binaries/plugins")),i={params:p.pageSizeNoTotalFilter()};function a(){delete e[n]}return e[n]||(e[n]=I(_.noop,2e3).then(function(){return o.get(r,i).then(p.getResData).finally(a)})),e[n]}function W(t){return{id:t.id,contextPath:t.rootContextPath,directoryName:t.directoryName,manifest:t}}function O(t){t=t.id||t;return p.url("".concat(h,"/").concat(t))}function D(t){t=O(t);return o.get(t)}function w(e,t){var n,r=O(e),t=(n=e,delete(n=_.cloneDeep(n)).type,_.defaults(t||{},m)),r=o.put(r,n,t).finally(function(){a.localStorage.setItem("refresh",e.contextPath)});return r.then(function(t){i.$emit("c8yApplication:update",{app:e,res:t})}),r}function j(e,t){var n=p.url(h),t=_.defaults(t||{},m),n=o.post(n,e,t);return n.then(function(t){return i.$emit("c8yApplication:create",{app:e,res:t})}).catch(function(){c.error("Could not emit c8yApplication:create for:",{app:e})}),n}function C(t,e){return(t.id?w:j)(t,e)}function R(n){var e,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length?arguments[2]:void 0,i=J,a=(3<arguments.length?arguments[3]:void 0)||u.defer(),o=t||0,t=0===o?"":"-".concat(o);function c(t){return"".concat(t).concat(e)}return e=t,C(_objectSpread(_objectSpread({},t=n),{},{name:c(t.name),key:c(t.key),contextPath:c(t.contextPath)}),_objectSpread({silentError:!0},r)).then(function(t){a.resolve(p.getResData(t))},function(t){var e;409===t.status&&o<i?R(n,r,o+1,a):(e=(e=_.get(t,"data.message")||_.get(t,"data.details.exceptionMessage"))?g.getString(e):f("Could not create application."),t=t.data,a.reject({errorMessage:e,errorDetails:t}))}),a.promise}function M(n){var t=D(n).then(p.getResData);return u.all({appDetails:t,appPlugins:t.then(P).then(X),appManifest:t.then(L),appIndex:t.then(Y)}).then(function(t){t.appDetails;var e,n=t.appPlugins,r=t.appManifest,t=t.appIndex,n=(e=n,_(r.imports).map(function(t){return _.find(e,{pluginName:t})}).compact().concat(e).uniq().value());return u.all({newAppManifest:function(t,e){e=_.cloneDeep(e);return e.imports=_.map(t,"pluginName"),e}(n,r),newAppIndex:(n=function(t,e){var t=_(t).map(function(t){var e=_.get(t,"pluginPackage.css",[]);return!!(e.length?e:_.get(t,"pluginPackage.less",[])).length&&"".concat(t.pluginName,"/style.css")}).filter(_.identity).value(),n=_.flattenDeep(["\x3c!--MODULES_CSS--\x3e",_.map(t.slice(0,1),function(t){return'<link rel="stylesheet" href="'.concat(t,'"></link>')}),"\x3c!--/MODULES_CSS--\x3e"]).join("\n"),t=_.flattenDeep(["\x3c!--MODULES_CSS_DEFER--\x3e","<script>",["[",'"'.concat(t.slice(1).join('", "'),'"'),"].forEach(function(f){loadCSS(f)})"].join(""),"<\/script>","\x3c!--/MODULES_CSS_DEFER--\x3e"]).join("\n");return e=(e=e.replace(new RegExp("\x3c!--MODULES_CSS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS--\x3e","gm"),n)).replace(new RegExp("\x3c!--MODULES_CSS_DEFER--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS_DEFER--\x3e","gm"),t)}(r=n,n=t),n=function(t,e){t=_.flattenDeep(["\x3c!--MODULES_JS--\x3e",_(t).map(function(t){return!!_.get(t,"pluginPackage.js",[]).length&&"".concat(t.pluginName,"/main.js")}).filter(_.identity).map(function(t){return'<script defer src="'.concat(t,'"><\/script>')}).value(),"\x3c!--/MODULES_JS--\x3e"]).join("\n");return e.replace(new RegExp("\x3c!--MODULES_JS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_JS--\x3e","gm"),t)}(r,n),n=function(t,e){t=['C8Y_NG_MODULES=["',_.uniq(_.flattenDeep(_.map(t,function(t){return _.get(t,"pluginPackage.ngModules",[])}))).join('","'),'"];'].join("");return e.replace(new RegExp("C8Y_NG_MODULES=\\[(.|\\n|\\r)*?\\];","gm"),t)}(r,n))})}).then(function(t){var e=t.newAppManifest,t=t.newAppIndex;return Q(n,[{path:"cumulocity.json",file:new Blob([JSON.stringify(e)],{type:"application/json"})},{path:"index.html",file:new Blob([t],{type:"text/html"})}])})}function X(t){var e=[],n=_.sortBy(t,function(t){return-1*_.get(t,"pluginPackage.priority",0)});return _.forEach(n,function(t){!function n(t,r,i){var e=x(r,_.get(t,"pluginPackage.contextPath"));if(e)return;e=_.get(t,"pluginPackage.imports",[]);_.forEach(e,function(t){var e=x(i,t);e?n(e,r,i):c.error("Plugin with context path ".concat(t," is missing."))});r.push(t)}(t,e,n)}),e}function x(t,e){var n=function(t){!function(t){return/^core\//.test(t)||/^administration\//.test(t)||/^devicemanagement\//.test(t)||/^cockpit\//.test(t)||/^platformadmin\//.test(t)||/^fieldbus4\//.test(t)||/^fieldbus3\//.test(t)||/^fieldbus2\//.test(t)||/^fieldbus\//.test(t)||/^demoboard\//.test(t)||/^vendme_plugins\//.test(t)}(t)||(t=t.replace(/\//g,"_"));return t}(e);return _.find(t,function(t){return t&&t.pluginPackage&&t.pluginPackage.contextPath===n})}function L(t){t="".concat(G(t),"/cumulocity.json");return o.get(t).then(p.getResData)}function Y(t){t="".concat(G(t),"/index.html");return o.get(t).then(p.getResData)}function G(t){return p.url("apps/".concat(t.contextPath))}function Q(t,e){var t="".concat(O(t),"/binaries/files"),n=new FormData;return _.forEach(e,function(t){n.append(t.path,new File([t.file],t.path))}),o.post(t,n,{transformRequest:_.identity,headers:{"Content-Type":void 0}})}function T(){var t=a.location.pathname.match(/\/apps\/(public\/){0,1}(.+?)(\/|\?|#|$)/);return t&&t[2]}function Z(){var t=a.location.pathname.match(/\/apps\/(public\/([^/]+)|([^/]+))/);return t&&-1!==t[1].indexOf("public")}function tt(){var n=T(),r=!!Z();function e(t){var e="MARKET"===t.availability;return t.contextPath===n&&(!r||e)}return b(null,{dropOverwrittenApps:!1}).then(function(t){return _.find(t,e)})}function et(e){return s.list({type:"c8y_SmartAppApplication"}).then(function(t){return _.find(t,{appId:e.id})||null})}function nt(t){var e;return(t?u.resolve(t):tt()).then(function(t){return e=t}).then(et).then(function(t){return e.config=t,e})}function rt(t){return _(t).uniq("id").filter(function(t){var e=t.manifest,n=!1;return!(n=e?e.noAppSwitcher:n)&&_.includes(["HOSTED","EXTERNAL"],t.type)}).value()}function it(t){var e=_.reject(t,function(t){return"management"===t.name&&"management"===t.owner.tenant.id});return _.assign(e,_.pick(t,_.filter(_.keys(t),function(t){return _.isNaN(_.toNumber(t))}))),e}function U(t,e){var n,e=_.isString(e)?(n=e,function(t){return t.name===n||t.contextPath===n||t.key===n}):e;return _.some(t,e)}function at(t){return"HOSTED"===t.type}function N(){return N.cache||o(e([p.url(h),(Z()?"public/":"")+T(),"manifest"].join("/"))).then(function(t){return o(e([p.url(h),t.data.application.id].join("/")))}).then(p.getResData).then(function(t){return N.cache=u.when(t),N.cache});function e(t){return{url:t,noAppKey:!0}}}return P.cache={},p.getFlag("test")&&(N.cache=u.when({name:"app",manifest:{}})),{list:n,listByUser:b,listByTenant:n,listByOwner:function(t){return v("".concat(d,"applicationsByOwner"),t)},listPlugins:function(){var t=p.url("".concat(d,"plugins"));return o.get(t,{params:{pageSize:V}}).then(function(t){return _.uniqBy(t.data.plugins,"id")})},listPluginsByTenant:function(){return n().then(function(t){var t=_.uniqBy(t,"id"),e=[];return _.forEach(t,function(t){at(t)&&e.push(A(t))}),u.all(e).then(_.flattenDeep).then(function(t){return _.uniqBy(t,"id")})})},listPluginsByApplication:A,listPluginsByPaasApp:P,listByVisibleLinks:function(){return b().then(rt).then(function(t){return u.when(t)})},listApplications:function t(e){var n=p.url("".concat(h)),r={params:p.pageSizeFilter(e)},e=p.cleanListCallback("applications",t,e);return o.get(n,r).then(e).then(E)},getApplicationMO:function(t){return t="c8y_Application_".concat(t),s.list({type:t}).then(function(t){return _.head(t)})},getApplicationMOs:function(t){var e=(t=t||{}).tenantId,t=void 0===(t=t.filters)?{}:t,n={type:"c8y_Application_*"};return e&&(n=F.addAndFilter(n,{__has:"c8y_Subscriptions.".concat(e)})),s.listQuery(n,t,!0)},getInstanceCounts:S,getSubscriptionsList:function(t){return t=_.get(t,"c8y_Subscriptions"),_.reduce(t,function(t,e,n){var r=_.get(e,"details"),e=_.get(e,"status"),r=S(r);return t.concat(_objectSpread(_objectSpread({},r),{},{tenantName:n,status:e}))},[])},getApplicationStatusForTenant:function(t,e){return _.get(t,["c8y_Subscriptions",e])},status:e,isAvailable:function(e){return b().then(function(t){return U(t,e)})},areAllAvailable:function(t){return b().then(function(e){return _.every(t,function(t){return U(e,t)})})},isAnyAvailable:function(t){return b().then(function(e){return _.some(t,function(t){return U(e,t)})})},detail:D,update:w,create:j,remove:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=O(e),r=nt(_.isObjectLike(e)?e:{id:e}).then(function(t){return!_.get(t,"config.id")||s.remove(t.config)}),n=o.delete(n,{params:t});return(t=u.all({cfg:r,res:n})).then(function(t){t=t.res;i.$emit("c8yApplication:delete",{app:e,res:t})}),t},save:C,trySave:R,clone:function(t,e){return t="".concat(O(t),"/clone"),o.post(t).then(p.getResData).then(function(t){return _.isObjectLike(e)?(_.assign(t,e),R(t).then(p.getResData)):t})},getHref:function(t){return at(t)?(e=t,n=80===(n=r.port())||443===n?"":":".concat(n),"".concat(r.protocol(),"://").concat(r.host()).concat(n,"/apps/").concat(e.public?"public/":"").concat(e.contextPath)):t.externalUrl;var e,n},isHosted:function(t){return"HOSTED"===t.type},isApamaCepRule:function(t){return"APAMA_CEP_RULE"===_.get(t,"type")},isMicroserviceWithManifest:function(e){return s.list({type:"c8y_microservice_manifest_".concat(e.id)}).then(function(t){return"MICROSERVICE"===e.type&&0<t.length})},canOpenInBrowser:function(t){return(_.isObjectLike(t)?u.resolve(t):D(t).then(p.getResData)).then(function(t){var e=!t.name.match(/feature-/),t=_.includes(z,t.type);return e&&t})},canAddPlugin:function(t){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),(_.isObjectLike(t)?u.resolve(t):D(t).then(function(t){return t.data})).then(function(t){return!_.isEmpty(t.manifest)&&_.includes(K,_.get(t,"type"))})},icon:function(t){var e=_.isString(t)?t:t.type;return t.manifest&&"MICROSERVICE"!==e&&(e="SMARTAPP"),$[e]},typeLabel:function(t){return t=_.isString(t)?t:t.type,q[t]},getCurrent:tt,getConfig:nt,pollRefreshMessages:function(){k(function(){var t;a.localStorage.getItem("refresh")===T()&&(a.localStorage.setItem("refresh",void 0),t||a.location.reload())},1e3,0,!1)},getCurrentContextPath:T,updateManifest:function(t,e){return D(t).then(function(t){t=t.data;return t.manifest=e,t}).then(w)},listArchives:function(t,e){return t="".concat(O(t),"/binaries"),e=p.pageSizeNoTotalFilter(e),o.get(t,{params:e,silentError:!0}).then(p.getResData)},uploadArchive:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},t={url:"".concat(O(t),"/binaries"),method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:e,fileName:e.name.replace(/\s+/g,"_")};return _.assign(t,n),l.upload(t)},deleteArchive:function(t,e){return e=e.id||e,t=[O(t),"binaries",e].join("/"),o.delete(t)},setActiveArchive:function(t,e){return C({id:t.id,activeVersionId:e.id})},addPaasAppPlugin:function(t,e){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var n=function(t){t=t.name.split(".");return t.pop(),t.join(".")}(e),n="".concat(O(t),"/binaries/plugins/").concat(n),n=l.upload({url:n,method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:e});return(e=n.then(_.partial(M,t))).progress=n.progress,e},removePaasAppPlugin:function(t,e){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),e=e.pluginName||e,e="".concat(O(t),"/binaries/plugins/").concat(e),o.delete(e).then(_.partial(M,t))},uploadPaasAppFiles:Q,getPaasAppManifest:L,refreshPaasApp:M,refreshHostedApp:function(t){return t="".concat(O(t),"/refresh"),o.post(t)},isPaasApp:function(t){return L(t).then(function(t){return t._webpaas},function(){return!1})},parseAppName:function(t){var e=t&&t.toLowerCase();return"devicemanagement"===e?"Device management":"digital-twin-manager"===e?"Digital twin manager":t||"Cumulocity"},currentAppCached:N,sortApps:E,isAppOnTheList:U}}t.$inject=["$rootScope","$http","$location","$q","$window","$interval","$timeout","$log","$injector","c8yBase","c8yUser","c8yInventory","$upload","gettext","$filter","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yApplication",t)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(t,e,n){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(t,e,n){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){e.$inject=["$window","$q","$injector","$location","$interpolate","c8yConfig","info","c8yUtil","gettext","gettextCatalog"],window.c8y=window.c8y||{};var t=window.c8y;function O(t){return((window.C8Y_APP||{}).core_path||"/apps/core/")+t}function j(t){return((window.C8Y_APP||{}).data_path||(window.C8Y_PAAS?"/apps/core/c8ydata/":"/apps/c8ydata/"))+t}function F(t){var e=!0;try{_.forEach(t,function(t){angular.module(t)})}catch(t){e=!1}return e}function e(t,r,e,n,i,a,o,c,u,s){var f=o.pageSize||100,l="YYYY-MM-DDTHH:mm:ssZ";function g(t){return"".concat("application/vnd.com.nsn.cumulocity."+t,"+json")}function p(i){var a=["refresh","next"];return function n(t){var e=i(t),r=t.paging,t=t.statistics;return r&&(_.forEach(a,function(t){var e;r[t]&&(e=r[t],r[t]=function(){return e().then(n)})}),e.paging=r,e.statistics=t),e}}function d(t,e){var n={};return e&&e.split("?")[1].split("&").forEach(function(t){t=t.split("=");n[t[0]]=decodeURIComponent(t[1])}),n[t]}function m(t,e){var n=t.statistics,t=t[1===e?"next":"prev"],e=d("currentPage",t);return{currentPage:parseInt(e,10),pageSize:n.pageSize,startkey:d("startkey",t),startkey_docid:d("startkey_docid",t)}}function y(t){var e=t.statistics||{},n={currentPage:1,pageSize:e.pageSize,startkey:null,startkey_docid:null};return _.isUndefined(t.totalPages)||(n.pageSize=e.pageSize),n}function P(t){var e=_.flattenDeep(t),n=S(t),t=function(e){var t={statistics:S(e),blind:_.some(e,"paging.blind"),more:_.some(e,"paging.more")};t.more&&(t.next=function(){var t=_.map(e,function(t){return _.result(t,"paging.next",[])});return r.all(t).then(P)});return t}(t);return e.paging=t,e.statistics=n,e}function S(t){var e=_.map(t,function(t){return _.get(t,"statistics.currentPage",1)}),n=_.map(t,function(t){return _.get(t,"statistics.pageSize",t.length)}),t=_.map(t,function(t){return _.get(t,"statistics.totalPages",1)});return{currentPage:_.max(e),pageSize:_.sum(n),totalPages:_.max(t)}}function b(t,e){return _.omit(t,e)}function v(t){var e;if(_.isObjectLike(t)&&(e=t.id),(_.isNumber(t)||_.isString(t)&&t.match(/^\d+$/))&&(e=String(t)),_.isUndefined(e))throw new Error("id cannot be found");return e}function h(t){return o[t]}function w(n){var t=(o.appConfig||{}).manifest,e=window.C8Y_APP&&window.C8Y_APP.C8Y_INSTANCE_OPTIONS,r=window.C8Y_INSTANCE_OPTIONS,t=_.merge({},t,e,r),e=_.defaultsDeep(t,a.defaultAppOptions);e[n]||_.find(e,function(t,e){return _.camelCase(n)===_.camelCase(e)});return e[n]}return c.enhanceWithLatestFactoryUtil({url:function(t){return(o.baseUrl||"/")+t},absoluteUrl:function(t){return"".concat(n.protocol(),"://").concat(n.host(),":").concat(n.port())+"/".concat(_.isString(t)?t:"").replace(/\/+/g,"/")},getStaticLink:function(t,e){var n=w("staticLinks");return(n=_.get(n,t,""))?r.resolve(i(n)(e)):r.reject("Static link was not found")},getStaticLinkTemplate:function(t){var e=w("staticLinks");return(e=_.get(e,t,""))?r.resolve(e):r.reject("Static link template was not found")},deleteProperties:b,mimeType:g,contentHeaders:function(t,e){return{"Content-Type":g(t),Accept:e?g(_.isString(e)?e:t):void 0}},pageSizeFilter:function(t){return _.assign({withTotalPages:!0,pageSize:f},t)},pageSizeNoTotalFilter:function(t){return _.assign({pageSize:f},t)},timeOrderFilter:function(t){return _.assign({dateFrom:"1970-01-01",dateTo:moment().add(1,"day").format(l)},t)},lastWeekFilter:function(t){return _.assign({dateFrom:moment().subtract(1,"week").format(l),dateTo:moment().add(1,"day").format(l)},t)},todayFilter:function(t){return _.assign({dateFrom:moment().subtract(1,"day").format(l),dateTo:moment().add(1,"day").format(l)},t)},fromThisMonthStartFilter:function(t){return _.assign({dateFrom:moment().startOf("month").format(l)},t)},monthFilter:function(t,e){return e=moment().subtract(e||0,"months"),_.assign({dateFrom:e.startOf("month").format(l),dateTo:e.endOf("month").format(l)},t)},createListFilter:function(e){return p(function(t){return t.filter(e)})},createListMapper:function(e){return p(function(t){return t.map(e)})},cleanListCallback:function(s,f,l){return function(t){var e,n,r,i,a,o,c,t=t.data||{},u=t[s]||[];return u.statistics=t.statistics,l.withTotalPages||u.length!==parseInt(l.pageSize,10)||(u.statistics.totalPages=1/0,t.statistics.totalPages=u.statistics.totalPages),u.paging=(e=t,n=f,t=!(r=l).withTotalPages,i=e.statistics,a=!_.isUndefined(e.prev),o=!_.isUndefined(e.next),c={},a&&(c.prev=function(){return n(_objectSpread(_objectSpread({},r),m(e,-1)))}),o&&(c.next=function(){return n(_objectSpread(_objectSpread({},r),m(e,1)))},_.isUndefined(i.totalPages)||(c.more=(i.totalPages-i.currentPage)*i.pageSize)),c.refresh=function(){return n(_.assign(_.cloneDeep(r),y(e)))},c.changePage=function(t){return n(_objectSpread(_objectSpread({},r),{},{currentPage:t,pageSize:i.pageSize}))},c.statistics=i,c.blind=t,c),u}},createPaging:function(t,e){var n=t.statistics,r=t.prev&&m(t,-1),i=t.next&&m(t,1),a=y(t),t=void 0===n.totalPages?void 0:(n.totalPages-n.currentPage)*n.pageSize;return{noPreFetch:!0,refresh:function(){return e(a)},changePage:function(t){return e({pageSize:n.pageSize,currentPage:t})},next:i&&function(){return e(i)},prev:r&&function(){return e(r)},loading:!1,more:t,stats:n}},combineLists:P,removeFromList:function(t,e){0<=(e=t.indexOf(e))&&t.splice(e,1)},cleanFields:b,dateFormat:"YYYY-MM-DD",dateFullFormat:l,dateFullFormatWithMs:"YYYY-MM-DDTHH:mm:ss.SSSZ",invalid:function(t,e,n){return t=t&&t[e],e=t&&t[n],t=e&&e.$touched,n=e&&e.$invalid,!0===t&&!0===n},invalidFormOrField:function(t){return t.$dirty&&t.$invalid},validationHints:function(n,r){var i=[];return n&&n.$error&&_.forEach(n.$error,function(t,e){t&&!_.isUndefined(r[e])&&(_.isObjectLike(r[e])&&r[e][n.$name]?i.push(r[e][n.$name]):i.push(r[e]))}),_.map(i,function(t){return s.getString(t)}).join(" ")},getCount:function(t,e){return e.pageSize=1,e.withTotalPages=!0,t(e).then(function(t){return t.statistics.totalPages})},humanizeFragment:function(t){return String(t||"").replace(/c8y_/,"").replace(/([A-Z])/g," $1").replace(/^\s*/,"").replace(/\s*$/,"")},getResData:function(t){return _.get(t,"data",t)},getResErrorMessage:function(t){return _.head(_.compact(_.at(t,["data.message","data.error"])))||u("An error occurred.")},createEnum:function(t){var n={},r=0;return n.values=_.constant(_.map(t,function(t){var e={};return _.isObjectLike(t)?_.defaults(e,t,{name:t.name,value:t.name,label:t.name}):_.defaults(e,{name:t,value:t,label:t}),_.assign(e,{ordinal:r}),r+=1,n[e.name]=e})),n},createLocalId:function(t,e){if(e=e||"id",_.isObjectLike(t))return _.isUndefined(t[e])&&(t[e]=String(Math.random()).substr(2)),t;throw new Error("mo is not an object")},hasId:function(t){var e=!0;try{v(t)}catch(t){e=!1}return e},getId:v,checkIfModulesExist:F,coreFilePath:O,dataFilePath:j,appOption:w,getPluginService:function(t){return e.has(t)?e.get(t):void 0},getFlag:h,getRuntimeOption:h,getParamFromUrl:d,PAGESIZE:f,MAX_PAGESIZE:2e3},r)}_.assign(t,{coreFilePath:O,dataFilePath:j,checkIfModulesExist:F}),angular.module("c8y.core").factory("c8yBase",e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},t=Object.prototype,f=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof g?e:g,e=Object.create(e.prototype),n=new L(n||[]);return l(e,"_invoke",{value:(o=t,i=r,a=n,c=y,function(t,e){if(c===h)throw new Error("Generator is already running");if(c===v){if("throw"===t)throw e;return{value:u,done:!0}}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;n=s(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,m;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,m):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}(r,a);if(r){if(r===m)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===y)throw c=v,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=h;r=s(o,i,a);if("normal"===r.type){if(c=a.done?v:p,r.arg===m)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=v,a.method="throw",a.arg=r.arg)}})}),e}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function g(){}function d(){}function w(){}var e={},b=(i(e,n,function(){return this}),Object.getPrototypeOf),b=b&&b(b(E([]))),_=(b&&b!==t&&f.call(b,n)&&(e=b),w.prototype=g.prototype=Object.create(e));function O(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function S(a,c){var e;l(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=s(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&f.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(f.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return l(_,"constructor",{value:d.prototype=w,configurable:!0}),l(w,"constructor",{value:d,configurable:!0}),d.displayName=i(w,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,i(t,o,"GeneratorFunction")),t.prototype=Object.create(_),t},a.awrap=function(t){return{__await:t}},O(S.prototype),i(S.prototype,r,function(){return this}),a.AsyncIterator=S,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new S(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(_),i(_,o,"Generator"),i(_,n,function(){return this}),i(_,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=E,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&f.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=f.call(o,"catchLoc"),c=f.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&f.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,j(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),m}},a}function ownKeys(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},t=Object.prototype,f=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof g?e:g,e=Object.create(e.prototype),n=new L(n||[]);return l(e,"_invoke",{value:(o=t,i=r,a=n,c=y,function(t,e){if(c===h)throw new Error("Generator is already running");if(c===v){if("throw"===t)throw e;return{value:u,done:!0}}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;n=s(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,m;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,m):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}(r,a);if(r){if(r===m)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===y)throw c=v,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=h;r=s(o,i,a);if("normal"===r.type){if(c=a.done?v:p,r.arg===m)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=v,a.method="throw",a.arg=r.arg)}})}),e}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function g(){}function d(){}function w(){}var e={},b=(i(e,n,function(){return this}),Object.getPrototypeOf),b=b&&b(b(E([]))),_=(b&&b!==t&&f.call(b,n)&&(e=b),w.prototype=g.prototype=Object.create(e));function O(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function S(a,c){var e;l(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=s(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&f.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(f.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return l(_,"constructor",{value:d.prototype=w,configurable:!0}),l(w,"constructor",{value:d,configurable:!0}),d.displayName=i(w,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,i(t,o,"GeneratorFunction")),t.prototype=Object.create(_),t},a.awrap=function(t){return{__await:t}},O(S.prototype),i(S.prototype,r,function(){return this}),a.AsyncIterator=S,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new S(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(_),i(_,o,"Generator"),i(_,n,function(){return this}),i(_,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=E,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&f.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=f.call(o,"catchLoc"),c=f.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&f.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,j(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),m}},a}function ownKeys(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}!function(){function t(a,t,c,n,e){var u="c8y_DeviceShellTemplate";function f(t,e,r){return _.map(t||[],function(t){return _.assign(t,{syntax:e,deviceType:r})})}function r(){return(r=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var r;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getGlobalParam(u);case 2:return r=t.sent,r=_.assign(_objectSpread({type:u},r&&{c8y_Global:{}}),e),t.abrupt("return",c.save(r));case 5:case"end":return t.stop()}},t)}))).apply(this,arguments)}return{getCommandTemplatesForDeviceType:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];o=e,n=[],_.forEach(o,function(t){e=t;var e=_.get(window.c8y,"collections.devicecommands",{})[e];e&&n.push(function(e,t){t=_.isArray(t)?_(t).map(function(t){return f(t.templates,t.syntax,e)}).flatten().value():f(t.templates,t.syntax,e);return a.when(t)}(t,e))});var n,o=a.all(n).then(_.flatten),i=function(t){t={__filter:{type:u,deviceType:{__in:t}},__orderby:[{creationTime:-1}]};return c.listQuery(t,{pageSize:1e3},!0)}(e);return a.all([o,i]).then(_.flatten)},canSendCommandsViaSMS:function(){return t.getSystemOptionValue({category:"messaging",key:"provider"},!1).then(function(t){return!!t})},saveTemplate:function(t){return r.apply(this,arguments)},getDeliveryTypes:function(){return{defaultDeliveryType:e("Default"),standardDeliveryTypes:[e("Default"),e("SMS")]}},removeTemplate:c.remove}}t.$inject=["$q","c8ySettings","c8yInventory","c8yGlobalConfigService","gettext"],angular.module("c8y.core").factory("c8yDeviceShell",t)}();
|
|
@@ -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 n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}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"
|
|
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 n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}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)||!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(){function e(n,o,i,u,c,a){var t="c8y_DynamicGroup",r="c8y_IsDynamicGroup",f="c8y_UIDeviceColumnsMeta",y="c8y_UIDeviceFilterConfig",l="c8y_DeviceQueryString";return{spawnEmpty:function(){return _defineProperty({type:t},r,{})},createWithUI:function(e){var t=e.columns,n=e.columnsConfig,r=e.configurableColumns;return i({templateUrl:":::PLUGIN_PATH:::/ui/views/addDynamicGroupModal.html",controller:"addDynamicGroupModalController",resolve:{columns:function(){return _.cloneDeep(t)},columnsConfig:function(){return _.cloneDeep(n)},configurableColumns:function(){return _.cloneDeep(r)}}})},create:function(e){var t=e.dynamicGroup,n=e.columns,r=e.columnsConfig,e=e.configurableColumns,t=_objectSpread(_objectSpread({},t),{},_defineProperty(_defineProperty(_defineProperty({},y,r),l,c.buildQuery(a.getQuery(n,r))),f,_.map(e,"meta")));return u.create(t).then(o.getResData)},getGroupList:function(){return u.list({fragmentType:r})},getGroupItems:p,getConfigurableColumnsMeta:function(e){return m(e).then(function(e){return _.get(e,f)})},saveConfigurableColumnsMeta:function(e,t){return u.save(_defineProperty({id:_.get(e,"id",e)},f,_.map(t,"meta")))},getColumnsConfig:function(e){return m(e).then(function(e){return _.get(e,y)})},saveColumnsConfig:function(e,t,n){var r=_defineProperty(_defineProperty({id:_.get(e,"id",e)},y,n),l,c.buildQuery(a.getQuery(t,n)));return m(r).then(function(e){e=_objectSpread(_objectSpread({},e),r);return u.save(e)}).then(o.getResData)},isDynamicGroup:d,isDynamicGroupForId:function(e){return _.isUndefined(e)?n.resolve(!1):u.detailCached(e).then(o.getResData).then(d)},addChildCountProperty:function(t,e){return n.all(_.map(t,function(t){return d(t)?s(t,e).then(function(e){return t.childCount=e,t}):n.resolve(t)})).then(function(e){return e.statistics=t.statistics,e.paging=t.paging,e})},getChildCount:s,getType:function(){return t},remove:function(e){return m(e).then(function(e){return u.remove(e)}).then(o.getResData)}};function s(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(d(e))return delete(t=_objectSpread({},t)).onlyRoots,p(e,_objectSpread(_objectSpread({},t),{},{pageSize:1,withTotalPages:!0,withChildren:!1,withParents:!1})).then(function(e){e=e.statistics.totalPages;return void 0===e?0:e});throw new Error("c8yDynamicGroups.fetchChildCount() can only be called with dynamic groups")}function p(e,t){return m(e).then(function(e){return u.list(_objectSpread({q:_.get(e,l)},t))})}function m(e){return d(e)?n.resolve(e):u.detail(e).then(o.getResData)}function d(e){return _.has(e,r)||_.get(e,"type")===t}}e.$inject=["$q","c8yBase","c8yModal","c8yInventory","c8yQueriesUtil","c8yFilteringSortingInventoryQueries"],angular.module("c8y.core").factory("c8yDynamicGroups",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"
|
|
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)||!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 _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],u=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){s=!0,i=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){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 ownKeys(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}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(){function e(o,l,i,c,f,r,p,F){var a="inventory/managedObjects",x="\\/inventory\\/managedObjects\\/(\\d+)",u={headers:f.contentHeaders("managedObject","managedObject")},M={headers:f.contentHeaders("managedObjectReference")},s=["lastUpdated","assetParents","deviceParents","additionParents","childAssets","childDevices","childAdditions","c8y_ActiveAlarmsStatus","c8y_Availability"];function d(e){e=e&&(e.id||e);return e&&f.url("".concat(a,"/").concat(e))}function h(e,t){return"".concat(d(e),"/").concat(t)}function y(e,t){var n=f.url(a),e=f.pageSizeFilter(e=(e=(e=e)||{}).text?_.pick(e,["text","pageSize","currentPage","skipChildrenNames","fragmentType","withParents","q","query"]):e),t=_objectSpread({params:e},t),e=f.cleanListCallback("managedObjects",y,e,!0);return o.get(n,t).then(e)}function g(e,t,n){e=d(e),t=_.defaults({params:t||{}},n);return e?o.get(e,t):l.reject("Managed object not valid")}function v(e,t,n){return g(e,t,n)}function m(e){var t=_.get(e,"assetParents.references"),n=_.get(e,"deviceParents.references"),e=_.get(e,"additionParents.references");return _.union(t,n,e).map(function(e){return e.managedObject})}function t(e){var t=f.url(a),n=_.cloneDeep(u),e=f.cleanFields(e,s);return o.post(t,e,n)}function n(e,t,n){var n=h(t,n),e=_.omit(e,["id"]),r=_.assign({},u,{Accept:"application/json"});return T(t),o.post(n,e,r)}function H(e){var t=new RegExp(x);return e.headers("Location").match(t)[1]}function b(t){var e=d(t),n=_.cloneDeep(u),r=f.cleanFields(t,s),e=o.put(e,r,n);return e.then(function(e){i.$emit("c8yInventory:update",{mo:e.data,res:e}),i.$emit("c8yInventory:update:".concat(t.id),{mo:e.data,res:e})}),T(t),e}function A(e,t){return!!j(e,t)}function j(e,t){return _.get(e,[t,"references","length"])}function O(e,t,n){var r=h(e,t),i=n||{},n=l.resolve(0);return(n=i.skipDetail?n:v(e).then(function(e){return e.data[t].references.length})).then(function(e){return _.get(i,"params.pageSize")||(i.params=i.params||{},i.params.pageSize=e),o.get(r,i)})}function S(e){return _.map(e.data.references,_.property("managedObject"))}function w(e,t,n){var n=h(e,n),t={managedObject:t},r=_.cloneDeep(M);return T(e),o.post(n,t,r)}function P(e,n,r,i){return g(e,{withParents:!0}).then(function(e){var t="data.".concat(n,"Parents.references");return _.map(_.get(e,t),_.property("managedObject.id"))}).then(function(e){var t=[],n={ids:e.join(",")};return t=e.length&&(t=y(n),r||i)?t.then(C(r,i)):t})}function C(t,n){return function(e){return _.filter(e,function(e){return t&&e.type===t||n&&!_.isUndefined(e[n])})}}function D(e,t,n,r,i){i=4<arguments.length&&void 0!==i?i:{},t=_.camelCase(["child",_.lowerCase(t),"id"]),i=_objectSpread({withParents:!0},i);return i[t]=e.id||e,y(i).then(function(e){return n||r?C(n,r)(e):e})}function I(e,t,n){t=(t=t).id||t;n="".concat(h(e,n),"/").concat(t);return T(e),o.delete(n)}function T(e){var e=f.getId(e),t=R.cache.__data__;k(t.string,e),k(t.hash,e)}function k(t,n){var e;0<t.size&&(e=Object.keys(t.__data__),_.forEach(e,function(e){e!==n.toString()&&!e.startsWith("".concat(n,"_"))||t.delete(e)}))}function E(e){e="".concat(d(e),"/supportedMeasurements");return o.get(e).then(_.property("data.c8y_SupportedMeasurements"))}function $(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,r=t&&(t.id||t),i=c.get("c8yMeasurements"),e=e<o,a=n.filter(function(e){return!e.unit});return e||0===a.length?l.resolve(n):(e=_.assign(f.timeOrderFilter(),{revert:!0,source:r,pageSize:2e3,dateTo:void 0,withTotalPages:!0,currentPage:o}),i.list(e).then(function(r){for(var i=0;i<a.length;i++)!function(){var e=a[i],t=_.property([e.fragment,e.series,"unit"]),n=_.find(r,function(e){return t(e)});n&&(e.unit=t(n))}();var e=r.statistics.totalPages;return $(t,n,e,o+1)}))}function z(e){return(_.get(e,"owner")?l.when(e):g(e).then(f.getResData)).then(_.property("owner"))}var L=_.memoize(z,function(e){return f.getId(e)}),R=_.memoize(v,function(e,t){return e=f.getId(e),e=t?"".concat(e,"_").concat(JSON.stringify(t)):e});function U(e){return f.url("inventory/managedObjects/".concat(e,"/user"))}return{list:y,listQuery:function(e,t,n,r){return(t=f.pageSizeFilter(t))[n?"query":"q"]=F.buildQuery(e),y(t,r)},listAll:function(e){function r(e){i.push.apply(i,_toConsumableArray(e));var t=e.statistics.pageSize,n=e.paging.next,t=e.length>=t;return n=n&&t?e.paging.next().then(r):l.resolve(i)}var i=[];return y(_objectSpread({pageSize:f.MAX_PAGESIZE},e)).then(r)},detail:g,detailCached:R,detailRealtime:function(e,t,r,n,i){var o,a,c,u=e.id||e,e=_.isObjectLike(e)?l.when(e):g(u,n,i).then(f.getResData),s="/managedobjects/".concat(u),n=p.realtimeActions().UPDATE;function d(n){return o?_.assign(o,n):o=n,_.forEach(o,function(e,t){void 0===n[t]&&delete o[t]}),_.isFunction(r)&&r(o),o}return t?(a=t.$id,p.addListener(a,s,n,function(e,t){d(t)}),p.start(a,s),t.$on("stopRealtime",function(){p.stop(a,s)}),t.$on("$destroy",function(){p.removeSubscriber(a,s)}),c=e.then(d)):(i=c=g(u).then(function(e){return d(e.data)}),t=p.watch({ops:n,channel:s,onUpdate:function(e,t){d(t)}}),i.stop=_.bind(t.stop,t)),c},create:t,createChild:n,createConfirm:function(e){return t(e).then(H).then(g)},update:b,save:function(e){return(e.id?b:t)(e)},remove:function(e,t){var n,r=d(e);if(r)return n=m(e),_.forEach(n,function(e){T(e)}),T(e),o.delete(r,{params:_.isObjectLike(t)?t:{}});throw new Error("No managed object id provided!")},extractParents:m,hasChildAssets:function(e){return A(e,"childAssets")},hasChildDevices:function(e){return A(e,"childDevices")},hasChildAdditions:function(e){return A(e,"childAdditions")},getChildAssetsCount:function(e){return j(e,"childAssets")},getChildDevicesCount:function(e){return j(e,"childDevices")},getChildAdditionsCount:function(e){return j(e,"childAdditions")},children:O,onChildren:S,childAssets:function(e,t){return O(e,"childAssets",t).then(S)},childDevices:function(e,t){return O(e,"childDevices",t).then(S)},childAdditions:function(e,t){return O(e,"childAdditions",t).then(S)},addChildAsset:function(e,t){return w(e,t,"childAssets")},addChildDevice:function(e,t){return w(e,t,"childDevices")},addChildAddition:function(e,t){return w(e,t,"childAdditions")},createChildAsset:function(e,t){return n(e,t,"childAssets")},createChildDevice:function(e,t){return n(e,t,"childDevices")},createChildAddition:function(e,t){return n(e,t,"childAdditions")},removeChildAsset:function(e,t){return I(e,t,"childAssets")},removeChildDevice:function(e,t){return I(e,t,"childDevices")},removeChildAddition:function(e,t){return I(e,t,"childAdditions")},parentsAsset:function(e,t,n){return P(e,"asset",t,n)},parentsDevice:function(e,t,n){return P(e,"device",t,n)},parentsAddition:function(e,t,n){return P(e,"addition",t,n)},directParentAssets:function(e,t,n,r){return D(e,"asset",t,n,r)},directParentDevices:function(e,t,n,r){return D(e,"device",t,n,r)},directParentAdditions:function(e,t,n,r){return D(e,"addition",t,n,r)},getCount:function(e){return f.getCount(y,e||{})},getFragments:function(e){var t=_.union(s,["id","type","name","owner","self"]);return _.keys(f.cleanFields(e,t))},getSupportedMeasurements:E,getSupportedSeries:function(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e=t,l.all([E(e),function(e){return e="".concat(d(e),"/supportedSeries"),o.get(e).then(_.property("data.c8y_SupportedSeries"))}(e)]).then(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1],n=_.sortBy(t,"length").reverse();return _(e).map(function(t){var e=_.find(n,function(e){return 0===t.indexOf(e)});return{fragment:e,series:t.replace("".concat(e,"."),"")}}).filter(_.property("fragment")).value()}).then(function(e){return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0;return t.withUnits?$(e,n):l.resolve(n)}(t,n,e)})},addUnits:$,isOwner:function(e,t){return t={user:t?l.when(t):r.current(),owner:z(e)},l.all(t).then(function(e){return e.user.userName===e.owner})},isOwnerCached:function(e,t){return t={user:t?l.when(t):r.current(),owner:L(e)},l.all(t).then(function(e){return e.user.userName===e.owner})},getOwner:z,getOwnerObject:function(e,t){var n=U(f.getId(e));return o.get(n,t).then(f.getResData).catch(function(t){return z(e).then(function(e){return l.reject({notFound:404===t.status,accessDenied:403===t.status,serviceUser:r.isServiceUser(e)})})})},getOwnerCached:L,setOwnerEnabled:function(e,t){return e=f.getId(e),o.put(U(e),{enabled:!!t}).then(f.getResData)},addGlobalFlag:function(e,t){return e.c8y_Global=t?{}:null,e},updateManagedObject:function(t,e){var n=_.keys(e),r=_.keys(t).filter(function(e){return!_.includes(n,e)});return _.forEach(r,function(e){return _.unset(t,e)}),_.assign(t,e)}}}e.$inject=["$http","$q","$rootScope","$injector","c8yBase","c8yUser","c8yRealtime","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yInventory",e)}();
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],u=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){s=!0,i=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){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 ownKeys(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}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)||!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(){function e(o,l,i,c,f,r,p,F){var a="inventory/managedObjects",x="\\/inventory\\/managedObjects\\/(\\d+)",u={headers:f.contentHeaders("managedObject","managedObject")},M={headers:f.contentHeaders("managedObjectReference")},s=["lastUpdated","assetParents","deviceParents","additionParents","childAssets","childDevices","childAdditions","c8y_ActiveAlarmsStatus","c8y_Availability"];function d(e){e=e&&(e.id||e);return e&&f.url("".concat(a,"/").concat(e))}function h(e,t){return"".concat(d(e),"/").concat(t)}function y(e,t){var n=f.url(a),e=f.pageSizeFilter(e=(e=(e=e)||{}).text?_.pick(e,["text","pageSize","currentPage","skipChildrenNames","fragmentType","withParents","q","query"]):e),t=_objectSpread({params:e},t),e=f.cleanListCallback("managedObjects",y,e,!0);return o.get(n,t).then(e)}function g(e,t,n){e=d(e),t=_.defaults({params:t||{}},n);return e?o.get(e,t):l.reject("Managed object not valid")}function v(e,t,n){return g(e,t,n)}function m(e){var t=_.get(e,"assetParents.references"),n=_.get(e,"deviceParents.references"),e=_.get(e,"additionParents.references");return _.union(t,n,e).map(function(e){return e.managedObject})}function t(e){var t=f.url(a),n=_.cloneDeep(u),e=f.cleanFields(e,s);return o.post(t,e,n)}function n(e,t,n){var n=h(t,n),e=_.omit(e,["id"]),r=_.assign({},u,{Accept:"application/json"});return T(t),o.post(n,e,r)}function H(e){var t=new RegExp(x);return e.headers("Location").match(t)[1]}function b(t){var e=d(t),n=_.cloneDeep(u),r=f.cleanFields(t,s),e=o.put(e,r,n);return e.then(function(e){i.$emit("c8yInventory:update",{mo:e.data,res:e}),i.$emit("c8yInventory:update:".concat(t.id),{mo:e.data,res:e})}),T(t),e}function A(e,t){return!!j(e,t)}function j(e,t){return _.get(e,[t,"references","length"])}function O(e,t,n){var r=h(e,t),i=n||{},n=l.resolve(0);return(n=i.skipDetail?n:v(e).then(function(e){return e.data[t].references.length})).then(function(e){return _.get(i,"params.pageSize")||(i.params=i.params||{},i.params.pageSize=e),o.get(r,i)})}function S(e){return _.map(e.data.references,_.property("managedObject"))}function w(e,t,n){var n=h(e,n),t={managedObject:t},r=_.cloneDeep(M);return T(e),o.post(n,t,r)}function P(e,n,r,i){return g(e,{withParents:!0}).then(function(e){var t="data.".concat(n,"Parents.references");return _.map(_.get(e,t),_.property("managedObject.id"))}).then(function(e){var t=[],n={ids:e.join(",")};return t=e.length&&(t=y(n),r||i)?t.then(C(r,i)):t})}function C(t,n){return function(e){return _.filter(e,function(e){return t&&e.type===t||n&&!_.isUndefined(e[n])})}}function D(e,t,n,r,i){i=4<arguments.length&&void 0!==i?i:{},t=_.camelCase(["child",_.lowerCase(t),"id"]),i=_objectSpread({withParents:!0},i);return i[t]=e.id||e,y(i).then(function(e){return n||r?C(n,r)(e):e})}function I(e,t,n){t=(t=t).id||t;n="".concat(h(e,n),"/").concat(t);return T(e),o.delete(n)}function T(e){var e=f.getId(e),t=R.cache.__data__;k(t.string,e),k(t.hash,e)}function k(t,n){var e;0<t.size&&(e=Object.keys(t.__data__),_.forEach(e,function(e){e!==n.toString()&&!e.startsWith("".concat(n,"_"))||t.delete(e)}))}function E(e){e="".concat(d(e),"/supportedMeasurements");return o.get(e).then(_.property("data.c8y_SupportedMeasurements"))}function $(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,r=t&&(t.id||t),i=c.get("c8yMeasurements"),e=e<o,a=n.filter(function(e){return!e.unit});return e||0===a.length?l.resolve(n):(e=_.assign(f.timeOrderFilter(),{revert:!0,source:r,pageSize:2e3,dateTo:void 0,withTotalPages:!0,currentPage:o}),i.list(e).then(function(r){for(var i=0;i<a.length;i++)!function(){var e=a[i],t=_.property([e.fragment,e.series,"unit"]),n=_.find(r,function(e){return t(e)});n&&(e.unit=t(n))}();var e=r.statistics.totalPages;return $(t,n,e,o+1)}))}function z(e){return(_.get(e,"owner")?l.when(e):g(e).then(f.getResData)).then(_.property("owner"))}var L=_.memoize(z,function(e){return f.getId(e)}),R=_.memoize(v,function(e,t){return e=f.getId(e),e=t?"".concat(e,"_").concat(JSON.stringify(t)):e});function U(e){return f.url("inventory/managedObjects/".concat(e,"/user"))}return{list:y,listQuery:function(e,t,n,r){return(t=f.pageSizeFilter(t))[n?"query":"q"]=F.buildQuery(e),y(t,r)},listAll:function(e){function r(e){i.push.apply(i,_toConsumableArray(e));var t=e.statistics.pageSize,n=e.paging.next,t=e.length>=t;return n=n&&t?e.paging.next().then(r):l.resolve(i)}var i=[];return y(_objectSpread({pageSize:f.MAX_PAGESIZE},e)).then(r)},detail:g,detailCached:R,detailRealtime:function(e,t,r,n,i){var o,a,c,u=e.id||e,e=_.isObjectLike(e)?l.when(e):g(u,n,i).then(f.getResData),s="/managedobjects/".concat(u),n=p.realtimeActions().UPDATE;function d(n){return o?_.assign(o,n):o=n,_.forEach(o,function(e,t){void 0===n[t]&&delete o[t]}),_.isFunction(r)&&r(o),o}return t?(a=t.$id,p.addListener(a,s,n,function(e,t){d(t)}),p.start(a,s),t.$on("stopRealtime",function(){p.stop(a,s)}),t.$on("$destroy",function(){p.removeSubscriber(a,s)}),c=e.then(d)):(i=c=g(u).then(function(e){return d(e.data)}),t=p.watch({ops:n,channel:s,onUpdate:function(e,t){d(t)}}),i.stop=_.bind(t.stop,t)),c},create:t,createChild:n,createConfirm:function(e){return t(e).then(H).then(g)},update:b,save:function(e){return(e.id?b:t)(e)},remove:function(e,t){var n,r=d(e);if(r)return n=m(e),_.forEach(n,function(e){T(e)}),T(e),o.delete(r,{params:_.isObjectLike(t)?t:{}});throw new Error("No managed object id provided!")},extractParents:m,hasChildAssets:function(e){return A(e,"childAssets")},hasChildDevices:function(e){return A(e,"childDevices")},hasChildAdditions:function(e){return A(e,"childAdditions")},getChildAssetsCount:function(e){return j(e,"childAssets")},getChildDevicesCount:function(e){return j(e,"childDevices")},getChildAdditionsCount:function(e){return j(e,"childAdditions")},children:O,onChildren:S,childAssets:function(e,t){return O(e,"childAssets",t).then(S)},childDevices:function(e,t){return O(e,"childDevices",t).then(S)},childAdditions:function(e,t){return O(e,"childAdditions",t).then(S)},addChildAsset:function(e,t){return w(e,t,"childAssets")},addChildDevice:function(e,t){return w(e,t,"childDevices")},addChildAddition:function(e,t){return w(e,t,"childAdditions")},createChildAsset:function(e,t){return n(e,t,"childAssets")},createChildDevice:function(e,t){return n(e,t,"childDevices")},createChildAddition:function(e,t){return n(e,t,"childAdditions")},removeChildAsset:function(e,t){return I(e,t,"childAssets")},removeChildDevice:function(e,t){return I(e,t,"childDevices")},removeChildAddition:function(e,t){return I(e,t,"childAdditions")},parentsAsset:function(e,t,n){return P(e,"asset",t,n)},parentsDevice:function(e,t,n){return P(e,"device",t,n)},parentsAddition:function(e,t,n){return P(e,"addition",t,n)},directParentAssets:function(e,t,n,r){return D(e,"asset",t,n,r)},directParentDevices:function(e,t,n,r){return D(e,"device",t,n,r)},directParentAdditions:function(e,t,n,r){return D(e,"addition",t,n,r)},getCount:function(e){return f.getCount(y,e||{})},getFragments:function(e){var t=_.union(s,["id","type","name","owner","self"]);return _.keys(f.cleanFields(e,t))},getSupportedMeasurements:E,getSupportedSeries:function(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e=t,l.all([E(e),function(e){return e="".concat(d(e),"/supportedSeries"),o.get(e).then(_.property("data.c8y_SupportedSeries"))}(e)]).then(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1],n=_.sortBy(t,"length").reverse();return _(e).map(function(t){var e=_.find(n,function(e){return 0===t.indexOf(e)});return{fragment:e,series:t.replace("".concat(e,"."),"")}}).filter(_.property("fragment")).value()}).then(function(e){return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0;return t.withUnits?$(e,n):l.resolve(n)}(t,n,e)})},addUnits:$,isOwner:function(e,t){return t={user:t?l.when(t):r.current(),owner:z(e)},l.all(t).then(function(e){return e.user.userName===e.owner})},isOwnerCached:function(e,t){return t={user:t?l.when(t):r.current(),owner:L(e)},l.all(t).then(function(e){return e.user.userName===e.owner})},getOwner:z,getOwnerObject:function(e,t){var n=U(f.getId(e));return o.get(n,t).then(f.getResData).catch(function(t){return z(e).then(function(e){return l.reject({notFound:404===t.status,accessDenied:403===t.status,serviceUser:r.isServiceUser(e)})})})},getOwnerCached:L,setOwnerEnabled:function(e,t){return e=f.getId(e),o.put(U(e),{enabled:!!t}).then(f.getResData)},addGlobalFlag:function(e,t){return e.c8y_Global=t?{}:null,e},updateManagedObject:function(t,e){var n=_.keys(e),r=_.keys(t).filter(function(e){return!_.includes(n,e)});return _.forEach(r,function(e){return _.unset(t,e)}),_.assign(t,e)}}}e.$inject=["$http","$q","$rootScope","$injector","c8yBase","c8yUser","c8yRealtime","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yInventory",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,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"
|
|
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)||!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(r,e,i,n,o,t,c){var u=["target","min","max","yellowRangeMin","yellowRangeMax","redRangeMin","redRangeMax"];function a(){return n.list({fragmentType:"c8y_Kpi",pageSize:c.MAX_PAGESIZE})}return{list:a,listByIds:function(t){return a().then(function(e){return t&&t.length?_.filter(e,function(e){return-1<t.indexOf(e.id)}):e})},detail:function(e){return n.detail(e).then(function(e){var t=e.data.c8y_Kpi;return _.forEach(u,function(e){_.isUndefined(t[e])||(t[e]=parseFloat(t[e]),Number.isNaN(Number(t[e]))&&delete t[e])}),e})},remove:n.remove,save:function(e){return delete(e=_.cloneDeep(e))._measurement,e.c8y_Global={},n.save(e)},listKpiForDevice:function(e){var t=e.id||e;return n.getSupportedSeries(t).then(function(e){return r.all({kpis:(n=c.url("inventory/managedObjects/".concat(t,"/kpis")),function e(t){var t=_.assign({pageSize:c.MAX_PAGESIZE},t),r={params:t},t=c.cleanListCallback("managedObjects",e,t);return i.get(n,r).then(t)}()),series:e});var n}).then(function(e){var r=e.kpis,t=e.series;return{matchKpi:_.filter(r,function(e){return _.find(t,{fragment:e.c8y_Kpi.fragment,series:e.c8y_Kpi.series})}),nonKpiSeries:_.filter(t,function(t){return!_.find(r,function(e){return e.c8y_Kpi.fragment===t.fragment&&e.c8y_Kpi.series===t.series})})}})},getMeasurement:function(e,t){var r=e.c8y_Kpi||e,e=_objectSpread(_objectSpread({},c.timeOrderFilter()),{},{source:t,valueFragmentType:r.fragment,valueFragmentSeries:r.series,pageSize:1,revert:!0});return o.list(e).then(_.head).then(function(e){return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return _objectSpread({kpi:e,time:t.time,source:t.source},_.get(t,e.fragment,{}))}(r,e)})}}}e.$inject=["$q","$log","$http","c8yInventory","c8yMeasurements","c8yUser","c8yBase"],angular.module("c8y.core").factory("c8yKpi",e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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"
|
|
1
|
+
"use strict";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)||!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 _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){function e(u,f,m,t,d,r,e){var l=window.c8y_testing?1:500,s=2083,n=d.clean,c="measurement/measurements",a={headers:d.contentHeaders("measurement")},p=e.getUnitHeaders();function o(e){e=e.id||e;return"".concat(d.url(c),"/").concat(e)}var i=d.createEnum([{name:"stream",value:"application/json-stream"},{name:"csv",value:"text/csv"},{name:"xlsx",value:"application/vnd.ms-excel"}]);function g(e,t){var r=d.url(c),e=_.assign({},d.todayFilter({}),{pageSize:1440},e),n={params:e},e=t?(n.responseType="blob",function(e){return e.data}):d.cleanListCallback("measurements",g,e),a={Accept:(t=t||i.stream)&&_(i).map("value").includes(t.value)?t.value:"application/json"};return p.then(function(e){return n.headers=_.assign({},e,a),u.get(r,n).then(function(e){return 202===e.status?f.reject({async:!0,data:e.data}):e})}).then(e)}function v(e){var r=d.url("".concat(c,"/series")),n=d.todayFilter(_.assign({pageSize:1440,revert:!0},e||{}));n.dateFrom&&(n.dateFrom=moment(n.dateFrom).format(d.dateFullFormat)),n.dateTo&&(n.dateTo=moment(n.dateTo).format(d.dateFullFormat));function a(e){return e.data}var o={params:n},e=_.findIndex(v._cacheFilter,_.partial(_.isEqual,n)),i=0<=e?v._cacheRequest[e]:null;return n.dateFrom&&(n.dateFrom=moment(n.dateFrom).format(d.dateFullFormat)),n.dateTo&&(n.dateTo=moment(n.dateTo).format(d.dateFullFormat)),e=n,"".concat(d.absoluteUrl(r),"?").concat(t(e)).length>s&&_.unset(n,"series"),p.then(function(e){var t;return _.assign(o,{headers:e}),i||(i=u.get(r,o).then(a),t=_.cloneDeep(n),v._cacheFilter.push(_.cloneDeep(t)),v._cacheRequest.push(i),moment(n.dateTo).isAfter(moment())&&setTimeout(function(){var e;e=i,_.remove(v._cacheFilter,t),_.remove(v._cacheRequest,e)},3e3)),i})}function y(e){var t=d.url(c),r=_.cloneDeep(a);if(e.source)return u.post(t,e,r);throw new Error("c8yMeasurement: source must be defined")}function b(e){var t=o(e),e=n(e),r=_.cloneDeep(a);return u.put(t,e,r)}v._cacheFilter=[],v._cacheRequest=[];var h=[];return{format:i,list:g,listPaged:function(e){function r(e){var t=!_.isUndefined(e.paging.next)&&e.length>=a.pageSize;return n.notify(e),t||n.resolve(!0),!!o||!t||e.paging.next().then(r)}var n=f.defer(),a=_.assign(e||{},{pageSize:1e3,withTotalPages:!0}),o=!1;return _.assign(n.promise,{cancel:function(){o=!0,n.reject("canceled")}}),g(a).then(r),n.promise},listSeries:v,listSeriesPaged:function(e){function t(e){return r.notify(e),e.paging.next||r.resolve(!0),!!n||!e.paging.next||e.paging.next().then(t)}var r=f.defer(),e=_.assign({revert:!0},e||{},{pageSize:1e3,withTotalPages:!0}),n=!1;return _.assign(r.promise,{cancel:function(){n=!0,r.reject("canceled")}}),v(e).then(t),r.promise},detail:function(e){return e=o(e),u.get(e)},create:y,update:b,save:function(e){return(e.id?b:y)(e)},remove:function(e){return e=o(e),u.delete(e)},latest:function(){var e,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length?arguments[1]:void 0,a={};if(!n.device)throw new Error("filter.device must be defined");if(!n.fragment)throw new Error("filter.fragment must be defined");if(n.series)return e=g(_.assign(d.timeOrderFilter(),{revert:!0,valueFragmentType:n.fragment,valueFragmentSeries:n.series,source:n.device,pageSize:1,dateTo:void 0})).then(function(e){return _.assign(a,_.first(e)||{}),a}),t&&(t={ops:"CREATE",channel:"/measurements/".concat(n.device),onUpdate:function(e,t){var r=t[n.fragment];r&&r[n.series]&&_.assign(a,t)}},t=r.watch(t),e.stop=_.bind(t.stop,t)),e;throw new Error("filter.series must be defined")},listForDataPoint:function(e,t,r,n,a){var o=h,i=("object"===_typeof(a)&&(o=a._cachedRequests||[],a._cachedRequests=o),t),u=r,a=e.__target.id,t=("NONE"!==n?n:0)||void 0;if(i){switch(i=moment(i),n){case"HOURLY":i.subtract(1,"hour").startOf("hour");break;case"DAILY":i.subtract(1,"day").startOf("day");break;default:i.subtract(1,"minute").startOf("minute")}i=i.format(d.dateFullFormat)}if(u){switch(u=moment(u),n){case"HOURLY":u.add(1,"hour").startOf("hour");break;case"DAILY":u.add(1,"days").startOf("day");break;default:u.add(1,"minute").startOf("minute")}u=u.format(d.dateFullFormat)}var s={dateFrom:i,dateTo:u,source:a,aggregationType:t},c=_.find(o,function(e){return _.isMatch(e.filters,s)}),r=(c||(c={deferred:f.defer(),sendDebounced:function(){return c._sendDebounced(),c.deferred.promise},_sendDebounced:_.debounce(function(){v(c.filters).then(_.unary(c.deferred.resolve))},l),filters:s},o.push(c)),[e.fragment,e.series].join("."));return c.filters.series=_.uniq((c.filters.series||[]).concat([r])),m(function(){return c.sendDebounced().then((a=e,function(e){var t,r=_.findIndex(e.series,function(e){return e.name===a.series&&e.type===a.fragment}),n=[];return-1<r&&(t=e.series[r].unit,_.forEach(e.values,function(e,t){_.isObjectLike(e[r])&&n.push({time:t,min:e[r].min&&Number(e[r].min),max:e[r].max&&Number(e[r].max)})})),{dataPoint:_objectSpread(_objectSpread({},a),{},{unit:t}),values:n,truncated:e.truncated}})).then(function(e){return e.aggregation=n,e.dateFrom=i,e.dateTo=u,e}).finally(function(){_.remove(o,c)});var a},5)},rtMeasurementForDatapoint:function(a){return function(e){var t=a.__target.id,r=a.fragment,n=a.series,r=_.get(e,[r,n]);return e.source.id===t&&!!r&&{dataPoint:a,values:[{time:e.time,min:r.value,max:r.value}]}}}}}e.$inject=["$http","$q","$timeout","$httpParamSerializer","c8yBase","c8yRealtime","c8yMeasurementUnits"],angular.module("c8y.core").factory("c8yMeasurements",e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(t,e,n){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"
|
|
1
|
+
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(t,e,n){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){var n;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}!function(){function t(o,i,c,t){var a="tenant/options",r="tenant/security-options",u="tenant/system/options",l={headers:c.contentHeaders("option")},p={};return{list:s,listAll:function(t){function r(t){o.push.apply(o,_toConsumableArray(t));var e=t.statistics.pageSize,n=t.paging.next,e=t.length>=e;return n=n&&e?t.paging.next().then(a).then(r):i.resolve(o)}var o=[],a=f(t);return s(_objectSpread({pageSize:c.MAX_PAGESIZE},t)).then(a).then(r)},listAllBy:function(t,e){t="".concat(a,"/").concat(t),t=c.url(t),e=_.set({},"params",e);return o.get(t,e).then(c.getResData).then(function(t){return _.map(t,function(t,e){return{key:e,value:t}})})},detail:n,detailValue:e,updateOption:function(t){var e=y(t),t=_.cloneDeep(t),n=_.cloneDeep(l);return o.put(e,t,n)},createOption:function(t){var e=c.url(a),t=_.cloneDeep(t),n=_.cloneDeep(l);return o.post(e,t,n)},deleteOption:function(t){t=y(t);return o.delete(t)},getSystemOption:g,getSystemOptionValue:d,getSupportUrl:function(){return i.all([e({category:"configuration",key:"system.support.url"},null,null).then(function(t){return _.isNull(t)?void 0:t}),d({category:"support",key:"url"},null).then(function(t){return _.isNull(t)?void 0:t}),c.appOption("support_url"),"https://support.cumulocity.com/hc/en-us/requests/new"]).then(function(t){return _.find(t,function(t){return!_.isUndefined(t)})})},parseOptionRawValue:b,setUserPasswordValidationParams:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:8,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:32;Object.defineProperty(window.c8yConfig.validation.password,"message",{get:function(){return t.getString("Password must have at least {{ min }} characters and no more than {{ max }} and can only contain letters, numbers and following symbols: {{ symbols }}",{min:e,max:n,symbols:"`~!@#$%^&*()_|+-=?;:'\",.<>{}[]\\/"})}}),Object.defineProperty(window.c8yConfig.validation.password,"pattern",{get:function(){var t="".concat(e,"_").concat(n);return p[t]||(p[t]=new RegExp("^[a-zA-Z0-9`~!@#$%^&*()_|+\\-=?;:'\",.<>{}\\[\\]\\\\/]{".concat(e,",").concat(n,"}$"))),p[t]}})}};function y(t){return c.url("".concat(a,"/").concat(encodeURIComponent(t.category)).concat(t.key?"/".concat(encodeURIComponent(t.key)):""))}function s(t){var e=c.url(a),n=c.pageSizeFilter(t),r={params:n},n=c.cleanListCallback("options",s,n),t=f(t);return o.get(e,r).then(n).then(t)}function f(e){return c.createListFilter(function(t){return!e||!e.category||e.category===t.category})}function n(t,e){var n="password"===t.category?(n=t,c.url("".concat(r,"/").concat(encodeURIComponent(n.category)).concat(n.key?"/".concat(encodeURIComponent(n.key)):""))):y(t),t=_.merge({silentError:!0},e);return o.get(n,t)}function e(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return n(t,2<arguments.length?arguments[2]:void 0).then(_.partialRight(m,e),_.partial(_.identity,e))}function g(t,e){t=t,r=encodeURIComponent(t.category),n=encodeURIComponent(t.key);var n,r=c.url("".concat(u,"/").concat(r).concat(t.key?"/".concat(n):"")),t=_.merge({silentError:!0},e);return o.get(r,t)}function d(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return g(t,2<arguments.length?arguments[2]:void 0).then(_.partialRight(m,e),_.partial(_.identity,e))}function m(t,e){return b(_.get(t,"data.value"),e)}function b(e,n){var r;try{r=JSON.parse(e)}catch(t){r=_.isUndefined(e)?n:e}return r}}t.$inject=["$http","$q","c8yBase","gettextCatalog"],angular.module("c8y.core").factory("c8ySettings",t)}();
|