@c8y/ng1-modules 1019.19.4 → 1019.20.7
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.
|
@@ -432,23 +432,27 @@
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
},
|
|
435
|
-
"
|
|
436
|
-
"title": "Software",
|
|
437
|
-
"type": "
|
|
435
|
+
"c8y_SoftwareList": {
|
|
436
|
+
"title": "Software list",
|
|
437
|
+
"type": "array",
|
|
438
438
|
"printFormat": "hidden",
|
|
439
439
|
"readonly": true,
|
|
440
|
-
"
|
|
441
|
-
"
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
440
|
+
"items": {
|
|
441
|
+
"type": "object",
|
|
442
|
+
"title": "Software",
|
|
443
|
+
"properties": {
|
|
444
|
+
"name": {
|
|
445
|
+
"title": "Name",
|
|
446
|
+
"type": "string"
|
|
447
|
+
},
|
|
448
|
+
"version": {
|
|
449
|
+
"title": "Version",
|
|
450
|
+
"type": "string"
|
|
451
|
+
},
|
|
452
|
+
"url": {
|
|
453
|
+
"title": "URL",
|
|
454
|
+
"type": ["string", "null"]
|
|
455
|
+
}
|
|
452
456
|
}
|
|
453
457
|
}
|
|
454
458
|
},
|
|
@@ -102,12 +102,22 @@
|
|
|
102
102
|
</li>
|
|
103
103
|
</ul>
|
|
104
104
|
<div ng-show="op.c8y_Command">
|
|
105
|
-
<div
|
|
106
|
-
|
|
105
|
+
<div
|
|
106
|
+
class="legend form-block"
|
|
107
|
+
translate
|
|
108
|
+
>
|
|
109
|
+
Command
|
|
110
|
+
</div>
|
|
111
|
+
<pre class="text-pre-line">
|
|
107
112
|
<code>{{op.c8y_Command.text}}</code>
|
|
108
113
|
</pre>
|
|
109
|
-
<div
|
|
110
|
-
|
|
114
|
+
<div
|
|
115
|
+
class="legend form-block"
|
|
116
|
+
translate
|
|
117
|
+
>
|
|
118
|
+
Response
|
|
119
|
+
</div>
|
|
120
|
+
<pre class="text-pre-line">
|
|
111
121
|
<code>{{op.c8y_Command.result}}</code>
|
|
112
122
|
</pre>
|
|
113
123
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,p=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(p.push(n.value),p.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return p}}function _toArray(e){return _arrayWithHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _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 r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _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(e,o,c,l,h,f,y,m,d){return new function r(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=n.tenantId,u=this,a="x-show-if-any-available",p="title";function i(e){var t=_.cloneDeep(e),e=l.when(t),r=_.find(u.ENTITIES.values(),{staticSchemaPath:u.propertiesCfg.static.path});return e=r?y.list().then(function(e){var t={appliesTo:{}};return t.appliesTo[r.value]=!0,_.filter(e,t)}).then(function(e){return _.map(e,function(e){return _.get(e,"c8y_JsonSchema")})}).then(function(e){return _.forEach(e,function(e){r===u.ENTITIES.TENANTS?_.merge(t.properties.customProperties.properties,e.properties):_.merge(t.properties,e.properties)}),t}):e}function s(e,t,r,n,i){if(r===p&&(r=_.has(i,"type"),i=!_.isUndefined(e),r)&&i)return e}this.ENTITIES=h.createEnum([{name:"MANAGED_OBJECTS",value:"MANAGED_OBJECTS",staticSchemaPath:h.dataFilePath("properties/managed-objects.json")},{name:"MEASUREMENTS",value:"MEASUREMENTS",staticSchemaPath:h.dataFilePath("properties/measurements.json")},{name:"ALARMS",value:"ALARMS",staticSchemaPath:h.dataFilePath("properties/alarms.json")},{name:"EVENTS",value:"EVENTS",staticSchemaPath:h.dataFilePath("properties/events.json")},{name:"TENANTS",value:"TENANTS",staticSchemaPath:h.dataFilePath("properties/tenants.json")}]),this.properties={},this.propertiesCfg={static:{path:e}},this.list=function(){return u.loadProperties().then(_.bind(u.getSimplifiedProperties,u))},this.getProperties=function(){return u.loadProperties().then(_.bind(u.getFullProperties,u))},this.getTenantDetails=function(){return t?d.detail(t).then(h.getResData):d.current()},this.removeKeysDependingOnAppsAvailability=function(t){return function e(t){for(var r=Object.keys(t),n=!1,i=0;i<r.length;i++){var o=r[i];_typeof(t[o])===_typeof({})&&null!==t[o]&&(n=o===a||n||e(t[o]))}return n}(t)?u.getTenantDetails().then(function(e){return e=_.flatMap(e.applications.references,"application"),function t(r,n){var e=Object.keys(r);return _.forEach(e,function(e){void 0===r[e][a]||_.some(r[e][a],function(e){return f.isAppOnTheList(n,e)})?_typeof(r[e])===_typeof({})&&null!==r[e]&&e!==a&&t(r[e],n):delete r[e]}),r}(t,e)}):t},this.loadProperties=_.throttle(function(){return u.loadStaticPropertiesSchema().then(i).then(u.removeKeysDependingOnAppsAvailability).then(_.bind(u.getPropertiesFromSchema,u)).then(_.bind(u.addProperties,u))},1e3,{leading:!0,trailing:!1}),this.loadStaticPropertiesSchema=function(){var e=u.propertiesCfg.static.path;return u.loadStaticPropertiesSchemaFromMemory()||o.get(e).then(h.getResData)},this.pathToKey=function(){var e=u.propertiesCfg.static.path;return _.last(e.split("/")).replace(/\.json$/,"")},this.loadStaticPropertiesSchemaFromMemory=function(){var e=u.pathToKey();return(e=(window.c8y&&window.c8y.collections&&window.c8y.collections.properties||{})[e])&&l.when(e)},this.getPropertiesFromSchema=function(e,t,r){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:["properties"],a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:[],p=5<arguments.length&&void 0!==arguments[5]?arguments[5]:[],s=t||e.id||"c8yDefaultSchema",t=_.cloneDeep(r||{type:"object",properties:{}}),c=u.setObjValue(t,o,{});return _.has(e,"properties")&&_.forEach(e.properties,function(e,t){var r=_.cloneDeep(c),n=_.flattenDeep([o,t,"properties"]),i=_.flattenDeep([a,t]),r=u.setObjValue(r,o,_.cloneDeep(e),t),t=u.getNewPropertyObj(s,i,r,e);p.push(t),u.getPropertiesFromSchema(e,s,r,n,i,p)}),p},this.getNewPropertyObj=function(e,t,r,n){var i=t.join("."),e={id:"".concat(e,"!!").concat(i),keyPath:t,type:n.type,printFormat:n.printFormat,label:u.getDefaultPropertyLabel(t,n),schema:r};return n.config&&(e.configSchema=n.config),n.computed&&(e.computed=n.computed),e},this.getFragmentName=function(e){var e=e[e.length-1],t=/_\d{9,}$/;return e=t.test(e)?e.replace(t,""):e},this.getDefaultPropertyLabel=function(e,t){return t=(t=t.title)||(t=(t=u.getFragmentName(e)).replace(/^c8y_/i,"").replace(/([A-Z][a-z])/g," $1").replace(/([^0-9])([0-9])/g,"$1 $2").replace("_"," ").replace(/^\s*/,"").replace(/\s*$/,"")).charAt(0).toUpperCase()+t.slice(1)},this.setObjValue=function(e,t,r,n){for(var i=e,o=0;o<t.length-1;o++)i[t[o]]||(i[t[o]]={}),i=i[t[o]];return n?i[t[o]][n]=r:i[t[o]]=r,e},this.addProperties=function(e){_.forEach(e,function(e){u.properties[e.id]=e})},this.getSimplifiedProperties=function(){return _.map(u.properties,_.bind(u.simplifyProperty,u))},this.simplifyProperty=function(e){return _.pick(e,["id","keyPath","type","label","configSchema","computed","printFormat"])},this.getFullProperties=function(){return _.cloneDeep(u.properties)},this.getSchema=function(e){return u.loadProperties().then(_.bind(u.getSchemaForProperties,u,e)).catch(c.error)},this.getSchemaForProperties=function(o){var a={type:"object",properties:{}};return _.forEach(o,function(e){u.isCustomProperty(e)&&u.addCustomProperty(e),_.mergeWith(a.properties,u.properties[e.id].schema.properties,s);var t,r,n,i=u.findInSchema(a,e);i&&(i.id=e.id,i.title=e.label||u.properties[e.id].label,n=i,t=e,r=o,u.isComplexProperty(t)&&0<u.getChildren(t,r).length&&(n.properties={}),_.forEach(_.get(i,"properties"),function(e){_.set(e,p,m.getString(e.title))}),t=a,r=e,n=_.last(r.id.split("!!")),i=_.last(r.keyPath),r.computed)&&r.configSchema&&(n!==i&&(t.properties[i]=t.properties[n],delete t.properties[n]),r.config&&4===r.config.resultType&&(t.properties[i].type="object",t.properties[i].properties={value:{title:m.getString("Value"),type:"number"},unit:{title:m.getString("Unit"),type:"string"}}),r.config)&&1===r.config.resultType&&(t.properties[i].type="number")}),function r(e,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];e.properties&&_.forEach(e.properties,function(e,t){n(e,t,[].concat(_toConsumableArray(i),[t])),r(e,n,[].concat(_toConsumableArray(i),[t]))})}(a,function(e,t,r){_.isUndefined(e.title)&&(e.title=u.getDefaultPropertyLabel(r,e))}),a},this.findInSchema=function(e,t){var r=t.keyPath;return t.computed&&(r=[u.getFragmentName(r)]),u.findInSchemaByKeyPath(e,r)},this.findInSchemaById=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return _.isObjectLike(e)&&_.forOwn(e,function(e){_.isObjectLike(e)&&e.id===t?r.push(e):u.findInSchemaById(e,t,r)}),r},this.findInSchemaByKeyPath=function(e,t){if(!t.length)return e;if(e.properties){var r=(t=_toArray(t))[0],t=t.slice(1);if(_.has(e.properties,r))return this.findInSchemaByKeyPath(e.properties[r],t)}},this.getForm=function(e,t){return u.loadProperties().then(_.bind(u.getFormForProperties,u,e,t))},this.getFormForProperties=function(e,n){var t=_(e).map(function(e){var t;return e.computed?e:(t=_slicedToArray(e.id.match(/^(.+)!!/),2)[1],t="".concat(t,"!!").concat(e.keyPath[0]),e=u.properties[t],_.pick(e,["id","keyPath"]))}).uniqBy("keyPath").value(),i=u.getSchemaForProperties(e);return t.map(function(e){return t=n,r=i,r=u.findInSchemaByKeyPath(r,e.keyPath),r=function(e,t){return t.computed&&t.configSchema&&(e.key=_.last(t.keyPath)),e}(r={key:ObjectPath.stringify(u.properties[e.id].keyPath),title:r.title||e.label||u.properties[e.id].label},e),_.assign(r,t),r;var t,r})},this.isComplexProperty=function(e){return"object"===e.type},this.isCustomProperty=function(e){return"c8yCustom"===e.id.split("!!")[0]},this.getChildren=function(t,e){return _.filter(e||u.properties,function(e){return t.id!==e.id&&_.isEqual(_.take(e.keyPath,t.keyPath.length),t.keyPath)})},this.changeActiveProperty=function(e,t){return _.map(e,function(e){return _.assign(e,{__active:t})})},this.removeDuplication=function(e){var t,r=e;return _.map(e,function(e){u.isComplexProperty(e)&&(t=_.map(u.getChildren(e),"id"),r=_.reject(r,function(e){return _.includes(t,e.id)}))}),r},this.getParent=function(t){return _.filter(u.properties,function(e){return t.keyPath.length>e.keyPath.length&&_.isEqual(_.take(t.keyPath,e.keyPath.length),e.keyPath)})},this.addCustomProperty=function(e){u.properties[e.id]||(u.properties[e.id]={}),_.merge(u.properties[e.id],e)},this.another=function(e,t){return new r(e,void 0===t?n:t)},this.paths=_.reduce(this.ENTITIES.values(),function(e,t){return e[_.startCase(_.camelCase(t.value)).replace(" ","")]=t.staticSchemaPath,e},{})}(h.dataFilePath("properties/managed-objects.json"))}e.$inject=["$filter","$http","$log","$q","c8yBase","c8yApplication","c8yJsonSchemas","gettextCatalog","c8yTenant"],angular.module("c8y.ui").provider("c8yPropertiesLibrary",function(){return{$get:e}})}();
|
|
1
|
+
"use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,p=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(p.push(n.value),p.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return p}}function _toArray(e){return _arrayWithHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _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 r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _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(e,o,c,l,h,f,y,m,d){return new function r(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=n.tenantId,u=this,a="x-show-if-any-available",p="title";function i(e){var t=_.cloneDeep(e),e=l.when(t),r=_.find(u.ENTITIES.values(),{staticSchemaPath:u.propertiesCfg.static.path});return e=r?y.list().then(function(e){var t={appliesTo:{}};return t.appliesTo[r.value]=!0,_.filter(e,t)}).then(function(e){return _.map(e,function(e){return _.get(e,"c8y_JsonSchema")})}).then(function(e){return _.forEach(e,function(e){r===u.ENTITIES.TENANTS?_.merge(t.properties.customProperties.properties,e.properties):_.merge(t.properties,e.properties)}),t}):e}function s(e,t,r,n,i){if(r===p&&(r=_.has(i,"type"),i=!_.isUndefined(e),r)&&i)return e}this.ENTITIES=h.createEnum([{name:"MANAGED_OBJECTS",value:"MANAGED_OBJECTS",staticSchemaPath:h.dataFilePath("properties/managed-objects.json")},{name:"MEASUREMENTS",value:"MEASUREMENTS",staticSchemaPath:h.dataFilePath("properties/measurements.json")},{name:"ALARMS",value:"ALARMS",staticSchemaPath:h.dataFilePath("properties/alarms.json")},{name:"EVENTS",value:"EVENTS",staticSchemaPath:h.dataFilePath("properties/events.json")},{name:"TENANTS",value:"TENANTS",staticSchemaPath:h.dataFilePath("properties/tenants.json")}]),this.properties={},this.propertiesCfg={static:{path:e}},this.list=function(){return u.loadProperties().then(_.bind(u.getSimplifiedProperties,u))},this.getProperties=function(){return u.loadProperties().then(_.bind(u.getFullProperties,u))},this.getTenantDetails=function(){return t?d.detail(t).then(h.getResData):d.current()},this.removeKeysDependingOnAppsAvailability=function(t){return function e(t){for(var r=Object.keys(t),n=!1,i=0;i<r.length;i++){var o=r[i];_typeof(t[o])===_typeof({})&&null!==t[o]&&(n=o===a||n||e(t[o]))}return n}(t)?u.getTenantDetails().then(function(e){return e=_.flatMap(e.applications.references,"application"),function t(r,n){var e=Object.keys(r);return _.forEach(e,function(e){void 0===r[e][a]||_.some(r[e][a],function(e){return f.isAppOnTheList(n,e)})?_typeof(r[e])===_typeof({})&&null!==r[e]&&e!==a&&t(r[e],n):delete r[e]}),r}(t,e)}):t},this.loadProperties=_.throttle(function(){return u.loadStaticPropertiesSchema().then(i).then(u.removeKeysDependingOnAppsAvailability).then(_.bind(u.getPropertiesFromSchema,u)).then(_.bind(u.addProperties,u))},1e3,{leading:!0,trailing:!1}),this.loadStaticPropertiesSchema=function(){var e=u.propertiesCfg.static.path;return u.loadStaticPropertiesSchemaFromMemory()||o.get(e).then(h.getResData)},this.pathToKey=function(){var e=u.propertiesCfg.static.path;return _.last(e.split("/")).replace(/\.json$/,"")},this.loadStaticPropertiesSchemaFromMemory=function(){var e=u.pathToKey();return(e=(window.c8y&&window.c8y.collections&&window.c8y.collections.properties||{})[e])&&l.when(e)},this.getPropertiesFromSchema=function(e,t,r){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:["properties"],a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:[],p=5<arguments.length&&void 0!==arguments[5]?arguments[5]:[],s=t||e.id||"c8yDefaultSchema",t=_.cloneDeep(r||{type:"object",properties:{}}),c=u.setObjValue(t,o,{});return _.has(e,"properties")&&_.forEach(e.properties,function(e,t){var r=_.cloneDeep(c),n=_.flattenDeep([o,t,"properties"]),i=_.flattenDeep([a,t]),r=u.setObjValue(r,o,_.cloneDeep(e),t),t=u.getNewPropertyObj(s,i,r,e);p.push(t),u.getPropertiesFromSchema(e,s,r,n,i,p)}),p},this.getNewPropertyObj=function(e,t,r,n){var i=t.join("."),e={id:"".concat(e,"!!").concat(i),keyPath:t,type:n.type,printFormat:n.printFormat,label:u.getDefaultPropertyLabel(t,n),schema:r};return n.config&&(e.configSchema=n.config),n.computed&&(e.computed=n.computed),e},this.getFragmentName=function(e){var e=e[e.length-1],t=/_\d{9,}$/;return e=t.test(e)?e.replace(t,""):e},this.getDefaultPropertyLabel=function(e,t){return t=(t=t.title)||(t=(t=u.getFragmentName(e)).replace(/^c8y_/i,"").replace(/([A-Z][a-z])/g," $1").replace(/([^0-9])([0-9])/g,"$1 $2").replace("_"," ").replace(/^\s*/,"").replace(/\s*$/,"")).charAt(0).toUpperCase()+t.slice(1)},this.setObjValue=function(e,t,r,n){for(var i=e,o=0;o<t.length-1;o++)i[t[o]]||(i[t[o]]={}),i=i[t[o]];return n?i[t[o]][n]=r:i[t[o]]=r,e},this.addProperties=function(e){_.forEach(e,function(e){u.properties[e.id]=e})},this.getSimplifiedProperties=function(){return _.map(u.properties,_.bind(u.simplifyProperty,u))},this.simplifyProperty=function(e){return _.pick(e,["id","keyPath","type","label","configSchema","computed","printFormat"])},this.getFullProperties=function(){return _.cloneDeep(u.properties)},this.getSchema=function(e){return u.loadProperties().then(_.bind(u.getSchemaForProperties,u,e)).catch(c.error)},this.getSchemaForProperties=function(o){var a={type:"object",properties:{}};return _.forEach(o,function(e){u.isCustomProperty(e)&&u.addCustomProperty(e),_.mergeWith(a.properties,u.properties[e.id].schema.properties,s);var t,r,n,i=u.findInSchema(a,e);i&&(i.id=e.id,i.title=e.label||u.properties[e.id].label,n=i,t=e,r=o,u.isComplexProperty(t)&&0<u.getChildren(t,r).length&&(n.properties={}),_.forEach(_.get(i,"properties"),function(e){_.set(e,p,m.getString(e.title))}),t=a,r=e,n=_.last(r.id.split("!!")),i=_.last(r.keyPath),r.computed)&&r.configSchema&&(n!==i&&(t.properties[i]=t.properties[n],delete t.properties[n]),r.config&&4===r.config.resultType&&(t.properties[i].type="object",t.properties[i].properties={value:{title:m.getString("Value"),type:"number"},unit:{title:m.getString("Unit"),type:"string"}}),r.config)&&1===r.config.resultType&&(t.properties[i].type="number")}),function r(e,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];e.properties&&_.forEach(e.properties,function(e,t){n(e,t,[].concat(_toConsumableArray(i),[t])),r(e,n,[].concat(_toConsumableArray(i),[t]))})}(a,function(e,t,r){_.isUndefined(e.title)&&(e.title=u.getDefaultPropertyLabel(r,e))}),a},this.findInSchema=function(e,t){var r=t.keyPath;return t.computed&&(r=[u.getFragmentName(r)]),u.findInSchemaByKeyPath(e,r)},this.findInSchemaById=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return _.isObjectLike(e)&&_.forOwn(e,function(e){_.isObjectLike(e)&&e.id===t?r.push(e):u.findInSchemaById(e,t,r)}),r},this.findInSchemaByKeyPath=function(e,t){if(!t.length)return e;if(e.properties){var r=(t=_toArray(t))[0],t=t.slice(1);if(_.has(e.properties,r))return this.findInSchemaByKeyPath(e.properties[r],t)}},this.getForm=function(e,t){return u.loadProperties().then(_.bind(u.getFormForProperties,u,e,t))},this.getFormForProperties=function(e,n){var t=_(e).map(function(e){var t;return e.computed?e:(t=_slicedToArray(e.id.match(/^(.+)!!/),2)[1],t="".concat(t,"!!").concat(e.keyPath[0]),e=u.properties[t],_.pick(e,["id","keyPath"]))}).uniqBy("keyPath").value(),i=u.getSchemaForProperties(e);return t.map(function(e){return t=n,r=i,r=u.findInSchemaByKeyPath(r,e.keyPath),r=function(e,t){return t.computed&&t.configSchema&&(e.key=_.last(t.keyPath)),e}(r={key:ObjectPath.stringify(u.properties[e.id].keyPath),title:r.title||e.label||u.properties[e.id].label},e),_.assign(r,t),r;var t,r})},this.isComplexProperty=function(e){return"object"===e.type||"array"===e.type},this.isCustomProperty=function(e){return"c8yCustom"===e.id.split("!!")[0]},this.getChildren=function(t,e){return _.filter(e||u.properties,function(e){return t.id!==e.id&&_.isEqual(_.take(e.keyPath,t.keyPath.length),t.keyPath)})},this.changeActiveProperty=function(e,t){return _.map(e,function(e){return _.assign(e,{__active:t})})},this.removeDuplication=function(e){var t,r=e;return _.map(e,function(e){u.isComplexProperty(e)&&(t=_.map(u.getChildren(e),"id"),r=_.reject(r,function(e){return _.includes(t,e.id)}))}),r},this.getParent=function(t){return _.filter(u.properties,function(e){return t.keyPath.length>e.keyPath.length&&_.isEqual(_.take(t.keyPath,e.keyPath.length),e.keyPath)})},this.addCustomProperty=function(e){u.properties[e.id]||(u.properties[e.id]={}),_.merge(u.properties[e.id],e)},this.another=function(e,t){return new r(e,void 0===t?n:t)},this.paths=_.reduce(this.ENTITIES.values(),function(e,t){return e[_.startCase(_.camelCase(t.value)).replace(" ","")]=t.staticSchemaPath,e},{})}(h.dataFilePath("properties/managed-objects.json"))}e.$inject=["$filter","$http","$log","$q","c8yBase","c8yApplication","c8yJsonSchemas","gettextCatalog","c8yTenant"],angular.module("c8y.ui").provider("c8yPropertiesLibrary",function(){return{$get:e}})}();
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
<label>{{ 'From`date`' | translate }}</label>
|
|
41
41
|
<c8y-date-time-picker
|
|
42
42
|
placeholder="{{ 'From`date`' | translate }}"
|
|
43
|
+
append-to-body="true"
|
|
43
44
|
is-open="vm.datePickerFromOpen"
|
|
44
45
|
ng-model="vm.filters.dateFrom"
|
|
45
46
|
max-date="vm.filters.dateTo"
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
<label>{{ 'To`date`' | translate }}</label>
|
|
54
55
|
<c8y-date-time-picker
|
|
55
56
|
placeholder="{{ 'To`date`' | translate }}"
|
|
57
|
+
append-to-body="true"
|
|
56
58
|
is-open="vm.datePickerToOpen"
|
|
57
59
|
ng-model="vm.filters.dateTo"
|
|
58
60
|
min-date="vm.filters.dateFrom"
|