From d0775d446f4c0f8229b9d44102a46d2c20f067e7 Mon Sep 17 00:00:00 2001 From: Romuald Caplier Date: Mon, 27 May 2024 07:51:48 +0200 Subject: [PATCH] refactor(datahub): renamed search-results-error component to error component. --- .../record-metadata.component.html | 12 +++++------ .../record-metadata.component.spec.ts | 21 ++++++------------- .../results-list.container.component.html | 8 +++---- libs/ui/elements/src/index.ts | 2 +- .../error.component.css} | 0 .../error.component.html} | 0 .../error.component.spec.ts} | 15 ++++++------- .../error.component.stories.ts} | 13 +++++------- .../error.component.ts} | 8 +++---- .../ui/elements/src/lib/ui-elements.module.ts | 7 +++---- 10 files changed, 35 insertions(+), 51 deletions(-) rename libs/ui/elements/src/lib/{search-results-error/search-results-error.component.css => error/error.component.css} (100%) rename libs/ui/elements/src/lib/{search-results-error/search-results-error.component.html => error/error.component.html} (100%) rename libs/ui/elements/src/lib/{search-results-error/search-results-error.component.spec.ts => error/error.component.spec.ts} (85%) rename libs/ui/elements/src/lib/{search-results-error/search-results-error.component.stories.ts => error/error.component.stories.ts} (80%) rename libs/ui/elements/src/lib/{search-results-error/search-results-error.component.ts => error/error.component.ts} (64%) diff --git a/apps/datahub/src/app/record/record-metadata/record-metadata.component.html b/apps/datahub/src/app/record/record-metadata/record-metadata.component.html index 28df27110e..922e1ba1d0 100644 --- a/apps/datahub/src/app/record/record-metadata/record-metadata.component.html +++ b/apps/datahub/src/app/record/record-metadata/record-metadata.component.html @@ -134,10 +134,10 @@ - + >
- - - + + >
diff --git a/libs/ui/elements/src/index.ts b/libs/ui/elements/src/index.ts index f48507d17b..e48900c513 100644 --- a/libs/ui/elements/src/index.ts +++ b/libs/ui/elements/src/index.ts @@ -17,7 +17,7 @@ export * from './lib/pagination-buttons/pagination-buttons.component' export * from './lib/pagination/pagination.component' export * from './lib/record-api-form/record-api-form.component' export * from './lib/related-record-card/related-record-card.component' -export * from './lib/search-results-error/search-results-error.component' +export * from './lib/error/error.component' export * from './lib/thumbnail/thumbnail.component' export * from './lib/ui-elements.module' export * from './lib/user-preview/user-preview.component' diff --git a/libs/ui/elements/src/lib/search-results-error/search-results-error.component.css b/libs/ui/elements/src/lib/error/error.component.css similarity index 100% rename from libs/ui/elements/src/lib/search-results-error/search-results-error.component.css rename to libs/ui/elements/src/lib/error/error.component.css diff --git a/libs/ui/elements/src/lib/search-results-error/search-results-error.component.html b/libs/ui/elements/src/lib/error/error.component.html similarity index 100% rename from libs/ui/elements/src/lib/search-results-error/search-results-error.component.html rename to libs/ui/elements/src/lib/error/error.component.html diff --git a/libs/ui/elements/src/lib/search-results-error/search-results-error.component.spec.ts b/libs/ui/elements/src/lib/error/error.component.spec.ts similarity index 85% rename from libs/ui/elements/src/lib/search-results-error/search-results-error.component.spec.ts rename to libs/ui/elements/src/lib/error/error.component.spec.ts index a0414ee37b..e0bf10b72b 100644 --- a/libs/ui/elements/src/lib/search-results-error/search-results-error.component.spec.ts +++ b/libs/ui/elements/src/lib/error/error.component.spec.ts @@ -1,26 +1,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' -import { - ErrorType, - SearchResultsErrorComponent, -} from './search-results-error.component' +import { ErrorComponent, ErrorType } from './error.component' import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core' import { By } from '@angular/platform-browser' -describe('SearchResultsErrorComponent', () => { - let component: SearchResultsErrorComponent - let fixture: ComponentFixture +describe('ErrorComponent', () => { + let component: ErrorComponent + let fixture: ComponentFixture let compiled: DebugElement beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [SearchResultsErrorComponent], + declarations: [ErrorComponent], schemas: [NO_ERRORS_SCHEMA], }).compileComponents() }) beforeEach(() => { - fixture = TestBed.createComponent(SearchResultsErrorComponent) + fixture = TestBed.createComponent(ErrorComponent) component = fixture.componentInstance compiled = fixture.debugElement }) diff --git a/libs/ui/elements/src/lib/search-results-error/search-results-error.component.stories.ts b/libs/ui/elements/src/lib/error/error.component.stories.ts similarity index 80% rename from libs/ui/elements/src/lib/search-results-error/search-results-error.component.stories.ts rename to libs/ui/elements/src/lib/error/error.component.stories.ts index 7132e94bc6..0e53bc15c5 100644 --- a/libs/ui/elements/src/lib/search-results-error/search-results-error.component.stories.ts +++ b/libs/ui/elements/src/lib/error/error.component.stories.ts @@ -1,7 +1,4 @@ -import { - ErrorType, - SearchResultsErrorComponent, -} from './search-results-error.component' +import { ErrorComponent, ErrorType } from './error.component' import { applicationConfig, componentWrapperDecorator, @@ -19,8 +16,8 @@ import { importProvidersFrom } from '@angular/core' import { MatIcon } from '@angular/material/icon' export default { - title: 'Elements/SearchResultsErrorComponent', - component: SearchResultsErrorComponent, + title: 'Elements/ErrorComponent', + component: ErrorComponent, decorators: [ moduleMetadata({ declarations: [MatIcon], @@ -36,9 +33,9 @@ export default { (story) => `
${story}
` ), ], -} as Meta +} as Meta -export const Primary: StoryObj = { +export const Primary: StoryObj = { args: { type: ErrorType.RECEIVED_ERROR, error: 'something wrong happened', diff --git a/libs/ui/elements/src/lib/search-results-error/search-results-error.component.ts b/libs/ui/elements/src/lib/error/error.component.ts similarity index 64% rename from libs/ui/elements/src/lib/search-results-error/search-results-error.component.ts rename to libs/ui/elements/src/lib/error/error.component.ts index d61927a68f..cf0546eb62 100644 --- a/libs/ui/elements/src/lib/search-results-error/search-results-error.component.ts +++ b/libs/ui/elements/src/lib/error/error.component.ts @@ -8,12 +8,12 @@ export enum ErrorType { } @Component({ - selector: 'gn-ui-search-results-error', - templateUrl: './search-results-error.component.html', - styleUrls: ['./search-results-error.component.css'], + selector: 'gn-ui-error', + templateUrl: './error.component.html', + styleUrls: ['./error.component.css'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class SearchResultsErrorComponent { +export class ErrorComponent { @Input() type!: ErrorType @Input() error?: string @Input() recordId?: string diff --git a/libs/ui/elements/src/lib/ui-elements.module.ts b/libs/ui/elements/src/lib/ui-elements.module.ts index 58d85ece10..28d194adc9 100644 --- a/libs/ui/elements/src/lib/ui-elements.module.ts +++ b/libs/ui/elements/src/lib/ui-elements.module.ts @@ -12,13 +12,12 @@ import { ApiCardComponent } from './api-card/api-card.component' import { UiWidgetsModule } from '@geonetwork-ui/ui/widgets' import { UiLayoutModule } from '@geonetwork-ui/ui/layout' import { TranslateModule } from '@ngx-translate/core' -import { LinkCardComponent } from './link-card/link-card.component' import { RelatedRecordCardComponent } from './related-record-card/related-record-card.component' import { MetadataContactComponent } from './metadata-contact/metadata-contact.component' import { MetadataCatalogComponent } from './metadata-catalog/metadata-catalog.component' import { MetadataQualityComponent } from './metadata-quality/metadata-quality.component' import { MetadataQualityItemComponent } from './metadata-quality-item/metadata-quality-item.component' -import { SearchResultsErrorComponent } from './search-results-error/search-results-error.component' +import { ErrorComponent } from './error/error.component' import { PaginationComponent } from './pagination/pagination.component' import { ThumbnailComponent } from './thumbnail/thumbnail.component' import { UiInputsModule } from '@geonetwork-ui/ui/inputs' @@ -62,7 +61,7 @@ import { TimeSincePipe } from './user-feedback-item/time-since.pipe' MetadataCatalogComponent, MetadataQualityComponent, MetadataQualityItemComponent, - SearchResultsErrorComponent, + ErrorComponent, PaginationComponent, AvatarComponent, UserPreviewComponent, @@ -84,7 +83,7 @@ import { TimeSincePipe } from './user-feedback-item/time-since.pipe' MetadataCatalogComponent, MetadataQualityComponent, MetadataQualityItemComponent, - SearchResultsErrorComponent, + ErrorComponent, PaginationComponent, ThumbnailComponent, AvatarComponent,