Skip to content

Commit

Permalink
Merge pull request #813 from geonetwork/fix/ogc-request-limit
Browse files Browse the repository at this point in the history
[Datahub][API form] Fix OGC API default limit
  • Loading branch information
cmoinier committed Mar 6, 2024
2 parents 37255b6 + 1fab7d2 commit 4db0b59
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ describe('api form', () => {
.find('gn-ui-copy-text-button')
.find('input')
.invoke('val')
.should('include', 'f=json')
.should('include', 'limit=-1&f=json')
})
it('should close the panel on click', () => {
cy.get('gn-ui-record-api-form').prev().find('button').click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
<gn-ui-text-input
class="mr-2 w-20"
(input)="setLimit($event.target.value)"
[value]="limit$ | async"
[value]="(limit$ | async) !== '-1' ? (limit$ | async) : ''"
hint=""
>
</gn-ui-text-input>
<div class="flex items-center">
<input
class="mr-2 cursor-pointer"
type="checkbox"
[checked]="(limit$ | async) === ''"
(change)="setLimit('')"
[checked]="(limit$ | async) === '-1'"
(change)="setLimit('-1')"
/>
<span class="text-sm" translate
>record.metadata.api.form.limit.all</span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ describe('RecordApFormComponent', () => {
it('should set the links and initial values correctly', async () => {
expect(component.apiBaseUrl).toBe('https://api.example.com/data')
expect(component.offset$.getValue()).toBe('')
expect(component.limit$.getValue()).toBe('')
expect(component.limit$.getValue()).toBe('-1')
expect(component.format$.getValue()).toBe('json')
const url = await firstValueFrom(component.apiQueryUrl$)
expect(url).toBe('https://api.example.com/data?f=json')
expect(url).toBe('https://api.example.com/data?limit=-1&f=json')
})
})
describe('When URL params are changed', () => {
Expand Down Expand Up @@ -83,7 +83,7 @@ describe('RecordApFormComponent', () => {
it('should reset URL to default parameters', () => {
component.resetUrl()
expect(component.offset$.getValue()).toBe('')
expect(component.limit$.getValue()).toBe('')
expect(component.limit$.getValue()).toBe('-1')
expect(component.format$.getValue()).toBe('json')
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BehaviorSubject, combineLatest, map } from 'rxjs'

const DEFAULT_PARAMS = {
OFFSET: '',
LIMIT: '',
LIMIT: '-1',
FORMAT: 'json',
}
@Component({
Expand Down

0 comments on commit 4db0b59

Please sign in to comment.