[ACS-7421] process: break app list dependency on material bundle (#9640)

* chore: break apps list dependency on material module bundle
This commit is contained in:
Denys Vuika
2024-05-06 10:34:31 -04:00
committed by GitHub
parent 70804088a1
commit 6f0bbe427e
33 changed files with 153 additions and 585 deletions

View File

@@ -1,7 +1,7 @@
<ng-container *ngIf="isCustom; else: default">
<ng-container *ngIf="isCustom; else: defaultIcon">
<mat-icon [color]="color" [svgIcon]="value" aria-hidden="true"></mat-icon>
</ng-container>
<ng-template #default>
<ng-template #defaultIcon>
<mat-icon [fontSet]="fontSet" [color]="color" aria-hidden="true">{{ value }}</mat-icon>
</ng-template>

View File

@@ -15,16 +15,15 @@
* limitations under the License.
*/
import {
Component,
Input,
ViewEncapsulation,
ChangeDetectionStrategy
} from '@angular/core';
import { Component, Input, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
import { ThemePalette } from '@angular/material/core';
import { MatIconModule } from '@angular/material/icon';
import { NgIf } from '@angular/common';
@Component({
selector: 'adf-icon',
standalone: true,
imports: [MatIconModule, NgIf],
templateUrl: './icon.component.html',
styleUrls: ['./icon.component.scss'],
encapsulation: ViewEncapsulation.None,

View File

@@ -17,19 +17,13 @@
import { NgModule } from '@angular/core';
import { IconComponent } from './icon.component';
import { MatIconModule } from '@angular/material/icon';
import { CommonModule } from '@angular/common';
/**
* @deprecated this Module is deprecated and should no longer be used.
* Consider importing components directly instead.
*/
@NgModule({
imports: [
CommonModule,
MatIconModule
],
declarations: [
IconComponent
],
exports: [
IconComponent
]
imports: [IconComponent],
exports: [IconComponent]
})
export class IconModule {}

View File

@@ -24,6 +24,7 @@ import { MatMenuModule } from '@angular/material/menu';
import { MatTabsModule } from '@angular/material/tabs';
import { TranslateModule } from '@ngx-translate/core';
import { PipeModule } from '../pipes/pipe.module';
import { FullNamePipe, InitialUsernamePipe } from '../pipes';
@NgModule({
declarations: [IdentityUserInfoComponent],
@@ -34,7 +35,9 @@ import { PipeModule } from '../pipes/pipe.module';
MatTabsModule,
MatCardModule,
TranslateModule,
PipeModule
PipeModule,
InitialUsernamePipe,
FullNamePipe
],
exports: [IdentityUserInfoComponent]
})

View File

@@ -16,9 +16,13 @@
*/
import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { IconComponent } from '../../icon';
@Component({
selector: 'adf-empty-content',
standalone: true,
imports: [TranslateModule, IconComponent],
templateUrl: './empty-content.component.html',
styleUrls: ['./empty-content.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -26,7 +30,6 @@ import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input } from '@a
host: { class: 'adf-empty-content' }
})
export class EmptyContentComponent {
/** Material Icon to use. */
@Input()
icon = 'cake';
@@ -38,5 +41,4 @@ export class EmptyContentComponent {
/** String or Resource Key for the subtitle. */
@Input()
subtitle = '';
}

View File

@@ -15,21 +15,19 @@
* limitations under the License.
*/
import {
Component,
ChangeDetectionStrategy,
Input,
ViewEncapsulation,
OnInit
} from '@angular/core';
import { Component, ChangeDetectionStrategy, Input, ViewEncapsulation, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { TranslationService } from '../../translation/translation.service';
import { Observable } from 'rxjs';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { map } from 'rxjs/operators';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
@Component({
selector: 'adf-error-content',
standalone: true,
imports: [CommonModule, TranslateModule],
templateUrl: './error-content.component.html',
styleUrls: ['./error-content.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -37,7 +35,6 @@ import { map } from 'rxjs/operators';
host: { class: 'adf-error-content' }
})
export class ErrorContentComponent implements OnInit {
static UNKNOWN_ERROR = 'UNKNOWN';
/** Error code associated with this error. */
@@ -47,27 +44,22 @@ export class ErrorContentComponent implements OnInit {
errorCodeTranslated: string;
isSmallScreen$: Observable<boolean>;
constructor(private route: ActivatedRoute,
private translateService: TranslationService,
private breakpointObserver: BreakpointObserver
) {
}
constructor(private route: ActivatedRoute, private translateService: TranslationService, private breakpointObserver: BreakpointObserver) {}
ngOnInit() {
if (this.route) {
this.route.params.subscribe(params => {
this.route.params.subscribe((params) => {
const code = params['id'] || this.errorCode;
const errorHasTranslation = this.checkErrorExists(code);
this.errorCodeTranslated = errorHasTranslation ? code : ErrorContentComponent.UNKNOWN_ERROR;
this.errorCodeTranslated = errorHasTranslation ? code : ErrorContentComponent.UNKNOWN_ERROR;
});
}
this.isSmallScreen$ = this.breakpointObserver.observe([Breakpoints.XSmall, Breakpoints.Small]).pipe(map(({ matches }) => matches));
}
checkErrorExists(errorCode: string ) {
checkErrorExists(errorCode: string) {
const errorMessage = this.translateService.instant('ERROR_CONTENT.' + errorCode);
return errorMessage !== ('ERROR_CONTENT.' + errorCode);
return errorMessage !== 'ERROR_CONTENT.' + errorCode;
}
}

View File

@@ -15,17 +15,16 @@
* limitations under the License.
*/
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { ErrorContentComponent } from './error-content/error-content.component';
import { EmptyContentComponent } from './empty-content/empty-content.component';
import { IconModule } from '../icon/icon.module';
import { MatButtonModule } from '@angular/material/button';
/**
* @deprecated this Module is deprecated and should no longer be used.
* Consider importing components directly instead.
*/
@NgModule({
imports: [CommonModule, TranslateModule, IconModule],
declarations: [ErrorContentComponent, EmptyContentComponent],
exports: [ErrorContentComponent, EmptyContentComponent, MatButtonModule]
imports: [ErrorContentComponent, EmptyContentComponent],
exports: [ErrorContentComponent, EmptyContentComponent]
})
export class TemplateModule {}