Merge pull request #8605 from jwangyangls/fix-Link-to-license-hardcoded

Fix issue width Link to license in the about dialog should not be hardcoded to master
This commit is contained in:
jwangyangls 2019-08-12 10:50:18 +08:00 committed by GitHub
commit fd6a422bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 3 deletions

View File

@ -2,6 +2,7 @@ FROM node:10.15.0 as nodeportal
COPY src/portal /portal_src COPY src/portal /portal_src
COPY ./docs/swagger.yaml /portal_src COPY ./docs/swagger.yaml /portal_src
COPY ./LICENSE /portal_src
WORKDIR /build_dir 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/dist /usr/share/nginx/html
COPY --from=nodeportal /build_dir/swagger.yaml /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/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 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 { VulnerabilityPageComponent } from './vulnerability-page/vulnerability-page.component';
import { GcPageComponent } from './gc-page/gc-page.component'; import { GcPageComponent } from './gc-page/gc-page.component';
import { OidcOnboardModule } from './oidc-onboard/oidc-onboard.module'; import { OidcOnboardModule } from './oidc-onboard/oidc-onboard.module';
import { LicenseModule } from './license/license.module';
registerLocaleData(zh, 'zh-cn'); registerLocaleData(zh, 'zh-cn');
registerLocaleData(es, 'es-es'); registerLocaleData(es, 'es-es');
registerLocaleData(localeFr, 'fr-fr'); registerLocaleData(localeFr, 'fr-fr');
@ -70,7 +71,8 @@ export function getCurrentLanguage(translateService: TranslateService) {
HarborRoutingModule, HarborRoutingModule,
ConfigurationModule, ConfigurationModule,
DeveloperCenterModule, DeveloperCenterModule,
OidcOnboardModule OidcOnboardModule,
LicenseModule
], ],
exports: [ exports: [
], ],

View File

@ -57,6 +57,7 @@ import { ListChartsComponent } from './project/helm-chart/list-charts.component'
import { ListChartVersionsComponent } from './project/helm-chart/list-chart-versions/list-chart-versions.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 { HelmChartDetailComponent } from './project/helm-chart/helm-chart-detail/chart-detail.component';
import { OidcOnboardComponent } from './oidc-onboard/oidc-onboard.component'; import { OidcOnboardComponent } from './oidc-onboard/oidc-onboard.component';
import { LicenseComponent } from './license/license.component';
import { SummaryComponent } from './project/summary/summary.component'; import { SummaryComponent } from './project/summary/summary.component';
import { TagRetentionComponent } from "./project/tag-retention/tag-retention.component"; import { TagRetentionComponent } from "./project/tag-retention/tag-retention.component";
@ -73,6 +74,10 @@ const harborRoutes: Routes = [
component: OidcOnboardComponent, component: OidcOnboardComponent,
canActivate: [OidcGuard, SignInGuard] canActivate: [OidcGuard, SignInGuard]
}, },
{
path: 'license',
component: LicenseComponent
},
{ {
path: 'harbor/sign-in', path: 'harbor/sign-in',
component: SignInComponent, 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"> <div *ngIf="!customIntroduction">
<p class="p5">{{'ABOUT.COPYRIGHT' | translate}}</p> <p class="p5">{{'ABOUT.COPYRIGHT' | translate}}</p>
<p class="p5"> <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> </p>
</div> </div>
<div *ngIf="customIntroduction"> <div *ngIf="customIntroduction">