From fb862e5cb8c1f39352b447e70f12e50a53140c0f Mon Sep 17 00:00:00 2001 From: kunw Date: Fri, 24 Mar 2017 18:29:51 +0800 Subject: [PATCH] Merge latest updates of UI. --- .../app/account/sign-in/sign-in.component.ts | 6 ++- .../global-search.component.html | 2 +- .../global-search/global-search.component.ts | 6 ++- .../search-result.component.html | 4 +- .../global-search/search-result.component.ts | 43 +++++++++++++----- .../global-search/search-trigger.service.ts | 10 ++--- .../harbor-shell/harbor-shell.component.html | 2 +- .../harbor-shell/harbor-shell.component.ts | 44 ++----------------- .../app/base/navigator/navigator.component.ts | 6 +-- .../config/auth/config-auth.component.html | 2 +- src/ui_ng/src/app/config/config.component.ts | 25 ++++++++--- src/ui_ng/src/app/log/recent-log.component.ts | 4 +- .../list-project/list-project.component.css | 0 .../list-project/list-project.component.html | 2 +- .../list-project/list-project.component.ts | 26 +++-------- .../project-detail.component.html | 6 ++- .../project-detail.component.ts | 7 +++ .../project-routing-resolver.service.ts | 22 +++++++--- .../src/app/project/project.component.css | 4 +- src/ui_ng/src/app/project/project.ts | 1 + .../create-edit-destination.component.ts | 1 + .../list-repository.component.html | 34 +++++++------- .../list-repository.component.ts | 29 +++--------- .../app/repository/repository.component.ts | 13 +----- .../tag-repository.component.html | 4 +- .../tag-repository.component.ts | 4 +- .../top-repo/top-repo.component.html | 2 +- .../src/app/shared/filter/filter.component.ts | 4 +- .../list-project-ro.component.html | 16 +++++++ .../list-project-ro.component.ts | 37 ++++++++++++++++ .../list-repository-ro.component.html | 14 ++++++ .../list-repository-ro.component.ts | 40 +++++++++++++++++ src/ui_ng/src/app/shared/port.directive.ts | 2 +- .../route/auth-user-activate.service.ts | 17 +++---- src/ui_ng/src/app/shared/shared.const.ts | 1 + src/ui_ng/src/app/shared/shared.module.ts | 11 ++++- 36 files changed, 273 insertions(+), 178 deletions(-) delete mode 100644 src/ui_ng/src/app/project/list-project/list-project.component.css create mode 100644 src/ui_ng/src/app/shared/list-project-ro/list-project-ro.component.html create mode 100644 src/ui_ng/src/app/shared/list-project-ro/list-project-ro.component.ts create mode 100644 src/ui_ng/src/app/shared/list-repository-ro/list-repository-ro.component.html create mode 100644 src/ui_ng/src/app/shared/list-repository-ro/list-repository-ro.component.ts diff --git a/src/ui_ng/src/app/account/sign-in/sign-in.component.ts b/src/ui_ng/src/app/account/sign-in/sign-in.component.ts index 9d0171f72..406e76821 100644 --- a/src/ui_ng/src/app/account/sign-in/sign-in.component.ts +++ b/src/ui_ng/src/app/account/sign-in/sign-in.component.ts @@ -51,7 +51,9 @@ export class SignInComponent implements AfterViewChecked, OnInit { ) { } ngOnInit(): void { - this.appConfig = this.appConfigService.getConfig(); + //Make sure the updated configuration can be loaded + this.appConfigService.load() + .then(updatedConfig => this.appConfig = updatedConfig); this.route.queryParams .subscribe(params => { this.redirectUrl = params["redirect_url"] || ""; @@ -108,7 +110,7 @@ export class SignInComponent implements AfterViewChecked, OnInit { //Fill the new user info into the sign in form private handleUserCreation(user: User): void { - if(user){ + if (user) { this.currentForm.setValue({ "login_username": user.username, "login_password": user.password diff --git a/src/ui_ng/src/app/base/global-search/global-search.component.html b/src/ui_ng/src/app/base/global-search/global-search.component.html index e895fa79e..77fb5e03b 100644 --- a/src/ui_ng/src/app/base/global-search/global-search.component.html +++ b/src/ui_ng/src/app/base/global-search/global-search.component.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/src/ui_ng/src/app/base/global-search/global-search.component.ts b/src/ui_ng/src/app/base/global-search/global-search.component.ts index 8c05dba6e..75bb4be18 100644 --- a/src/ui_ng/src/app/base/global-search/global-search.component.ts +++ b/src/ui_ng/src/app/base/global-search/global-search.component.ts @@ -21,10 +21,11 @@ export class GlobalSearchComponent implements OnInit, OnDestroy { //Keep subscription for future use private searchSub: Subscription; - private stateSub: Subscription; + private closeSub: Subscription; //To indicate if the result panel is opened private isResPanelOpened: boolean = false; + private searchTerm: string = ""; constructor( private searchTrigger: SearchTriggerService, @@ -38,6 +39,9 @@ export class GlobalSearchComponent implements OnInit, OnDestroy { .subscribe(term => { this.searchTrigger.triggerSearch(term); }); + this.closeSub = this.searchTrigger.searchClearChan$.subscribe(clear => { + this.searchTerm = ""; + }); } ngOnDestroy(): void { diff --git a/src/ui_ng/src/app/base/global-search/search-result.component.html b/src/ui_ng/src/app/base/global-search/search-result.component.html index 2edc6107f..00d68ca56 100644 --- a/src/ui_ng/src/app/base/global-search/search-result.component.html +++ b/src/ui_ng/src/app/base/global-search/search-result.component.html @@ -7,8 +7,8 @@
{{'SEARCH.IN_PROGRESS' | translate}}

{{'PROJECT.PROJECTS' | translate}}

- +

{{'PROJECT_DETAIL.REPOSITORIES' | translate}}

- +
\ No newline at end of file diff --git a/src/ui_ng/src/app/base/global-search/search-result.component.ts b/src/ui_ng/src/app/base/global-search/search-result.component.ts index fc2f5b484..1516a57d3 100644 --- a/src/ui_ng/src/app/base/global-search/search-result.component.ts +++ b/src/ui_ng/src/app/base/global-search/search-result.component.ts @@ -1,4 +1,4 @@ -import { Component, Output, EventEmitter } from '@angular/core'; +import { Component, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core'; import { GlobalSearchService } from './global-search.service'; import { SearchResults } from './search-results'; @@ -8,6 +8,8 @@ import { MessageService } from '../../global-message/message.service'; import { SearchTriggerService } from './search-trigger.service'; +import { Subscription } from 'rxjs/Subscription'; + @Component({ selector: "search-result", templateUrl: "search-result.component.html", @@ -16,7 +18,7 @@ import { SearchTriggerService } from './search-trigger.service'; providers: [GlobalSearchService] }) -export class SearchResultComponent { +export class SearchResultComponent implements OnInit, OnDestroy { private searchResults: SearchResults = new SearchResults(); private originalCopy: SearchResults; @@ -30,11 +32,34 @@ export class SearchResultComponent { //Whether or not mouse point is onto the close indicator private mouseOn: boolean = false; + //Watch message channel + private searchSub: Subscription; + private closeSearchSub: Subscription; + constructor( private search: GlobalSearchService, private msgService: MessageService, private searchTrigger: SearchTriggerService) { } + ngOnInit() { + this.searchSub = this.searchTrigger.searchTriggerChan$.subscribe(term => { + this.doSearch(term); + }); + this.closeSearchSub = this.searchTrigger.searchCloseChan$.subscribe(close => { + this.close(); + }); + } + + ngOnDestroy() { + if (this.searchSub) { + this.searchSub.unsubscribe(); + } + + if (this.closeSearchSub) { + this.closeSearchSub.unsubscribe(); + } + } + private clone(src: SearchResults): SearchResults { let res: SearchResults = new SearchResults(); @@ -64,27 +89,23 @@ export class SearchResultComponent { return this.mouseOn; } - //Handle mouse event of close indicator - mouseAction(over: boolean): void { - this.mouseOn = over; - } - //Show the results show(): void { this.stateIndicator = true; - this.searchTrigger.searchInputStat(true); } //Close the result page close(): void { - //Tell shell close - this.searchTrigger.closeSearch(true); - this.searchTrigger.searchInputStat(false); this.stateIndicator = false; + this.searchTrigger.clear(true); } //Call search service to complete the search request doSearch(term: string): void { + //Only search none empty term + if (!term || term.trim() === "") { + return; + } //Do nothing if search is ongoing if (this.onGoing) { return; diff --git a/src/ui_ng/src/app/base/global-search/search-trigger.service.ts b/src/ui_ng/src/app/base/global-search/search-trigger.service.ts index edcdd34e2..99d29d07d 100644 --- a/src/ui_ng/src/app/base/global-search/search-trigger.service.ts +++ b/src/ui_ng/src/app/base/global-search/search-trigger.service.ts @@ -7,11 +7,11 @@ export class SearchTriggerService { private searchTriggerSource = new Subject(); private searchCloseSource = new Subject(); - private searchInputSource = new Subject(); + private searchClearSource = new Subject(); searchTriggerChan$ = this.searchTriggerSource.asObservable(); searchCloseChan$ = this.searchCloseSource.asObservable(); - searchInputChan$ = this.searchInputSource.asObservable(); + searchClearChan$ = this.searchClearSource.asObservable(); triggerSearch(event: string) { this.searchTriggerSource.next(event); @@ -23,9 +23,9 @@ export class SearchTriggerService { this.searchCloseSource.next(event); } - //Notify the state change of search box in home start page - searchInputStat(event: boolean) { - this.searchInputSource.next(event); + //Clear search term + clear(event): void { + this.searchClearSource.next(event); } } \ No newline at end of file diff --git a/src/ui_ng/src/app/base/harbor-shell/harbor-shell.component.html b/src/ui_ng/src/app/base/harbor-shell/harbor-shell.component.html index 40357dbb3..c435eed3e 100644 --- a/src/ui_ng/src/app/base/harbor-shell/harbor-shell.component.html +++ b/src/ui_ng/src/app/base/harbor-shell/harbor-shell.component.html @@ -8,7 +8,7 @@ -