Display storage statistic only in filesystem mode

This commit is contained in:
Deng, Qian 2018-01-25 17:28:56 +08:00
parent 4a21f80b86
commit a1c850cfdb
9 changed files with 50 additions and 44 deletions

View File

@ -1,6 +1,6 @@
{
"name": "harbor-ui",
"version": "0.6.25",
"version": "0.6.30",
"description": "Harbor shared UI components based on Clarity and Angular4",
"scripts": {
"start": "ng serve --host 0.0.0.0 --port 4500 --proxy-config proxy.config.json",

View File

@ -1,6 +1,6 @@
{
"name": "harbor-ui",
"version": "0.6.25",
"version": "0.6.30",
"description": "Harbor shared UI components based on Clarity and Angular4",
"author": "VMware",
"module": "index.js",

View File

@ -2,10 +2,10 @@ export const LIST_REPLICATION_RULE_TEMPLATE: string = `
<div style="padding-bottom: 15px;">
<clr-datagrid [clrDgLoading]="loading" [(clrDgSingleSelected)]="selectedRow" [clDgRowSelection]="true">
<clr-dg-action-bar style="height:24px;" *ngIf="opereateAvailable || isSystemAdmin">
<button type="button" class="btn btn-sm btn-secondary" (click)="openModal()">{{'REPLICATION.NEW_REPLICATION_RULE' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" (click)="openModal()"><clr-icon shape="plus" size="16"></clr-icon>&nbsp;{{'REPLICATION.NEW_REPLICATION_RULE' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="editRule(selectedRow)"><clr-icon shape="pencil" size="16"></clr-icon>&nbsp;{{'REPLICATION.EDIT_POLICY' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="deleteRule(selectedRow)"><clr-icon shape="times" size="16"></clr-icon>&nbsp;{{'REPLICATION.DELETE_POLICY' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="replicateRule(selectedRow)"><clr-icon shape="export"></clr-icon>&nbsp;{{'REPLICATION.REPLICATE' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="replicateRule(selectedRow)"><clr-icon shape="export" size="16"></clr-icon>&nbsp;{{'REPLICATION.REPLICATE' | translate}}</button>
</clr-dg-action-bar>
<clr-dg-column [clrDgField]="'name'">{{'REPLICATION.NAME' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'projects'" *ngIf="!projectScope">{{'REPLICATION.PROJECT' | translate}}</clr-dg-column>

View File

@ -31,7 +31,7 @@
"clarity-icons": "^0.10.17",
"clarity-ui": "^0.10.17",
"core-js": "^2.4.1",
"harbor-ui": "0.6.29",
"harbor-ui": "0.6.30",
"intl": "^1.2.5",
"mutationobserver-shim": "^0.3.2",
"ngx-cookie": "^1.0.0",

View File

@ -14,25 +14,6 @@
import { ClairDBStatus } from 'harbor-ui';
export class AppConfig {
constructor() {
//Set default value
this.with_notary = false;
this.with_admiral = false;
this.with_clair = false;
this.admiral_endpoint = "";
this.auth_mode = "db_auth";
this.registry_url = "";
this.project_creation_restriction = "everyone";
this.self_registration = true;
this.has_ca_root = false;
this.harbor_version = "1.2.0";//default
this.clair_vulnerability_status = {
overall_last_update: 0,
details: []
};
this.next_scan_all = 0;
}
with_notary: boolean;
with_admiral: boolean;
with_clair: boolean;
@ -45,4 +26,25 @@ export class AppConfig {
harbor_version: string;
clair_vulnerability_status?: ClairDBStatus;
next_scan_all: number;
registry_storage_provider_name: string;
constructor() {
// Set default value
this.with_notary = false;
this.with_admiral = false;
this.with_clair = false;
this.admiral_endpoint = "";
this.auth_mode = "db_auth";
this.registry_url = "";
this.project_creation_restriction = "everyone";
this.self_registration = true;
this.has_ca_root = false;
this.harbor_version = "1.2.0";
this.clair_vulnerability_status = {
overall_last_update: 0,
details: []
};
this.next_scan_all = 0;
this.registry_storage_provider_name = "";
}
}

View File

@ -10,10 +10,10 @@
<div class="option-right">
<div class="select" style="float: left; left:-6px; top:8px;">
<select (change)="doFilterProjects()" [(ngModel)]="selecteType">
<option value="0" [selected]="currentFilteredType === 0">{{projectTypes[0] | translate}}</option>
<option value="1">{{projectTypes[1] | translate}}</option>
<option value="2">{{projectTypes[2] | translate}}</option>
</select>
<option value="0" [selected]="currentFilteredType === 0">{{projectTypes[0] | translate}}</option>
<option value="1">{{projectTypes[1] | translate}}</option>
<option value="2">{{projectTypes[2] | translate}}</option>
</select>
</div>
<hbr-filter [withDivider]="true" filterPlaceholder='{{"PROJECT.FILTER_PLACEHOLDER" | translate}}' (filter)="doSearchProjects($event)" [currentValue]="projectName"></hbr-filter>
<span class="refresh-btn" (click)="refresh()">

View File

@ -11,22 +11,24 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component, Input, OnInit, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { Component, Input, OnInit, OnDestroy } from "@angular/core";
import { Subscription } from "rxjs/Subscription";
import { StatisticsService } from './statistics.service';
import { Statistics } from './statistics';
import { StatisticsService } from "./statistics.service";
import { Statistics } from "./statistics";
import { SessionService } from '../session.service';
import { Volumes } from './volumes';
import { SessionService } from "../session.service";
import { Volumes } from "./volumes";
import { MessageHandlerService } from "../message-handler/message-handler.service";
import { StatisticHandler } from "./statistic-handler.service";
import { AppConfigService } from "./../../app-config.service";
import { MessageHandlerService } from '../message-handler/message-handler.service';
import { StatisticHandler } from './statistic-handler.service';
@Component({
selector: 'statistics-panel',
selector: "statistics-panel",
templateUrl: "statistics-panel.component.html",
styleUrls: ['statistics.component.css'],
styleUrls: ["statistics.component.css"],
providers: [StatisticsService]
})
@ -36,16 +38,17 @@ export class StatisticsPanelComponent implements OnInit, OnDestroy {
volumesInfo: Volumes = new Volumes();
refreshSub: Subscription;
small: number;
constructor(
private statistics: StatisticsService,
private msgHandler: MessageHandlerService,
private session: SessionService,
private appConfigService: AppConfigService,
private statisticHandler: StatisticHandler) {
}
ngOnInit(): void {
//Refresh
// Refresh
this.refreshSub = this.statisticHandler.refreshChan$.subscribe(clear => {
this.getStatistics();
});
@ -95,7 +98,8 @@ export class StatisticsPanelComponent implements OnInit, OnDestroy {
}
public get isValidStorage(): boolean {
return this.volumesInfo.storage.total != 0;
return this.volumesInfo.storage.total !== 0 &&
this.appConfigService.getConfig().registry_storage_provider_name === "filesystem";
}
getGBFromBytes(bytes: number): number {

View File

@ -119,8 +119,8 @@
},
"USER": {
"ADD_ACTION": "New User",
"ENABLE_ADMIN_ACTION": "Set as Administrator",
"DISABLE_ADMIN_ACTION": "Revoke Administrator",
"ENABLE_ADMIN_ACTION": "SET AS ADMIN",
"DISABLE_ADMIN_ACTION": "REVOKE ADMIN",
"DEL_ACTION": "Delete",
"FILTER_PLACEHOLDER": "Filter users",
"COLUMN_NAME": "Name",

View File

@ -221,7 +221,7 @@
"SWITCH_TITLE": "切换项目成员确认",
"SWITCH_SUMMARY": "你确认切换项目成员 {{param}}??",
"ACTION": "设置角色",
"REMOVE": "移除"
"REMOVE": "移除成员"
},
"AUDIT_LOG": {
"USERNAME": "用户名",