UI: Refactoring
This commit is contained in:
parent
b87699dc8d
commit
2d6dba7772
@ -28,7 +28,7 @@
|
|||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="!hideLoadingBar && isLoading$ | async">
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="!hideLoadingBar && isLoading$ | async">
|
||||||
</mat-progress-bar>
|
</mat-progress-bar>
|
||||||
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
<div style="height: 4px;" *ngIf="!(!hideLoadingBar && isLoading$ | async)"></div>
|
||||||
<mat-card-content style="padding-top: 16px;">
|
<mat-card-content style="padding-top: 16px;">
|
||||||
<form [formGroup]="repositorySettingsForm" #formDirective="ngForm" (ngSubmit)="save()">
|
<form [formGroup]="repositorySettingsForm" #formDirective="ngForm" (ngSubmit)="save()">
|
||||||
<fieldset [disabled]="isLoading$ | async">
|
<fieldset [disabled]="isLoading$ | async">
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import { selectHasRepository } from '@core/auth/auth.selectors';
|
|||||||
import { catchError, mergeMap, take } from 'rxjs/operators';
|
import { catchError, mergeMap, take } from 'rxjs/operators';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { TbPopoverComponent } from '@shared/components/popover.component';
|
import { TbPopoverComponent } from '@shared/components/popover.component';
|
||||||
|
import { coerceBoolean } from '@shared/decorators/coercion';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-repository-settings',
|
selector: 'tb-repository-settings',
|
||||||
@ -49,6 +50,7 @@ export class RepositorySettingsComponent extends PageComponent implements OnInit
|
|||||||
popoverComponent: TbPopoverComponent;
|
popoverComponent: TbPopoverComponent;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
|
@coerceBoolean()
|
||||||
hideLoadingBar = false;
|
hideLoadingBar = false;
|
||||||
|
|
||||||
repositorySettingsForm: UntypedFormGroup;
|
repositorySettingsForm: UntypedFormGroup;
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
-->
|
-->
|
||||||
<tb-repository-settings #repositorySettingsComponent
|
<tb-repository-settings #repositorySettingsComponent
|
||||||
[detailsMode]="detailsMode"
|
[detailsMode]="detailsMode"
|
||||||
[hideLoadingBar]="true"
|
hideLoadingBar
|
||||||
[popoverComponent]="popoverComponent"
|
[popoverComponent]="popoverComponent"
|
||||||
*ngIf="!(hasRepository$ | async); else versionsTable">
|
*ngIf="!(hasRepository$ | async); else versionsTable">
|
||||||
</tb-repository-settings>
|
</tb-repository-settings>
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
///
|
///
|
||||||
|
|
||||||
import { AfterViewInit, Component, ElementRef, Inject, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, ElementRef, Inject, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||||
import { startWith, skip, Subject } from 'rxjs';
|
import { skip, startWith, Subject } from 'rxjs';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
@ -151,10 +151,10 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni
|
|||||||
this.textSearch.reset('', {emitEvent: false});
|
this.textSearch.reset('', {emitEvent: false});
|
||||||
this.activeComponent = activeComponent;
|
this.activeComponent = activeComponent;
|
||||||
let showLoadingBar: boolean;
|
let showLoadingBar: boolean;
|
||||||
if (isDefined(this.route.children[0]?.snapshot?.data?.showLoadingBar)) {
|
if (isDefined(this.activeComponent.activatedRoute?.data?.value?.showLoadingBar)) {
|
||||||
showLoadingBar = this.route.children[0]?.snapshot?.data?.showLoadingBar;
|
showLoadingBar = this.activeComponent.activatedRoute?.data?.value?.showLoadingBar;
|
||||||
} else if (isDefined(this.route.children[0]?.children[0]?.snapshot?.data?.showLoadingBar)) {
|
} else if (isDefined(this.activeComponent?.showLoadingBar)) {
|
||||||
showLoadingBar = this.route.children[0]?.children[0]?.snapshot?.data?.showLoadingBar;
|
showLoadingBar = this.activeComponent.showLoadingBar;
|
||||||
}
|
}
|
||||||
if (activeComponent && activeComponent instanceof RouterTabsComponent) {
|
if (activeComponent && activeComponent instanceof RouterTabsComponent) {
|
||||||
this.hideLoadingBar = isDefinedAndNotNull(showLoadingBar) ? !showLoadingBar : true;
|
this.hideLoadingBar = isDefinedAndNotNull(showLoadingBar) ? !showLoadingBar : true;
|
||||||
|
|||||||
@ -323,7 +323,6 @@ const routes: Routes = [
|
|||||||
canDeactivate: [ConfirmOnExitGuard],
|
canDeactivate: [ConfirmOnExitGuard],
|
||||||
data: {
|
data: {
|
||||||
auth: [Authority.SYS_ADMIN],
|
auth: [Authority.SYS_ADMIN],
|
||||||
showLoadingBar: false,
|
|
||||||
title: 'admin.general',
|
title: 'admin.general',
|
||||||
breadcrumb: {
|
breadcrumb: {
|
||||||
label: 'admin.general',
|
label: 'admin.general',
|
||||||
@ -337,7 +336,6 @@ const routes: Routes = [
|
|||||||
canDeactivate: [ConfirmOnExitGuard],
|
canDeactivate: [ConfirmOnExitGuard],
|
||||||
data: {
|
data: {
|
||||||
auth: [Authority.SYS_ADMIN],
|
auth: [Authority.SYS_ADMIN],
|
||||||
showLoadingBar: false,
|
|
||||||
title: 'admin.2fa.2fa',
|
title: 'admin.2fa.2fa',
|
||||||
breadcrumb: {
|
breadcrumb: {
|
||||||
label: 'admin.2fa.2fa',
|
label: 'admin.2fa.2fa',
|
||||||
@ -351,7 +349,6 @@ const routes: Routes = [
|
|||||||
canDeactivate: [ConfirmOnExitGuard],
|
canDeactivate: [ConfirmOnExitGuard],
|
||||||
data: {
|
data: {
|
||||||
auth: [Authority.SYS_ADMIN],
|
auth: [Authority.SYS_ADMIN],
|
||||||
showLoadingBar: false,
|
|
||||||
title: 'admin.oauth2.oauth2',
|
title: 'admin.oauth2.oauth2',
|
||||||
breadcrumb: {
|
breadcrumb: {
|
||||||
label: 'admin.oauth2.oauth2',
|
label: 'admin.oauth2.oauth2',
|
||||||
|
|||||||
@ -15,7 +15,14 @@
|
|||||||
///
|
///
|
||||||
|
|
||||||
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { AbstractControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, ValidationErrors, Validators } from '@angular/forms';
|
import {
|
||||||
|
AbstractControl,
|
||||||
|
UntypedFormArray,
|
||||||
|
UntypedFormBuilder,
|
||||||
|
UntypedFormGroup,
|
||||||
|
ValidationErrors,
|
||||||
|
Validators
|
||||||
|
} from '@angular/forms';
|
||||||
import {
|
import {
|
||||||
ClientAuthenticationMethod,
|
ClientAuthenticationMethod,
|
||||||
DomainSchema,
|
DomainSchema,
|
||||||
@ -26,9 +33,11 @@ import {
|
|||||||
MapperConfigType,
|
MapperConfigType,
|
||||||
OAuth2ClientRegistrationTemplate,
|
OAuth2ClientRegistrationTemplate,
|
||||||
OAuth2DomainInfo,
|
OAuth2DomainInfo,
|
||||||
OAuth2Info, OAuth2MobileInfo,
|
OAuth2Info,
|
||||||
|
OAuth2MobileInfo,
|
||||||
OAuth2ParamsInfo,
|
OAuth2ParamsInfo,
|
||||||
OAuth2RegistrationInfo, PlatformType,
|
OAuth2RegistrationInfo,
|
||||||
|
PlatformType,
|
||||||
platformTypeTranslations,
|
platformTypeTranslations,
|
||||||
TenantNameStrategy
|
TenantNameStrategy
|
||||||
} from '@shared/models/oauth2.models';
|
} from '@shared/models/oauth2.models';
|
||||||
@ -45,13 +54,14 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { isDefined, isDefinedAndNotNull, randomAlphanumeric } from '@core/utils';
|
import { isDefined, isDefinedAndNotNull, randomAlphanumeric } from '@core/utils';
|
||||||
import { OAuth2Service } from '@core/http/oauth2.service';
|
import { OAuth2Service } from '@core/http/oauth2.service';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { HasShowLoading } from '@home/pages/home-pages.models';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-oauth2-settings',
|
selector: 'tb-oauth2-settings',
|
||||||
templateUrl: './oauth2-settings.component.html',
|
templateUrl: './oauth2-settings.component.html',
|
||||||
styleUrls: ['./oauth2-settings.component.scss', './settings-card.scss']
|
styleUrls: ['./oauth2-settings.component.scss', './settings-card.scss']
|
||||||
})
|
})
|
||||||
export class OAuth2SettingsComponent extends PageComponent implements OnInit, HasConfirmForm, OnDestroy {
|
export class OAuth2SettingsComponent extends PageComponent implements OnInit, HasConfirmForm, HasShowLoading, OnDestroy {
|
||||||
|
|
||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
@ -105,6 +115,8 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha
|
|||||||
|
|
||||||
templateProvider = ['Custom'];
|
templateProvider = ['Custom'];
|
||||||
|
|
||||||
|
showLoadingBar = false;
|
||||||
|
|
||||||
private loginProcessingUrl: string = this.route.snapshot.data.loginProcessingUrl;
|
private loginProcessingUrl: string = this.route.snapshot.data.loginProcessingUrl;
|
||||||
|
|
||||||
private static validateScope(control: AbstractControl): ValidationErrors | null {
|
private static validateScope(control: AbstractControl): ValidationErrors | null {
|
||||||
|
|||||||
@ -23,7 +23,8 @@ import {
|
|||||||
AbstractControl,
|
AbstractControl,
|
||||||
UntypedFormBuilder,
|
UntypedFormBuilder,
|
||||||
UntypedFormControl,
|
UntypedFormControl,
|
||||||
UntypedFormGroup, ValidationErrors,
|
UntypedFormGroup,
|
||||||
|
ValidationErrors,
|
||||||
ValidatorFn,
|
ValidatorFn,
|
||||||
Validators
|
Validators
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
@ -35,21 +36,21 @@ import { randomAlphanumeric } from '@core/utils';
|
|||||||
import { AuthService } from '@core/auth/auth.service';
|
import { AuthService } from '@core/auth/auth.service';
|
||||||
import { DialogService } from '@core/services/dialog.service';
|
import { DialogService } from '@core/services/dialog.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { forkJoin, Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
import { HasShowLoading } from '@home/pages/home-pages.models';
|
||||||
import { AlarmInfo } from '@shared/models/alarm.models';
|
|
||||||
import { QueueProcessingStrategyTypes, QueueProcessingStrategyTypesMap } from '@shared/models/queue.models';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-security-settings',
|
selector: 'tb-security-settings',
|
||||||
templateUrl: './security-settings.component.html',
|
templateUrl: './security-settings.component.html',
|
||||||
styleUrls: ['./security-settings.component.scss', './settings-card.scss']
|
styleUrls: ['./security-settings.component.scss', './settings-card.scss']
|
||||||
})
|
})
|
||||||
export class SecuritySettingsComponent extends PageComponent implements HasConfirmForm {
|
export class SecuritySettingsComponent extends PageComponent implements HasConfirmForm, HasShowLoading {
|
||||||
|
|
||||||
securitySettingsFormGroup: UntypedFormGroup;
|
securitySettingsFormGroup: UntypedFormGroup;
|
||||||
jwtSecuritySettingsFormGroup: UntypedFormGroup;
|
jwtSecuritySettingsFormGroup: UntypedFormGroup;
|
||||||
|
|
||||||
|
showLoadingBar = false;
|
||||||
|
|
||||||
private securitySettings: SecuritySettings;
|
private securitySettings: SecuritySettings;
|
||||||
private jwtSettings: JwtSettings;
|
private jwtSettings: JwtSettings;
|
||||||
|
|
||||||
|
|||||||
@ -32,13 +32,14 @@ import { isNotEmptyStr } from '@core/utils';
|
|||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { MatExpansionPanel } from '@angular/material/expansion';
|
import { MatExpansionPanel } from '@angular/material/expansion';
|
||||||
|
import { HasShowLoading } from '@home/pages/home-pages.models';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-2fa-settings',
|
selector: 'tb-2fa-settings',
|
||||||
templateUrl: './two-factor-auth-settings.component.html',
|
templateUrl: './two-factor-auth-settings.component.html',
|
||||||
styleUrls: [ './settings-card.scss', './two-factor-auth-settings.component.scss']
|
styleUrls: [ './settings-card.scss', './two-factor-auth-settings.component.scss']
|
||||||
})
|
})
|
||||||
export class TwoFactorAuthSettingsComponent extends PageComponent implements OnInit, HasConfirmForm, OnDestroy {
|
export class TwoFactorAuthSettingsComponent extends PageComponent implements OnInit, HasConfirmForm, HasShowLoading, OnDestroy {
|
||||||
|
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly posIntValidation = [Validators.required, Validators.min(1), Validators.pattern(/^\d*$/)];
|
private readonly posIntValidation = [Validators.required, Validators.min(1), Validators.pattern(/^\d*$/)];
|
||||||
@ -47,6 +48,8 @@ export class TwoFactorAuthSettingsComponent extends PageComponent implements OnI
|
|||||||
twoFactorAuthProviderType = TwoFactorAuthProviderType;
|
twoFactorAuthProviderType = TwoFactorAuthProviderType;
|
||||||
twoFactorAuthProvidersData = twoFactorAuthProvidersData;
|
twoFactorAuthProvidersData = twoFactorAuthProvidersData;
|
||||||
|
|
||||||
|
showLoadingBar = false;
|
||||||
|
|
||||||
@ViewChildren(MatExpansionPanel) expansionPanel: QueryList<MatExpansionPanel>;
|
@ViewChildren(MatExpansionPanel) expansionPanel: QueryList<MatExpansionPanel>;
|
||||||
|
|
||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
|
|||||||
@ -31,3 +31,7 @@ export const entityDetailsPageBreadcrumbLabelFunction: BreadCrumbLabelFunction<E
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export interface HasShowLoading {
|
||||||
|
showLoadingBar?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user