+
diff --git a/src/portal/src/app/dev-center/dev-center.component.html b/src/portal/src/app/dev-center/dev-center.component.html
new file mode 100644
index 000000000..9eef24511
--- /dev/null
+++ b/src/portal/src/app/dev-center/dev-center.component.html
@@ -0,0 +1,2 @@
+
+
diff --git a/src/portal/src/app/dev-center/dev-center.component.scss b/src/portal/src/app/dev-center/dev-center.component.scss
new file mode 100644
index 000000000..c95a6e969
--- /dev/null
+++ b/src/portal/src/app/dev-center/dev-center.component.scss
@@ -0,0 +1,8 @@
+.swagger-container {
+ overflow: auto;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
\ No newline at end of file
diff --git a/src/portal/src/app/dev-center/dev-center.component.spec.ts b/src/portal/src/app/dev-center/dev-center.component.spec.ts
new file mode 100644
index 000000000..9878313eb
--- /dev/null
+++ b/src/portal/src/app/dev-center/dev-center.component.spec.ts
@@ -0,0 +1,26 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DevCenterComponent } from './dev-center.component';
+
+describe('DevCenterComponent', () => {
+ let component: DevCenterComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ DevCenterComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DevCenterComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+});
diff --git a/src/portal/src/app/dev-center/dev-center.component.ts b/src/portal/src/app/dev-center/dev-center.component.ts
new file mode 100644
index 000000000..504a763cd
--- /dev/null
+++ b/src/portal/src/app/dev-center/dev-center.component.ts
@@ -0,0 +1,37 @@
+import { AfterViewInit, Component, ElementRef, OnInit } from '@angular/core';
+import { Http } from '@angular/http';
+import { throwError as observableThrowError, Observable } from 'rxjs';
+import { catchError, map } from 'rxjs/operators';
+
+
+const SwaggerUI = require('swagger-ui');
+@Component({
+ selector: 'dev-center',
+ templateUrl: 'dev-center.component.html',
+ styleUrls: ['dev-center.component.scss']
+})
+export class DevCenterComponent implements AfterViewInit {
+ private ui: any;
+ private host: any;
+ private json: any;
+ constructor(private el: ElementRef, private http: Http) {
+ }
+
+ ngAfterViewInit() {
+ this.http.get("/swagger.json")
+ .pipe(catchError(error => observableThrowError(error)))
+ .pipe(map(response => response.json())).subscribe(json => {
+ json.host = window.location.host;
+ const protocal = window.location.protocol;
+ json.schemes = [protocal.replace(":", "")];
+ let ui = SwaggerUI({
+ spec: json,
+ domNode: this.el.nativeElement.querySelector('.swagger-container'),
+ deepLinking: true,
+ presets: [
+ SwaggerUI.presets.apis
+ ],
+ });
+ });
+ }
+}
diff --git a/src/portal/src/app/dev-center/dev-center.module.ts b/src/portal/src/app/dev-center/dev-center.module.ts
new file mode 100644
index 000000000..2551d22c5
--- /dev/null
+++ b/src/portal/src/app/dev-center/dev-center.module.ts
@@ -0,0 +1,23 @@
+import { NgModule } from "@angular/core";
+import { RouterModule } from "@angular/router";
+import { CommonModule } from "@angular/common";
+import { ClarityModule } from '@clr/angular';
+import { SharedModule } from '../shared/shared.module';
+import { DevCenterComponent } from "./dev-center.component";
+
+
+@NgModule({
+ imports: [
+ CommonModule,
+ SharedModule,
+ RouterModule.forChild([{
+ path: "**",
+ component: DevCenterComponent,
+ }]),
+ ClarityModule.forRoot(),
+ ],
+ declarations: [
+ DevCenterComponent,
+ ],
+})
+export class DeveloperCenterModule {}
diff --git a/src/portal/src/app/harbor-routing.module.ts b/src/portal/src/app/harbor-routing.module.ts
index 2817716da..a6f01fbe2 100644
--- a/src/portal/src/app/harbor-routing.module.ts
+++ b/src/portal/src/app/harbor-routing.module.ts
@@ -22,6 +22,7 @@ import { MemberGuard } from './shared/route/member-guard-activate.service';
import { PageNotFoundComponent } from './shared/not-found/not-found.component';
import { HarborShellComponent } from './base/harbor-shell/harbor-shell.component';
import { ConfigurationComponent } from './config/config.component';
+import { DevCenterComponent } from './dev-center/dev-center.component';
import { UserComponent } from './user/user.component';
import { SignInComponent } from './account/sign-in/sign-in.component';
@@ -43,7 +44,7 @@ import { LeavingRepositoryRouteDeactivate } from './shared/route/leaving-reposit
import { ProjectComponent } from './project/project.component';
import { ProjectDetailComponent } from './project/project-detail/project-detail.component';
import { MemberComponent } from './project/member/member.component';
-import {ProjectLabelComponent} from "./project/project-label/project-label.component";
+import { ProjectLabelComponent } from "./project/project-label/project-label.component";
import { ProjectConfigComponent } from './project/project-config/project-config.component';
import { ProjectRoutingResolver } from './project/project-routing-resolver.service';
import { ListChartsComponent } from './project/list-charts/list-charts.component';
@@ -53,6 +54,10 @@ import { ChartDetailComponent } from './project/chart-detail/chart-detail.compon
const harborRoutes: Routes = [
{ path: '', redirectTo: 'harbor', pathMatch: 'full' },
{ path: 'reset_password', component: ResetPasswordComponent },
+ {
+ path: 'devcenter',
+ component: DevCenterComponent
+ },
{
path: 'harbor',
component: HarborShellComponent,
diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json
index e3bf82800..ae1e9bff9 100644
--- a/src/portal/src/i18n/lang/en-us-lang.json
+++ b/src/portal/src/i18n/lang/en-us-lang.json
@@ -121,7 +121,8 @@
"GROUP": "Groups",
"REGISTRY": "Registries",
"REPLICATION": "Replications",
- "CONFIG": "Configuration"
+ "CONFIG": "Configuration",
+ "DEVCENTER": "Developer Center"
},
"LOGS": "Logs"
},
diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json
index 1c6f7bccc..88e217eaa 100644
--- a/src/portal/src/i18n/lang/es-es-lang.json
+++ b/src/portal/src/i18n/lang/es-es-lang.json
@@ -121,7 +121,8 @@
"REGISTRY": "Registries",
"GROUP": "Groups",
"REPLICATION": "Replicacións",
- "CONFIG": "Configuración"
+ "CONFIG": "Configuración",
+ "DEVCENTER": "Developer Center"
},
"LOGS": "Logs"
},
diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json
index 9f780664a..d5b16fdea 100644
--- a/src/portal/src/i18n/lang/fr-fr-lang.json
+++ b/src/portal/src/i18n/lang/fr-fr-lang.json
@@ -107,7 +107,8 @@
"USER": "Utilisateurs",
"GROUP": "Groups",
"REPLICATION": "Réplication",
- "CONFIG": "Configuration"
+ "CONFIG": "Configuration",
+ "DEVCENTER": "Developer Center"
},
"LOGS": "Logs"
},
diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json
index eacc1d461..822c12d9c 100644
--- a/src/portal/src/i18n/lang/pt-br-lang.json
+++ b/src/portal/src/i18n/lang/pt-br-lang.json
@@ -119,7 +119,8 @@
"GROUP": "Grupos",
"REGISTRY": "Registros",
"REPLICATION": "Replicações",
- "CONFIG": "Configuração"
+ "CONFIG": "Configuração",
+ "DEVCENTER": "Developer Center"
},
"LOGS": "Logs"
},
diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json
index 426240437..1c05a5365 100644
--- a/src/portal/src/i18n/lang/zh-cn-lang.json
+++ b/src/portal/src/i18n/lang/zh-cn-lang.json
@@ -120,7 +120,8 @@
"GROUP": "组管理",
"REGISTRY": "仓库管理",
"REPLICATION": "复制管理",
- "CONFIG": "配置管理"
+ "CONFIG": "配置管理",
+ "DEVCENTER": "开发者中心"
},
"LOGS": "日志"
},
diff --git a/src/portal/src/polyfills.ts b/src/portal/src/polyfills.ts
index 70d9165b9..fc6ef5280 100644
--- a/src/portal/src/polyfills.ts
+++ b/src/portal/src/polyfills.ts
@@ -37,3 +37,6 @@ import 'intl/locale-data/jsonp/zh';
import 'zone.js/dist/zone';
+(window as any).global = window;
+// @ts-ignore
+window.Buffer = window.Buffer || require('buffer').Buffer;
diff --git a/src/portal/src/tsconfig.app.json b/src/portal/src/tsconfig.app.json
index e67ce7c76..d1f143d26 100644
--- a/src/portal/src/tsconfig.app.json
+++ b/src/portal/src/tsconfig.app.json
@@ -8,6 +8,10 @@
"es6",
"dom"
],
+ "types": [
+ "node",
+ "jasmine"
+ ],
"mapRoot": "./",
"module": "commonjs",
"moduleResolution": "node",
diff --git a/src/portal/tsconfig.json b/src/portal/tsconfig.json
index fe7ff4d82..939d69229 100644
--- a/src/portal/tsconfig.json
+++ b/src/portal/tsconfig.json
@@ -7,7 +7,7 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
- "es2015",
+ "es2017",
"dom"
],
"noImplicitAny": false,