@c8y/ng1-modules 1020.29.0 → 1020.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";function _typeof(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: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
+ "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: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 M(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?M(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 R(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:M,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),M(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(R,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(R,t))},uploadPaasAppFiles:Q,getPaasAppManifest:L,refreshPaasApp:R,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)}();
@@ -14521,6 +14521,12 @@ msgstr "Smart Rule \"{{name}}\" deaktiviert."
14521
14521
  msgid "Smart rule \"{{name}}\" deleted."
14522
14522
  msgstr "Smart Rule \"{{name}}\" gelöscht."
14523
14523
 
14524
+ msgid "Smart rule \"{{name}}\" saved but not visible here. <a href=\"{{link}}\">Navigate to \"{{nameOfMo}}\"</a>."
14525
+ msgstr "Smart Rule \"{{name}}\" gespeichert, aber hier nicht sichtbar. <a href=\"{{link}}\">Navigieren Sie zu \"{{nameOfMo}}\"</a>."
14526
+
14527
+ msgid "Smart rule \"{{name}}\" saved under the selected asset \"{{nameOfMo}}\" of type \"{{typeOfMo}}\"."
14528
+ msgstr "Smart Rule \"{{name}}\" unter dem ausgewählten Asset \"{{nameOfMo}}\" vom Typ \"{{typeOfMo}}\" gespeichert."
14529
+
14524
14530
  msgid "Smart rule \"{{name}}\" saved."
14525
14531
  msgstr "Smart Rule \"{{name}}\" gespeichert."
14526
14532
 
@@ -14551,6 +14551,12 @@ msgstr "Regla inteligente \"{{name}}\" desactivada."
14551
14551
  msgid "Smart rule \"{{name}}\" deleted."
14552
14552
  msgstr "Regla inteligente \"{{name}}\" eliminada."
14553
14553
 
14554
+ msgid "Smart rule \"{{name}}\" saved but not visible here. <a href=\"{{link}}\">Navigate to \"{{nameOfMo}}\"</a>."
14555
+ msgstr "Regla inteligente \"{{name}}\" Guardada pero no visible aquí. <a href=\"{{link}}\">Navegación a \"{{nameOfMo}}\"</a>."
14556
+
14557
+ msgid "Smart rule \"{{name}}\" saved under the selected asset \"{{nameOfMo}}\" of type \"{{typeOfMo}}\"."
14558
+ msgstr "Regla inteligente \"{{name}}\" Guardado bajo el Activo seleccionado \"{{nameOfMo}}\" de Tipo \"{{typeOfMo}}\"."
14559
+
14554
14560
  msgid "Smart rule \"{{name}}\" saved."
14555
14561
  msgstr "Regla inteligente \"{{name}}\" guardada."
14556
14562
 
@@ -14551,6 +14551,12 @@ msgstr "Smart Rule \"{{name}}\" désactivée."
14551
14551
  msgid "Smart rule \"{{name}}\" deleted."
14552
14552
  msgstr "Smart Rule \"{{name}}\" supprimée."
14553
14553
 
14554
+ msgid "Smart rule \"{{name}}\" saved but not visible here. <a href=\"{{link}}\">Navigate to \"{{nameOfMo}}\"</a>."
14555
+ msgstr "Smart Rule \"{{name}}\" enregistrée mais non visible ici. <a href=\"{{link}}\">Naviguez jusqu'à \"{{nameOfMo}}\"</a>."
14556
+
14557
+ msgid "Smart rule \"{{name}}\" saved under the selected asset \"{{nameOfMo}}\" of type \"{{typeOfMo}}\"."
14558
+ msgstr "Smart Rule \"{{name}}\" enregistrée sous l'Actif sélectionné \"{{nameOfMo}}\" de type \"{{typeOfMo}}\"."
14559
+
14554
14560
  msgid "Smart rule \"{{name}}\" saved."
14555
14561
  msgstr "Smart Rule \"{{name}}\" enregistrée."
14556
14562
 
@@ -14543,6 +14543,12 @@ msgstr "スマート ルール \"{{name}}\" が無効化されました。"
14543
14543
  msgid "Smart rule \"{{name}}\" deleted."
14544
14544
  msgstr "スマート ルール \"{{name}}\" が削除されました。"
14545
14545
 
14546
+ msgid "Smart rule \"{{name}}\" saved but not visible here. <a href=\"{{link}}\">Navigate to \"{{nameOfMo}}\"</a>."
14547
+ msgstr "スマートルール「{{name}}」は保存されましたが、ここでは表示されません。<a href=\"{{link}}\">「{{nameOfMo}}」に移動</a>します。"
14548
+
14549
+ msgid "Smart rule \"{{name}}\" saved under the selected asset \"{{nameOfMo}}\" of type \"{{typeOfMo}}\"."
14550
+ msgstr "スマートルール「{{name}}」は、選択されたタイプ「{{typeOfMo}}」のアセット「{{nameOfMo}}」の下に保存されました。"
14551
+
14546
14552
  msgid "Smart rule \"{{name}}\" saved."
14547
14553
  msgstr "スマート ルール \"{{name}}\" が保存されました。"
14548
14554
 
@@ -14550,6 +14550,12 @@ msgstr "Smart rule \"{{name}}\" gedeactiveerd."
14550
14550
  msgid "Smart rule \"{{name}}\" deleted."
14551
14551
  msgstr "Smart rule \"{{name}}\" verwijderd."
14552
14552
 
14553
+ msgid "Smart rule \"{{name}}\" saved but not visible here. <a href=\"{{link}}\">Navigate to \"{{nameOfMo}}\"</a>."
14554
+ msgstr "Smart rule \"{{name}}\" opgeslagen maar hier niet zichtbaar. <a href=\"{{link}}\">Navigeer naar \"{{nameOfMo}}\"</a>."
14555
+
14556
+ msgid "Smart rule \"{{name}}\" saved under the selected asset \"{{nameOfMo}}\" of type \"{{typeOfMo}}\"."
14557
+ msgstr "Smart rule \"{{name}}\" opgeslagen onder de Geselecteerde asset \"{{nameOfMo}}\" van type \"{{typeOfMo}}\"."
14558
+
14553
14559
  msgid "Smart rule \"{{name}}\" saved."
14554
14560
  msgstr "Smart rule \"{{name}}\" opgeslagen."
14555
14561
 
@@ -14576,6 +14576,12 @@ msgstr "Reguła inteligentna „{{name}}” została dezaktywowana."
14576
14576
  msgid "Smart rule \"{{name}}\" deleted."
14577
14577
  msgstr "Reguła inteligentna „{{name}}” została usunięta."
14578
14578
 
