From a1c850cfdbb5cf5f395ad35d48d7894f685d31b2 Mon Sep 17 00:00:00 2001 From: "Deng, Qian" Date: Thu, 25 Jan 2018 17:28:56 +0800 Subject: [PATCH] Display storage statistic only in filesystem mode --- src/ui_ng/lib/package.json | 2 +- src/ui_ng/lib/pkg/package.json | 2 +- .../list-replication-rule.component.html.ts | 4 +- src/ui_ng/package.json | 2 +- src/ui_ng/src/app/app-config.ts | 40 ++++++++++--------- .../src/app/project/project.component.html | 8 ++-- .../statictics/statistics-panel.component.ts | 30 ++++++++------ src/ui_ng/src/i18n/lang/en-us-lang.json | 4 +- src/ui_ng/src/i18n/lang/zh-cn-lang.json | 2 +- 9 files changed, 50 insertions(+), 44 deletions(-) diff --git a/src/ui_ng/lib/package.json b/src/ui_ng/lib/package.json index 0c99887f8..bba58816b 100644 --- a/src/ui_ng/lib/package.json +++ b/src/ui_ng/lib/package.json @@ -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", diff --git a/src/ui_ng/lib/pkg/package.json b/src/ui_ng/lib/pkg/package.json index 69d0a683c..f85d0b751 100644 --- a/src/ui_ng/lib/pkg/package.json +++ b/src/ui_ng/lib/pkg/package.json @@ -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", diff --git a/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.html.ts b/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.html.ts index 0bdec9232..834958f7d 100644 --- a/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.html.ts +++ b/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.html.ts @@ -2,10 +2,10 @@ export const LIST_REPLICATION_RULE_TEMPLATE: string = `
- + - + {{'REPLICATION.NAME' | translate}} {{'REPLICATION.PROJECT' | translate}} diff --git a/src/ui_ng/package.json b/src/ui_ng/package.json index dbba99693..32549fb92 100644 --- a/src/ui_ng/package.json +++ b/src/ui_ng/package.json @@ -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", diff --git a/src/ui_ng/src/app/app-config.ts b/src/ui_ng/src/app/app-config.ts index 0702cba12..ab63b2dfc 100644 --- a/src/ui_ng/src/app/app-config.ts +++ b/src/ui_ng/src/app/app-config.ts @@ -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 = ""; + } } \ No newline at end of file diff --git a/src/ui_ng/src/app/project/project.component.html b/src/ui_ng/src/app/project/project.component.html index f4b4c9781..7b76a8678 100644 --- a/src/ui_ng/src/app/project/project.component.html +++ b/src/ui_ng/src/app/project/project.component.html @@ -10,10 +10,10 @@
+ + + +
diff --git a/src/ui_ng/src/app/shared/statictics/statistics-panel.component.ts b/src/ui_ng/src/app/shared/statictics/statistics-panel.component.ts index 9edfeb3f9..3d172d0a6 100644 --- a/src/ui_ng/src/app/shared/statictics/statistics-panel.component.ts +++ b/src/ui_ng/src/app/shared/statictics/statistics-panel.component.ts @@ -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 { diff --git a/src/ui_ng/src/i18n/lang/en-us-lang.json b/src/ui_ng/src/i18n/lang/en-us-lang.json index a415ccda6..c4502fa6b 100644 --- a/src/ui_ng/src/i18n/lang/en-us-lang.json +++ b/src/ui_ng/src/i18n/lang/en-us-lang.json @@ -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", diff --git a/src/ui_ng/src/i18n/lang/zh-cn-lang.json b/src/ui_ng/src/i18n/lang/zh-cn-lang.json index 9d6039ae9..b1994204d 100644 --- a/src/ui_ng/src/i18n/lang/zh-cn-lang.json +++ b/src/ui_ng/src/i18n/lang/zh-cn-lang.json @@ -221,7 +221,7 @@ "SWITCH_TITLE": "切换项目成员确认", "SWITCH_SUMMARY": "你确认切换项目成员 {{param}}??", "ACTION": "设置角色", - "REMOVE": "移除" + "REMOVE": "移除成员" }, "AUDIT_LOG": { "USERNAME": "用户名",