From 220e70953087b779ff14de25b6ae01c092771a54 Mon Sep 17 00:00:00 2001 From: Steven Zou Date: Fri, 28 Jul 2017 18:49:17 +0800 Subject: [PATCH 1/2] support read-ony mode for replication list view (#2915) --- src/ui_ng/lib/README.md | 4 +++- .../list-replication-rule.component.html.ts | 2 +- .../list-replication-rule/list-replication-rule.component.ts | 1 + src/ui_ng/lib/src/replication/replication.component.html.ts | 4 ++-- src/ui_ng/lib/src/replication/replication.component.ts | 5 +++++ src/ui_ng/package.json | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ui_ng/lib/README.md b/src/ui_ng/lib/README.md index ce4796cd0..00adee80b 100644 --- a/src/ui_ng/lib/README.md +++ b/src/ui_ng/lib/README.md @@ -74,8 +74,10 @@ If **projectId** is set to the id of specified project, then only show the repli **withReplicationJob** is used to determine whether or not show the replication jobs which are relevant with the selected replication rule. +**readonly** is to disable all the create/edit/delete actions. + ``` - + ``` * **Endpoint Management View** 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 60357b30f..047a61c2f 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 @@ -9,7 +9,7 @@ export const LIST_REPLICATION_RULE_TEMPLATE: string = ` {{'REPLICATION.ACTIVATION' | translate}} {{'REPLICATION.PLACEHOLDER' | translate }} - + diff --git a/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.ts b/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.ts index b543a0556..bad464f98 100644 --- a/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.ts +++ b/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.ts @@ -43,6 +43,7 @@ export class ListReplicationRuleComponent implements OnInit { @Input() projectId: number; @Input() selectedId: number | string; @Input() withReplicationJob: boolean; + @Input() readonly: boolean; @Input() loading: boolean = false; diff --git a/src/ui_ng/lib/src/replication/replication.component.html.ts b/src/ui_ng/lib/src/replication/replication.component.html.ts index 0bab97d7d..d71f47378 100644 --- a/src/ui_ng/lib/src/replication/replication.component.html.ts +++ b/src/ui_ng/lib/src/replication/replication.component.html.ts @@ -3,7 +3,7 @@ export const REPLICATION_TEMPLATE: string = `
- +
@@ -20,7 +20,7 @@ export const REPLICATION_TEMPLATE: string = `
- +
diff --git a/src/ui_ng/lib/src/replication/replication.component.ts b/src/ui_ng/lib/src/replication/replication.component.ts index 59007c770..c5768985f 100644 --- a/src/ui_ng/lib/src/replication/replication.component.ts +++ b/src/ui_ng/lib/src/replication/replication.component.ts @@ -75,6 +75,7 @@ export class ReplicationComponent implements OnInit { @Input() projectId: number | string; @Input() withReplicationJob: boolean; + @Input() readonly: boolean; @Output() redirect = new EventEmitter(); @@ -118,6 +119,10 @@ export class ReplicationComponent implements OnInit { private translateService: TranslateService) { } + public get creationAvailable(): boolean { + return !this.readonly && this.projectId ? true : false; + } + ngOnInit() { this.currentRuleStatus = this.ruleStatus[0]; this.currentJobStatus = this.jobStatus[0]; diff --git a/src/ui_ng/package.json b/src/ui_ng/package.json index 5c6bdf1fd..520987a56 100644 --- a/src/ui_ng/package.json +++ b/src/ui_ng/package.json @@ -31,7 +31,7 @@ "clarity-icons": "^0.9.8", "clarity-ui": "^0.9.8", "core-js": "^2.4.1", - "harbor-ui": "0.3.64", + "harbor-ui": "0.3.66", "intl": "^1.2.5", "mutationobserver-shim": "^0.3.2", "ngx-cookie": "^1.0.0", From 468257167a5f500e1a5f1bb7df22d7f906816e8c Mon Sep 17 00:00:00 2001 From: pengpengshui Date: Sat, 29 Jul 2017 06:19:46 +0800 Subject: [PATCH 2/2] fix #2896 #2886 #2888 about tooltips,inline alert ,datagrid leftside style --- src/ui_ng/src/app/project/project.component.ts | 10 +++++++--- src/ui_ng/src/styles.css | 13 ++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/ui_ng/src/app/project/project.component.ts b/src/ui_ng/src/app/project/project.component.ts index 921ba8179..8242ed498 100644 --- a/src/ui_ng/src/app/project/project.component.ts +++ b/src/ui_ng/src/app/project/project.component.ts @@ -11,7 +11,7 @@ // 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, OnInit, ViewChild, OnDestroy } from '@angular/core'; +import {Component, OnInit, ViewChild, OnDestroy, ChangeDetectorRef, ChangeDetectionStrategy} from '@angular/core'; import { Router } from '@angular/router'; @@ -43,7 +43,8 @@ import { StatisticHandler } from '../shared/statictics/statistic-handler.service @Component({ selector: 'project', templateUrl: 'project.component.html', - styleUrls: ['./project.component.css'] + styleUrls: ['./project.component.css'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class ProjectComponent implements OnInit, OnDestroy { @@ -68,7 +69,8 @@ export class ProjectComponent implements OnInit, OnDestroy { private appConfigService: AppConfigService, private sessionService: SessionService, private deletionDialogService: ConfirmationDialogService, - private statisticHandler: StatisticHandler) { + private statisticHandler: StatisticHandler, + private ref: ChangeDetectorRef) { this.subscription = deletionDialogService.confirmationConfirm$.subscribe(message => { if (message && message.state === ConfirmationState.CONFIRMED && @@ -136,6 +138,8 @@ export class ProjectComponent implements OnInit, OnDestroy { this.messageHandlerService.handleError(error); } ); + let hnd = setInterval(()=>this.ref.markForCheck(), 100); + setTimeout(()=>clearInterval(hnd), 2000); } openModal(): void { diff --git a/src/ui_ng/src/styles.css b/src/ui_ng/src/styles.css index cc0ee8f2d..c02851a6c 100644 --- a/src/ui_ng/src/styles.css +++ b/src/ui_ng/src/styles.css @@ -28,4 +28,15 @@ align-items: center; overflow-y: auto; overflow-x: hidden; -} \ No newline at end of file +} +.tooltip-content{white-space: normal;word-wrap: break-word;} + + .alert.alert-warning{ + padding:10px 12px; +} + .alert-warning .alert-actions button{ + margin: -2px 0 0px 0; +} + .modal-header{ + padding: 0; + } \ No newline at end of file