-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore: make branchName a query param in consolidated api #38851
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
dvj1988
merged 10 commits into
release
from
chore/remove-branchname-header-consolidated-api
Jan 28, 2025
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4fed761
chore: remove request headers from consolidated api
029a844
add request params to consolidated view api
2afb073
add /
6ad31ee
remove headers from request key
96a7249
fix prefetch url
e87dea7
convert type to interface
869ecd6
convert queryparams to string
7a818ef
update client unit test cases
4419207
Merge remote-tracking branch 'origin' into chore/remove-branchname-he…
45b23c1
remove pickby in sagas
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
26 changes: 13 additions & 13 deletions
26
app/client/src/api/services/ConsolidatedPageLoadApi/api.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 |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| import { api } from "api/core"; | ||
| import type { InitConsolidatedApi } from "sagas/InitSagas"; | ||
| import type { ConsolidatedApiParams } from "./types"; | ||
| import { ConsolidatedApiUtils } from "./url"; | ||
|
|
||
| const BASE_URL = "v1/consolidated-api"; | ||
| const VIEW_URL = `${BASE_URL}/view`; | ||
| const EDIT_URL = `${BASE_URL}/edit`; | ||
| export const getConsolidatedPageLoadDataView = async ( | ||
| params: ConsolidatedApiParams, | ||
| ) => { | ||
| const viewUrl = ConsolidatedApiUtils.getViewUrl(params); | ||
|
|
||
| export const getConsolidatedPageLoadDataView = async (params: { | ||
| applicationId?: string; | ||
| defaultPageId?: string; | ||
| }) => { | ||
| return api.get<InitConsolidatedApi>(VIEW_URL, { params }); | ||
| return api.get<InitConsolidatedApi>(viewUrl); | ||
| }; | ||
|
|
||
| export const getConsolidatedPageLoadDataEdit = async (params: { | ||
| applicationId?: string; | ||
| defaultPageId?: string; | ||
| }) => { | ||
| return api.get<InitConsolidatedApi>(EDIT_URL, { params }); | ||
| export const getConsolidatedPageLoadDataEdit = async ( | ||
| params: ConsolidatedApiParams, | ||
| ) => { | ||
| const editUrl = ConsolidatedApiUtils.getEditUrl(params); | ||
|
|
||
| return api.get<InitConsolidatedApi>(editUrl); | ||
| }; |
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,5 @@ | ||
| export interface ConsolidatedApiParams { | ||
| applicationId?: string; | ||
| defaultPageId?: string; | ||
| branchName?: string; | ||
| } |
25 changes: 25 additions & 0 deletions
25
app/client/src/api/services/ConsolidatedPageLoadApi/url.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,25 @@ | ||
| import pickBy from "lodash/pickBy"; | ||
| import identity from "lodash/identity"; | ||
| import type { ConsolidatedApiParams } from "./types"; | ||
|
|
||
| export class ConsolidatedApiUtils { | ||
| private static BASE_URL = "v1/consolidated-api"; | ||
| private static VIEW_URL = `${this.BASE_URL}/view`; | ||
| private static EDIT_URL = `${this.BASE_URL}/edit`; | ||
|
|
||
| static getViewUrl = (requestParams: ConsolidatedApiParams) => { | ||
| // Remove undefined values from the requestParams object | ||
| const queryParamsObject = pickBy(requestParams, identity); | ||
| const queryParamsString = new URLSearchParams(queryParamsObject).toString(); | ||
|
|
||
| return `${this.VIEW_URL}?${queryParamsString}`; | ||
| }; | ||
|
|
||
| static getEditUrl = (requestParams: ConsolidatedApiParams) => { | ||
| // Remove undefined values from the requestParams object | ||
| const queryParamsObject = pickBy(requestParams, identity); | ||
| const queryParamsString = new URLSearchParams(queryParamsObject).toString(); | ||
|
|
||
| return `${this.EDIT_URL}?${queryParamsString}`; | ||
| }; | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.