modify registry component using tabs

Signed-off-by: Meina Zhou <meinaz@vmware.com>
This commit is contained in:
Meina Zhou 2018-11-09 08:57:17 +08:00
parent b3c87673a6
commit 6bcc803588
4 changed files with 20 additions and 22 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@harbor/ui",
"version": "1.0.0-rc6",
"version": "1.0.0-rc7",
"description": "Harbor shared UI components based on Clarity and Angular6",
"author": "CNCF",
"module": "index.js",

View File

@ -1,9 +1,17 @@
<div>
<system-settings #systemSettings [(systemSettings)]="config" [showSubTitle]="true" [hasAdminRole]="hasAdminRole" [hasCAFile]="hasCAFile" [withAdmiral]="withAdmiral"></system-settings>
<clr-tabs>
<clr-tab>
<button id="config-system" clrTabLink>{{'CONFIG.SYSTEM' | translate}}</button>
<clr-tab-content id="system_settings" *clrIfActive>
<system-settings #systemSettings [(systemSettings)]="config" [showSubTitle]="true" [hasAdminRole]="hasAdminRole" [hasCAFile]="hasCAFile"
[withAdmiral]="withAdmiral">
</system-settings>
</clr-tab-content>
</clr-tab>
<clr-tab>
<button id="config-vulnerability" clrTabLink>{{'CONFIG.VULNERABILITY' | translate}}</button>
<clr-tab-content id="vulnerability" *clrIfActive>
<vulnerability-config *ngIf="withClair" #vulnerabilityConfig [(vulnerabilityConfig)]="config" [showSubTitle]="true"></vulnerability-config>
<div>
<button type="button" class="btn btn-primary" (click)="save()" [disabled]="shouldDisable">{{'BUTTON.SAVE' | translate}}</button>
<button type="button" class="btn btn-outline" (click)="cancel()" [disabled]="shouldDisable">{{'BUTTON.CANCEL' | translate}}</button>
</div>
</clr-tab-content>
</clr-tab>
</clr-tabs>
<confirmation-dialog #cfgConfirmationDialog (confirmAction)="confirmCancel($event)"></confirmation-dialog>
</div>

View File

@ -27,7 +27,6 @@ describe('RegistryConfigComponent (inline template)', () => {
let cfgService: ConfigurationService;
let systemInfoService: SystemInfoService;
let spy: jasmine.Spy;
let saveSpy: jasmine.Spy;
let spySystemInfo: jasmine.Spy;
let mockConfig: Configuration = new Configuration();
mockConfig.token_expiration.value = 90;
@ -82,7 +81,6 @@ describe('RegistryConfigComponent (inline template)', () => {
cfgService = fixture.debugElement.injector.get(ConfigurationService);
systemInfoService = fixture.debugElement.injector.get(SystemInfoService);
spy = spyOn(cfgService, 'getConfigurations').and.returnValue(Promise.resolve(mockConfig));
saveSpy = spyOn(cfgService, 'saveConfigurations').and.returnValue(Promise.resolve(true));
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValue(Promise.resolve(mockSystemInfo));
fixture.detectChanges();
@ -102,16 +100,8 @@ describe('RegistryConfigComponent (inline template)', () => {
fixture.detectChanges();
let el3: HTMLInputElement = fixture.nativeElement.querySelector('.btn-scan');
let el3: HTMLElement = fixture.nativeElement.querySelector('#config-vulnerability');
expect(el3).toBeTruthy();
expect(el3).not.toBeFalsy();
});
}));
it('should save the configuration changes', async(() => {
comp.save();
fixture.detectChanges();
expect(saveSpy.calls.any).toBeTruthy();
}));
});

View File

@ -48,7 +48,7 @@
<button class="btn btn-primary btn-sm" (click)="cancel()" >{{'BUTTON.CANCEL' | translate}}</button>
</div>
<div class="btn-scan-right btn-scan">
<button class="btn btn-primary btn-sm" (click)="scanNow()" [disabled]="!scanAvailable">{{ 'CONFIG.SCANNING.SCAN_NOW' | translate }}</button><br>
<button class="btn btn-primary btn-sm btn-scan" (click)="scanNow()" [disabled]="!scanAvailable">{{ 'CONFIG.SCANNING.SCAN_NOW' | translate }}</button><br>
<span *ngIf="!scanAvailable">{{ 'CONFIG.SCANNING.NEXT_SCAN' | translate }} {{ nextScanTimestamp | date:'y/MM/dd HH:mm' }}</span>
</div>
</section>