Skip to content

Commit

Permalink
feat(router): remove /search from routes
Browse files Browse the repository at this point in the history
  • Loading branch information
tkohr committed Apr 8, 2024
1 parent 95cbad1 commit ba447d8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apps/datahub/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
UiMapModule,
GN_UI_VERSION,
WEB_COMPONENT_EMBEDDER_URL,
RouterService,
} from 'geonetwork-ui'
import {
TranslateLoader,
Expand Down Expand Up @@ -60,6 +61,7 @@ import { MelMapViewComponent } from './dataset/dataset-visualisation/map-view/ma
import { MelDataViewComponent } from './dataset/dataset-visualisation/data-view/data-view.component'
import { environment } from '../environments/environnment'
import { MelModule, MelEmbeddedTranslateLoader } from '@mel-dataplatform/mel'
import { AppRouterService } from './app.router.service'

@NgModule({
declarations: [
Expand Down Expand Up @@ -147,6 +149,7 @@ import { MelModule, MelEmbeddedTranslateLoader } from '@mel-dataplatform/mel'
provide: LOGIN_URL,
useFactory: () => '${current_url}?login',
},
{ provide: RouterService, useClass: AppRouterService },
],
bootstrap: [AppComponent],
})
Expand Down
26 changes: 26 additions & 0 deletions apps/datahub/src/app/app.router.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Injectable } from '@angular/core'
import { Routes } from '@angular/router'
import { DATAHUB_ROUTE_DATASET } from '@mel-dataplatform/mel'
import { RouterService } from 'geonetwork-ui'
import { SearchPageComponent } from './search/search-page/search-page.component'
import { DatasetPageComponent } from './dataset/dataset-page/dataset-page.component'

@Injectable()
export class AppRouterService extends RouterService {
override buildRoutes(): Routes {
return [
{
path: '',
data: {
shouldDetach: true,
},
component: SearchPageComponent,
},
{
path: `${DATAHUB_ROUTE_DATASET}/:metadataUuid`,
component: DatasetPageComponent,
},
{ path: '**', redirectTo: '', pathMatch: 'full' },
]
}
}
2 changes: 1 addition & 1 deletion libs/mel/src/lib/route.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CatalogRecord } from 'geonetwork-ui/libs/common/domain/src/lib/model/re

export const DATAHUB_ROOT = '/catalogue'
export const DATAHUB_ROUTE_DATASET = 'dataset'
export const DATAHUB_ROUTE_SEARCH = 'search'
export const DATAHUB_ROUTE_SEARCH = ''

export function goFromHomeToRecord(record: CatalogRecord) {
window.location.href = `${DATAHUB_ROOT}/${DATAHUB_ROUTE_DATASET}/${record.uniqueIdentifier}`
Expand Down

0 comments on commit ba447d8

Please sign in to comment.