Merge latest update.

This commit is contained in:
kunw 2017-03-28 19:02:15 +08:00
commit fb79b4d730
16 changed files with 60 additions and 27 deletions

View File

@ -1,4 +1,4 @@
<clr-modal [(clrModalOpen)]="opened" [clrModalStaticBackdrop]="staticBackdrop"> <clr-modal [(clrModalOpen)]="opened" [clrModalStaticBackdrop]="staticBackdrop" [clrModalClosable]="false">
<h3 class="modal-title">{{'PROFILE.TITLE' | translate}}</h3> <h3 class="modal-title">{{'PROFILE.TITLE' | translate}}</h3>
<inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></inline-alert> <inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></inline-alert>
<div class="modal-body" style="overflow-y: hidden;"> <div class="modal-body" style="overflow-y: hidden;">

View File

@ -97,14 +97,10 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked {
} }
for (var prop in this.originalStaticData) { for (var prop in this.originalStaticData) {
if (this.originalStaticData[prop]) {
if (this.account[prop]) {
if (this.originalStaticData[prop] != this.account[prop]) { if (this.originalStaticData[prop] != this.account[prop]) {
return true; return true;
} }
} }
}
}
return false; return false;
} }
@ -188,7 +184,7 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked {
if (this.msgHandler.isAppLevel(error)) { if (this.msgHandler.isAppLevel(error)) {
this.opened = false; this.opened = false;
this.msgHandler.handleError(error); this.msgHandler.handleError(error);
}else{ } else {
this.inlineAlert.showInlineError(error); this.inlineAlert.showInlineError(error);
} }
}); });

View File

@ -1,4 +1,4 @@
<clr-modal [(clrModalOpen)]="opened" [clrModalStaticBackdrop]="true"> <clr-modal [(clrModalOpen)]="opened" [clrModalStaticBackdrop]="true" [clrModalClosable]="false">
<h3 class="modal-title">{{'CHANGE_PWD.TITLE' | translate}}</h3> <h3 class="modal-title">{{'CHANGE_PWD.TITLE' | translate}}</h3>
<inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></inline-alert> <inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></inline-alert>
<div class="modal-body" style="overflow-y: hidden;"> <div class="modal-body" style="overflow-y: hidden;">

View File

@ -1,4 +1,4 @@
<clr-modal [(clrModalOpen)]="opened" [clrModalStaticBackdrop]="staticBackdrop" [clrModalClosable]="true"> <clr-modal [(clrModalOpen)]="opened" [clrModalStaticBackdrop]="staticBackdrop" [clrModalClosable]="false">
<h3 class="modal-title">{{'SIGN_UP.TITLE' | translate}}</h3> <h3 class="modal-title">{{'SIGN_UP.TITLE' | translate}}</h3>
<inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></inline-alert> <inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></inline-alert>
<div class="modal-body" style="overflow-y: hidden;"> <div class="modal-body" style="overflow-y: hidden;">

View File

@ -9,6 +9,7 @@ export class AppConfig {
this.project_creation_restriction = "everyone"; this.project_creation_restriction = "everyone";
this.self_registration = true; this.self_registration = true;
this.has_ca_root = false; this.has_ca_root = false;
this.harbor_version = "0.5.0";//default
} }
with_notary: boolean; with_notary: boolean;
@ -19,4 +20,5 @@ export class AppConfig {
project_creation_restriction: string; project_creation_restriction: string;
self_registration: boolean; self_registration: boolean;
has_ca_root: boolean; has_ca_root: boolean;
harbor_version: string;
} }

View File

@ -7,8 +7,6 @@
<div style="height: 12px;"></div> <div style="height: 12px;"></div>
<div> <div>
<span class="p5 about-version">{{'ABOUT.VERSION' | translate}} {{version}}</span> <span class="p5 about-version">{{'ABOUT.VERSION' | translate}} {{version}}</span>
<span>|</span>
<span class="p5 about-build">{{'ABOUT.BUILD' | translate}} {{build}}</span>
</div> </div>
<div style="height: 12px;"></div> <div style="height: 12px;"></div>
<div> <div>

View File

