-
Notifications
You must be signed in to change notification settings - Fork 5
fix: use server-side pagination for conference list tab #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d3bd04d
25135b9
50d307c
c955984
ec4a631
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,7 +117,14 @@ | |
| /> | ||
| </div> | ||
| <div class="tab-pane fade" id="conferences" role="tabpanel" aria-labelledby="conferences-tab"> | ||
| <conferences-tab :conferences="conferences" /> | ||
| <conferences-tab | ||
| :conferences="paginatedConferences" | ||
| :total-count="conferencesCount" | ||
| :current-page="conferencesPage" | ||
| :per-page="conferencesPerPage" | ||
| :loading="conferencesLoading" | ||
| @page-changed="fetchConferences" | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
@@ -147,6 +154,11 @@ export default { | |
| data: {}, | ||
|
|
||
| conferences: null, | ||
| paginatedConferences: null, | ||
| conferencesCount: 0, | ||
| conferencesPage: 1, | ||
| conferencesPerPage: 20, | ||
| conferencesLoading: false, | ||
| sessions: null, | ||
| connections: null, | ||
| issues: null, | ||
|
|
@@ -179,8 +191,13 @@ export default { | |
| }, | ||
|
|
||
| async created() { | ||
| const since = new Date(); | ||
| since.setDate(since.getDate() - peermetrics.daysHistory); | ||
| const created_at_gte = since.toISOString(); | ||
|
|
||
| this.data.issues = await peermetrics.get(peermetrics.urls.issues(), { | ||
| appId: peermetrics.app.id | ||
| appId: peermetrics.app.id, | ||
| created_at_gte, | ||
| }).catch(e => { | ||
| console.warn(e) | ||
| }); | ||
|
|
@@ -190,9 +207,9 @@ export default { | |
| } | ||
|
|
||
| this.data.conferences = await peermetrics.get(peermetrics.urls.conferences(), { | ||
| appId: peermetrics.app.id | ||
| }) | ||
| .catch(e => { | ||
| appId: peermetrics.app.id, | ||
| created_at_gte, | ||
| }).catch(e => { | ||
| console.warn(e) | ||
| }); | ||
|
|
||
|
|
@@ -201,18 +218,22 @@ export default { | |
| this.conferences = Object.freeze(this.data.conferences); | ||
| } | ||
|
|
||
| await this.fetchConferences(); | ||
|
|
||
| this.data.sessions = await peermetrics.get(peermetrics.urls.sessions, { | ||
| appId: peermetrics.app.id | ||
| appId: peermetrics.app.id, | ||
| created_at_gte, | ||
| }) | ||
| .catch(e => console.warn(e)); | ||
|
|
||
| if(this.data.sessions) { | ||
| this.data.sessions = peermetrics.utils.populateIssues(this.data.sessions, this.data.issues) | ||
| this.sessions = Object.freeze(this.data.sessions); | ||
| } | ||
|
|
||
| this.data.connections = await peermetrics.get(peermetrics.urls.connections(), { | ||
| appId: peermetrics.app.id | ||
| appId: peermetrics.app.id, | ||
| created_at_gte, | ||
| }) | ||
| .catch(e => { | ||
| console.warn(e) | ||
|
|
@@ -291,6 +312,26 @@ export default { | |
| return Object.values(object).sort((a, b) => a.value > b.value ? 1 : -1) | ||
| }, | ||
|
|
||
| async fetchConferences(page) { | ||
| if (page) this.conferencesPage = page; | ||
| this.conferencesLoading = true; | ||
| const offset = (this.conferencesPage - 1) * this.conferencesPerPage; | ||
| try { | ||
| const response = await peermetrics.get(peermetrics.urls.conferences(), { | ||
| appId: peermetrics.app.id, | ||
| limit: this.conferencesPerPage, | ||
| offset: offset, | ||
|
Comment on lines
+320
to
+323
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new Useful? React with 👍 / 👎.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the bot's concern is likely a false positive in our case. The pagination is doing its job correctly: These two views are supposed to show different scopes. |
||
| }); | ||
| if (response) { | ||
| this.paginatedConferences = Object.freeze(response.results || []); | ||
| this.conferencesCount = response.count || 0; | ||
| } | ||
| } catch (e) { | ||
| console.warn(e); | ||
| } | ||
| this.conferencesLoading = false; | ||
| }, | ||
|
|
||
| applyFilters () { | ||
| // if no filters are applied, use all the data | ||
| if (!this.selectedAppVersion && !this.selectedBrowser && !this.selectedOs && !this.selectedCountry) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Binding the list tab to
paginatedConferencesbypassesapplyFilters(), which still only updatesthis.conferencesbased on the selected app version/browser/OS/country watchers. After this change, changing filters updates graphs but leaves the conference list unfiltered, which is a behavior regression from the previous wiring and makes the global filter UI inconsistent across tabs.Useful? React with 👍 / 👎.