UNPKG

@harbor/ui

Version:

Harbor shared UI components based on Clarity and Angular6

1 lines 363 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("@angular/http"),require("rxjs/operators"),require("rxjs/index"),require("@ngx-translate/core"),require("@angular/forms"),require("@angular/router"),require("@angular/animations"),require("@angular/platform-browser"),require("@angular/common"),require("@angular/common/http"),require("@clr/angular"),require("ngx-cookie"),require("ngx-markdown"),require("@ngx-translate/http-loader")):"function"==typeof define&&define.amd?define("@harbor/ui",["exports","@angular/core","rxjs","@angular/http","rxjs/operators","rxjs/index","@ngx-translate/core","@angular/forms","@angular/router","@angular/animations","@angular/platform-browser","@angular/common","@angular/common/http","@clr/angular","ngx-cookie","ngx-markdown","@ngx-translate/http-loader"],t):t((e.harbor=e.harbor||{},e.harbor.ui={}),e.ng.core,e.rxjs,e.ng.http,e.rxjs.operators,e.rxjs.index,e.core$1,e.ng.forms,e.ng.router,e.ng.animations,e.ng.platformBrowser,e.ng.common,e.ng.common.http,e.angular,e.ngxCookie,e.ngxMarkdown,e.httpLoader)}(this,function(e,c,l,a,p,i,n,r,t,o,s,d,u,h,g,f,m){"use strict";var b=function(e,t){this.kind=e,this.pattern=t},y=function(e,t){this.kind=e,this.schedule_param=t},v={_SEVERITY:0,NONE:1,UNKNOWN:2,LOW:3,MEDIUM:4,HIGH:5};v[v._SEVERITY]="_SEVERITY",v[v.NONE]="NONE",v[v.UNKNOWN]="UNKNOWN",v[v.LOW]="LOW",v[v.MEDIUM]="MEDIUM",v[v.HIGH]="HIGH";var I=function(e,t){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function E(e,t){function n(){this.constructor=e}I(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function C(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function T(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(i=o.next()).done;)a.push(i.value)}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o["return"])&&n.call(o)}finally{if(r)throw r.error}}return a}var S=new c.InjectionToken("service.config");function w(e){return e?e instanceof l.Observable?e.toPromise():Promise.resolve(e):Promise.reject("Bad argument")}var O="harbor-lang",L=["en-us","zh-cn","es-es","fr-fr","pt-br"],R="en-us",x=new a.RequestOptions({headers:new a.Headers({"Content-Type":"application/json",Accept:"application/json"})}),N=new a.RequestOptions({headers:new a.Headers({"Content-Type":"application/json",Accept:"application/json","Cache-Control":"no-cache",Pragma:"no-cache"})}),P=new a.RequestOptions({headers:new a.Headers({"Content-Type":"multipart/form-data"})});function A(e){var t=new a.RequestOptions({headers:new a.Headers({"Content-Type":"application/json",Accept:"application/json","Cache-Control":"no-cache",Pragma:"no-cache"})});return e&&(t.search=e),t}var _={left:{button:0},right:{button:2}};var k=function(){function e(e,t){this.fieldName=e,this.type=t}return e.prototype.compare=function(e,t){var n=0;if(e&&t){var i=e[this.fieldName],r=t[this.fieldName];switch(this.type){case"number":n=r-i;break;case"date":n=new Date(r).getTime()-new Date(i).getTime()}}return n},e}(),D=15,j={unknown:"n/a",pending:"pending",running:"running",error:"error",stopped:"stopped",finished:"finished"};function F(e){return e&&e.page?Math.ceil((e.page.to+1)/e.page.size):1}function M(e,t){return e&&0!==e.length&&t&&t.filters&&0!==t.filters.length&&t.filters.forEach(function(n){e=e.filter(function(e){if(-1===n.property.indexOf("."))return H(n.value,e[n.property]);var t=n.property.split(".");return Array.isArray(e[t[0]])&&e[t[0]].length?e[t[0]].some(function(e){return n.value===e[t[1]]}):void 0})}),e}function H(e,t){return new RegExp(".*"+e+".*","i").test(t)}function V(e,o){return e&&0!==e.length&&o&&o.sort?e.sort(function(e,t){var n=0;if("string"!=typeof o.sort.by)n=o.sort.by.compare(e,t);else{var i=e[o.sort.by.toString()],r=t[o.sort.by.toString()];"string"==typeof i?n=i.localeCompare(r):r<i?n=1:i<r&&(n=-1)}return o.sort.reverse&&(n=-n),n}):e}function U(e,t){return!(e&&!t||!e&&t)&&(!e&&!t||JSON.stringify(e)===JSON.stringify(t))}function B(e){return!e||"{}"===JSON.stringify(e)}function G(e){return e?JSON.parse(JSON.stringify(e)):null}function Y(e){return!e||"{}"===JSON.stringify(e)}function z(e){var t=window.URL.createObjectURL(e.data),n=document.createElement("a");document.body.appendChild(n),n.setAttribute("style","display: none"),n.href=t,n.download=e.filename,n.click(),window.URL.revokeObjectURL(t),n.remove()}function J(e,t){var n,i,r={};if(!t||!e)return r;try{for(var o=C(Object.keys(t)),a=o.next();!a.done;a=o.next()){var s=a.value,l=e[s];l&&l.editable&&(U(l.value,t[s].value)||(r[s]=t[s].value,"number"==typeof l.value&&(r[s]=+r[s]),"string"==typeof l.value&&(r[s]=(""+r[s]).trim())))}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=o["return"])&&i.call(o)}finally{if(n)throw n.error}}return r}var W=function(){},$=function(i){function e(e,t){var n=i.call(this)||this;return n.config=e,n.http=t,n}return E(e,i),e.prototype.getSystemInfo=function(){var e=this.config.systemInfoEndpoint?this.config.systemInfoEndpoint:"/api/systeminfo";return this.http.get(e,N).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[S]}]},{type:a.Http}]},e}(W),K=function(){},q=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n.config=t,n}return E(e,i),e.prototype.getAuditLogs=function(e,t){return l.of({})},e.prototype.getRecentLogs=function(e){var t=this.config.logBaseEndpoint?this.config.logBaseEndpoint:"";return""===t&&(t="/api/logs"),this.http.get(t,e?A(e):N).toPromise().then(function(e){var t={metadata:{xTotalCount:0},data:[]},n="0";return e&&e.headers&&(n=e.headers.get("X-Total-Count")),t&&t.metadata&&(t.metadata.xTotalCount=parseInt(n||"0",0),0<t.metadata.xTotalCount&&(t.data=e.json())),t})["catch"](function(e){return Promise.reject(e)})},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(K),X=function(e){function t(){return e.call(this)||this}return E(t,e),t}(a.URLSearchParams),Q=function(){},Z=function(i){function e(e,t){var n=i.call(this)||this;return n.http=t,n._endpointUrl=e.targetBaseEndpoint?e.targetBaseEndpoint:"/api/targets",n}return E(e,i),e.prototype.getEndpoints=function(e,t){t||(t=new X),e&&t.set("name",e);var n=""+this._endpointUrl;return this.http.get(n,A(t)).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.getEndpoint=function(e){if(!e||e<=0)return Promise.reject("Bad request argument.");var t=this._endpointUrl+"/"+e;return this.http.get(t,N).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.createEndpoint=function(e){if(!e)return Promise.reject("Invalid endpoint.");var t=""+this._endpointUrl;return this.http.post(t,JSON.stringify(e),x).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)})},e.prototype.updateEndpoint=function(e,t){if(!e||e<=0)return Promise.reject("Bad request argument.");if(!t)return Promise.reject("Invalid endpoint.");var n=this._endpointUrl+"/"+e;return this.http.put(n,JSON.stringify(t),x).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)})},e.prototype.deleteEndpoint=function(e){if(!e||e<=0)return Promise.reject("Bad request argument.");var t=this._endpointUrl+"/"+e;return this.http["delete"](t).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)})},e.prototype.pingEndpoint=function(e){if(!e)return Promise.reject("Invalid endpoint.");var t=this._endpointUrl+"/ping";return this.http.post(t,e,x).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)})},e.prototype.getEndpointWithReplicationRules=function(e){if(!e||e<=0)return Promise.reject("Bad request argument.");var t=this._endpointUrl+"/"+e+"/policies";return this.http.get(t,N).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[S]}]},{type:a.Http}]},e}(Q),ee=function(){},te=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n._ruleBaseUrl=t.replicationRuleEndpoint?t.replicationRuleEndpoint:"/api/policies/replication",n._jobBaseUrl=t.replicationJobEndpoint?t.replicationJobEndpoint:"/api/jobs/replication",n._replicateUrl=t.replicationBaseEndpoint?t.replicationBaseEndpoint:"/api/replications",n}return E(e,i),e.prototype._isValidRule=function(e){return e!==undefined&&null!=e&&e.name!==undefined&&""!==e.name.trim()&&0!==e.targets.length},e.prototype.getJobBaseUrl=function(){return this._jobBaseUrl},e.prototype.getReplicationRules=function(e,t,n){return n||(n=new X),e&&n.set("project_id",""+e),t&&n.set("name",t),this.http.get(this._ruleBaseUrl,A(n)).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.getReplicationRule=function(e){if(!e)return Promise.reject("Bad argument");var t=this._ruleBaseUrl+"/"+e;return this.http.get(t,N).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.createReplicationRule=function(e){return this._isValidRule(e)?this.http.post(this._ruleBaseUrl,JSON.stringify(e),x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)}):Promise.reject("Bad argument")},e.prototype.updateReplicationRule=function(e,t){if(!this._isValidRule(t))return Promise.reject("Bad argument");var n=this._ruleBaseUrl+"/"+e;return this.http.put(n,JSON.stringify(t),x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.prototype.deleteReplicationRule=function(e){if(!e||e<=0)return Promise.reject("Bad argument");var t=this._ruleBaseUrl+"/"+e;return this.http["delete"](t,x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.prototype.replicateRule=function(e){if(!e)return Promise.reject("Bad argument");var t=""+this._replicateUrl;return this.http.post(t,{policy_id:e},x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.prototype.enableReplicationRule=function(e,t){if(!e||e<=0)return Promise.reject("Bad argument");var n=this._ruleBaseUrl+"/"+e+"/enablement";return this.http.put(n,{enabled:t},x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.prototype.disableReplicationRule=function(e){if(!e||e<=0)return Promise.reject("Bad argument");var t=this._ruleBaseUrl+"/"+e+"/enablement";return this.http.put(t,{enabled:0},x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.prototype.getJobs=function(e,t){return!e||e<=0?Promise.reject("Bad argument"):(t||(t=new X),t.set("policy_id",""+e),this.http.get(this._jobBaseUrl,A(t)).toPromise().then(function(e){var t={metadata:{xTotalCount:0},data:[]};if(e&&e.headers){var n=e.headers.get("X-Total-Count");n&&(t.metadata.xTotalCount=parseInt(n,0))}return t.data=e.json(),0===t.metadata.xTotalCount&&t.data&&0<t.data.length&&(t.metadata.xTotalCount=t.data.length),t})["catch"](function(e){return Promise.reject(e)}))},e.prototype.getJobLog=function(e){if(!e||e<=0)return Promise.reject("Bad argument");var t=this._jobBaseUrl+"/"+e+"/log";return this.http.get(t,N).toPromise().then(function(e){return e.text()})["catch"](function(e){return Promise.reject(e)})},e.prototype.stopJobs=function(e){return this.http.put(this._jobBaseUrl,JSON.stringify({policy_id:e,status:"stop"}),x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(ee),ne=function(){},ie=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n.config=t,n}return E(e,i),e.prototype.getRepositories=function(e,t,n){if(!e)return Promise.reject("Bad argument");n||(n=new X),n.set("project_id",""+e),t&&""!==t.trim()&&n.set("q",t);var i=this.config.repositoryBaseEndpoint?this.config.repositoryBaseEndpoint:"/api/repositories";return this.http.get(i,A(n)).toPromise().then(function(e){var t={metadata:{xTotalCount:0},data:[]};if(e&&e.headers){var n=e.headers.get("X-Total-Count");n&&(t.metadata.xTotalCount=parseInt(n,0))}return t.data=e.json(),0===t.metadata.xTotalCount&&t.data&&0<t.data.length&&(t.metadata.xTotalCount=t.data.length),t})["catch"](function(e){return Promise.reject(e)})},e.prototype.updateRepositoryDescription=function(e,t,n){n||(n=new X);var i=(this.config.repositoryBaseEndpoint?this.config.repositoryBaseEndpoint:"/api/repositories")+"/"+e;return this.http.put(i,{description:t},x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.prototype.deleteRepository=function(e){if(!e)return Promise.reject("Bad argument");var t=this.config.repositoryBaseEndpoint?this.config.repositoryBaseEndpoint:"/api/repositories";return t=t+"/"+e,this.http["delete"](t,x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(ne),re=function(){},oe=function(){},ae=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n.config=t,n._baseUrl=n.config.repositoryBaseEndpoint?n.config.repositoryBaseEndpoint:"/api/repositories",n._labelUrl=n.config.labelEndpoint?n.config.labelEndpoint:"/api/labels",n}return E(e,i),e.prototype._getTags=function(e,t){t||(t=new X),t.set("detail","1");var n=this._baseUrl+"/"+e+"/tags";return this.http.get(n,A(t)).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype._getSignatures=function(e){var t=this._baseUrl+"/"+e+"/signatures";return this.http.get(t,N).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.getTags=function(e,t){return e?this._getTags(e,t):Promise.reject("Bad argument")},e.prototype.deleteTag=function(e,t){if(!e||!t)return Promise.reject("Bad argument");var n=this._baseUrl+"/"+e+"/tags/"+t;return this.http["delete"](n,x).toPromise().then(function(e){return e})["catch"](function(e){return Promise.reject(e)})},e.prototype.getTag=function(e,t,n){if(!e||!t)return Promise.reject("Bad argument");var i=this._baseUrl+"/"+e+"/tags/"+t;return this.http.get(i,N).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.addLabelToImages=function(e,t,n){if(!n||!t||!e)return Promise.reject("Invalid parameters.");var i=this._baseUrl+"/"+e+"/tags/"+t+"/labels";return this.http.post(i,{id:n},x).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)})},e.prototype.deleteLabelToImages=function(e,t,n){if(!n||!t||!e)return Promise.reject("Invalid parameters.");var i=this._baseUrl+"/"+e+"/tags/"+t+"/labels/"+n;return this.http["delete"](i).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)})},e.prototype.getManifest=function(e,t){if(!e||!t)return Promise.reject("Bad argument");var n=this._baseUrl+"/"+e+"/tags/"+t+"/manifest";return this.http.get(n,N).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(oe),se=function(){},le=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n.config=t,n._baseUrl="/api/repositories",n.config&&n.config.vulnerabilityScanningBaseEndpoint&&(n._baseUrl=n.config.vulnerabilityScanningBaseEndpoint),n}return E(e,i),e.prototype.getVulnerabilityScanningSummary=function(e,t,n){return e&&""!==e.trim()&&t&&""!==t.trim()?l.of({}):Promise.reject("Bad argument")},e.prototype.getVulnerabilityScanningResults=function(e,t,n){return e&&""!==e.trim()&&t&&""!==t.trim()?this.http.get(this._baseUrl+"/"+e+"/tags/"+t+"/vulnerability/details",A(n)).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)}):Promise.reject("Bad argument")},e.prototype.startVulnerabilityScanning=function(e,t){return e&&""!==e.trim()&&t&&""!==t.trim()?this.http.post(this._baseUrl+"/"+e+"/tags/"+t+"/scan",x).toPromise().then(function(){return!0})["catch"](function(e){return Promise.reject(e)}):Promise.reject("Bad argument")},e.prototype.startScanningAll=function(){return this.http.post(this._baseUrl+"/scanAll",x).toPromise().then(function(){return!0})["catch"](function(e){return Promise.reject(e)})},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(se),ce=function(){},pe=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n.config=t,n._baseUrl=n.config&&n.config.configurationEndpoint?n.config.configurationEndpoint:"/api/configurations",n}return E(e,i),e.prototype.getConfigurations=function(){return this.http.get(this._baseUrl,N).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.saveConfigurations=function(e){return e?this.http.put(this._baseUrl,JSON.stringify(e),x).toPromise().then(function(){})["catch"](function(e){return Promise.reject(e)}):Promise.reject("Bad argument!")},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(ce),de=function(){},ue=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n._replicationJobBaseUrl=t.replicationJobEndpoint?t.replicationJobEndpoint:"/api/jobs/replication",n._scanningJobBaseUrl=t.scanJobEndpoint?t.scanJobEndpoint:"/api/jobs/scan",n._supportedJobTypes=["replication","scan"],n}return E(e,i),e.prototype._getJobLog=function(e){return this.http.get(e,N).toPromise().then(function(e){return e.text()})["catch"](function(e){return Promise.reject(e)})},e.prototype._isSupportedJobType=function(t){return!!this._supportedJobTypes.find(function(e){return e===t})},e.prototype.getScanJobBaseUrl=function(){return this._scanningJobBaseUrl},e.prototype.getJobLog=function(e,t){if(!this._isSupportedJobType(e))return Promise.reject("Unsupport job type: "+e);if(!t||t<=0)return Promise.reject("Bad argument");var n=this._replicationJobBaseUrl+"/"+t+"/log";return"scan"===e&&(n=this._scanningJobBaseUrl+"/"+t+"/log"),this._getJobLog(n)},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(de),he=function(){},ge=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n.config=t,n}return E(e,i),e.prototype.getProject=function(e){if(!e)return Promise.reject("Bad argument");var t=this.config.projectBaseEndpoint?this.config.projectBaseEndpoint:"/api/projects";return this.http.get(t+"/"+e,N).pipe(p.map(function(e){return e.json()})).pipe(p.catchError(function(e){return l.throwError(e)}))},e.prototype.listProjects=function(e,t,n,i){var r=this.config.projectBaseEndpoint?this.config.projectBaseEndpoint:"/api/projects",o=new X;return n&&i&&(o.set("page",n+""),o.set("page_size",i+"")),e&&""!==e.trim()&&o.set("name",e),t!==undefined&&o.set("public",""+t),this.http.get(r,A(o)).pipe(p.map(function(e){return e.json()})).pipe(p.catchError(function(e){return l.throwError(e)}))},e.prototype.updateProjectPolicy=function(e,t){var n=this.config.projectBaseEndpoint?this.config.projectBaseEndpoint:"/api/projects";return this.http.put(n+"/"+e,{metadata:{"public":t.Public?"true":"false",enable_content_trust:t.ContentTrust?"true":"false",prevent_vul:t.PreventVulImg?"true":"false",severity:t.PreventVulImgSeverity,auto_scan:t.ScanImgOnPush?"true":"false"}},x).pipe(p.map(function(e){return e.status})).pipe(p.catchError(function(e){return l.throwError(e)}))},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(he),fe=function(e){return""===e.text()?[]:e.json()||[]},me=function(){},be=function(i){function e(e,t){var n=i.call(this)||this;return n.http=t,n.labelUrl=e.labelEndpoint?e.labelEndpoint:"/api/labels",n.chartUrl=e.helmChartEndpoint?e.helmChartEndpoint:"/api/chartrepo",n}return E(e,i),e.prototype.getGLabels=function(e,t){return t||(t=new X),t.set("scope","g"),e&&t.set("name",""+e),this.http.get(this.labelUrl,A(t)).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.getPLabels=function(e,t,n){return n||(n=new X),n.set("scope","p"),e&&n.set("project_id",""+e),t&&n.set("name",""+t),this.http.get(this.labelUrl,A(n)).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.getProjectLabels=function(e,t,n){return n||(n=new X),n.set("scope","p"),e&&n.set("project_id",""+e),t&&n.set("name",""+t),this.http.get(this.labelUrl,A(n)).pipe(p.map(function(e){return fe(e)}))},e.prototype.getLabels=function(e,t,n,i){return i||(i=new X),e&&i.set("scope",e),t&&i.set("project_id",""+t),n&&i.set("name",""+n),this.http.get(this.labelUrl,A(i)).pipe(p.map(function(e){return e.json()})).pipe(p.catchError(function(e){return Promise.reject(e)}))},e.prototype.createLabel=function(e){return e?this.http.post(this.labelUrl,JSON.stringify(e),x).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)}):Promise.reject("Invalid label.")},e.prototype.getLabel=function(e){if(!e||e<=0)return Promise.reject("Bad request argument.");var t=this.labelUrl+"/"+e;return this.http.get(t,x).toPromise().then(function(e){return e.json()})["catch"](function(e){return Promise.reject(e)})},e.prototype.updateLabel=function(e,t){if(!e||e<=0)return Promise.reject("Bad request argument.");if(!t)return Promise.reject("Invalid endpoint.");var n=this.labelUrl+"/"+e;return this.http.put(n,JSON.stringify(t),x).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)})},e.prototype.deleteLabel=function(e){if(!e||e<=0)return Promise.reject("Bad request argument.");var t=this.labelUrl+"/"+e;return this.http["delete"](t).toPromise().then(function(e){return e.status})["catch"](function(e){return Promise.reject(e)})},e.prototype.getChartVersionLabels=function(e,t,n){return this.http.get(this.chartUrl+"/"+e+"/charts/"+t+"/"+n+"/labels").pipe(p.map(function(e){return fe(e)}))},e.prototype.markChartLabel=function(e,t,n,i){return this.http.post(this.chartUrl+"/"+e+"/charts/"+t+"/"+n+"/labels",JSON.stringify(i),x).pipe(p.map(function(e){return fe(e)}))},e.prototype.unmarkChartLabel=function(e,t,n,i){return this.http["delete"](this.chartUrl+"/"+e+"/charts/"+t+"/"+n+"/labels/"+i.id,x).pipe(p.map(function(e){return fe(e)}))},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:undefined,decorators:[{type:c.Inject,args:[S]}]},{type:a.Http}]},e}(me),ye=function(){},ve=function(i){function e(e,t){var n=i.call(this)||this;return n.http=e,n.config=t,n}return E(e,i),e.prototype.extractData=function(e){return""===e.text()?[]:e.json()||[]},e.prototype.handleErrorObservable=function(e){return l.throwError(e.message||e)},e.prototype.getHelmCharts=function(e){var t=this;return e?this.http.get(this.config.helmChartEndpoint+"/"+e+"/charts",N).pipe(p.map(function(e){return t.extractData(e)},p.catchError(function(e){return t.handleErrorObservable(e)}))):l.throwError("Bad argument, No project id to get helm charts")},e.prototype.deleteHelmChart=function(e,t){var n=this;return t||l.throwError("Bad argument"),this.http["delete"](this.config.helmChartEndpoint+"/"+e+"/charts/"+t).pipe(p.map(function(e){return n.extractData(e)})).pipe(p.catchError(this.handleErrorObservable))},e.prototype.getChartVersions=function(e,t){var n=this;return this.http.get(this.config.helmChartEndpoint+"/"+e+"/charts/"+t,N).pipe(p.map(function(e){return n.extractData(e)}),p.catchError(this.handleErrorObservable))},e.prototype.deleteChartVersion=function(e,t,n){var i=this;return this.http["delete"](this.config.helmChartEndpoint+"/"+e+"/charts/"+t+"/"+n,x).pipe(p.map(function(e){return i.extractData(e)})).pipe(p.catchError(this.handleErrorObservable))},e.prototype.getChartDetail=function(e,t,n){var i=this;return this.http.get(this.config.helmChartEndpoint+"/"+e+"/charts/"+t+"/"+n).pipe(p.map(function(e){return i.extractData(e)})).pipe(p.catchError(this.handleErrorObservable))},e.prototype.downloadChart=function(e,t){return this.http.get(this.config.downloadChartEndpoint+"/"+e+"/"+t,{responseType:a.ResponseContentType.Blob}).pipe(p.map(function(e){return{filename:t.split("/")[1],data:e.blob()}})).pipe(p.catchError(this.handleErrorObservable))},e.prototype.uploadChart=function(e,t,n){var i=this,r=new FormData,o=this.config.helmChartEndpoint+"/"+e+"/charts";return t&&r.append("chart",t),n&&(r.append("prov",n),t||(o=this.config.helmChartEndpoint+"/"+e+"/prov")),this.http.post(o,r,{responseType:a.ResponseContentType.Json}).pipe(p.map(function(e){return i.extractData(e)})).pipe(p.catchError(this.handleErrorObservable))},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http},{type:undefined,decorators:[{type:c.Inject,args:[S]}]}]},e}(ye),Ie=function(){},Ee=function(n){function e(e){var t=n.call(this)||this;return t.http=e,t}return E(e,n),e.prototype.retag=function(e){return this.http.post("/api/repositories/"+e.targetProject+"/"+e.targetRepo+"/tags",{tag:e.targetTag,src_image:e.srcImage,override:e.override},x).pipe(p.catchError(function(e){return i.throwError(e)}))},e.decorators=[{type:c.Injectable}],e.ctorParameters=function(){return[{type:a.Http}]},e}(Ie),Ce=function(){},Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),t.prototype.error=function(e){console.error("[Default error handler]: ",e)},t.prototype.warning=function(e){console.warn("[Default warning handler]: ",e)},t.prototype.info=function(e){console.info("[Default info handler]: ",e)},t.prototype.log=function(e){console.log("[Default log handler]: ",e)},t.decorators=[{type:c.Injectable}],t}(Ce),Se=function(){function e(e,t){this.logService=e,this.errorHandler=t,this.recentLogs=[],this.loading=!0,this.defaultFilter="username",this.withTitle=!1,this.pageSize=D,this.currentPage=1,this.currentPagePvt=0,this.opTimeComparator=new k("op_time","date")}return e.prototype.ngOnInit=function(){},Object.defineProperty(e.prototype,"totalCount",{get:function(){return this.logsCache&&this.logsCache.metadata?this.logsCache.metadata.xTotalCount:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inProgress",{get:function(){return this.loading},enumerable:!0,configurable:!0}),e.prototype.doFilter=function(e){if(e&&(this.currentTerm=e.trim(),this.loading=!0,(this.currentPage=1)===this.currentPagePvt)){var t=this.currentState;t||(t={page:{}}),t.page.from=0,t.page.to=this.pageSize-1,t.page.size=this.pageSize,this.currentPagePvt=0,this.load(t)}},e.prototype.refresh=function(){this.doFilter("")},e.prototype.openFilter=function(e){this.isOpenFilterTag=!!e},e.prototype.selectFilterKey=function(e){this.defaultFilter=e.target.value,this.doFilter(this.currentTerm)},e.prototype.load=function(t){var n=this,i=F(this.currentState=t);if(i!==this.currentPagePvt){var e=new X;e.set("page",""+i),e.set("page_size",""+this.pageSize),this.currentTerm&&""!==this.currentTerm&&e.set(this.defaultFilter,this.currentTerm),this.loading=!0,w(this.logService.getRecentLogs(e)).then(function(e){n.logsCache=e,n.recentLogs=n.logsCache.data.filter(function(e){return""!==e.username}),n.recentLogs=M(n.recentLogs,t),n.recentLogs=V(n.recentLogs,t),n.currentPagePvt=i,n.loading=!1})["catch"](function(e){n.loading=!1,n.errorHandler.error(e)})}else this.recentLogs=this.logsCache.data.filter(function(e){return""!==e.username}),this.recentLogs=M(this.recentLogs,t),this.recentLogs=V(this.recentLogs,t)},e.prototype.isMatched=function(e,t){var n=new RegExp(".*"+e+".*","i");return n.test(t.username)||n.test(t.repo_name)||n.test(t.operation)||n.test(t.repo_tag)},e.decorators=[{type:c.Component,args:[{selector:"hbr-log",template:'<div>\n <h2 class="h2-log-override" *ngIf="withTitle">{{\'SIDE_NAV.LOGS\' | translate}}</h2>\n <div class="row flex-items-xs-between flex-items-xs-bottom">\n <div></div>\n <div class="action-head-pos rightPos">\n <div class="select filterTag" [hidden]="!isOpenFilterTag">\n <select id="selectKey" (change)="selectFilterKey($event)">\n <option value="username">{{"AUDIT_LOG.USERNAME" | translate | lowercase}}</option>\n <option value="repository">{{"CONFIG.REPOSITORY" | translate | lowercase}}</option>\n <option value="tag">{{"REPOSITORY.TAG" | translate | lowercase}}</option>\n <option value="operation">{{"AUDIT_LOG.OPERATION" | translate | lowercase}}</option>\n </select>\n </div>\n <hbr-filter [withDivider]="true" filterPlaceholder=\'{{"AUDIT_LOG.FILTER_PLACEHOLDER" | translate}}\' (filterEvt)="doFilter($event)"\n (openFlag)="openFilter($event)" [currentValue]="currentTerm"></hbr-filter>\n <span (click)="refresh()" class="refresh-btn">\n <clr-icon shape="refresh" [hidden]="inProgress" ng-disabled="inProgress"></clr-icon>\n <span class="spinner spinner-inline" [hidden]="!inProgress"></span>\n </span>\n </div>\n </div>\n <div>\n <clr-datagrid (clrDgRefresh)="load($event)" [clrDgLoading]="loading">\n <clr-dg-column [clrDgField]="\'username\'">{{\'AUDIT_LOG.USERNAME\' | translate}}</clr-dg-column>\n <clr-dg-column [clrDgField]="\'repo_name\'">{{\'AUDIT_LOG.REPOSITORY_NAME\' | translate}}</clr-dg-column>\n <clr-dg-column [clrDgField]="\'repo_tag\'">{{\'AUDIT_LOG.TAGS\' | translate}}</clr-dg-column>\n <clr-dg-column [clrDgField]="\'operation\'">{{\'AUDIT_LOG.OPERATION\' | translate}}</clr-dg-column>\n <clr-dg-column [clrDgSortBy]="opTimeComparator">{{\'AUDIT_LOG.TIMESTAMP\' | translate}}</clr-dg-column>\n <clr-dg-placeholder>We couldn\'t find any logs!</clr-dg-placeholder>\n <clr-dg-row *ngFor="let l of recentLogs">\n <clr-dg-cell>{{l.username}}</clr-dg-cell>\n <clr-dg-cell>{{l.repo_name}}</clr-dg-cell>\n <clr-dg-cell>{{l.repo_tag}}</clr-dg-cell>\n <clr-dg-cell>{{l.operation}}</clr-dg-cell>\n <clr-dg-cell>{{l.op_time | date: \'short\'}}</clr-dg-cell>\n </clr-dg-row>\n <clr-dg-footer>\n {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{\'AUDIT_LOG.OF\' | translate}} {{pagination.totalItems}} {{\'AUDIT_LOG.ITEMS\'\n | translate}}\n <clr-dg-pagination #pagination [(clrDgPage)]="currentPage" [clrDgPageSize]="pageSize" [clrDgTotalItems]="totalCount"></clr-dg-pagination>\n </clr-dg-footer>\n </clr-datagrid>\n </div>\n</div>',styles:[".h2-log-override{margin-top:0!important}.action-head-pos{padding-right:18px;height:24px}.refresh-btn{cursor:pointer}.refresh-btn:hover{color:#007cbb}.custom-lines-button{padding:0!important;min-width:25px!important}.lines-button-toggole{font-size:16px;text-decoration:underline}.log-select{width:130px;display:inline-block;top:1px}.item-divider{height:24px;display:inline-block;width:1px;background-color:#ccc;opacity:.55;margin-left:12px;top:8px;position:relative}.rightPos{position:absolute;z-index:100;right:35px;margin-top:4px}.filterTag{float:left;margin-top:8px}"]}]}],e.ctorParameters=function(){return[{type:K},{type:Ce}]},e.propDecorators={withTitle:[{type:c.Input}]},e}(),we=[Se],Oe=function(){function e(){this.placeHolder="",this.filterTerms=new l.Subject,this.isExpanded=!1,this.filterEvt=new c.EventEmitter,this.openFlag=new c.EventEmitter,this.expandMode=!1,this.withDivider=!1}return Object.defineProperty(e.prototype,"flPlaceholder",{set:function(e){this.placeHolder=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.filterTerms.pipe(p.debounceTime(500)).subscribe(function(e){t.filterEvt.emit(e)})},e.prototype.valueChange=function(){this.filterTerms.next(this.currentValue&&this.currentValue.trim())},e.prototype.inputFocus=function(){this.openFlag.emit(this.isExpanded)},e.prototype.onClick=function(){this.expandMode||(this.isExpanded=!this.isExpanded,this.openFlag.emit(this.isExpanded))},Object.defineProperty(e.prototype,"isShowSearchBox",{get:function(){return this.expandMode||!this.expandMode&&this.isExpanded},enumerable:!0,configurable:!0}),e.decorators=[{type:c.Component,args:[{selector:"hbr-filter",template:'<span>\n <clr-icon shape="search" size="20" class="search-btn" [class.filter-icon]="isShowSearchBox" (click)="onClick()"></clr-icon>\n <input [hidden]="!isShowSearchBox" type="text" style="padding-left: 15px;" (keyup)="valueChange()" (focus)="inputFocus()"\n placeholder="{{placeHolder}}" [(ngModel)]="currentValue" />\n <span class="filter-divider" *ngIf="withDivider"></span>\n</span>',styles:[".filter-icon{position:relative;right:-12px}.filter-divider{display:inline-block;height:16px;width:2px;background-color:#ccc;padding-top:12px;padding-bottom:12px;position:relative;top:9px;margin-right:6px;margin-left:6px}.search-btn{cursor:pointer}.search-btn:hover{color:#007cbb}"]}]}],e.propDecorators={filterEvt:[{type:c.Output}],openFlag:[{type:c.Output}],currentValue:[{type:c.Input}],flPlaceholder:[{type:c.Input,args:["filterPlaceholder"]}],expandMode:[{type:c.Input}],withDivider:[{type:c.Input}]},e}(),Le=[Oe],Re=function(e,t,n,i,r,o){this.data={},this.targetId=0,this.title=e,this.message=t,this.data=i,this.targetId=r,this.param=n,this.buttons=o||0},xe=function(){function e(e){this.translate=e,this.inlineAlertType="alert-danger",this.inlineAlertClosable=!1,this.alertClose=!0,this.displayedText="",this.showCancelAction=!1,this.useAppLevelStyle=!1,this.timer=null,this.count=0,this.blinking=!1,this.confirmEvt=new c.EventEmitter}return Object.defineProperty(e.prototype,"errorMessage",{get:function(){return this.displayedText},enumerable:!0,configurable:!0}),e.prototype.showInlineError=function(e){var t=this;this.displayedText=function(e){if(!e)return"UNKNOWN_ERROR";if(!e.statusCode&&!e.status)return""+e;switch(e.statusCode||e.status){case 400:return"BAD_REQUEST_ERROR";case 401:return"UNAUTHORIZED_ERROR";case 403:return"FORBIDDEN_ERROR";case 404:return"NOT_FOUND_ERROR";case 412:return"PRECONDITION_FAILED";case 409:return"CONFLICT_ERROR";case 500:return"SERVER_ERROR";default:return"UNKNOWN_ERROR"}}(e),this.displayedText&&this.translate.get(this.displayedText).subscribe(function(e){return t.displayedText=e}),this.inlineAlertType="alert-danger",this.showCancelAction=!1,this.inlineAlertClosable=!0,this.alertClose=!1,this.useAppLevelStyle=!1},e.prototype.showInlineConfirmation=function(e){var t=this;this.displayedText="",e&&e.message&&this.translate.get(e.message).subscribe(function(e){return t.displayedText=e}),this.inlineAlertType="alert-warning",this.showCancelAction=!0,this.inlineAlertClosable=!1,this.alertClose=!1,this.useAppLevelStyle=!1},e.prototype.showInlineSuccess=function(e){var t=this;this.displayedText="",e&&e.message&&this.translate.get(e.message).subscribe(function(e){return t.displayedText=e}),this.inlineAlertType="alert-success",this.showCancelAction=!1,this.inlineAlertClosable=!0,this.alertClose=!1,this.useAppLevelStyle=!1},e.prototype.close=function(){this.alertClose=!0},e.prototype.blink=function(){},e.prototype.confirmCancel=function(){this.confirmEvt.emit(!0)},e.decorators=[{type:c.Component,args:[{selector:"hbr-inline-alert",template:'<clr-alert [clrAlertType]="inlineAlertType" [clrAlertClosable]="inlineAlertClosable" [(clrAlertClosed)]="alertClose" [clrAlertAppLevel]="useAppLevelStyle">\n <div class="alert-item">\n <span class="alert-text" [class.alert-text-blink]="blinking">\n {{errorMessage}}\n </span>\n <div class="alert-actions" *ngIf="showCancelAction">\n <button class="btn btn-sm btn-link alert-btn-link" (click)="close()">{{\'BUTTON.NO\' | translate}}</button>\n <button class="btn btn-sm btn-link alert-btn-link" (click)="confirmCancel()">{{\'BUTTON.YES\' | translate}}</button>\n </div>\n </div>\n</clr-alert>',styles:[".alert-text-blink{color:red;font-weight:bolder}.alert-btn-link{padding:0!important;min-width:30px!important}.alert-item{text-align:center}:host>>>.alert-icon-wrapper{display:inline}"]}]}],e.ctorParameters=function(){return[{type:n.TranslateService}]},e.propDecorators={confirmEvt:[{type:c.Output}]},e}(),Ne="rjGcfuRu",Pe=function(){function e(e,t,n,i){this.endpointService=e,this.errorHandler=t,this.translateService=n,this.ref=i,this.staticBackdrop=!0,this.closable=!1,this.target=this.initEndpoint(),this.reload=new c.EventEmitter}return Object.defineProperty(e.prototype,"isValid",{get:function(){return!this.testOngoing&&!this.onGoing&&this.targetForm&&this.targetForm.valid&&this.editable&&!U(this.target,this.initVal)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inProgress",{get:function(){return this.onGoing||this.testOngoing},enumerable:!0,configurable:!0}),e.prototype.setInsecureValue=function(e){this.target.insecure=!e},e.prototype.ngOnDestroy=function(){this.valueChangesSub&&this.valueChangesSub.unsubscribe()},e.prototype.initEndpoint=function(){return{endpoint:"",name:"",username:"",password:"",insecure:!1,type:0}},e.prototype.open=function(){this.createEditDestinationOpened=!0},e.prototype.close=function(){this.createEditDestinationOpened=!1},e.prototype.reset=function(){this.testOngoing=!1,this.onGoing=!1,this.target=this.initEndpoint(),this.initVal=this.initEndpoint(),this.formValues=null,this.endpointId="",this.inlineAlert.close()},e.prototype.forceRefreshView=function(e){var t=this;this.timerHandler&&clearInterval(this.timerHandler),this.timerHandler=setInterval(function(){return t.ref.markForCheck()},100),setTimeout(function(){t.timerHandler&&(clearInterval(t.timerHandler),t.timerHandler=null)},e)},e.prototype.openCreateEditTarget=function(e,t){var n=this;this.editable=e,this.reset(),t?(this.endpointId=t,this.translateService.get("DESTINATION.TITLE_EDIT").subscribe(function(e){return n.modalTitle=e}),w(this.endpointService.getEndpoint(t)).then(function(e){n.target=e,n.initVal=G(e),n.initVal.password=Ne,n.target.password=Ne,n.open(),n.forceRefreshView(2e3)})["catch"](function(e){return n.errorHandler.error(e)})):(this.endpointId="",this.translateService.get("DESTINATION.TITLE_ADD").subscribe(function(e){return n.modalTitle=e}),this.open())},e.prototype.testConnection=function(){var e,t,n=this,i=this.initEndpoint();if(this.endpointId){var r=this.getChanges();try{for(var o=C(Object.keys(i)),a=o.next();!a.done;a=o.next()){var s=a.value;delete i[s]}}catch(l){e={error:l}}finally{try{a&&!a.done&&(t=o["return"])&&t.call(o)}finally{if(e)throw e.error}}if(i.id=this.target.id,!B(r))Object.keys(this.getChanges()).forEach(function(e){i[e]=r[e]})}else i.endpoint=this.target.endpoint,i.username=this.target.username,i.password=this.target.password,i.insecure=this.target.insecure;this.testOngoing=!0,w(this.endpointService.pingEndpoint(i)).then(function(e){n.inlineAlert.showInlineSuccess({message:"DESTINATION.TEST_CONNECTION_SUCCESS"}),n.forceRefreshView(2e3),n.testOngoing=!1})["catch"](function(e){n.inlineAlert.showInlineError("DESTINATION.TEST_CONNECTION_FAILURE"),n.forceRefreshView(2e3),n.testOngoing=!1})},e.prototype.onSubmit=function(){this.endpointId?this.updateEndpoint():this.addEndpoint()},e.prototype.addEndpoint=function(){var n=this;this.onGoing||(this.onGoing=!0,w(this.endpointService.createEndpoint(this.target)).then(function(e){n.translateService.get("DESTINATION.CREATED_SUCCESS").subscribe(function(e){return n.errorHandler.info(e)}),n.reload.emit(!0),n.onGoing=!1,n.close(),n.forceRefreshView(2e3)})["catch"](function(e){n.onGoing=!1;var t=n.handleErrorMessageKey(e.status);n.translateService.get(t).subscribe(function(e){n.inlineAlert.showInlineError(e)}),n.forceRefreshView(2e3)}))},e.prototype.updateEndpoint=function(){var e,t,n=this;if(!this.onGoing){var i=this.initEndpoint();try{for(var r=C(Object.keys(i)),o=r.next();!o.done;o=r.next()){var a=o.value;delete i[a]}}catch(l){e={error:l}}finally{try{o&&!o.done&&(t=r["return"])&&t.call(r)}finally{if(e)throw e.error}}var s=this.getChanges();if(!B(s))Object.keys(s).forEach(function(e){i[e]=s[e]}),this.target.id&&(this.onGoing=!0,w(this.endpointService.updateEndpoint(this.target.id,i)).then(function(e){n.translateService.get("DESTINATION.UPDATED_SUCCESS").subscribe(function(e){return n.errorHandler.info(e)}),n.reload.emit(!0),n.close(),n.onGoing=!1,n.forceRefreshView(2e3)})["catch"](function(e){var t=n.handleErrorMessageKey(e.status);n.translateService.get(t).subscribe(function(e){n.inlineAlert.showInlineError(e)}),n.onGoing=!1,n.forceRefreshView(2e3)}))}},e.prototype.handleErrorMessageKey=function(e){switch(e){case 409:return"DESTINATION.CONFLICT_NAME";case 400:return"DESTINATION.INVALID_NAME";default:return"UNKNOWN_ERROR"}},e.prototype.onCancel=function(){B(this.getChanges())?(this.close(),this.targetForm&&this.targetForm.reset()):this.inlineAlert.showInlineConfirmation({message:"ALERT.FORM_CHANGE_CONFIRMATION"})},e.prototype.confirmCancel=function(e){this.inlineAlert.close(),this.close()},e.prototype.ngAfterViewChecked=function(){var i=this;this.targetForm!==this.currentForm&&(this.targetForm=this.currentForm,this.targetForm&&(this.valueChangesSub=this.targetForm.valueChanges.subscribe(function(e){if(e){var t=0;for(var n in e)null!==e[n]&&t++;if(5!==t)return;U(i.formValues,e)||(i.formValues=e,i.inlineAlert.close())}})))},e.prototype.getChanges=function(){var e,t,n={};if(!this.target||!this.initVal)return n;try{for(var i=C(Object.keys(this.target)),r=i.next();!r.done;r=i.next()){var o=r.value,a=this.initVal[o];U(a,this.target[o])||(n[o]=this.target[o],"number"==typeof a&&(n[o]=+n[o]),"string"==typeof a&&(n[o]=(""+n[o]).trim()))}}catch(s){e={error:s}}finally{try{r&&!r.done&&(t=i["return"])&&t.call(i)}finally{if(e)throw e.error}}return n},e.decorators=[{type:c.Component,args:[{selector:"hbr-create-edit-endpoint",template:'<clr-modal [(clrModalOpen)]="createEditDestinationOpened" [clrModalStaticBackdrop]="staticBackdrop" [clrModalClosable]="closable">\n <h3 class="modal-title">{{modalTitle}}</h3>\n <hbr-inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></hbr-inline-alert>\n <div class="modal-body">\n <div class="alert alert-warning" *ngIf="!editable">\n <div class="alert-item static">\n <span class="alert-text">\n {{\'DESTINATION.CANNOT_EDIT\' | translate}}\n </span>\n </div>\n </div>\n <form #targetForm="ngForm">\n <section class="form-block">\n <div class="form-group">\n <label for="destination_name" class="col-md-4 form-group-label-override required">{{ \'DESTINATION.NAME\' | translate }}</label>\n <label class="col-md-8" for="destination_name" aria-haspopup="true" role="tooltip" [class.invalid]="targetName.errors && (targetName.dirty || targetName.touched)" [class.valid]="targetName.valid" class="tooltip tooltip-validation tooltip-sm tooltip-bottom-left">\n <input type="text" id="destination_name" [disabled]="testOngoing" [readonly]="!editable" [(ngModel)]="target.name" name="targetName" size="20" #targetName="ngModel" required> \n <span class="tooltip-content" *ngIf="targetName.errors && targetName.errors.required && (targetName.dirty || targetName.touched)">\n {{ \'DESTINATION.NAME_IS_REQUIRED\' | translate }}\n </span>\n </label>\n </div>\n <div class="form-group">\n <label for="destination_url" class="col-md-4 form-group-label-override required">{{ \'DESTINATION.URL\' | translate }}</label>\n <label class="col-md-8" for="destination_url" aria-haspopup="true" role="tooltip" [class.invalid]="targetEndpoint.errors && (targetEndpoint.dirty || targetEndpoint.touched)" [class.valid]="targetEndpoint.valid" class="tooltip tooltip-validation tooltip-sm tooltip-bottom-left">\n <input type="text" id="destination_url" [disabled]="testOngoing" [readonly]="!editable" [(ngModel)]="target.endpoint" size="20" name="endpointUrl" #targetEndpoint="ngModel" required placeholder="http(s)://192.168.1.1">\n <span class="tooltip-content" *ngIf="targetEndpoint.errors && targetEndpoint.errors.required && (targetEndpoint.dirty || targetEndpoint.touched)">\n {{ \'DESTINATION.URL_IS_REQUIRED\' | translate }}\n </span>\n </label>\n </div>\n <div class="form-group">\n <label for="destination_username" class="col-md-4 form-group-label-override">{{ \'DESTINATION.USERNAME\' | translate }}</label>\n <input type="text" class="col-md-8" id="destination_username" [disabled]="testOngoing" [readonly]="!editable" [(ngModel)]="target.username" size="20" name="username" #username="ngModel">\n </div>\n <div class="form-group">\n <label for="destination_password" class="col-md-4 form-group-label-override">{{ \'DESTINATION.PASSWORD\' | translate }}</label>\n <input type="password" class="col-md-8" id="destination_password" [disabled]="testOngoing" [readonly]="!editable" [(ngModel)]="target.password" size="20" name="password" #password="ngModel">\n </div>\n <div class="form-group">\n <label for="destination_insecure" class="col-md-4 form-group-label-override">{{\'CONFIG.VERIFY_REMOTE_CERT\' | translate }}</label>\n <clr-checkbox #insecure name="insecure" id="destination_insecure" [clrDisabled]="testOngoing || !editable" [clrChecked]="!target.insecure" [clrInline]="true" (clrCheckedChange)="setInsecureValue($event)">\n </clr-checkbox>\n <clr-tooltip>\n <clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>\n <clr-tooltip-content clrPosition="top-right" clrSize="md" *clrIfOpen>\n {{\'CONFIG.TOOLTIP.VERIFY_REMOTE_CERT\' | translate}}\n </clr-tooltip-content>\n </clr-tooltip>\n </div>\n <div class="form-group" style="height:30px;">\n <label for="spin" class="col-md-4"></label>\n <span class="col-md-8 spinner spinner-inline" [hidden]="!inProgress"></span>\n </div>\n </section>\n </form>\n </div>\n <div class="modal-footer">\n <button type="button" class="btn btn-outline" (click)="testConnection()" [disabled]="inProgress || targetEndpoint.errors">{{ \'DESTINATION.TEST_CONNECTION\' | translate }}</button>\n <button type="button" class="btn btn-outline" (click)="onCancel()" [disabled]="inProgress">{{ \'BUTTON.CANCEL\' | translate }}</button>\n <button type="submit" class="btn btn-primary" (click)="onSubmit()" [disabled]="!isValid">{{ \'BUTTON.OK\' | translate }}</button>\n </div>\n</clr-modal>',styles:[".form-group-label-override{font-size:14px;font-weight:400}clr-tooltip{top:3px;position:relative}"]}]}],e.ctorParameters=function(){return[{type:Q},{type:Ce},{type:n.TranslateService},{type:c.ChangeDetectorRef}]},e.propDecorators={currentForm:[{type:c.ViewChild,args:["targetForm"]}],inlineAlert:[{type:c.ViewChild,args:[xe]}],reload:[{type:c.Output}]},e}(),Ae=function(){this.name="",this.state="",this.data={id:-1,name:"",errorInf:""},this.timeStamp=0,this.timeDiff="less 1 minute"};function _e(e,t,n,i){return e.state=t,e.data.errorInf=n,e.timeStamp=(new Date).getTime(),e}var ke={progressing:"progressing",success:"success",failure:"failure",interrupt:"interrupt"},De=function(){function e(){this.subjects=null,this.operationInfoSource=new l.Subject,this.operationInfo$=this.operationInfoSource.asObservable()}return e.prototype.publishInfo=function(e){this.operationInfoSource.next(e)},e.decorators=[{type:c.Injectable}],e}(),je=function(){function e(e,t,n,i,r){this.endpointService=e,this.errorHandler=t,this.translateService=n,this.operationService=i,this.ref=r,this.loading=!1,this.creationTimeComparator=new k("creation_time","date"),this.selectedRow=[],this.forceRefreshView(1e3)}return Object.defineProperty(e.prototype,"initEndpoint",{get:function(){return{endpoint:"",name:"",username:"",password:"",insecure:!1,type:0}},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.targetName="",this.retrieve()},e.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},e.prototype.selectedChange=function(){this.forceRefreshView(5e3)},e.prototype.retrieve=function(){var t=this;this.loading=!0,this.selectedRow=[],w(this.endpointService.getEndpoints(this.targetName)).then(function(e){t.targets=e||[],t.forceRefreshView(1e3),t.loading=!1})["catch"](function(e){t.errorHandler.error(e),t.loading=!1})},e.prototype.doSearchTargets=function(e){this.targetName=e,this.retrieve()},e.prototype.refreshTargets=function(){this.retrieve()},e.prototype.reload=function(e){this.targetName="",this.retrieve()},e.prototype.openModal=function(){this.createEditEndpointComponent.openCreateEditTarget(!0),this.target=this.initEndpoint},e.prototype.editTargets=function(e){if(e&&1===e.length){var t=e[0];if(!t.id)return