@ -1,5 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { AppConfigService } from '../../app-config.service';
@Component({ @Component({
selector: 'about-dialog', selector: 'about-dialog',
templateUrl: "about-dialog.component.html", templateUrl: "about-dialog.component.html",
@ -7,8 +9,14 @@ import { Component } from '@angular/core';
}) })
export class AboutDialogComponent { export class AboutDialogComponent {
private opened: boolean = false; private opened: boolean = false;
private version: string ="0.4.1"; private build: string = "4276418";
private build: string ="4276418";
constructor(private appConfigService: AppConfigService) { }
public get version(): string {
let appConfig = this.appConfigService.getConfig();
return appConfig?appConfig.harbor_version: "n/a";
}
public open(): void { public open(): void {
this.opened = true; this.opened = true;

View File

@ -0,0 +1,4 @@
.alert-text-blink {
color: red;
font-weight: bolder;
}

View File

@ -1,9 +1,10 @@
<clr-alert [clrAlertType]="inlineAlertType" [clrAlertClosable]="inlineAlertClosable" [(clrAlertClosed)]="alertClose" [clrAlertAppLevel]="useAppLevelStyle"> <clr-alert [clrAlertType]="inlineAlertType" [clrAlertClosable]="inlineAlertClosable" [(clrAlertClosed)]="alertClose" [clrAlertAppLevel]="useAppLevelStyle">
<div class="alert-item"> <div class="alert-item">
<span class="alert-text"> <span class="alert-text" [class.alert-text-blink]="blinking">
{{errorMessage}} {{errorMessage}}
</span> </span>
<div class="alert-actions" *ngIf="showCancelAction"> <div class="alert-actions" *ngIf="showCancelAction">
<button class="btn alert-action" (click)="close()">{{'BUTTON.NO' | translate}}</button>
<button class="btn alert-action" (click)="confirmCancel()">{{'BUTTON.YES' | translate}}</button> <button class="btn alert-action" (click)="confirmCancel()">{{'BUTTON.YES' | translate}}</button>
</div> </div>
</div> </div>

View File

@ -2,18 +2,24 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { errorHandler } from '../shared.utils'; import { errorHandler } from '../shared.utils';
import { Observable } from 'rxjs/Rx';
import { Subscription } from "rxjs";
@Component({ @Component({
selector: 'inline-alert', selector: 'inline-alert',
templateUrl: "inline-alert.component.html" templateUrl: "inline-alert.component.html",
styleUrls: ['inline-alert.component.css']
}) })
export class InlineAlertComponent { export class InlineAlertComponent {
private inlineAlertType: string = 'alert-danger'; private inlineAlertType: string = 'alert-danger';
private inlineAlertClosable: boolean = true; private inlineAlertClosable: boolean = false;
private alertClose: boolean = true; private alertClose: boolean = true;
private displayedText: string = ""; private displayedText: string = "";
private showCancelAction: boolean = false; private showCancelAction: boolean = false;
private useAppLevelStyle: boolean = false; private useAppLevelStyle: boolean = false;
private timer: Subscription = null;
private count: number = 0;
private blinking: boolean = false;
@Output() confirmEvt = new EventEmitter<boolean>(); @Output() confirmEvt = new EventEmitter<boolean>();
@ -45,7 +51,7 @@ export class InlineAlertComponent {
} }
this.inlineAlertType = 'alert-warning'; this.inlineAlertType = 'alert-warning';
this.showCancelAction = true; this.showCancelAction = true;
this.inlineAlertClosable = true; this.inlineAlertClosable = false;
this.alertClose = false; this.alertClose = false;
this.useAppLevelStyle = false; this.useAppLevelStyle = false;
} }
@ -68,6 +74,9 @@ export class InlineAlertComponent {
this.alertClose = true; this.alertClose = true;
} }
public blink() {
}
private confirmCancel(): void { private confirmCancel(): void {
this.confirmEvt.emit(true); this.confirmEvt.emit(true);
} }

View File

@ -35,8 +35,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="statistic-item-divider"></div> <div class="statistic-item-divider" [hidden]="!isValidSession"></div>
<div class="statistic-block"> <div class="statistic-block" [hidden]="!isValidSession">
<div>{{freeStorage}}GB | {{totalStorage}}GB</div> <div>{{freeStorage}}GB | {{totalStorage}}GB</div>
<div>[STORAGE]</div> <div>[STORAGE]</div>
</div> </div>

View File

@ -26,8 +26,11 @@ export class StatisticsPanelComponent implements OnInit {
private session: SessionService) { } private session: SessionService) { }
ngOnInit(): void { ngOnInit(): void {
if (this.isValidSession) { if (this.session.getCurrentUser()) {
this.getStatistics(); this.getStatistics();
}
if (this.isValidSession) {
this.getVolumes(); this.getVolumes();
} }
} }

View File

@ -10,7 +10,7 @@
.statistic-data { .statistic-data {
font-size: 16px; font-size: 16px;
font-weight: 900; font-weight: 900;
font-family: "semibold"; font-family: "Metropolis Semibold";
line-height: 16px; line-height: 16px;
} }
@ -18,7 +18,7 @@
font-size: 10px; font-size: 10px;
line-height: 10px; line-height: 10px;
text-transform: uppercase; text-transform: uppercase;
font-family: "semibold"; font-family: "Metropolis Regular";
} }
.statistic-column-block { .statistic-column-block {
@ -30,6 +30,7 @@
position: relative; position: relative;
text-transform: uppercase; text-transform: uppercase;
font-size: 14px; font-size: 14px;
font-family: "Metropolis Regular";
} }
.statistic-column-title-pro { .statistic-column-title-pro {

View File

@ -1,4 +1,4 @@
<clr-modal [(clrModalOpen)]="opened" [clrModalStaticBackdrop]="true"> <clr-modal [(clrModalOpen)]="opened" [clrModalStaticBackdrop]="true" [clrModalClosable]="false">
<h3 class="modal-title">{{'USER.ADD_USER_TITLE' | translate}}</h3> <h3 class="modal-title">{{'USER.ADD_USER_TITLE' | translate}}</h3>
<inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></inline-alert> <inline-alert class="modal-title" (confirmEvt)="confirmCancel($event)"></inline-alert>
<div class="modal-body" style="overflow-y: hidden;"> <div class="modal-body" style="overflow-y: hidden;">

View File

@ -3,7 +3,7 @@
<h2 class="custom-h2">{{'SIDE_NAV.SYSTEM_MGMT.USER' | translate}}</h2> <h2 class="custom-h2">{{'SIDE_NAV.SYSTEM_MGMT.USER' | translate}}</h2>
<div class="action-panel-pos"> <div class="action-panel-pos">
<span> <span>
<button type="submit" class="btn btn-primary custom-add-button" (click)="addNewUser()"><clr-icon shape="add"></clr-icon> {{'USER.ADD_ACTION' | translate}}</button> <button *ngIf="canCreateUser" type="submit" class="btn btn-primary custom-add-button" (click)="addNewUser()"><clr-icon shape="add"></clr-icon> {{'USER.ADD_ACTION' | translate}}</button>
</span> </span>
<grid-filter class="filter-pos" filterPlaceholder='{{"USER.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)"></grid-filter> <grid-filter class="filter-pos" filterPlaceholder='{{"USER.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)"></grid-filter>
<span class="refresh-btn" (click)="refreshUser()"> <span class="refresh-btn" (click)="refreshUser()">

View File

@ -12,6 +12,7 @@ import { ConfirmationState, ConfirmationTargets } from '../shared/shared.const'
import { MessageHandlerService } from '../shared/message-handler/message-handler.service'; import { MessageHandlerService } from '../shared/message-handler/message-handler.service';
import { SessionService } from '../shared/session.service'; import { SessionService } from '../shared/session.service';
import { AppConfigService } from '../app-config.service';
@Component({ @Component({
selector: 'harbor-user', selector: 'harbor-user',
@ -37,7 +38,8 @@ export class UserComponent implements OnInit, OnDestroy {
private translate: TranslateService, private translate: TranslateService,
private deletionDialogService: ConfirmationDialogService, private deletionDialogService: ConfirmationDialogService,
private msgHandler: MessageHandlerService, private msgHandler: MessageHandlerService,
private session: SessionService) { private session: SessionService,
private appConfigService: AppConfigService) {
this.deletionSubscription = deletionDialogService.confirmationConfirm$.subscribe(confirmed => { this.deletionSubscription = deletionDialogService.confirmationConfirm$.subscribe(confirmed => {
if (confirmed && if (confirmed &&
confirmed.source === ConfirmationTargets.USER && confirmed.source === ConfirmationTargets.USER &&
@ -62,6 +64,15 @@ export class UserComponent implements OnInit, OnDestroy {
return testedItem.indexOf(terms) != -1; return testedItem.indexOf(terms) != -1;
} }
public get canCreateUser(): boolean {
let appConfig = this.appConfigService.getConfig();
if (appConfig) {
return appConfig.auth_mode != 'ldap_auth';
} else {
return true;
}
}
isSystemAdmin(u: User): string { isSystemAdmin(u: User): string {
if (!u) { if (!u) {
return "{{MISS}}"; return "{{MISS}}";