harbor-angular
Version:
Harbor shared components based on Clarity and Angular2s
1 lines • 2.35 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/http"),require("rxjs/add/operator/toPromise")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common","@angular/http","rxjs/add/operator/toPromise"],t):t(e.harborangular=e.harborangular||{},e.ng.core,e._angular_common,e._angular_http)}(this,function(e,t,r,n){"use strict";var o=new t.OpaqueToken("service.config"),i=function(){function e(e,t){this.http=e,this.config=t,this.httpOptions=new n.RequestOptions({headers:new n.Headers({"Content-Type":"application/json"})})}return e.prototype.getSystemInfo=function(){return""===this.config.systemInfoEndpoint.trim()?Promise.reject("500: Internal error"):this.http.get(this.config.systemInfoEndpoint,this.httpOptions).toPromise().then(function(e){return e.json()}).catch(function(e){return console.error("Get systeminfo error: ",e)})},e.decorators=[{type:t.Injectable}],e.ctorParameters=function(){return[{type:n.Http},{type:void 0,decorators:[{type:t.Inject,args:[o]}]}]},e}(),s=function(){function e(e){this.systemService=e,this._systemInfo="Loading..."}return Object.defineProperty(e.prototype,"info",{get:function(){return this._systemInfo},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.getInfo()},e.prototype.getInfo=function(){var e=this;this.systemService.getSystemInfo().then(function(t){return e._systemInfo=JSON.stringify(t)}).catch(function(e){return console.error("Retrieve system info error: ",e)})},e.decorators=[{type:t.Component,args:[{selector:"hbr-system",template:"\n <pre>\n {{info}}\n </pre>\n ",styles:[],providers:[i]}]}],e.ctorParameters=function(){return[{type:i}]},e}(),u=[s],a={systemInfoEndpoint:"/api/system"},c=function(){function e(){}return e.forRoot=function(t){return void 0===t&&(t={}),{ngModule:e,providers:[t.config||{provide:o,useValue:a}]}},e.forChild=function(t){return void 0===t&&(t={}),{ngModule:e,providers:[t.config||{provide:o,useValue:a}]}},e.decorators=[{type:t.NgModule,args:[{imports:[r.CommonModule],declarations:[u],exports:[u]}]}],e.ctorParameters=function(){return[]},e}();e.DefaultServiceConfig=a,e.HarborLibraryModule=c,e.SYSTEMINFO_DIRECTIVES=u,e.SystemComponent=s,e.SERVICE_CONFIG=o,Object.defineProperty(e,"__esModule",{value:!0})});