@c8y/ng1-modules 1018.81.0 → 1018.83.0

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(){function t(t,a,r,e){var i=this,n={required:e.getString("This field is required."),maxlength:e.getString("Up to 120 characters allowed."),url:e.getString("Valid URL required.")},s={type:"HOSTED",resourcesUrl:"https://bitbucket.org/m2m/cumulocity-ui/raw/default/build",resourcesUsername:"afwifawfoijafa",resourcesPassword:"kjijfgknnoippk"};_.assign(i,{host:t.host(),invalid:a.invalidFormOrField,validationHints:_.partialRight(a.validationHints,n),create:function(){var t=_.defaults(i.wizardCtrl.data.smartApp,s);return t.key=[t.path,"appkey",String(Math.random()).substr(2)].join("-"),t.manifest={imports:["core/c8yBranding"]},t.manifest.uiCreated=!0,r.save(t).then(a.getResData).then(function(t){i.wizardCtrl.data.createdApp=t,i.wizardCtrl.goTo("success")})}})}t.$inject=["$location","c8yBase","c8yApplication","gettextCatalog"],angular.module("c8y.parts.applications").component("appWizardSmartAppStep",{require:{wizardCtrl:"^c8yWizardStep"},templateUrl:":::PLUGIN_PATH:::/appWizard/appWizardSmartAppStep.html",controller:t,controllerAs:"vm"})}();
1
+ "use strict";!function(){function t(t,a,r,i){var e=this,n={required:i.getString("This field is required."),maxlength:i.getString("Up to 120 characters allowed."),url:i.getString("Valid URL required.")},p={type:"HOSTED"};_.assign(e,{host:t.host(),invalid:a.invalidFormOrField,validationHints:_.partialRight(a.validationHints,n),create:function(){var t=_.defaults(e.wizardCtrl.data.smartApp,p);return t.key=[t.path,"appkey",String(Math.random()).substr(2)].join("-"),t.manifest={imports:["core/c8yBranding"]},t.manifest.uiCreated=!0,r.save(t).then(a.getResData).then(function(t){e.wizardCtrl.data.createdApp=t,e.wizardCtrl.goTo("success")})}})}t.$inject=["$location","c8yBase","c8yApplication","gettextCatalog"],angular.module("c8y.parts.applications").component("appWizardSmartAppStep",{require:{wizardCtrl:"^c8yWizardStep"},templateUrl:":::PLUGIN_PATH:::/appWizard/appWizardSmartAppStep.html",controller:t,controllerAs:"vm"})}();
@@ -1 +1 @@
1
- "use strict";!function(){function e(c,e,l,r,i,t,n,s,p,a){var o,u=this,d={inProgress:!1,progress:0,label:null,deferred:null,cancelled:!1};function f(e){var t=c.defer();return d.deferred=t,d.cancelled&&t.reject({cancelled:!0}),c.when(e).then(t.resolve,t.reject),t.promise.catch(function(e){var t=e.cancelled;t&&(d.cancelled=t)}),o=function(){_.has(e,"abort")&&e.abort(),d.cancelled=!0,t.reject({cancelled:!0})},t.promise}function g(e,t){return _.head(_.compact(_.at(e,t)))}function h(e){var t=c.resolve();return _.get(u.wizardCtrl.data.chosenMethod,"expectedType")!==e&&(t=c.reject({type:"typeValidation",message:a.getString(u.wizardCtrl.data.chosenMethod.invalidFileTypeMessage)})),t}function v(e){return y(e).then(function(e){return _.get(e,"type")||(_.get(e,"apiVersion")?"MICROSERVICE":"HOSTED")}).catch(function(){return"HOSTED"})}function y(e){return t.getJsonData(e,{filename:"cumulocity.json"})}function m(){d.cancelled=!0,o&&o()}_.assign(u,{processingStatus:d,createAppAndUploadArchive:function(e){var t;return d.inProgress=!0,d.progress=0,d.cancelled=!1,v(e).then(h).then(function(){return function(i){var u={manifest:{},resourcesUrl:"/"};return d.label=p("Creating application"),v(i).then(function(t){return"HOSTED"===t?y(i).catch(function(){return{}}).then(function(e){return{appType:t,appModel:e}}):{appType:t}}).then(function(e){var t=e.appType,n=e.appModel,r=function(e,t,n){var r=_.get(n,"name",e.name.replace(/.zip$/i,""));return"MICROSERVICE"===t&&(r=r.replace(/-\d+\.\d+\.\d+(-SNAPSHOT)?$/,"")),r}(i,t,n),a=function(e){return e.replace(/[^a-zA-Z0-9-_]/g,"")}(r),o=function(e,t){var n=_.get(e,"key");return n||(n="".concat(_.kebabCase(t),"-key")),n}(n,a),c=function(e,t){return _.get(e,"contextPath",t.toLowerCase())}(n,a);return _.assign(u,{type:t,name:r,key:o,contextPath:c})}).then(r.revertType).then(function(e){var t="MICROSERVICE"===e.type?r.save(e).then(l.getResData):r.trySave(e);return"MARKET"===e.availability&&"HOSTED"===e.type?c.all({newApp:t,tenant:s.current()}).then(function(e){var t=e.newApp,n=e.tenant;return s.addApplication({id:n.name},t),t}):t}).finally(function(){d.progress+=10})}(e)}).then(function(e){t=e}).then(function(){return f(function(e){return"MICROSERVICE"===e.type?n({title:p("Subscribe to microservice"),size:"sm",labels:{ok:p("Subscribe"),cancel:p("Don't subscribe")},body:p("You are about to subscribe to the microservice after upload. Do you want to subscribe to it?"),status:"info"}).then(function(){return!0},function(){return!1}).then(function(e){u.activateAfterUpdate=e}):c.resolve()}(t))}).then(function(){return f(function(e,t){d.label=p("Uploading file");var n=r.uploadArchive(e,t,{silentError:!0});return n.progress(function(e){d.progress=10+e.loaded/e.total*90}).then(l.getResData).then(_.partial(r.setActiveArchive,e)).then(function(){return e}),n}(t,e))}).then(function(){return f(function(e){var t=c.resolve();return"MICROSERVICE"===(u.wizardCtrl.data.createdApp=e).type?t=function(a,o){return s.current(!0).then(function(e){var t=e.applications.references,n=t.some(function(e){var t=e.application;return t.id===o.id}),r=c.resolve();return!n&&a?r=s.addApplication(e.name,o,{silentError:!0}).catch(function(e){409===e.status?i.warning(p("Could not subscribe to the microservice because another application with the same context path is already subscribed.")):i.danger(l.getResErrorMessage(e))}):n&&!a&&(r=s.removeApplication(e.name,o)),r})}(u.activateAfterUpdate,u.wizardCtrl.data.createdApp).then(function(){return u.wizardCtrl.goTo("success")}):u.wizardCtrl.goTo("success"),t}(t))}).catch(function(e){t&&r.remove(t,{force:!0}),function(e){"typeValidation"===e.type?i.warning(e.message,e.details):e.cancelled||i.danger(function(e){var t=g(e,["data.message","data.error","errorMessage"])||p("An internal error occurred, try to upload again.");return a.getString(t)}(e),function(e){return g(e,["data.details","errorDetails"])}(e))}(e)}).finally(function(){d.inProgress=!1,d.progress=100})},goTo:function(e){m(),u.wizardCtrl.goTo(e)}}),e.$parent.$on("modal.closing",m),e.$watch(function(){return u.wizardCtrl.getCurrentStep()},function(e){"upload"===_.get(e,"stepId")&&u.wizardCtrl.data.appUpload&&(u.wizardCtrl.data.appUpload.files=[{file:null}])})}e.$inject=["$q","$scope","c8yBase","c8yApplication","c8yAlert","c8yZip","c8yModal","c8yTenant","gettext","gettextCatalog"],angular.module("c8y.parts.applications").component("appWizardUploadStep",{require:{wizardCtrl:"^c8yWizardStep"},templateUrl:":::PLUGIN_PATH:::/appWizard/appWizardUploadStep.html",controller:e,controllerAs:"vm"})}();
1
+ "use strict";!function(){function e(i,e,l,r,c,t,n,s,p,a){var o,u=this,d={inProgress:!1,progress:0,label:null,deferred:null,cancelled:!1};function f(e){var t=i.defer();return d.deferred=t,d.cancelled&&t.reject({cancelled:!0}),i.when(e).then(t.resolve,t.reject),t.promise.catch(function(e){var t=e.cancelled;t&&(d.cancelled=t)}),o=function(){_.has(e,"abort")&&e.abort(),d.cancelled=!0,t.reject({cancelled:!0})},t.promise}function g(e,t){return _.head(_.compact(_.at(e,t)))}function h(e){var t=i.resolve();return _.get(u.wizardCtrl.data.chosenMethod,"expectedType")!==e&&(t=i.reject({type:"typeValidation",message:a.getString(u.wizardCtrl.data.chosenMethod.invalidFileTypeMessage)})),t}function v(e){return y(e).then(function(e){return _.get(e,"type")||(_.get(e,"apiVersion")?"MICROSERVICE":"HOSTED")}).catch(function(){return"HOSTED"})}function y(e){return t.getJsonData(e,{filename:"cumulocity.json"})}function m(){d.cancelled=!0,o&&o()}_.assign(u,{processingStatus:d,createAppAndUploadArchive:function(e){var t;return d.inProgress=!0,d.progress=0,d.cancelled=!1,v(e).then(h).then(function(){return function(c){var u={manifest:{}};return d.label=p("Creating application"),v(c).then(function(t){return"HOSTED"===t?y(c).catch(function(){return{}}).then(function(e){return{appType:t,appModel:e}}):{appType:t}}).then(function(e){var t=e.appType,n=e.appModel,r=function(e,t,n){var r=_.get(n,"name",e.name.replace(/.zip$/i,""));return"MICROSERVICE"===t&&(r=r.replace(/-\d+\.\d+\.\d+(-SNAPSHOT)?$/,"")),r}(c,t,n),a=function(e){return e.replace(/[^a-zA-Z0-9-_]/g,"")}(r),o=function(e,t){var n=_.get(e,"key");return n||(n="".concat(_.kebabCase(t),"-key")),n}(n,a),i=function(e,t){return _.get(e,"contextPath",t.toLowerCase())}(n,a);return _.assign(u,{type:t,name:r,key:o,contextPath:i})}).then(function(e){var t="MICROSERVICE"===e.type?r.save(e).then(l.getResData):r.trySave(e);return"MARKET"===e.availability&&"HOSTED"===e.type?i.all({newApp:t,tenant:s.current()}).then(function(e){var t=e.newApp,n=e.tenant;return s.addApplication({id:n.name},t),t}):t}).finally(function(){d.progress+=10})}(e)}).then(function(e){t=e}).then(function(){return f(function(e){return"MICROSERVICE"===e.type?n({title:p("Subscribe to microservice"),size:"sm",labels:{ok:p("Subscribe"),cancel:p("Don't subscribe")},body:p("You are about to subscribe to the microservice after upload. Do you want to subscribe to it?"),status:"info"}).then(function(){return!0},function(){return!1}).then(function(e){u.activateAfterUpdate=e}):i.resolve()}(t))}).then(function(){return f(function(e,t){d.label=p("Uploading file");var n=r.uploadArchive(e,t,{silentError:!0});return n.progress(function(e){d.progress=10+e.loaded/e.total*90}).then(l.getResData).then(_.partial(r.setActiveArchive,e)).then(function(){return e}),n}(t,e))}).then(function(){return f(function(e){var t=i.resolve();return"MICROSERVICE"===(u.wizardCtrl.data.createdApp=e).type?t=function(a,o){return s.current(!0).then(function(e){var t=e.applications.references,n=t.some(function(e){var t=e.application;return t.id===o.id}),r=i.resolve();return!n&&a?r=s.addApplication(e.name,o,{silentError:!0}).catch(function(e){409===e.status?c.warning(p("Could not subscribe to the microservice because another application with the same context path is already subscribed.")):c.danger(l.getResErrorMessage(e))}):n&&!a&&(r=s.removeApplication(e.name,o)),r})}(u.activateAfterUpdate,u.wizardCtrl.data.createdApp).then(function(){return u.wizardCtrl.goTo("success")}):u.wizardCtrl.goTo("success"),t}(t))}).catch(function(e){t&&r.remove(t,{force:!0}),function(e){"typeValidation"===e.type?c.warning(e.message,e.details):e.cancelled||c.danger(function(e){var t=g(e,["data.message","data.error","errorMessage"])||p("An internal error occurred, try to upload again.");return a.getString(t)}(e),function(e){return g(e,["data.details","errorDetails"])}(e))}(e)}).finally(function(){d.inProgress=!1,d.progress=100})},goTo:function(e){m(),u.wizardCtrl.goTo(e)}}),e.$parent.$on("modal.closing",m),e.$watch(function(){return u.wizardCtrl.getCurrentStep()},function(e){"upload"===_.get(e,"stepId")&&u.wizardCtrl.data.appUpload&&(u.wizardCtrl.data.appUpload.files=[{file:null}])})}e.$inject=["$q","$scope","c8yBase","c8yApplication","c8yAlert","c8yZip","c8yModal","c8yTenant","gettext","gettextCatalog"],angular.module("c8y.parts.applications").component("appWizardUploadStep",{require:{wizardCtrl:"^c8yWizardStep"},templateUrl:":::PLUGIN_PATH:::/appWizard/appWizardUploadStep.html",controller:e,controllerAs:"vm"})}();
@@ -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(){function t(n,e,i,a,t,o,r,c,l){var p=this,s="applicationForm",u="subscribedApplications",f={required:c.getString("This field is required."),maxlength:c.getString("Up to 120 characters allowed."),url:c.getString("Valid URL required.")};function d(t){p.application=a.convertType(t),_.isUndefined(p.application.manifest)||("PER_TENANT"===p.application.manifest.isolation&&(p.singleTenant=!0),"SUBSCRIPTION"===p.application.manifest.billingMode&&(p.subscription=!0))}function y(t){l.success(r("Application saved.")),p.isNew?n.path("/applications/".concat(t.id)):e.reload()}function h(t){p.tenant=t.tenant}function b(){return p.basePath===u}_.assign(p,{$onInit:function(){(function(){var t=i.applicationId;t?a.detail(t).then(function(t){return t.data}).then(d).then(a.typeLabel):(p.isNew=!0,d({}))})(),t.current().then(h)},icon:a.icon,typeLabel:a.typeLabel,invalid:angular.bind(o,o.invalid,p,"applicationForm"),validationHints:function(e){var i=[];p[s][e]&&p[s][e].$error&&_.forEach(p[s][e].$error,function(t,n){t&&(_.isUndefined(f[n])||("object"===_typeof(f[n])?f[n][e]&&i.push(f[n][e]):i.push(f[n])))});return i.join(" ")},save:function(t){var n=_.cloneDeep(t);n.manifest||(n.manifest={});var e=n.type;"HOSTED"===e&&(n.resourcesUrl="/");n=a.revertType(n);var i=a.save(n).then(o.getResData);"HOSTED"===e&&p.file&&(i=i.then(function(t){return n=t,a.uploadArchive(n,p.file)}).then(o.getResData).then(function(t){return a.save(_.assign(n,{activeVersionId:t.id})).then(o.getResData)}));return i.then(y)},cancel:function(){n.path("applications")},onFileSelect:function(t){t.length&&(p.file=t[0])},host:n.host(),breadcrumbsLabel:function(){return b()?r("Subscribed applications"):r("Own applications")},isPlatformApplicationBasePath:b})}t.$inject=["$location","$route","$routeParams","c8yApplication","c8yUser","c8yBase","gettext","gettextCatalog","c8yAlert"],angular.module("c8y.parts.applications").component("c8yApplicationDetail",{bindings:{basePath:"@"},templateUrl:":::PLUGIN_PATH:::/application-detail/application-detail.html",controller:t,controllerAs:"vm"})}();
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(){function t(n,i,e,a,t,o,c,r,l){var p=this,s="applicationForm",u="subscribedApplications",f={required:r.getString("This field is required."),maxlength:r.getString("Up to 120 characters allowed."),url:r.getString("Valid URL required.")};function d(t){p.application=t,_.isUndefined(p.application.manifest)||("PER_TENANT"===p.application.manifest.isolation&&(p.singleTenant=!0),"SUBSCRIPTION"===p.application.manifest.billingMode&&(p.subscription=!0))}function h(t){l.success(c("Application saved.")),p.isNew?n.path("/applications/".concat(t.id)):i.reload()}function y(t){p.tenant=t.tenant}function b(){return p.basePath===u}_.assign(p,{$onInit:function(){(function(){var t=e.applicationId;t?a.detail(t).then(function(t){return t.data}).then(d).then(a.typeLabel):(p.isNew=!0,d({}))})(),t.current().then(y)},icon:a.icon,typeLabel:a.typeLabel,invalid:angular.bind(o,o.invalid,p,"applicationForm"),validationHints:function(i){var e=[];p[s][i]&&p[s][i].$error&&_.forEach(p[s][i].$error,function(t,n){t&&(_.isUndefined(f[n])||("object"===_typeof(f[n])?f[n][i]&&e.push(f[n][i]):e.push(f[n])))});return e.join(" ")},save:function(t){var n=_.cloneDeep(t);n.manifest||(n.manifest={});var i=n.type,e=a.save(n).then(o.getResData);"HOSTED"===i&&p.file&&(e=e.then(function(t){return n=t,a.uploadArchive(n,p.file)}).then(o.getResData).then(function(t){return a.save(_.assign(n,{activeVersionId:t.id})).then(o.getResData)}));return e.then(h)},cancel:function(){n.path("applications")},onFileSelect:function(t){t.length&&(p.file=t[0])},host:n.host(),breadcrumbsLabel:function(){return b()?c("Subscribed applications"):c("Own applications")},isPlatformApplicationBasePath:b})}t.$inject=["$location","$route","$routeParams","c8yApplication","c8yUser","c8yBase","gettext","gettextCatalog","c8yAlert"],angular.module("c8y.parts.applications").component("c8yApplicationDetail",{bindings:{basePath:"@"},templateUrl:":::PLUGIN_PATH:::/application-detail/application-detail.html",controller:t,controllerAs:"vm"})}();
@@ -1 +1 @@
1
- "use strict";!function(){function n(i,t,n){var o=this,r=n.applicationId;function e(n){o.application=t.convertType(n),o.requiredRoles=a(o.application.requiredRoles),o.roles=a(o.application.roles)}function a(n){return i.convertServerPermissionsToUI(_.map(n,function(n){return{id:n}}))}_.assign(o,{$onInit:function(){t.detail(r).then(function(n){return n.data}).then(e)}})}n.$inject=["c8yPermissions","c8yApplication","$routeParams"],angular.module("c8y.parts.applications").controller("permissionsCtrl",n)}();
1
+ "use strict";!function(){function n(i,n,t){var o=this,r=t.applicationId;function e(n){o.application=n,o.requiredRoles=a(o.application.requiredRoles),o.roles=a(o.application.roles)}function a(n){return i.convertServerPermissionsToUI(_.map(n,function(n){return{id:n}}))}_.assign(o,{$onInit:function(){n.detail(r).then(function(n){return n.data}).then(e)}})}n.$inject=["c8yPermissions","c8yApplication","$routeParams"],angular.module("c8y.parts.applications").controller("permissionsCtrl",n)}();
@@ -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 _objectSpread(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.forEach(function(t){_defineProperty(n,t,e[t])})}return n}function _defineProperty(t,n,e){return(n=_toPropertyKey(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function _toPropertyKey(t){var n=_toPrimitive(t,"string");return"symbol"===_typeof(n)?n:String(n)}function _toPrimitive(t,n){if("object"!==_typeof(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);var r=e.call(t,n||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(c,u,e,p,o,t,l,s,n,f,r,g,h,d,i,m){var v,a=i("humanizeAppName"),y="application/",S="".concat(y,"applications"),E={headers:f.contentHeaders("application",!0)},b=this,A={HOSTED:"cloud",EXTERNAL:"external-link",SMARTAPP:"puzzle-piece",MICROSERVICE:"microchip",APAMA_CEP_RULE:"file-code-o"},P=["HOSTED","EXTERNAL","REPOSITORY"],O=["HOSTED","EXTERNAL","REPOSITORY"],x={HOSTED:d("Hosted application"),REPOSITORY:d("Repository"),EXTERNAL:d("External application"),MICROSERVICE:d("Microservice"),APAMA_CEP_RULE:d("Apama CEP rule")},D=f.createEnum([{name:"UP",label:d("Up"),value:"Up",icon:"check-circle text-success"},{name:"DOWN",label:d("Down"),value:"Down",icon:"warning status critical"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealth",icon:"exclamation-circle status major"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealthy",icon:"exclamation-circle status major"}]),R=1e3,C=10;try{v=n.get("gettextCatalog")}catch(t){v={getString:_.identity}}function w(c,o){return r.current().then(function(t){var n=t.tenant,e=f.pageSizeFilter(o),r={params:e},i="".concat(f.url(c),"/").concat(n),a=f.cleanListCallback("applications",angular.bind(b,w,c),e);return u.get(i,r).then(a).then(rt).then(M)})}function T(t){var n=t.desired,e=t.active;return{active:e,unhealthy:function(t,n){return _.isNumber(n)?t-n:t}(n,e),desired:n}}function j(c,o){return r.current().then(function(t){var n=c||t,e=f.pageSizeFilter(o),r={params:_.defaults(e,{noPaging:!0,dropOverwrittenApps:!0})},i=f.url("".concat(y,"applicationsByUser/").concat(encodeURIComponent(n.id))),a=f.cleanListCallback("applications",angular.bind(b,j,n),e);return u.get(i,r).then(a).then(rt).then(M)})}function M(t){var n=_.sortBy(t,[function(t){return a(t)}]);return _.assign(n,_.pick(t,["statistics","paging"])),n}function L(t){return w("".concat(y,"applicationsByTenant"),t)}function U(t){var n=f.url("".concat(S,"/").concat(t.contextPath,"/manifest")),e={params:f.pageSizeNoTotalFilter()};return u.get(n,e).then(function(t){return _.map(t.data.imports,k)})}function N(t){var n=N.cache,e=t.id||t,r=f.url("".concat(S,"/").concat(e,"/binaries/plugins")),i={params:f.pageSizeNoTotalFilter()};function a(){delete n[e]}return n[e]||(n[e]=l(_.noop,2e3).then(function(){return u.get(r,i).then(f.getResData).finally(a)})),n[e]}function k(t){return{id:t.id,contextPath:t.rootContextPath,directoryName:t.directoryName,manifest:t}}function I(t){var n=t.id||t;return f.url("".concat(S,"/").concat(n))}function B(t){var n=I(t);return u.get(n)}function H(n,t){var e=I(n),r=function(t){var n=_.cloneDeep(t);return delete n.type,n}(n),i=_.defaults(t||{},E),a=u.put(e,r,i).finally(function(){o.localStorage.setItem("refresh",n.contextPath)});return a.then(function(t){c.$emit("c8yApplication:update",{app:n,res:t})}),a}function F(n,t){var e=f.url(S),r=_.defaults(t||{},E),i=u.post(e,n,r);return i.then(function(t){return c.$emit("c8yApplication:create",{app:n,res:t})}).catch(function(){s.error("Could not emit c8yApplication:create for:",{app:n})}),i}function $(t,n){return t.id?H(t,n):F(t,n)}function z(i){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0,c=C,o=n||p.defer(),u=t||0,e=0===u?"":"-".concat(u);return $(function(t,n){var e=function(t){return"".concat(t).concat(n)};return _objectSpread({},t,{name:e(t.name),key:e(t.key),contextPath:e(t.contextPath)})}(i,e),_objectSpread({silentError:!0},a)).then(function(t){o.resolve(f.getResData(t))},function(t){if(409===t.status&&u<c)z(i,a,u+1,o);else{var n=_.get(t,"data.message")||_.get(t,"data.details.exceptionMessage"),e=n?v.getString(n):d("Could not create application."),r=t.data;o.reject({errorMessage:e,errorDetails:r})}}),o.promise}function Y(r){var t=B(r).then(f.getResData);return p.all({appDetails:t,appPlugins:t.then(N).then(q),appManifest:t.then(V),appIndex:t.then(J)}).then(function(t){t.appDetails;var n=t.appPlugins,e=t.appManifest,r=t.appIndex,i=function(n,t){return _(t.imports).map(function(t){return _.find(n,{pluginName:t})}).compact().concat(n).uniq().value()}(n,e);return p.all({newAppManifest:function(t,n){var e=_.cloneDeep(n);return e.imports=_.map(t,"pluginName"),e}(i,e),newAppIndex:function(t,n,e){var r=e;return r=function(t,n,e){var r=e,i=_(n).map(function(t){var n=_.get(t,"pluginPackage.css",[]);return!!(n=n.length?n:_.get(t,"pluginPackage.less",[])).length&&"".concat(t.pluginName,"/style.css")}).filter(_.identity).value(),a=_.flattenDeep(["\x3c!--MODULES_CSS--\x3e",_.map(i.slice(0,1),function(t){return'<link rel="stylesheet" href="'.concat(t,'"></link>')}),"\x3c!--/MODULES_CSS--\x3e"]).join("\n"),c=_.flattenDeep(["\x3c!--MODULES_CSS_DEFER--\x3e","<script>",["[",'"'.concat(i.slice(1).join('", "'),'"'),"].forEach(function(f){loadCSS(f)})"].join(""),"<\/script>","\x3c!--/MODULES_CSS_DEFER--\x3e"]).join("\n");return r=(r=r.replace(new RegExp("\x3c!--MODULES_CSS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS--\x3e","gm"),a)).replace(new RegExp("\x3c!--MODULES_CSS_DEFER--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS_DEFER--\x3e","gm"),c)}(0,n,r),r=function(t,n,e){var r=_.flattenDeep(["\x3c!--MODULES_JS--\x3e",_(n).map(function(t){var n=_.get(t,"pluginPackage.js",[]);return!!n.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"),r)}(0,n,r),r=function(t,n,e){var r=['C8Y_NG_MODULES=["',_.uniq(_.flattenDeep(_.map(n,function(t){return _.get(t,"pluginPackage.ngModules",[])}))).join('","'),'"];'].join("");return e.replace(new RegExp("C8Y_NG_MODULES=\\[(.|\\n|\\r)*?\\];","gm"),r)}(0,n,r)}(0,i,r)})}).then(function(t){var n=t.newAppManifest,e=t.newAppIndex;return X(r,[{path:"cumulocity.json",file:new Blob([JSON.stringify(n)],{type:"application/json"})},{path:"index.html",file:new Blob([e],{type:"text/html"})}])})}function q(t){var n=[],e=_.sortBy(t,function(t){return-1*_.get(t,"pluginPackage.priority",0)});return _.forEach(e,function(t){!function e(t,r,i){var n=K(r,_.get(t,"pluginPackage.contextPath"));if(n)return;var a=_.get(t,"pluginPackage.imports",[]);_.forEach(a,function(t){var n=K(i,t);n?e(n,r,i):s.error("Plugin with context path ".concat(t," is missing."))});r.push(t)}(t,n,e)}),n}function K(t,n){var e=function(t){var n=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)})(n)&&(n=n.replace(/\//g,"_"));return n}(n);return _.find(t,function(t){return t&&t.pluginPackage&&t.pluginPackage.contextPath===e})}function V(t){var n="".concat(W(t),"/cumulocity.json");return u.get(n).then(f.getResData)}function J(t){var n="".concat(W(t),"/index.html");return u.get(n).then(f.getResData)}function W(t){return f.url("apps/".concat(t.contextPath))}function X(t,n){var e="".concat(I(t),"/binaries/files"),r=new FormData;return _.forEach(n,function(t){r.append(t.path,new File([t.file],t.path))}),u.post(e,r,{transformRequest:_.identity,headers:{"Content-Type":void 0}})}function G(){var t=o.location.pathname.match(/\/apps\/(public\/){0,1}(.+?)(\/|\?|#|$)/);return t&&t[2]}function Q(){var t=o.location.pathname.match(/\/apps\/(public\/([^/]+)|([^/]+))/);return t&&-1!==t[1].indexOf("public")}function Z(){var e=G(),r=!!Q();function n(t){var n="MARKET"===t.availability;return t.contextPath===e&&(!r||n)}return j(null,{dropOverwrittenApps:!1}).then(function(t){return _.find(t,n)})}function tt(n){return g.list({type:"c8y_SmartAppApplication"}).then(function(t){return _.find(t,{appId:n.id})||null})}function nt(t){var n;return(t?p.resolve(t):Z()).then(function(t){return n=t}).then(tt).then(function(t){return n.config=t,n})}function et(t){return _(t).uniq("id").filter(function(t){var n=t.manifest,e=!1;return n&&(e=n.noAppSwitcher),!e&&_.includes(["HOSTED","EXTERNAL"],t.type)}).value()}function rt(t){var n=_.reject(t,function(t){return"management"===t.name&&"management"===t.owner.tenant.id});return _.assign(n,_.pick(t,_.filter(_.keys(t),function(t){return _.isNaN(_.toNumber(t))}))),n}function it(t,n){var e=_.isString(n)?function(n){return function(t){return t.name===n||t.contextPath===n||t.key===n}}(n):n;return _.some(t,e)}function at(t){return"HOSTED"===t.type||"REPOSITORY"===t.type}function ct(){if(ct.cache)return ct.cache;function n(t){return{url:t,noAppKey:!0}}return u(n([f.url(S),(Q()?"public/":"")+G(),"manifest"].join("/"))).then(function(t){return u(n([f.url(S),t.data.application.id].join("/")))}).then(f.getResData).then(function(t){return ct.cache=p.when(t)})}return N.cache={},f.getFlag("test")&&(ct.cache=p.when({name:"app",manifest:{}})),{list:L,listByUser:j,listByTenant:L,listByOwner:function(t){return w("".concat(y,"applicationsByOwner"),t)},listPlugins:function(){var t=f.url("".concat(y,"plugins")),n={params:{pageSize:R}};return u.get(t,n).then(function(t){return _.uniqBy(t.data.plugins,"id")})},listPluginsByTenant:function(){return L().then(function(t){var n=_.uniqBy(t,"id"),e=[];return _.forEach(n,function(t){at(t)&&e.push(U(t))}),p.all(e).then(_.flattenDeep).then(function(t){return _.uniqBy(t,"id")})})},listPluginsByApplication:U,listPluginsByPaasApp:N,listByVisibleLinks:function(){return j().then(et).then(function(t){return p.when(t)})},listApplications:function t(n){var e=f.url("".concat(S)),r={params:f.pageSizeFilter(n)},i=f.cleanListCallback("applications",t,n);return u.get(e,r).then(i).then(M)},getApplicationMO:function(t){var n="c8y_Application_".concat(t);return g.list({type:n}).then(function(t){return _.head(t)})},getApplicationMOs:function(t){var n=t||{},e=n.tenantId,r=n.filters,i=void 0===r?{}:r,a={type:"c8y_Application_*"};return e&&(a=m.addAndFilter(a,{__has:"c8y_Subscriptions.".concat(e)})),g.listQuery(a,i,!0)},getInstanceCounts:T,getSubscriptionsList:function(t){var n=_.get(t,"c8y_Subscriptions");return _.reduce(n,function(t,n,e){var r=_.get(n,"details"),i=_.get(n,"status"),a=T(r);return t.concat(_objectSpread({},a,{tenantName:e,status:i}))},[])},getApplicationStatusForTenant:function(t,n){return _.get(t,["c8y_Subscriptions",n])},status:D,isAvailable:function(n){return j().then(function(t){return it(t,n)})},areAllAvailable:function(t){return j().then(function(n){return _.every(t,function(t){return it(n,t)})})},isAnyAvailable:function(t){return j().then(function(n){return _.some(t,function(t){return it(n,t)})})},detail:B,update:H,create:F,remove:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=I(e),r=nt(_.isObjectLike(e)?e:{id:e}).then(function(t){return!_.get(t,"config.id")||g.remove(t.config)}),i=u.delete(n,{params:t}),a=p.all({cfg:r,res:i});return a.then(function(t){var n=t.res;c.$emit("c8yApplication:delete",{app:e,res:n})}),a},save:$,trySave:z,clone:function(t,n){var e="".concat(I(t),"/clone");return u.post(e).then(f.getResData).then(function(t){return _.isObjectLike(n)?(_.assign(t,n),z(t).then(f.getResData)):t})},getHref:function(t){return at(t)?function(t){var n=e.port();return n=80===n||443===n?"":":".concat(n),"".concat(e.protocol(),"://").concat(e.host()).concat(n,"/apps/").concat(t.public?"public/":"").concat(t.contextPath)}(t):t.externalUrl},isHosted:function(t){return"HOSTED"===t.type},isApamaCepRule:function(t){return"APAMA_CEP_RULE"===_.get(t,"type")},isMicroserviceWithManifest:function(n){return g.list({type:"c8y_microservice_manifest_".concat(n.id)}).then(function(t){return"MICROSERVICE"===n.type&&0<t.length})},canOpenInBrowser:function(t){return(_.isObjectLike(t)?p.resolve(t):B(t).then(f.getResData)).then(function(t){var n=!t.name.match(/feature-/),e=_.includes(P,t.type);return n&&e})},canAddPlugin:function(t){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),(_.isObjectLike(t)?p.resolve(t):B(t).then(function(t){return t.data})).then(function(t){return!_.isEmpty(t.manifest)&&_.includes(O,_.get(t,"type"))})},icon:function(t){var n=_.isString(t)?t:t.type;return t.manifest&&"MICROSERVICE"!==n&&(n="SMARTAPP"),A[n]},typeLabel:function(t){var n=_.isString(t)?t:t.type;return x[n]},getCurrent:Z,getConfig:nt,pollRefreshMessages:function(){t(function(){!function(t){o.localStorage.getItem("refresh")===G()&&(o.localStorage.setItem("refresh",void 0),t||o.location.reload())}()},1e3,0,!1)},getCurrentContextPath:G,updateManifest:function(t,e){return B(t).then(function(t){var n=t.data;return n.manifest=e,n}).then(H)},listArchives:function(t,n){var e="".concat(I(t),"/binaries"),r={params:f.pageSizeNoTotalFilter(n),silentError:!0};return u.get(e,r).then(f.getResData)},uploadArchive:function(t,n){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r={url:"".concat(I(t),"/binaries"),method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:n,fileName:function(t){return t.replace(/\s+/g,"_")}(n.name)};return _.assign(r,e),h.upload(r)},deleteArchive:function(t,n){var e=n.id||n,r=[I(t),"binaries",e].join("/");return u.delete(r)},setActiveArchive:function(t,n){return $({id:t.id,activeVersionId:n.id})},addPaasAppPlugin:function(t,n){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var e=function(t){var n=t.name.split(".");return n.pop(),n.join(".")}(n),r="".concat(I(t),"/binaries/plugins/").concat(e),i=h.upload({url:r,method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:n}),a=i.then(_.partial(Y,t));return a.progress=i.progress,a},removePaasAppPlugin:function(t,n){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var e=n.pluginName||n,r="".concat(I(t),"/binaries/plugins/").concat(e);return u.delete(r).then(_.partial(Y,t))},uploadPaasAppFiles:X,getPaasAppManifest:V,refreshPaasApp:Y,refreshHostedApp:function(t){var n="".concat(I(t),"/refresh");return u.post(n)},isPaasApp:function(t){return V(t).then(function(t){return t._webpaas},function(){return!1})},convertType:function(t){var n=_.cloneDeep(t);return void 0===n.type||(n.type=function(t){return"HOSTED"===t.type&&t.resourcesUrl&&"/"!==t.resourcesUrl.charAt(0)}(n)?"REPOSITORY":n.type),n},revertType:function(t){var n=_.cloneDeep(t);return"HOSTED"===n.type&&(n.resourcesUrl="/"),"REPOSITORY"===n.type&&(n.type="HOSTED"),n},parseAppName:function(t){var n=t&&t.toLowerCase();return"devicemanagement"===n?"Device management":"digital-twin-manager"===n?"Digital twin manager":t||"Cumulocity"},currentAppCached:ct,sortApps:M,isAppOnTheList:it}}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 _objectSpread(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.forEach(function(t){_defineProperty(n,t,e[t])})}return n}function _defineProperty(t,n,e){return(n=_toPropertyKey(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function _toPropertyKey(t){var n=_toPrimitive(t,"string");return"symbol"===_typeof(n)?n:String(n)}function _toPrimitive(t,n){if("object"!==_typeof(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===n?String:Number)(t);var r=e.call(t,n||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function t(c,u,e,p,o,t,l,s,n,f,r,g,h,d,i,m){var v,a=i("humanizeAppName"),y="application/",S="".concat(y,"applications"),b={headers:f.contentHeaders("application",!0)},E=this,A={HOSTED:"cloud",EXTERNAL:"external-link",SMARTAPP:"puzzle-piece",MICROSERVICE:"microchip",APAMA_CEP_RULE:"file-code-o"},P=["HOSTED","EXTERNAL","REPOSITORY"],x=["HOSTED","EXTERNAL","REPOSITORY"],O={HOSTED:d("Hosted application"),REPOSITORY:d("Repository"),EXTERNAL:d("External application"),MICROSERVICE:d("Microservice"),APAMA_CEP_RULE:d("Apama CEP rule")},D=f.createEnum([{name:"UP",label:d("Up"),value:"Up",icon:"check-circle text-success"},{name:"DOWN",label:d("Down"),value:"Down",icon:"warning status critical"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealth",icon:"exclamation-circle status major"},{name:"UNHEALTHY",label:d("Unhealthy"),value:"Unhealthy",icon:"exclamation-circle status major"}]),R=1e3,C=10;try{v=n.get("gettextCatalog")}catch(t){v={getString:_.identity}}function w(c,o){return r.current().then(function(t){var n=t.tenant,e=f.pageSizeFilter(o),r={params:e},i="".concat(f.url(c),"/").concat(n),a=f.cleanListCallback("applications",angular.bind(E,w,c),e);return u.get(i,r).then(a).then(rt).then(L)})}function j(t){var n=t.desired,e=t.active;return{active:e,unhealthy:function(t,n){return _.isNumber(n)?t-n:t}(n,e),desired:n}}function M(c,o){return r.current().then(function(t){var n=c||t,e=f.pageSizeFilter(o),r={params:_.defaults(e,{noPaging:!0,dropOverwrittenApps:!0})},i=f.url("".concat(y,"applicationsByUser/").concat(encodeURIComponent(n.id))),a=f.cleanListCallback("applications",angular.bind(E,M,n),e);return u.get(i,r).then(a).then(rt).then(L)})}function L(t){var n=_.sortBy(t,[function(t){return a(t)}]);return _.assign(n,_.pick(t,["statistics","paging"])),n}function T(t){return w("".concat(y,"applicationsByTenant"),t)}function U(t){var n=f.url("".concat(S,"/").concat(t.contextPath,"/manifest")),e={params:f.pageSizeNoTotalFilter()};return u.get(n,e).then(function(t){return _.map(t.data.imports,k)})}function N(t){var n=N.cache,e=t.id||t,r=f.url("".concat(S,"/").concat(e,"/binaries/plugins")),i={params:f.pageSizeNoTotalFilter()};function a(){delete n[e]}return n[e]||(n[e]=l(_.noop,2e3).then(function(){return u.get(r,i).then(f.getResData).finally(a)})),n[e]}function k(t){return{id:t.id,contextPath:t.rootContextPath,directoryName:t.directoryName,manifest:t}}function I(t){var n=t.id||t;return f.url("".concat(S,"/").concat(n))}function B(t){var n=I(t);return u.get(n)}function F(n,t){var e=I(n),r=function(t){var n=_.cloneDeep(t);return delete n.type,n}(n),i=_.defaults(t||{},b),a=u.put(e,r,i).finally(function(){o.localStorage.setItem("refresh",n.contextPath)});return a.then(function(t){c.$emit("c8yApplication:update",{app:n,res:t})}),a}function H(n,t){var e=f.url(S),r=_.defaults(t||{},b),i=u.post(e,n,r);return i.then(function(t){return c.$emit("c8yApplication:create",{app:n,res:t})}).catch(function(){s.error("Could not emit c8yApplication:create for:",{app:n})}),i}function $(t,n){return t.id?F(t,n):H(t,n)}function z(i){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0,c=C,o=n||p.defer(),u=t||0,e=0===u?"":"-".concat(u);return $(function(t,n){var e=function(t){return"".concat(t).concat(n)};return _objectSpread({},t,{name:e(t.name),key:e(t.key),contextPath:e(t.contextPath)})}(i,e),_objectSpread({silentError:!0},a)).then(function(t){o.resolve(f.getResData(t))},function(t){if(409===t.status&&u<c)z(i,a,u+1,o);else{var n=_.get(t,"data.message")||_.get(t,"data.details.exceptionMessage"),e=n?v.getString(n):d("Could not create application."),r=t.data;o.reject({errorMessage:e,errorDetails:r})}}),o.promise}function q(r){var t=B(r).then(f.getResData);return p.all({appDetails:t,appPlugins:t.then(N).then(Y),appManifest:t.then(V),appIndex:t.then(J)}).then(function(t){t.appDetails;var n=t.appPlugins,e=t.appManifest,r=t.appIndex,i=function(n,t){return _(t.imports).map(function(t){return _.find(n,{pluginName:t})}).compact().concat(n).uniq().value()}(n,e);return p.all({newAppManifest:function(t,n){var e=_.cloneDeep(n);return e.imports=_.map(t,"pluginName"),e}(i,e),newAppIndex:function(t,n,e){var r=e;return r=function(t,n,e){var r=e,i=_(n).map(function(t){var n=_.get(t,"pluginPackage.css",[]);return!!(n=n.length?n:_.get(t,"pluginPackage.less",[])).length&&"".concat(t.pluginName,"/style.css")}).filter(_.identity).value(),a=_.flattenDeep(["\x3c!--MODULES_CSS--\x3e",_.map(i.slice(0,1),function(t){return'<link rel="stylesheet" href="'.concat(t,'"></link>')}),"\x3c!--/MODULES_CSS--\x3e"]).join("\n"),c=_.flattenDeep(["\x3c!--MODULES_CSS_DEFER--\x3e","<script>",["[",'"'.concat(i.slice(1).join('", "'),'"'),"].forEach(function(f){loadCSS(f)})"].join(""),"<\/script>","\x3c!--/MODULES_CSS_DEFER--\x3e"]).join("\n");return r=(r=r.replace(new RegExp("\x3c!--MODULES_CSS--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS--\x3e","gm"),a)).replace(new RegExp("\x3c!--MODULES_CSS_DEFER--\x3e(.|\\n|\\r)*\x3c!--\\/MODULES_CSS_DEFER--\x3e","gm"),c)}(0,n,r),r=function(t,n,e){var r=_.flattenDeep(["\x3c!--MODULES_JS--\x3e",_(n).map(function(t){var n=_.get(t,"pluginPackage.js",[]);return!!n.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"),r)}(0,n,r),r=function(t,n,e){var r=['C8Y_NG_MODULES=["',_.uniq(_.flattenDeep(_.map(n,function(t){return _.get(t,"pluginPackage.ngModules",[])}))).join('","'),'"];'].join("");return e.replace(new RegExp("C8Y_NG_MODULES=\\[(.|\\n|\\r)*?\\];","gm"),r)}(0,n,r)}(0,i,r)})}).then(function(t){var n=t.newAppManifest,e=t.newAppIndex;return X(r,[{path:"cumulocity.json",file:new Blob([JSON.stringify(n)],{type:"application/json"})},{path:"index.html",file:new Blob([e],{type:"text/html"})}])})}function Y(t){var n=[],e=_.sortBy(t,function(t){return-1*_.get(t,"pluginPackage.priority",0)});return _.forEach(e,function(t){!function e(t,r,i){var n=K(r,_.get(t,"pluginPackage.contextPath"));if(n)return;var a=_.get(t,"pluginPackage.imports",[]);_.forEach(a,function(t){var n=K(i,t);n?e(n,r,i):s.error("Plugin with context path ".concat(t," is missing."))});r.push(t)}(t,n,e)}),n}function K(t,n){var e=function(t){var n=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)})(n)&&(n=n.replace(/\//g,"_"));return n}(n);return _.find(t,function(t){return t&&t.pluginPackage&&t.pluginPackage.contextPath===e})}function V(t){var n="".concat(W(t),"/cumulocity.json");return u.get(n).then(f.getResData)}function J(t){var n="".concat(W(t),"/index.html");return u.get(n).then(f.getResData)}function W(t){return f.url("apps/".concat(t.contextPath))}function X(t,n){var e="".concat(I(t),"/binaries/files"),r=new FormData;return _.forEach(n,function(t){r.append(t.path,new File([t.file],t.path))}),u.post(e,r,{transformRequest:_.identity,headers:{"Content-Type":void 0}})}function G(){var t=o.location.pathname.match(/\/apps\/(public\/){0,1}(.+?)(\/|\?|#|$)/);return t&&t[2]}function Q(){var t=o.location.pathname.match(/\/apps\/(public\/([^/]+)|([^/]+))/);return t&&-1!==t[1].indexOf("public")}function Z(){var e=G(),r=!!Q();function n(t){var n="MARKET"===t.availability;return t.contextPath===e&&(!r||n)}return M(null,{dropOverwrittenApps:!1}).then(function(t){return _.find(t,n)})}function tt(n){return g.list({type:"c8y_SmartAppApplication"}).then(function(t){return _.find(t,{appId:n.id})||null})}function nt(t){var n;return(t?p.resolve(t):Z()).then(function(t){return n=t}).then(tt).then(function(t){return n.config=t,n})}function et(t){return _(t).uniq("id").filter(function(t){var n=t.manifest,e=!1;return n&&(e=n.noAppSwitcher),!e&&_.includes(["HOSTED","EXTERNAL"],t.type)}).value()}function rt(t){var n=_.reject(t,function(t){return"management"===t.name&&"management"===t.owner.tenant.id});return _.assign(n,_.pick(t,_.filter(_.keys(t),function(t){return _.isNaN(_.toNumber(t))}))),n}function it(t,n){var e=_.isString(n)?function(n){return function(t){return t.name===n||t.contextPath===n||t.key===n}}(n):n;return _.some(t,e)}function at(t){return"HOSTED"===t.type||"REPOSITORY"===t.type}function ct(){if(ct.cache)return ct.cache;function n(t){return{url:t,noAppKey:!0}}return u(n([f.url(S),(Q()?"public/":"")+G(),"manifest"].join("/"))).then(function(t){return u(n([f.url(S),t.data.application.id].join("/")))}).then(f.getResData).then(function(t){return ct.cache=p.when(t)})}return N.cache={},f.getFlag("test")&&(ct.cache=p.when({name:"app",manifest:{}})),{list:T,listByUser:M,listByTenant:T,listByOwner:function(t){return w("".concat(y,"applicationsByOwner"),t)},listPlugins:function(){var t=f.url("".concat(y,"plugins")),n={params:{pageSize:R}};return u.get(t,n).then(function(t){return _.uniqBy(t.data.plugins,"id")})},listPluginsByTenant:function(){return T().then(function(t){var n=_.uniqBy(t,"id"),e=[];return _.forEach(n,function(t){at(t)&&e.push(U(t))}),p.all(e).then(_.flattenDeep).then(function(t){return _.uniqBy(t,"id")})})},listPluginsByApplication:U,listPluginsByPaasApp:N,listByVisibleLinks:function(){return M().then(et).then(function(t){return p.when(t)})},listApplications:function t(n){var e=f.url("".concat(S)),r={params:f.pageSizeFilter(n)},i=f.cleanListCallback("applications",t,n);return u.get(e,r).then(i).then(L)},getApplicationMO:function(t){var n="c8y_Application_".concat(t);return g.list({type:n}).then(function(t){return _.head(t)})},getApplicationMOs:function(t){var n=t||{},e=n.tenantId,r=n.filters,i=void 0===r?{}:r,a={type:"c8y_Application_*"};return e&&(a=m.addAndFilter(a,{__has:"c8y_Subscriptions.".concat(e)})),g.listQuery(a,i,!0)},getInstanceCounts:j,getSubscriptionsList:function(t){var n=_.get(t,"c8y_Subscriptions");return _.reduce(n,function(t,n,e){var r=_.get(n,"details"),i=_.get(n,"status"),a=j(r);return t.concat(_objectSpread({},a,{tenantName:e,status:i}))},[])},getApplicationStatusForTenant:function(t,n){return _.get(t,["c8y_Subscriptions",n])},status:D,isAvailable:function(n){return M().then(function(t){return it(t,n)})},areAllAvailable:function(t){return M().then(function(n){return _.every(t,function(t){return it(n,t)})})},isAnyAvailable:function(t){return M().then(function(n){return _.some(t,function(t){return it(n,t)})})},detail:B,update:F,create:H,remove:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=I(e),r=nt(_.isObjectLike(e)?e:{id:e}).then(function(t){return!_.get(t,"config.id")||g.remove(t.config)}),i=u.delete(n,{params:t}),a=p.all({cfg:r,res:i});return a.then(function(t){var n=t.res;c.$emit("c8yApplication:delete",{app:e,res:n})}),a},save:$,trySave:z,clone:function(t,n){var e="".concat(I(t),"/clone");return u.post(e).then(f.getResData).then(function(t){return _.isObjectLike(n)?(_.assign(t,n),z(t).then(f.getResData)):t})},getHref:function(t){return at(t)?function(t){var n=e.port();return n=80===n||443===n?"":":".concat(n),"".concat(e.protocol(),"://").concat(e.host()).concat(n,"/apps/").concat(t.public?"public/":"").concat(t.contextPath)}(t):t.externalUrl},isHosted:function(t){return"HOSTED"===t.type},isApamaCepRule:function(t){return"APAMA_CEP_RULE"===_.get(t,"type")},isMicroserviceWithManifest:function(n){return g.list({type:"c8y_microservice_manifest_".concat(n.id)}).then(function(t){return"MICROSERVICE"===n.type&&0<t.length})},canOpenInBrowser:function(t){return(_.isObjectLike(t)?p.resolve(t):B(t).then(f.getResData)).then(function(t){var n=!t.name.match(/feature-/),e=_.includes(P,t.type);return n&&e})},canAddPlugin:function(t){return console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications."),(_.isObjectLike(t)?p.resolve(t):B(t).then(function(t){return t.data})).then(function(t){return!_.isEmpty(t.manifest)&&_.includes(x,_.get(t,"type"))})},icon:function(t){var n=_.isString(t)?t:t.type;return t.manifest&&"MICROSERVICE"!==n&&(n="SMARTAPP"),A[n]},typeLabel:function(t){var n=_.isString(t)?t:t.type;return O[n]},getCurrent:Z,getConfig:nt,pollRefreshMessages:function(){t(function(){!function(t){o.localStorage.getItem("refresh")===G()&&(o.localStorage.setItem("refresh",void 0),t||o.location.reload())}()},1e3,0,!1)},getCurrentContextPath:G,updateManifest:function(t,e){return B(t).then(function(t){var n=t.data;return n.manifest=e,n}).then(F)},listArchives:function(t,n){var e="".concat(I(t),"/binaries"),r={params:f.pageSizeNoTotalFilter(n),silentError:!0};return u.get(e,r).then(f.getResData)},uploadArchive:function(t,n){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r={url:"".concat(I(t),"/binaries"),method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:n,fileName:function(t){return t.replace(/\s+/g,"_")}(n.name)};return _.assign(r,e),h.upload(r)},deleteArchive:function(t,n){var e=n.id||n,r=[I(t),"binaries",e].join("/");return u.delete(r)},setActiveArchive:function(t,n){return $({id:t.id,activeVersionId:n.id})},addPaasAppPlugin:function(t,n){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var e=function(t){var n=t.name.split(".");return n.pop(),n.join(".")}(n),r="".concat(I(t),"/binaries/plugins/").concat(e),i=h.upload({url:r,method:"POST",headers:{Content:"multipart/form-data",Accept:"application/json"},file:n}),a=i.then(_.partial(q,t));return a.progress=i.progress,a},removePaasAppPlugin:function(t,n){console.warning("This method is now deprecated. Consider using Web SDK to customize and extend applications.");var e=n.pluginName||n,r="".concat(I(t),"/binaries/plugins/").concat(e);return u.delete(r).then(_.partial(q,t))},uploadPaasAppFiles:X,getPaasAppManifest:V,refreshPaasApp:q,refreshHostedApp:function(t){var n="".concat(I(t),"/refresh");return u.post(n)},isPaasApp:function(t){return V(t).then(function(t){return t._webpaas},function(){return!1})},parseAppName:function(t){var n=t&&t.toLowerCase();return"devicemanagement"===n?"Device management":"digital-twin-manager"===n?"Digital twin manager":t||"Cumulocity"},currentAppCached:ct,sortApps:L,isAppOnTheList:it}}t.$inject=["$rootScope","$http","$location","$q","$window","$interval","$timeout","$log","$injector","c8yBase","c8yUser","c8yInventory","$upload","gettext","$filter","c8yQueriesUtil"],angular.module("c8y.core").factory("c8yApplication",t)}();
@@ -1 +1 @@
1
- "use strict";!function(){function n(n,t,o,c){var e="public-options";return{save:function(r){var i=u();return a().then(function(n){var t=Object.assign(n,r),e=[function(n){var t=JSON.stringify(n),e=new Blob([t],{type:"application/json"});return c([e],"options.json")}(function(n){return _.pickBy(n,function(n){return!_.isEmpty(n)})}(t))];return o.update(i,e)})},read:a,remove:function(){var n=u();return o.remove(n)}};function u(){var n=e;return{name:n,contextPath:n,description:t("Application containing public options used by branding."),key:"".concat(n,"-key"),type:"HOSTED",resourcesUrl:"/",manifest:{noAppSwitcher:!0}}}function a(){return n.get("/apps/public/".concat(e,"/options.json"),{silentError:!0}).then(function(n){return n.data},function(){return{}})}}n.$inject=["$http","gettext","c8yStaticAssets","createFile"],angular.module("c8y.ui-assets").factory("c8yPublicOptions",n)}();
1
+ "use strict";!function(){function n(n,t,o,c){var e="public-options";return{save:function(i){var r=u();return a().then(function(n){var t=Object.assign(n,i),e=[function(n){var t=JSON.stringify(n),e=new Blob([t],{type:"application/json"});return c([e],"options.json")}(function(n){return _.pickBy(n,function(n){return!_.isEmpty(n)})}(t))];return o.update(r,e)})},read:a,remove:function(){var n=u();return o.remove(n)}};function u(){var n=e;return{name:n,contextPath:n,description:t("Application containing public options used by branding."),key:"".concat(n,"-key"),type:"HOSTED",manifest:{noAppSwitcher:!0}}}function a(){return n.get("/apps/public/".concat(e,"/options.json"),{silentError:!0}).then(function(n){return n.data},function(){return{}})}}n.$inject=["$http","gettext","c8yStaticAssets","createFile"],angular.module("c8y.ui-assets").factory("c8yPublicOptions",n)}();
@@ -1 +1 @@
1
- "use strict";!function(){function t(n,t,e){return{contextPath:c,update:function(n){return r().then(function(t){return e.update(t,n)})},remove:function(){return r().then(function(t){return e.remove(t)})}};function c(){return t.current().then(function(t){return"ui-assets-".concat(t.name)})}function r(){return c().then(function(t){return{name:t,contextPath:t,description:n("Application containing static assets used by branding."),key:"".concat(t,"-key"),type:"HOSTED",resourcesUrl:"/",manifest:{noAppSwitcher:!0}}})}}t.$inject=["gettext","c8yTenant","c8yStaticAssets"],angular.module("c8y.ui-assets").factory("c8yUiAssets",t)}();
1
+ "use strict";!function(){function t(n,t,e){return{contextPath:c,update:function(n){return r().then(function(t){return e.update(t,n)})},remove:function(){return r().then(function(t){return e.remove(t)})}};function c(){return t.current().then(function(t){return"ui-assets-".concat(t.name)})}function r(){return c().then(function(t){return{name:t,contextPath:t,description:n("Application containing static assets used by branding."),key:"".concat(t,"-key"),type:"HOSTED",manifest:{noAppSwitcher:!0}}})}}t.$inject=["gettext","c8yTenant","c8yStaticAssets"],angular.module("c8y.ui-assets").factory("c8yUiAssets",t)}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.81.0",
3
+ "version": "1018.83.0",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",