14579
+ msgid "Smart rule \"{{name}}\" saved but not visible here. <a href=\"{{link}}\">Navigate to \"{{nameOfMo}}\"</a>."
14580
+ msgstr "Reguła inteligentna \"{{name}}\" została zapisana, ale nie jest widoczna tutaj. <a href=\"{{link}}\">Nawiguj do \"{{nameOfMo}}\"</a>."
14581
+
14582
+ msgid "Smart rule \"{{name}}\" saved under the selected asset \"{{nameOfMo}}\" of type \"{{typeOfMo}}\"."
14583
+ msgstr "Reguła inteligentna \"{{name}}\" zapisana pod wybranym zasobem \"{{nameOfMo}}\" typu \"{{typeOfMo}}\"."
14584
+
14579
14585
  msgid "Smart rule \"{{name}}\" saved."
14580
14586
  msgstr "Reguła inteligentna „{{name}}” została zapisana."
14581
14587
 
@@ -14550,6 +14550,12 @@ msgstr "Smart rule \"{{name}}\" desativada."
14550
14550
  msgid "Smart rule \"{{name}}\" deleted."
14551
14551
  msgstr "Smart rule \"{{name}}\" excluída."
14552
14552
 
14553
+ msgid "Smart rule \"{{name}}\" saved but not visible here. <a href=\"{{link}}\">Navigate to \"{{nameOfMo}}\"</a>."
14554
+ msgstr "Smart rule \"{{name}}\" salva, mas não visível aqui. <a href=\"{{link}}\">Navegue até \"{{nameOfMo}}\"</a>."
14555
+
14556
+ msgid "Smart rule \"{{name}}\" saved under the selected asset \"{{nameOfMo}}\" of type \"{{typeOfMo}}\"."
14557
+ msgstr "Smart rule \"{{name}}\" salva no ativo selecionado \"{{nameOfMo}}\" do tipo \"{{typeOfMo}}\"."
14558
+
14553
14559
  msgid "Smart rule \"{{name}}\" saved."
14554
14560
  msgstr "Smart rule \"{{name}}\" salva."
14555
14561
 
@@ -1 +1 @@
1
- "use strict";!function(){function e(p,d,y,e,v,g,h){var E;return{list:function(){return p.all({deviceList:d.list({pageSize:6}),currentApp:e.getCurrent(),buildTarget:p.resolve(y.appOption("target")),userApps:e.listByUser().then(i)}).then(function(e){var i,r,n=_.get(e,"currentApp.name"),c=(e.deviceList||[]).length,t=e.buildTarget,e=(E=e.userApps,[]),o=p.all({currentUser:g.current(),userHierarchyActive:v.userHierarchyActive()}).then(function(e){var i=e.currentUser,e=e.userHierarchyActive;return(g.hasRole(i,"ROLE_USER_MANAGEMENT_ADMIN")||e&&g.hasRole(i,"ROLE_USER_MANAGEMENT_CREATE"))&&m("administration")}).then(function(e){return e?_.assign({priority:2,icon:"c8y-icon c8y-icon-add-user",label:h("Add user"),url:"/apps/administration/index.html#/users/new",color:"#FEFEFE",backgroundColorClass:k("a")},i):null}),a=function(e){var i;m("devicemanagement")&&(i=_.assign({priority:2,icon:"c8y-icon c8y-icon-device-connect",label:h("Add device"),url:"/apps/devicemanagement/#/deviceregistration",color:"#FEFEFE",backgroundColorClass:k("b")},e));return i}(),l={priority:({dt:{priority:2}}[t]||{}).priority||3,icon:"c8y-icon c8y-icon-device-management",label:h("Device management"),url:"/apps/devicemanagement",color:"#EFEFEF",backgroundColorClass:k("f")},u={priority:({dt:{priority:2}}[t]||{}).priority||3,icon:"c8y-icon c8y-icon-cockpit",label:h("Cockpit"),url:"/apps/cockpit",color:"#EFEFEF",backgroundColorClass:k("e")},s={priority:2,iconSrc:":::PLUGIN_PATH:::/icons/HelpAndService.svg",label:h("Help & Service"),url:"/apps/HelpAndService",color:"#EFEFEF",backgroundColorClass:k("f")};return 0===c?void 0!==a&&(a.priority=1):c<=5?(r=1===c?1:3,e.push(d.list({pageSize:c}).then(function(e){var i=[];return _.forEach(e,function(e){i.push(function(e,i,r,n){var c,t=_.filter(["cockpit","devicemanagement"],m);t.length&&(n=_.includes(t,n)?n:_.head(t),c=_.assign({priority:({dt:{priority:2}}[r]||{}).priority||3,icon:"c8y-icon c8y-icon-device",label:e.name||h("Device ")+e.id,url:"/apps/".concat(n,"/#/device/").concat(e.id),color:"#FEFEFE",backgroundColorClass:k("c")},i));return c}(e,{priority:r},t,n))}),i}))):u.priority=1,e.push(function(){var e,i=y.getPluginService("phoneRegistrationService");i&&(e=i.createAddPhoneLink());return e}()),e.push(p.when(o)),e.push(p.when(a)),"devicemanagement"!==n&&m("devicemanagement")&&e.push(p.when(l)),"cockpit"!==n&&m("cockpit")&&e.push(p.when(u)),"HelpAndService"!==n&&"dt"===t&&m("HelpAndService")&&e.push(p.when(s)),p.all(e).then(_.flattenDeep).then(_.partialRight(_.filter,_.identity))})}};function m(e){return _.includes(E,e)}function k(e){return["quick-link","quick-link-".concat(e.priority),"quick-link-bgcolor-".concat(e.backgroundColorClass)]}function i(e){return _(e).map("contextPath").uniq().value()}}e.$inject=["$q","c8yDevices","c8yBase","c8yApplication","c8yUserUtil","c8yUser","gettext"],angular.module("c8y.ui").factory("c8yQuickLinks",e)}();
1
+ "use strict";!function(){function e(p,d,y,e,v,g,h){var E;return{list:function(){return p.all({deviceList:d.list({pageSize:6}),currentApp:e.getCurrent(),buildTarget:p.resolve(y.appOption("target")),userApps:e.listByUser().then(i)}).then(function(e){var i,r,n=_.get(e,"currentApp.name"),c=(e.deviceList||[]).length,t=e.buildTarget,e=(E=e.userApps,[]),o=p.all({currentUser:g.current(),userHierarchyActive:v.userHierarchyActive()}).then(function(e){var i=e.currentUser,e=e.userHierarchyActive;return(g.hasRole(i,"ROLE_USER_MANAGEMENT_ADMIN")||e&&g.hasRole(i,"ROLE_USER_MANAGEMENT_CREATE"))&&k("administration")}).then(function(e){return e?_.assign({priority:2,icon:"c8y-icon c8y-icon-add-user",label:h("Add user"),url:"/apps/administration/index.html#/users/new",color:"#FEFEFE",backgroundColorClass:m("a")},i):null}),a=function(e){var i;k("devicemanagement")&&(i=_.assign({priority:2,icon:"c8y-icon c8y-icon-device-connect",label:h("Add device"),url:"/apps/devicemanagement/#/deviceregistration",color:"#FEFEFE",backgroundColorClass:m("b")},e));return i}(),l={priority:({dt:{priority:2}}[t]||{}).priority||3,icon:"c8y-icon c8y-icon-device-management",label:h("Device Management"),url:"/apps/devicemanagement",color:"#EFEFEF",backgroundColorClass:m("f")},u={priority:({dt:{priority:2}}[t]||{}).priority||3,icon:"c8y-icon c8y-icon-cockpit",label:h("Cockpit"),url:"/apps/cockpit",color:"#EFEFEF",backgroundColorClass:m("e")},s={priority:2,iconSrc:":::PLUGIN_PATH:::/icons/HelpAndService.svg",label:h("Help & Service"),url:"/apps/HelpAndService",color:"#EFEFEF",backgroundColorClass:m("f")};return 0===c?void 0!==a&&(a.priority=1):c<=5?(r=1===c?1:3,e.push(d.list({pageSize:c}).then(function(e){var i=[];return _.forEach(e,function(e){i.push(function(e,i,r,n){var c,t=_.filter(["cockpit","devicemanagement"],k);t.length&&(n=_.includes(t,n)?n:_.head(t),c=_.assign({priority:({dt:{priority:2}}[r]||{}).priority||3,icon:"c8y-icon c8y-icon-device",label:e.name||h("Device ")+e.id,url:"/apps/".concat(n,"/#/device/").concat(e.id),color:"#FEFEFE",backgroundColorClass:m("c")},i));return c}(e,{priority:r},t,n))}),i}))):u.priority=1,e.push(function(){var e,i=y.getPluginService("phoneRegistrationService");i&&(e=i.createAddPhoneLink());return e}()),e.push(p.when(o)),e.push(p.when(a)),"devicemanagement"!==n&&k("devicemanagement")&&e.push(p.when(l)),"cockpit"!==n&&k("cockpit")&&e.push(p.when(u)),"HelpAndService"!==n&&"dt"===t&&k("HelpAndService")&&e.push(p.when(s)),p.all(e).then(_.flattenDeep).then(_.partialRight(_.filter,_.identity))})}};function k(e){return _.includes(E,e)}function m(e){return["quick-link","quick-link-".concat(e.priority),"quick-link-bgcolor-".concat(e.backgroundColorClass)]}function i(e){return _(e).map("contextPath").uniq().value()}}e.$inject=["$q","c8yDevices","c8yBase","c8yApplication","c8yUserUtil","c8yUser","gettext"],angular.module("c8y.ui").factory("c8yQuickLinks",e)}();
@@ -24,6 +24,7 @@
24
24
  <li
