Fix issue width Link to license in the about dialog should not be hardcoded to master

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2019-08-05 14:20:03 +08:00
parent a935823e3d
commit 53bd4d7897
9 changed files with 82 additions and 3 deletions

View File

@ -1,7 +1,8 @@
FROM node:10.15.0 as nodeportal
COPY src/portal /portal_src
COPY ./docs/swagger.yaml /portal_src
COPY ./docs/swagger.yaml /portal_src
COPY ./LICENSE /portal_src
WORKDIR /build_dir
@ -21,6 +22,7 @@ FROM photon:2.0
COPY --from=nodeportal /build_dir/dist /usr/share/nginx/html
COPY --from=nodeportal /build_dir/swagger.yaml /usr/share/nginx/html
COPY --from=nodeportal /build_dir/swagger.json /usr/share/nginx/html
COPY --from=nodeportal /build_dir/LICENSE /usr/share/nginx/html
COPY make/photon/portal/nginx.conf /etc/nginx/nginx.conf

View File

@ -37,6 +37,7 @@ import { DevCenterComponent } from './dev-center/dev-center.component';
import { VulnerabilityPageComponent } from './vulnerability-page/vulnerability-page.component';
import { GcPageComponent } from './gc-page/gc-page.component';
import { OidcOnboardModule } from './oidc-onboard/oidc-onboard.module';
import { LicenseModule } from './license/license.module';
registerLocaleData(zh, 'zh-cn');
registerLocaleData(es, 'es-es');
registerLocaleData(localeFr, 'fr-fr');
@ -70,7 +71,8 @@ export function getCurrentLanguage(translateService: TranslateService) {
HarborRoutingModule,
ConfigurationModule,
DeveloperCenterModule,
OidcOnboardModule
OidcOnboardModule,
LicenseModule
],
exports: [
],

View File

@ -56,6 +56,7 @@ import { ListChartsComponent } from './project/helm-chart/list-charts.component'
import { ListChartVersionsComponent } from './project/helm-chart/list-chart-versions/list-chart-versions.component';
import { HelmChartDetailComponent } from './project/helm-chart/helm-chart-detail/chart-detail.component';
import { OidcOnboardComponent } from './oidc-onboard/oidc-onboard.component';
import { LicenseComponent } from './license/license.component';
import { SummaryComponent } from './project/summary/summary.component';
import { TagRetentionComponent } from "./project/tag-retention/tag-retention.component";
@ -72,6 +73,10 @@ const harborRoutes: Routes = [
component: OidcOnboardComponent,
canActivate: [OidcGuard, SignInGuard]
},
{
path: 'license',
component: LicenseComponent
},
{
path: 'harbor/sign-in',
component: SignInComponent,

View File

@ -0,0 +1 @@
<div class="license" >{{licenseContent}}</div>

View File

@ -0,0 +1,8 @@
.license {
display: block;
font-family: monospace;
word-wrap: break-word;
white-space: pre-wrap;
margin: 1em 0px;
font-size: 1rem;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LicenseComponent } from './license.component';
describe('LicenseComponent', () => {
let component: LicenseComponent;
let fixture: ComponentFixture<LicenseComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LicenseComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LicenseComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,25 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { throwError as observableThrowError } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { Title } from '@angular/platform-browser';
@Component({
selector: 'app-license',
viewProviders: [Title],
templateUrl: './license.component.html',
styleUrls: ['./license.component.scss']
})
export class LicenseComponent implements OnInit {
constructor(
private http: HttpClient
) { }
public licenseContent: any;
ngOnInit() {
this.http.get("/LICENSE", { responseType: 'text'})
.pipe(catchError(error => observableThrowError(error)))
.subscribe(json => {
this.licenseContent = json;
});
}
}

View File

@ -0,0 +1,11 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LicenseComponent } from './license.component';
@NgModule({
declarations: [LicenseComponent],
imports: [
CommonModule
]
})
export class LicenseModule { }

View File

@ -11,7 +11,7 @@
<div *ngIf="!customIntroduction">
<p class="p5">{{'ABOUT.COPYRIGHT' | translate}}</p>
<p class="p5">
<a href="https://raw.githubusercontent.com/goharbor/harbor/master/LICENSE" target="_blank">{{'ABOUT.OPEN_SOURCE_LICENSE' | translate}}</a>
<a href="/license" target="_blank">{{'ABOUT.OPEN_SOURCE_LICENSE' | translate}}</a>
</p>
</div>
<div *ngIf="customIntroduction">