Browse Source

UI: Refactoring

pull/10036/head
Artem Dzhereleiko 3 years ago
parent
commit
c17b2d3b48
  1. 2
      ui-ngx/src/app/modules/home/components/vc/repository-settings.component.html
  2. 18
      ui-ngx/src/app/modules/home/home.component.ts
  3. 5
      ui-ngx/src/app/modules/home/pages/home-pages.models.ts
  4. 3
      ui-ngx/src/app/shared/components/page.component.ts

2
ui-ngx/src/app/modules/home/components/vc/repository-settings.component.html

@ -28,7 +28,7 @@
</mat-card-header>
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="!hideLoadingBar && isLoading$ | async">
</mat-progress-bar>
<div style="height: 4px;" *ngIf="hideLoadingBar && !(isLoading$ | async)"></div>
<div style="height: 4px;" *ngIf="hideLoadingBar || !(isLoading$ | async)"></div>
<mat-card-content style="padding-top: 16px;">
<form [formGroup]="repositorySettingsForm" #formDirective="ngForm" (ngSubmit)="save()">
<fieldset [disabled]="isLoading$ | async">

18
ui-ngx/src/app/modules/home/home.component.ts

@ -149,17 +149,15 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni
this.hideLoadingBar = false;
this.textSearch.reset('', {emitEvent: false});
this.activeComponent = activeComponent;
let showLoadingBar: boolean;
if (isDefined(this.activeComponent.activatedRoute?.snapshot?.data?.showMainLoadingBar)) {
showLoadingBar = this.activeComponent.activatedRoute.snapshot.data.showMainLoadingBar;
} else if (isDefined(this.activeComponent?.showMainLoadingBar)) {
showLoadingBar = this.activeComponent.showMainLoadingBar;
}
if (activeComponent && activeComponent instanceof RouterTabsComponent) {
this.hideLoadingBar = isDefinedAndNotNull(showLoadingBar) ? !showLoadingBar : true;
} else if (activeComponent && activeComponent instanceof PageComponent && isDefinedAndNotNull(showLoadingBar)) {
this.hideLoadingBar = !showLoadingBar;
if (activeComponent && activeComponent instanceof RouterTabsComponent
&& isDefinedAndNotNull(this.activeComponent.activatedRoute?.snapshot?.data?.showMainLoadingBar)) {
this.hideLoadingBar = !this.activeComponent.activatedRoute.snapshot.data.showMainLoadingBar;
} else if (activeComponent && activeComponent instanceof PageComponent
&& isDefinedAndNotNull(this.activeComponent?.showMainLoadingBar)) {
this.hideLoadingBar = !this.activeComponent.showMainLoadingBar;
}
if (this.activeComponent && instanceOfSearchableComponent(this.activeComponent)) {
this.searchEnabled = true;
this.searchableComponent = this.activeComponent;

5
ui-ngx/src/app/modules/home/pages/home-pages.models.ts

@ -30,8 +30,3 @@ export const entityDetailsPageBreadcrumbLabelFunction: BreadCrumbLabelFunction<E
return component.entity?.name;
}
});
export interface HasShowMainLoading {
showMainLoadingBar?: boolean;
}

3
ui-ngx/src/app/shared/components/page.component.ts

@ -21,10 +21,9 @@ import { Observable, Subscription } from 'rxjs';
import { selectIsLoading } from '@core/interceptors/load.selectors';
import { delay, share } from 'rxjs/operators';
import { AbstractControl } from '@angular/forms';
import { HasShowMainLoading } from '@home/pages/home-pages.models';
@Directive()
export abstract class PageComponent implements OnDestroy, HasShowMainLoading {
export abstract class PageComponent implements OnDestroy {
isLoading$: Observable<boolean>;
loadingSubscription: Subscription;

Loading…
Cancel
Save