-
Notifications
You must be signed in to change notification settings - Fork 167
Loading states for sync-in-progress #384
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
Merged
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e1a55ec
creates func for fetching bookmarked repos, and fetches data into dor…
e-for-eshaan 67bc9d6
adds types for book_marked repos
e-for-eshaan b92741d
creates slice and state for book-marked repos
e-for-eshaan 118cc2e
changes the bookmark fetcher to return only repo-IDs
e-for-eshaan 25ff513
updates loader to accept label
e-for-eshaan 51d4fe8
updates type of the api-response for dora-metrics API
e-for-eshaan 0b15503
creates a hook `useSyncedRepos` to watch the sync-status of repos
e-for-eshaan 7517558
removes redundant data-processing
e-for-eshaan 59b18ac
updates the init-state of `teamReposMaps`
e-for-eshaan 5d5d51d
adds `additionalFilters` as props to the component `PageWrapper`
e-for-eshaan 8c4b20b
implements loading state to show sync-status for the team's repos
e-for-eshaan 1f1013c
optimizes `getBookmarkedRepos` to get repos only for the team
e-for-eshaan ef9e840
removes repo-sync loader from header of page
e-for-eshaan c3b7571
Creates a syncing-loader for dora-metrics
e-for-eshaan 231d813
changes repo-sync loader logic for first load of dora-metrics
e-for-eshaan 2b8eaf1
creates an endpoint for fetching bookmarked repos
e-for-eshaan f24a21d
fixes mock response
e-for-eshaan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
web-server/pages/api/resources/teams/[team_id]/bookmarked_repos.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import * as yup from 'yup'; | ||
|
|
||
| import { getTeamRepos } from '@/api/resources/team_repos'; | ||
| import { Endpoint, nullSchema } from '@/api-helpers/global'; | ||
| import { Table } from '@/constants/db'; | ||
| import { uuid } from '@/utils/datatype'; | ||
| import { db } from '@/utils/db'; | ||
|
|
||
| const pathSchema = yup.object().shape({ | ||
| team_id: yup.string().uuid().required() | ||
| }); | ||
|
|
||
| const endpoint = new Endpoint(pathSchema); | ||
|
|
||
| endpoint.handle.GET(nullSchema, async (req, res) => { | ||
| if (req.meta?.features?.use_mock_data) { | ||
| return res.send([1, 2, 3].map(() => uuid())); | ||
| } | ||
|
|
||
| res.send(await getBookmarkedRepos(req.payload.team_id)); | ||
| }); | ||
|
|
||
| export const getBookmarkedRepos = async (teamId?: ID) => { | ||
| const query = db(Table.Bookmark).select('repo_id'); | ||
|
|
||
| if (!teamId) | ||
| return (await query.then((res) => | ||
| res.map((item) => item?.repo_id) | ||
| )) as ID[]; | ||
|
|
||
| const teamRepoIds = await getTeamRepos(teamId).then((res) => | ||
| res.map((repo) => repo.id) | ||
| ); | ||
|
|
||
| return (await query | ||
| .whereIn('repo_id', teamRepoIds) | ||
| .then((res) => res.map((item) => item?.repo_id))) as ID[]; | ||
| }; | ||
|
|
||
| export default endpoint.serve(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[1,2,3]seems very odd, maybe directly use[uuid(),uuid(),uuid()]or declare it inside a mock file