25
25
  class="{{ form.fieldHtmlClass }}"
26
26
  ng-repeat="item in modelArray.slice(0, visibleItems) track by $index"
27
+ data-cy="array--item-in-modelArray"
27
28
  >
28
29
  <div class="d-flex a-i-start">
29
30
  <sf-decorator
@@ -59,6 +60,7 @@
59
60
  style="border: 1px solid"
60
61
  type="button"
61
62
  ng-click="visibleItems = visibleItems + 10"
63
+ data-cy="array--Load-more-button"
62
64
  >
63
65
  <i c8y-icon="repeat"></i>
64
66
  <span>{{ 'Load more' | translate }}</span>
@@ -1 +1 @@
1
- "use strict";!function(){function e(i,a,c,l){return{list:function(){var e,t=a.appOption("target"),n=[{icon:"c8y-c8y-data",label:l("Concepts`KEEP_ORIGINAL`"),url:o("/docs/concepts/introduction")},{icon:"c8y-user",label:l("Getting started`KEEP_ORIGINAL`"),url:o("/docs/section/getting_started")},{icon:"c8y-administration",label:l("Platform administration`KEEP_ORIGINAL`"),url:o("/docs/section/platform_administration")},{icon:"c8y-device-management",label:l("Device management`KEEP_ORIGINAL`"),url:o("/docs/section/device_management")},{icon:"c8y-cockpit",label:l("Application enablement`KEEP_ORIGINAL`"),url:o("/docs/section/app_enablement")},{icon:"c8y-book",label:l("Cumulocity IoT Edge`KEEP_ORIGINAL`"),url:o("/docs/edge/edge-introduction")},{icon:"c8y-data-explorer",label:l("Streaming analytics`KEEP_ORIGINAL`"),url:o("/docs/streaming-analytics/overview-analytics")},{icon:"rest-api",label:l("OpenAPI specification`KEEP_ORIGINAL`"),url:o("/api")},{icon:"gavel",label:l("Legal notices"),url:"https://documentation.softwareag.com/legal"}];switch(t){case"dt":e=i.resolve([{icon:"comments",label:l("Help & Service"),url:l("https://support.ram.m2m.telekom.com/apps/HelpAndService/index.html")}]);break;case"quarktech":e=i.resolve(n);break;default:e=c.getSupportUrl().then(function(e){return!1!==e&&n.push({icon:"comments",label:l("Forum support"),url:e}),n})}return e.then(function(e){return _.filter(e,"url")})},getBaseUrl:n,getUserGuideLink:o};function n(){return a.appOption("docsBaseUrl")}function o(e){var t;return _.isNull(n())?null:(t=a.appOption("guideHrefTemplate"),e=e,_.isNull(t)||_.isUndefined(t)||0===t.length?void 0:t.replace(/\${docsBaseUrl}/,n()).replace(/\${partialUrl}/,function(e){return(_.isEmpty(e)||_.startsWith(e,"/")?"":"/")+e}(e)))}}e.$inject=["$q","c8yBase","c8ySettings","gettext"],angular.module("c8y.ui").factory("c8yDocs",e)}();
1
+ "use strict";!function(){function e(i,a,c,l){return{list:function(){var e,t=a.appOption("target"),n=[{icon:"c8y-c8y-data",label:l("Concepts`KEEP_ORIGINAL`"),url:o("/docs/concepts/introduction")},{icon:"c8y-user",label:l("Getting started`KEEP_ORIGINAL`"),url:o("/docs/section/getting_started")},{icon:"c8y-administration",label:l("Platform administration`KEEP_ORIGINAL`"),url:o("/docs/section/platform_administration")},{icon:"c8y-device-management",label:l("Device Management"),url:o("/docs/section/device_management")},{icon:"c8y-cockpit",label:l("Application enablement`KEEP_ORIGINAL`"),url:o("/docs/section/app_enablement")},{icon:"c8y-book",label:l("Cumulocity IoT Edge`KEEP_ORIGINAL`"),url:o("/docs/edge/edge-introduction")},{icon:"c8y-data-explorer",label:l("Streaming analytics`KEEP_ORIGINAL`"),url:o("/docs/streaming-analytics/overview-analytics")},{icon:"rest-api",label:l("OpenAPI specification`KEEP_ORIGINAL`"),url:o("/api")},{icon:"gavel",label:l("Legal notices"),url:"https://documentation.softwareag.com/legal"}];switch(t){case"dt":e=i.resolve([{icon:"comments",label:l("Help & Service"),url:l("https://support.ram.m2m.telekom.com/apps/HelpAndService/index.html")}]);break;case"quarktech":e=i.resolve(n);break;default:e=c.getSupportUrl().then(function(e){return!1!==e&&n.push({icon:"comments",label:l("Forum support"),url:e}),n})}return e.then(function(e){return _.filter(e,"url")})},getBaseUrl:n,getUserGuideLink:o};function n(){return a.appOption("docsBaseUrl")}function o(e){var t;return _.isNull(n())?null:(t=a.appOption("guideHrefTemplate"),e=e,_.isNull(t)||_.isUndefined(t)||0===t.length?void 0:t.replace(/\${docsBaseUrl}/,n()).replace(/\${partialUrl}/,function(e){return(_.isEmpty(e)||_.startsWith(e,"/")?"":"/")+e}(e)))}}e.$inject=["$q","c8yBase","c8ySettings","gettext"],angular.module("c8y.ui").factory("c8yDocs",e)}();
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "Device management",
2
+ "name": "Device Management",
3
3
  "ngModules": ["c8y.deviceManagement"],
