@@ -165,14 +170,14 @@
class="mt-12 p-4 max-w-[600px] m-auto text-[13px]"
*ngIf="metadataViewFacade.error$ | async as error"
>
-
-
+
+ >
diff --git a/apps/datahub/src/app/record/record-metadata/record-metadata.component.spec.ts b/apps/datahub/src/app/record/record-metadata/record-metadata.component.spec.ts
index 1912197273..5f6585bc4d 100644
--- a/apps/datahub/src/app/record/record-metadata/record-metadata.component.spec.ts
+++ b/apps/datahub/src/app/record/record-metadata/record-metadata.component.spec.ts
@@ -10,10 +10,7 @@ import { By } from '@angular/platform-browser'
import { SourcesService } from '@geonetwork-ui/feature/catalog'
import { MapManagerService } from '@geonetwork-ui/feature/map'
import { SearchService } from '@geonetwork-ui/feature/search'
-import {
- ErrorType,
- SearchResultsErrorComponent,
-} from '@geonetwork-ui/ui/elements'
+import { ErrorComponent, ErrorType } from '@geonetwork-ui/ui/elements'
import { TranslateModule } from '@ngx-translate/core'
import { BehaviorSubject, of } from 'rxjs'
import { RecordMetadataComponent } from './record-metadata.component'
@@ -177,7 +174,7 @@ describe('RecordMetadataComponent', () => {
MockDataOtherlinksComponent,
MockDataApisComponent,
MockRelatedComponent,
- SearchResultsErrorComponent,
+ ErrorComponent,
MockMetadataInfoComponent,
MockMetadataCatalogComponent,
MockMetadataContactComponent,
@@ -623,9 +620,9 @@ describe('RecordMetadataComponent', () => {
describe('error handling', () => {
describe('normal', () => {
it('does not show errors', () => {
- const result = fixture.debugElement.query(
- By.directive(SearchResultsErrorComponent)
- )
+ facade.otherLinks$.next([''])
+ fixture.detectChanges()
+ const result = fixture.debugElement.query(By.directive(ErrorComponent))
expect(result).toBeFalsy()
})
})
@@ -635,9 +632,7 @@ describe('RecordMetadataComponent', () => {
fixture.detectChanges()
})
it('shows error', () => {
- const result = fixture.debugElement.query(
- By.directive(SearchResultsErrorComponent)
- )
+ const result = fixture.debugElement.query(By.directive(ErrorComponent))
expect(result).toBeTruthy()
expect(result.componentInstance.type).toBe(ErrorType.RECORD_NOT_FOUND)
@@ -653,14 +648,30 @@ describe('RecordMetadataComponent', () => {
fixture.detectChanges()
})
it('shows error', () => {
- const result = fixture.debugElement.query(
- By.directive(SearchResultsErrorComponent)
- )
+ const result = fixture.debugElement.query(By.directive(ErrorComponent))
expect(result).toBeTruthy()
expect(result.componentInstance.type).toBe(ErrorType.RECEIVED_ERROR)
expect(result.componentInstance.error).toBe('This is an Error!')
})
})
+
+ describe('When there are no link (download, api or other links)', () => {
+ beforeEach(() => {
+ facade.apiLinks$.next([])
+ facade.downloadLinks$.next([])
+ facade.otherLinks$.next([])
+ fixture.detectChanges()
+ })
+ it('shows the no link error block', () => {
+ const result = fixture.debugElement.query(
+ By.css('[data-test="dataset-has-no-link-block"]')
+ )
+ expect(result).toBeTruthy()
+ expect(result.componentInstance.type).toBe(
+ ErrorType.DATASET_HAS_NO_LINK
+ )
+ })
+ })
})
})
diff --git a/apps/datahub/src/app/record/record-metadata/record-metadata.component.ts b/apps/datahub/src/app/record/record-metadata/record-metadata.component.ts
index 94ee20c041..d04313355a 100644
--- a/apps/datahub/src/app/record/record-metadata/record-metadata.component.ts
+++ b/apps/datahub/src/app/record/record-metadata/record-metadata.component.ts
@@ -54,6 +54,17 @@ export class RecordMetadataComponent {
map((records) => records?.length > 0)
)
+ displayDatasetHasNoLinkBlock$ = combineLatest([
+ this.displayDownload$,
+ this.displayApi$,
+ this.displayOtherLinks,
+ ]).pipe(
+ map(
+ ([displayDownload, displayApi, displayOtherLinks]) =>
+ !displayDownload && !displayApi && !displayOtherLinks
+ )
+ )
+
organisationName$ = this.metadataViewFacade.metadata$.pipe(
map((record) => record?.ownerOrganization?.name),
filter(Boolean)
diff --git a/libs/feature/search/src/lib/results-list/results-list.container.component.html b/libs/feature/search/src/lib/results-list/results-list.container.component.html
index 45ed9d351b..45ba6814aa 100644
--- a/libs/feature/search/src/lib/results-list/results-list.container.component.html
+++ b/libs/feature/search/src/lib/results-list/results-list.container.component.html
@@ -42,16 +42,16 @@