Skip to content

Commit

Permalink
fix(api-form): make swagger url dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
tkohr committed May 29, 2024
1 parent 75852e5 commit 5361b87
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
13 changes: 6 additions & 7 deletions apps/datahub-e2e/src/e2e/dataset.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,12 @@ describe('datasets', () => {
.find('mel-datahub-api-card')
.last()
.click()
cy.get('mel-datahub-api-form')
.find('a')
.invoke('attr', 'href')
.should(
'eq',
'https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/swagger-ui/index.html'
)
cy.window().then((win) => {
cy.get('mel-datahub-api-form')
.find('a')
.invoke('attr', 'href')
.should('eq', `${win.location.origin}/data/swagger-ui/index.html`)
})
})
it('should open the api form', () => {
cy.get('mel-datahub-dataset-apis')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<span translate>mel.dataset.api.access</span>
<a
class="flex flex-row items-center gap-1 text-primary cursor-pointer hover:underline"
href="https://mel.integration.apps.gs-fr-prod.camptocamp.com/data/swagger-ui/index.html"
[href]="swaggerUrl"
target="_blank"
translate
>mel.dataset.api.swagger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ import { RecordApiFormComponent } from 'geonetwork-ui'
styles: ``,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ApiFormComponent extends RecordApiFormComponent {}
export class ApiFormComponent extends RecordApiFormComponent {
get swaggerUrl() {
return `${window.location.origin}/data/swagger-ui/index.html`
}
}

0 comments on commit 5361b87

Please sign in to comment.