4
4
  "category": "Device",
5
5
  "icon": "home",
@@ -168,13 +168,13 @@
168
168
  <li ng-if="getLinkToDM(i)">
169
169
  <c8y-if-allowed any-app="['devicemanagement']">
170
170
  <a
171
- title="{{ 'Open in Device management' | translate }}"
171
+ title="{{ 'Open in Device Management' | translate }}"
172
172
  target="_blank"
173
173
  rel="noopener noreferrer"
174
174
  ng-href="{{ getLinkToDM(i) }}"
175
175
  >
176
176
  <i c8y-icon="external-link"></i>
177
- {{ 'Device management' | translate }}
177
+ {{ 'Device Management' | translate }}
178
178
  </a>
179
179
  </c8y-if-allowed>
180
180
  </li>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1020.29.0",
3
+ "version": "1020.33.1",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",
@@ -1 +1 @@
1
- "use strict";!function(){function e(t,e,n,s,i,l,a,r,u,o,c,d,m){var g=_.isEmpty(c)?null:c,h="smartRuleForm",y={parent:null,mo:null,withChildren:{assets:!0,devices:!1}},p={inProgres:!1};function v(e){o=e,t.ruleTemplate=o,t.rule.name||(t.rule.name=m.getString(t.ruleTemplate.description))}function C(e){t.enabledSources=_.sortBy(e,"name")}function f(e){t.disabledSources=_.sortBy(e,"name")}function S(){return R(),n.reject()}function b(){p.inProgress=!0}function R(){p.inProgress=!1}t.hasChildAssets=angular.bind(i,i.hasChildAssets),t.getChildAssetsCount=angular.bind(i,i.getChildAssetsCount),t.ruleTemplate=o,t.rule=c,t.save=function(){o.noTarget&&(y.withChildren={assets:!1,devices:!1}),n.when().then(b).then(angular.bind(r,r.save,c,o,y)).then(e.close,S).then(_.partial(_.unary(a.success),m.getString('Smart rule "{{name}}" saved.',{name:c.name}))).then(R)},t.savingStatus=p,t.cancel=e.dismiss,t.invalid=angular.bind(s,s.invalid,t,h);var T,A=t.$watch(h,function(e){g&&e.$setDirty(),e&&A()});c&&c.id||(c=_.assign(r.getEmpty(),c||{})),t.rule=c,h=r.getRuleModalTitle(t.rule),t.title=h,o?v(o):u.getTemplateForRule(c).then(v),t.initialActivationCfg=y,h=_.get(c,"c8y_Context",d?{id:d}:l.getContext()),i.detail(h.id).then(s.getResData).then(function(e){y.mo=e,y.searchOnlyChildAssetsOf=_.cloneDeep(e)}),c&&c.id&&(_.isEmpty(c.enabledSources)||(T=c.enabledSources.join(","),i.list({ids:T}).then(C)),_.isEmpty(c.disabledSources)||(T=c.disabledSources.join(","),i.list({ids:T}).then(f)))}e.$inject=["$scope","$uibModalInstance","$q","c8yBase","c8yInventory","c8yUiUtil","c8yAlert","smartRulesSvc","smartRuleTemplatesSvc","ruleTemplate","rule","contextMoId","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRuleEditCtrl",e)}();
1
+ "use strict";!function(){function e(t,e,n,a,s,i,l,o,r,u,c,d,m,g){var h=_.isEmpty(c)?null:c,y="smartRuleForm",f={parent:null,mo:null,withChildren:{assets:!0,devices:!1},useMoAsContext:m},C={inProgres:!1};function p(e){u=e,t.ruleTemplate=u,t.rule.name||(t.rule.name=g.getString(t.ruleTemplate.description))}function v(e){t.enabledSources=_.sortBy(e,"name")}function S(e){t.disabledSources=_.sortBy(e,"name")}function x(){return M(),n.reject()}function b(){C.inProgress=!0}function M(){C.inProgress=!1}t.hasChildAssets=angular.bind(s,s.hasChildAssets),t.getChildAssetsCount=angular.bind(s,s.getChildAssetsCount),t.ruleTemplate=u,t.rule=c,t.save=function(){u.noTarget&&(f.withChildren={assets:!1,devices:!1}),n.when().then(b).then(angular.bind(o,o.save,c,u,f)).then(e.close,x).then(function(){var e,t={text:"",type:"success",allowHtml:!0};return!!(c&&c.c8y_Context&&c.c8y_Context.id&&c.c8y_Context.context)&&f.useMoAsContext?(e="#".concat(i.getContextPath(c.c8y_Context),"/smart_rules"),t.text=g.getString('Smart rule "{{name}}" saved but not visible here. <a href="{{link}}">Navigate to "{{nameOfMo}}"</a>.',{name:c.name,nameOfMo:f.mo.name,link:e}),t.detailedData=g.getString('Smart rule "{{name}}" saved under the selected asset "{{nameOfMo}}" of type "{{typeOfMo}}".',{name:c.name,typeOfMo:f.mo.type,nameOfMo:f.mo.name})):t.text=g.getString('Smart rule "{{name}}" saved.',{name:c.name}),l.add(t)}).then(M)},t.savingStatus=C,t.cancel=e.dismiss,t.invalid=angular.bind(a,a.invalid,t,y);var A,O=t.$watch(y,function(e){h&&e.$setDirty(),e&&O()});c&&c.id||(c=_.assign(o.getEmpty(),c||{})),t.rule=c,y=o.getRuleModalTitle(t.rule),t.title=y,u?p(u):r.getTemplateForRule(c).then(p),t.initialActivationCfg=f,y=_.get(c,"c8y_Context",d?{id:d}:i.getContext()),s.detail(y.id).then(a.getResData).then(function(e){f.mo=e,m||(f.searchOnlyChildAssetsOf=_.cloneDeep(e))}),c&&c.id&&(_.isEmpty(c.enabledSources)||(A=c.enabledSources.join(","),s.list({ids:A}).then(v)),_.isEmpty(c.disabledSources)||(A=c.disabledSources.join(","),s.list({ids:A}).then(S)))}e.$inject=["$scope","$uibModalInstance","$q","c8yBase","c8yInventory","c8yUiUtil","c8yAlert","smartRulesSvc","smartRuleTemplatesSvc","ruleTemplate","rule","contextMoId","isCloned","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRuleEditCtrl",e)}();
@@ -1 +1 @@
1
- "use strict";!function(){function e(i,r,e,o,t,n,a,P,c,u,l,s,d,f,h,g,m,v){var p,S=r.deviceId||r.groupId,C={},A={},R={done:!1,inProgress:!1},y={true:{text:m("Enabled`rule`"),icon:"check-circle",cls:"text-success"},false:{text:m("Disabled`rule`"),icon:"ban",cls:"text-danger"}},E=s.getContext(),b=m("Global smart rules");function x(){return o.when().then(T).then(k).then(D).then(w).then(I).catch(j)}function T(){R.inProgress=!0}function I(){R.inProgress=!1,R.done=!0,R.error=!1}function j(e){e.data&&e.data.message&&l.danger(e.data.message),R.inProgress=!1,R.done=!0,R.error=!0}function k(){return h.list().then($)}function $(e){_.forEach(e||[],function(e){C[e.name]=e})}function D(){var e=S?g.listByContext(S):o.resolve([]),t=f.hasPermissions().then(function(e){return e?g.list():o.when([])});return o.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;S&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return N(e)&&!n.test(t)}}(S)));return t}(_.concat(e.listByContext,e.list))})}function N(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function O(e){return g.hasSource(e,S)}function w(){var e,t;return!(Array.isArray(i.rules)&&0<i.rules.length)||null===(t=s.getContext()).context?o.resolve():(e=a.childAssets(t.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}),t=a.childDevices(t.id,{params:{pageSize:2e3,withChildren:!1}}),o.all([e,t]).then(_.flatten).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=M(e)})}))}function M(t){return _.filter(i.children,function(e){return g.hasSource(t,e)})}function U(e){var t=_.get(C,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=A.canAddRules;return e&&!t&&(n=!1),_.isUndefined(n)&&(e=i.context?c.isAllowed({adminMOs:[i.context.id]}):o.all({isAllowedInventory:c.isAllowed({anyRole:["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"]}),isAllowedSmartRules:c.isAllowed({anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]})}).then(function(e){var t=e.isAllowedInventory,e=e.isAllowedSmartRules;return t&&e}),A.canAddRules=e.then(function(e){return A.canAddRules=e,A.canAddRules}),n=!1),n}function G(t){A.rules=A.rules||{};var n=A.rules,e=n[t.id];return _.isUndefined(e)&&(n[t.id]=c.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1),e}function L(e){var t=!0;return t=E.context!==s.CONTEXT.DEVICE&&E.context!==s.CONTEXT.GROUP?t:t&&e&&"c8y_SmartRule"!==e.type}_.assign(i,{isOpen:{},moId:S,loadingStatus:R,refresh:x,paging:{refresh:x},ruleTemplates:C,getLinkToDM:function(){var e={deviceId:S};return t(p||"")(e)},add:function(){g.addNewWithUI().then(x)},edit:function(e){g.editWithUI(e).then(x)},clone:function(e){g.cloneWithUI(e).then(x)},remove:function(e){u({title:m("Delete smart rule"),body:v.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:m("Delete")},status:"danger"}).then(angular.bind(g,g.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return l.success(m("Smart rule deleted."))})},hasSource:O,getChildrenEnabledForSmartRule:M,toggleRuleActivationForContextMO:function(e){if(O(e))return g.deactivate(e,S,!1).then(function(){l.success(v.getString('Smart rule "{{name}}" deactivated.',e))});return g.activate(e,S,!1).then(function(){l.success(v.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(e,n){var t=_.filter(n,function(t){return!_.find(i.ruleChildren[e.id],function(e){return e.id===t.id})}),r=_.filter(i.ruleChildren[e.id],function(t){return!_.find(n,function(e){return t.id===e.id})});return g.updateSources(e,t,r,!1).then(D).then(w).then(function(){l.success(v.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":m("Activate for this group"),"for device":m("Activate for this device"),"for object":m("Activate for this object")},deactivate:{"for group":m("Deactivate for this group"),"for device":m("Deactivate for this device"),"for object":m("Deactivate for this object")}},e=e.enabled&&O(e)?"deactivate":"activate",n=r.groupId?s.CONTEXT.GROUP:"object";return n=r.deviceId?s.CONTEXT.DEVICE:n,t[e]["for ".concat(n)]},type:function(e){var t,e=C[e.ruleTemplateName];e&&(t=e.label.full?v.getString(e.label.full):"".concat(v.getString(e.label.input)," ").concat(v.getString(e.label.output)));return t},status:function(e){return y[e.enabled].text},statusIcon:function(e){return y[e.enabled].icon},statusClass:function(e){return y[e.enabled].cls},showTitle:function(){return null!==s.getContext().context},title:b,context:E,inputIcon:function(e){var t,e=C[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=C[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:U,canDuplicate:function(e){return U(e)&&L(e)},canEdit:function(e){return G(e)&&L(e)},canRemove:G,canModify:G,canApplyOnChildren:function(e){return!N(e)},canSeeSection:function(){var e=A.canSeeSection;_.isUndefined(e)&&(A.canSeeSection=(n.checkIfModulesExist(["c8y.cockpit.config"])?f.shouldShowLocalSmartRules():o.when(!1)).then(function(e){return A.canSeeSection=e,A.canSeeSection}),e=!1);return e},isConfigurationGlobalSmartRulesContext:void 0,getRuleCardTitle:function(e){return"c8y_SmartRule"===e.type?m("Global smart rule"):m("Local smart rule")}}),i.isConfigurationGlobalSmartRulesContext=e.path().includes("/rules"),x(),null===s.getContext().context&&d.changeTitle({title:b}),E.context===s.CONTEXT.DEVICE&&n.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){p=e})}e.$inject=["$scope","$routeParams","$location","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();
1
+ "use strict";!function(){function e(i,r,e,o,t,n,a,P,c,u,l,s,d,f,h,g,m,v){var p,S=r.deviceId||r.groupId,C={},A={},R={done:!1,inProgress:!1},y={true:{text:m("Enabled`rule`"),icon:"check-circle",cls:"text-success"},false:{text:m("Disabled`rule`"),icon:"ban",cls:"text-danger"}},x=s.getContext(),E=m("Global smart rules");function b(){return o.when().then(T).then(k).then(D).then(w).then(I).catch(j)}function T(){R.inProgress=!0}function I(){R.inProgress=!1,R.done=!0,R.error=!1}function j(e){e.data&&e.data.message&&l.danger(e.data.message),R.inProgress=!1,R.done=!0,R.error=!0}function k(){return h.list().then($)}function $(e){_.forEach(e||[],function(e){C[e.name]=e})}function D(){var e=S?g.listByContext(S):o.resolve([]),t=f.hasPermissions().then(function(e){return e?g.list():o.when([])});return o.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;S&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return N(e)&&!n.test(t)}}(S)));return t}(_.concat(e.listByContext,e.list))})}function N(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function O(e){return g.hasSource(e,S)}function w(){var e,t;return!(Array.isArray(i.rules)&&0<i.rules.length)||null===(t=s.getContext()).context?o.resolve():(e=a.childAssets(t.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}),t=a.childDevices(t.id,{params:{pageSize:2e3,withChildren:!1}}),o.all([e,t]).then(_.flatten).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=M(e)})}))}function M(t){return _.filter(i.children,function(e){return g.hasSource(t,e)})}function U(e){var t=_.get(C,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=A.canAddRules;return e&&!t&&(n=!1),_.isUndefined(n)&&(e=i.context?c.isAllowed({adminMOs:[i.context.id]}):o.all({isAllowedInventory:c.isAllowed({anyRole:["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"]}),isAllowedSmartRules:c.isAllowed({anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]})}).then(function(e){var t=e.isAllowedInventory,e=e.isAllowedSmartRules;return t&&e}),A.canAddRules=e.then(function(e){return A.canAddRules=e,A.canAddRules}),n=!1),n}function G(t){A.rules=A.rules||{};var n=A.rules,e=n[t.id];return _.isUndefined(e)&&(n[t.id]=c.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1),e}function L(e){var t=!0;return t=x.context!==s.CONTEXT.DEVICE&&x.context!==s.CONTEXT.GROUP?t:t&&e&&"c8y_SmartRule"!==e.type}_.assign(i,{isOpen:{},moId:S,loadingStatus:R,refresh:b,paging:{refresh:b},ruleTemplates:C,getLinkToDM:function(){var e={deviceId:S};return t(p||"")(e)},add:function(){g.addNewWithUI().then(b)},edit:function(e){g.editWithUI(e).then(b)},clone:function(e){var t=e&&e.c8y_Context&&e.c8y_Context.id;(t?g.cloneWithUI(e,t,!0):g.cloneWithUI(e)).then(b)},remove:function(e){u({title:m("Delete smart rule"),body:v.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:m("Delete")},status:"danger"}).then(angular.bind(g,g.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return l.success(m("Smart rule deleted."))})},hasSource:O,getChildrenEnabledForSmartRule:M,toggleRuleActivationForContextMO:function(e){if(O(e))return g.deactivate(e,S,!1).then(function(){l.success(v.getString('Smart rule "{{name}}" deactivated.',e))});return g.activate(e,S,!1).then(function(){l.success(v.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(e,n){var t=_.filter(n,function(t){return!_.find(i.ruleChildren[e.id],function(e){return e.id===t.id})}),r=_.filter(i.ruleChildren[e.id],function(t){return!_.find(n,function(e){return t.id===e.id})});return g.updateSources(e,t,r,!1).then(D).then(w).then(function(){l.success(v.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":m("Activate for this group"),"for device":m("Activate for this device"),"for object":m("Activate for this object")},deactivate:{"for group":m("Deactivate for this group"),"for device":m("Deactivate for this device"),"for object":m("Deactivate for this object")}},e=e.enabled&&O(e)?"deactivate":"activate",n=r.groupId?s.CONTEXT.GROUP:"object";return n=r.deviceId?s.CONTEXT.DEVICE:n,t[e]["for ".concat(n)]},type:function(e){var t,e=C[e.ruleTemplateName];e&&(t=e.label.full?v.getString(e.label.full):"".concat(v.getString(e.label.input)," ").concat(v.getString(e.label.output)));return t},status:function(e){return y[e.enabled].text},statusIcon:function(e){return y[e.enabled].icon},statusClass:function(e){return y[e.enabled].cls},showTitle:function(){return null!==s.getContext().context},title:E,context:x,inputIcon:function(e){var t,e=C[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=C[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:U,canDuplicate:function(e){return U(e)&&L(e)},canEdit:function(e){return G(e)&&L(e)},canRemove:G,canModify:G,canApplyOnChildren:function(e){return!N(e)},canSeeSection:function(){var e=A.canSeeSection;_.isUndefined(e)&&(A.canSeeSection=(n.checkIfModulesExist(["c8y.cockpit.config"])?f.shouldShowLocalSmartRules():o.when(!1)).then(function(e){return A.canSeeSection=e,A.canSeeSection}),e=!1);return e},isConfigurationGlobalSmartRulesContext:void 0,getRuleCardTitle:function(e){return"c8y_SmartRule"===e.type?m("Global smart rule"):m("Local smart rule")}}),i.isConfigurationGlobalSmartRulesContext=e.path().includes("/rules"),b(),null===s.getContext().context&&d.changeTitle({title:E}),x.context===s.CONTEXT.DEVICE&&n.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){p=e})}e.$inject=["$scope","$routeParams","$location","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();
@@ -1 +1 @@
1
- "use strict";!function(){function e(o,u,i,r,n,a,c,l,t,d,s){var f=i.url("service/smartrule"),h="".concat(f,"/smartrules"),p=["id","self","cepModuleId","lastUpdated","creationTime"],m=["type","cepModuleId","creationTime","lastUpdated"];return{permissionsCfgs:{create:[{anyRole:["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"]},{anyRole:["ROLE_CEP_MANAGEMENT_ADMIN","ROLE_SMARTRULE_ADMIN"]}]},getEmpty:function(e){var e=e||n.getContext(),t={type:"c8y_SmartRule",name:"",enabled:!0,config:{}};e.context&&e.id&&(t.c8y_Context=e,t.type="c8y_PrivateSmartRule");return t},list:function(){return u.get(h).then(i.getResData).then(_.property("rules")).then(v)},listByContext:function(e){return u.get(S({moId:e})).then(i.getResData).then(_.property("rules")).then(v)},detail:function(e){e=y({id:e});return u.get(e).then(i.getResData)},save:function(e,t,n){e=e.id?g(e):function(e,t,n){var r=y(e,!0);return function(e,t,n){return e.ruleTemplateName=t.name,C(e),function(e,t){var n=o.when(e);e.c8y_Context||t.mo?(e.enabledSources=[],e.disabledSources=void 0,n=b(e,t.mo,t.withChildren)):(e.enabledSources=void 0,e.disabledSources=[]);return n}(e,n)}(e,t,n).then(_.partial(u.post,r)).then(i.getResData)}(e,t,n);return e},remove:function(e){e=y(e,!0);return u.delete(e)},hasSource:function(e,t){t=t&&t.id||t;if(!t)return!1;if(e.disabledSources)return!A(e.disabledSources,t);if(e.enabledSources)return A(e.enabledSources,t);return!0},activate:function(e,t,n){return b(e,t,n).then(g)},deactivate:function(e,t,n){return R(e,t,n).then(g)},updateSources:function(e,t,r,u){return function(e,t,n){return t.reduce(function(e,t){return e.then(function(e){return b(e,t,n)})},o.resolve(e))}(e,t,u).then(function(e){return n=u,r.reduce(function(e,t){return e.then(function(e){return R(e,t,n)})},o.resolve(e));var n}).then(g)},addNewWithUI:D,addNewForInputAlarmAndOutputUserWithUI:function(e,t){return D({inputAlarm:e,outputUser:t})},addNewForInputDataPointWithUI:function(e){return D({inputDataPoint:e})},addNewForOutputOperationWithUI:function(e){return D({outputOperation:{template:function(e){return i.cleanFields(e,["id","self","status","deviceId","creationTime","failureReason"])}(e)}})},createInstanceWithUI:N,createInstanceWithUIByName:function(e,t){return l.getTemplateByName(e).then(function(e){return N(e,t)})},editWithUI:function(e,t){return T(e,void 0,t)},cloneWithUI:function(e,t){return c.current().then(_.partial(U,e)).then(function(e){return T(e,void 0,t)})},getRuleModalTitle:E};function v(e){return o.all(_.map(e,function(t){return l.getTemplateForRule(t).then(function(e){return _.isUndefined(e)?null:t})})).then(_.flatten).then(_.filter)}function y(e,t){var n=_.get(e,"c8y_Context.id"),t=t&&n?S({moId:n}):h;return e.id&&(t+="/".concat(e.id)),t}function S(e){return"".concat(f,"/managedObjects/").concat(e.moId,"/smartrules")}function g(e){C(e);var t=y(e,!0),e=i.cleanFields(e,m);return u.put(t,e)}function b(n,e,t){return I(e,t).then(function(e){return _.forEach(e,function(t){_.isArray(n.enabledSources)&&!A(n.enabledSources,t)&&n.enabledSources.push(t),_.isArray(n.disabledSources)&&A(n.disabledSources,t)&&_.remove(n.disabledSources,function(e){return _.toString(e)===_.toString(t)})}),n})}function R(n,e,t){return I(e,t).then(function(e){return _.forEach(e,function(t){_.isArray(n.enabledSources)&&A(n.enabledSources,t)&&_.remove(n.enabledSources,function(e){return _.toString(e)===_.toString(t)}),_.isArray(n.disabledSources)&&!A(n.disabledSources,t)&&n.disabledSources.push(t)}),n})}function I(e,t){var e=e&&e.id||e,n=[];return e&&(n.push(o.when(e)),n.push(function(e,t){var n=[];!0!==t&&!0!==t.assets||n.push(r.childAssets(e));!0!==t&&!0!==t.devices||n.push(r.childDevices(e));return o.all(n).then(_.flattenDeep).then(_.partialRight(_.map,"id"))}(e,t))),o.all(n).then(_.flattenDeep)}function A(e,t){var n=t.id||t;return _.some(e,function(e){return _.toString(e)===_.toString(n)})}function E(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=e.id?"c8y_SmartRule"===e.type?t("Edit global smart rule"):t("Edit local smart rule"):"/rules"===s.path()?t("Add global smart rule"):t("Add local smart rule");return e}function D(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length?arguments[1]:void 0,n=2<arguments.length?arguments[2]:void 0;return a({title:E(),templateUrl:":::PLUGIN_PATH:::/views/add.html",controller:"SmartRuleAddCtrl",ariaLabelledBy:"modal-title",ariaDescribedBy:"modal-body",size:"lg",keyboard:!1,resolve:{context:function(){return _.cloneDeep(e)},ruleInitialObj:function(){return _.cloneDeep(n)},ruleTemplatesFilterFn:function(){return t}}})}function N(e,t){return T(t,e)}function U(e,t){e=_.cloneDeep(e);return(e=i.cleanFields(e,p)).name=d.getString("Duplicate of {{name}}",e),t&&(e.owner=t.id),e}function T(e,t,n){return a({templateUrl:":::PLUGIN_PATH:::/views/edit.html",controller:"SmartRuleEditCtrl",size:"sm",keyboard:!1,resolve:{ruleTemplate:function(){return _.cloneDeep(t)},rule:function(){return _.cloneDeep(e)},contextMoId:function(){return _.cloneDeep(n)}}})}function C(e){e.c8y_Context&&e.c8y_Context.contextData&&delete e.c8y_Context.contextData}}e.$inject=["$q","$http","c8yBase","c8yInventory","c8yUiUtil","c8yModal","c8yUser","smartRuleTemplatesSvc","gettext","gettextCatalog","$location"],angular.module("c8y.smartRules").factory("smartRulesSvc",e)}();
1
+ "use strict";!function(){function e(o,r,u,i,n,a,c,l,t,d,s){var f=u.url("service/smartrule"),h="".concat(f,"/smartrules"),m=["id","self","cepModuleId","lastUpdated","creationTime"],p=["type","cepModuleId","creationTime","lastUpdated"];return{permissionsCfgs:{create:[{anyRole:["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE"]},{anyRole:["ROLE_CEP_MANAGEMENT_ADMIN","ROLE_SMARTRULE_ADMIN"]}]},getEmpty:function(e){var e=e||n.getContext(),t={type:"c8y_SmartRule",name:"",enabled:!0,config:{}};e.context&&e.id&&(t.c8y_Context=e,t.type="c8y_PrivateSmartRule");return t},list:function(){return r.get(h).then(u.getResData).then(_.property("rules")).then(v)},listByContext:function(e){return r.get(g({moId:e})).then(u.getResData).then(_.property("rules")).then(v)},detail:function(e){e=y({id:e});return r.get(e).then(u.getResData)},save:function(e,t,n){e=e.id?S(e):function(e,t,n){return function(e,t,n){n.useMoAsContext&&(e.c8y_Context={id:n.mo.id,context:n.mo.isDevice?"device":"group"});return e.ruleTemplateName=t.name,T(e),function(e,t){var n=o.when(e);e.c8y_Context||t.mo?(e.enabledSources=[],e.disabledSources=void 0,n=b(e,t.mo,t.withChildren)):(e.enabledSources=void 0,e.disabledSources=[]);return n}(e,n)}(e,t,n).then(_.partial(r.post,y(e,!0))).then(u.getResData)}(e,t,n);return e},remove:function(e){e=y(e,!0);return r.delete(e)},hasSource:function(e,t){t=t&&t.id||t;if(!t)return!1;if(e.disabledSources)return!A(e.disabledSources,t);if(e.enabledSources)return A(e.enabledSources,t);return!0},activate:function(e,t,n){return b(e,t,n).then(S)},deactivate:function(e,t,n){return R(e,t,n).then(S)},updateSources:function(e,t,r,u){return function(e,t,n){return t.reduce(function(e,t){return e.then(function(e){return b(e,t,n)})},o.resolve(e))}(e,t,u).then(function(e){return n=u,r.reduce(function(e,t){return e.then(function(e){return R(e,t,n)})},o.resolve(e));var n}).then(S)},addNewWithUI:D,addNewForInputAlarmAndOutputUserWithUI:function(e,t){return D({inputAlarm:e,outputUser:t})},addNewForInputDataPointWithUI:function(e){return D({inputDataPoint:e})},addNewForOutputOperationWithUI:function(e){return D({outputOperation:{template:function(e){return u.cleanFields(e,["id","self","status","deviceId","creationTime","failureReason"])}(e)}})},createInstanceWithUI:C,createInstanceWithUIByName:function(e,t){return l.getTemplateByName(e).then(function(e){return C(e,t)})},editWithUI:function(e,t){return U(e,void 0,t)},cloneWithUI:function(e,t,n){return c.current().then(_.partial(N,e)).then(function(e){return U(e,void 0,t,n)})},getRuleModalTitle:E};function v(e){return o.all(_.map(e,function(t){return l.getTemplateForRule(t).then(function(e){return _.isUndefined(e)?null:t})})).then(_.flatten).then(_.filter)}function y(e,t){var n=_.get(e,"c8y_Context.id"),t=t&&n?g({moId:n}):h;return e.id&&(t+="/".concat(e.id)),t}function g(e){return"".concat(f,"/managedObjects/").concat(e.moId,"/smartrules")}function S(e){T(e);var t=y(e,!0),e=u.cleanFields(e,p);return r.put(t,e)}function b(n,e,t){return I(e,t).then(function(e){return _.forEach(e,function(t){_.isArray(n.enabledSources)&&!A(n.enabledSources,t)&&n.enabledSources.push(t),_.isArray(n.disabledSources)&&A(n.disabledSources,t)&&_.remove(n.disabledSources,function(e){return _.toString(e)===_.toString(t)})}),n})}function R(n,e,t){return I(e,t).then(function(e){return _.forEach(e,function(t){_.isArray(n.enabledSources)&&A(n.enabledSources,t)&&_.remove(n.enabledSources,function(e){return _.toString(e)===_.toString(t)}),_.isArray(n.disabledSources)&&!A(n.disabledSources,t)&&n.disabledSources.push(t)}),n})}function I(e,t){var e=e&&e.id||e,n=[];return e&&(n.push(o.when(e)),n.push(function(e,t){var n=[];!0!==t&&!0!==t.assets||n.push(i.childAssets(e));!0!==t&&!0!==t.devices||n.push(i.childDevices(e));return o.all(n).then(_.flattenDeep).then(_.partialRight(_.map,"id"))}(e,t))),o.all(n).then(_.flattenDeep)}function A(e,t){var n=t.id||t;return _.some(e,function(e){return _.toString(e)===_.toString(n)})}function E(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=e.id?"c8y_SmartRule"===e.type?t("Edit global smart rule"):t("Edit local smart rule"):"/rules"===s.path()?t("Add global smart rule"):t("Add local smart rule");return e}function D(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length?arguments[1]:void 0,n=2<arguments.length?arguments[2]:void 0;return a({title:E(),templateUrl:":::PLUGIN_PATH:::/views/add.html",controller:"SmartRuleAddCtrl",ariaLabelledBy:"modal-title",ariaDescribedBy:"modal-body",size:"lg",keyboard:!1,resolve:{context:function(){return _.cloneDeep(e)},ruleInitialObj:function(){return _.cloneDeep(n)},ruleTemplatesFilterFn:function(){return t}}})}function C(e,t){return U(t,e)}function N(e,t){e=_.cloneDeep(e);return(e=u.cleanFields(e,m)).name=d.getString("Duplicate of {{name}}",e),t&&(e.owner=t.id),e}function U(e,t,n,r){return a({templateUrl:":::PLUGIN_PATH:::/views/edit.html",controller:"SmartRuleEditCtrl",size:"sm",keyboard:!1,resolve:{ruleTemplate:function(){return _.cloneDeep(t)},rule:function(){return _.cloneDeep(e)},contextMoId:function(){return _.clone(n)},isCloned:function(){return _.clone(r)}}})}function T(e){e.c8y_Context&&e.c8y_Context.contextData&&delete e.c8y_Context.contextData}}e.$inject=["$q","$http","c8yBase","c8yInventory","c8yUiUtil","c8yModal","c8yUser","smartRuleTemplatesSvc","gettext","gettextCatalog","$location"],angular.module("c8y.smartRules").factory("smartRulesSvc",e)}();
@@ -37,14 +37,14 @@
37
37
  <c8y-if-allowed any-app="['devicemanagement']">
38
38
  <a
39
39
  class="btn btn-link"
40
- title="{{ 'Open in Device management' | translate }}"
40
+ title="{{ 'Open in Device Management' | translate }}"
41
41
  type="button"
42
42
  target="_blank"
43
43
  rel="noopener noreferrer"
44
44
  ng-href="{{ getLinkToDM() }}"
45
45
  >
46
46
  <i c8y-icon="external-link"></i>
47
- {{ 'Device management' | translate }}
47
+ {{ 'Device Management' | translate }}
48
48
  </a>
49
49
  </c8y-if-allowed>
50
50
  </li>