-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5646 from cloudforet-io/feature-dashboard-vue-query
feat(vue-query): apply vue-query to dashboard & create api-clients
- Loading branch information
Showing
912 changed files
with
6,738 additions
and
12,837 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
apps/web/src/api-clients/_common/composables/use-query-key.ts
This file contains 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,41 @@ | ||
import type { ComputedRef } from 'vue'; | ||
import { computed, reactive } from 'vue'; | ||
|
||
|
||
import type { QueryKey } from '@tanstack/vue-query'; | ||
|
||
import { useAppContextStore } from '@/store/app-context/app-context-store'; | ||
import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-workspace-store'; | ||
|
||
/** | ||
* Generates a computed query key for API requests, incorporating global parameters. | ||
* | ||
* @param primaryQueryKey - The primary key for the api query (e.g., 'private-dashboard/get'). It follows the `{api-resource-name}/{api-verb}` convention. | ||
* @param additionalGlobalParams - Optional additional global parameters to include in the api query key. | ||
* @returns A computed reference to the query key array. | ||
*/ | ||
|
||
interface GlobalQueryParams { | ||
workspaceId?: string; | ||
isAdminMode?: boolean; | ||
} | ||
export const useAPIQueryKey = ( | ||
primaryQueryKey: string, | ||
additionalGlobalParams?: Partial<GlobalQueryParams>, | ||
): ComputedRef<QueryKey> => { | ||
const appContextStore = useAppContextStore(); | ||
const userWorkspaceStore = useUserWorkspaceStore(); | ||
|
||
const _state = reactive({ | ||
currentWorkdpaceId: computed<string|undefined>(() => userWorkspaceStore.getters.currentWorkspaceId), | ||
isAdminMode: computed<boolean>(() => appContextStore.getters.isAdminMode), | ||
}); | ||
|
||
const globalQueryParams = reactive<GlobalQueryParams>({ | ||
workspaceId: _state.currentWorkdpaceId, | ||
isAdminMode: _state.isAdminMode, | ||
...additionalGlobalParams, | ||
}); | ||
|
||
return computed<QueryKey>(() => [primaryQueryKey, { ...globalQueryParams }]); | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
apps/web/src/schema/_common/type.ts → ...eb/src/api-clients/_common/schema/type.ts
This file contains 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
4 changes: 2 additions & 2 deletions
4
apps/web/src/schema/add-ons/favorite/list.ts → ...i-clients/add-ons/favorite/schema/list.ts
This file contains 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
File renamed without changes.
Empty file.
2 changes: 1 addition & 1 deletion
2
...nalysis/budget-usage/api-verbs/analyze.ts → .../budget-usage/schema/api-verbs/analyze.ts
This file contains 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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...chema/cost-analysis/budget-usage/model.ts → ...ost-analysis/budget-usage/schema/model.ts
This file contains 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
Empty file.
6 changes: 3 additions & 3 deletions
6
.../cost-analysis/budget/api-verbs/create.ts → ...nalysis/budget/schema/api-verbs/create.ts
This file contains 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
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ma/cost-analysis/budget/api-verbs/list.ts → ...-analysis/budget/schema/api-verbs/list.ts
This file contains 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
2 changes: 1 addition & 1 deletion
2
...ysis/budget/api-verbs/set-notification.ts → ...dget/schema/api-verbs/set-notification.ts
This file contains 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
4 changes: 2 additions & 2 deletions
4
.../cost-analysis/budget/api-verbs/update.ts → ...nalysis/budget/schema/api-verbs/update.ts
This file contains 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
6 changes: 3 additions & 3 deletions
6
.../src/schema/cost-analysis/budget/model.ts → ...ents/cost-analysis/budget/schema/model.ts
This file contains 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
File renamed without changes.
Empty file.
10 changes: 10 additions & 0 deletions
10
apps/web/src/api-clients/cost-analysis/cost-query-set/schema/api-verbs/create.ts
This file contains 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,10 @@ | ||
import type { Tags } from '@/api-clients/_common/schema/model'; | ||
import type { CostQuerySetOption } from '@/api-clients/cost-analysis/cost-query-set/schema/type'; | ||
|
||
|
||
export interface CostQuerySetCreateParameters { | ||
data_source_id: string; | ||
name: string; | ||
options: CostQuerySetOption; | ||
tags?: Tags; | ||
} |
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
apps/web/src/api-clients/cost-analysis/cost-query-set/schema/api-verbs/update.ts
This file contains 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,10 @@ | ||
import type { Tags } from '@/api-clients/_common/schema/model'; | ||
import type { CostQuerySetOption } from '@/api-clients/cost-analysis/cost-query-set/schema/type'; | ||
|
||
|
||
export interface CostQuerySetUpdateParameters { | ||
cost_query_set_id: string; | ||
name?: string; | ||
options?: CostQuerySetOption; | ||
tags?: Tags; | ||
} |
4 changes: 2 additions & 2 deletions
4
...ema/cost-analysis/cost-query-set/model.ts → ...t-analysis/cost-query-set/schema/model.ts
This file contains 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
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...cost-analysis/cost-report-config/model.ts → ...alysis/cost-report-config/schema/model.ts
This file contains 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
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...st-analysis/cost-report/api-verbs/list.ts → ...ysis/cost-report/schema/api-verbs/list.ts
This file contains 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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...schema/cost-analysis/cost-report/model.ts → ...cost-analysis/cost-report/schema/model.ts
This file contains 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
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...eb/src/schema/cost-analysis/cost/model.ts → ...lients/cost-analysis/cost/schema/model.ts
This file contains 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
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...st-analysis/data-source/api-verbs/list.ts → ...ysis/data-source/schema/api-verbs/list.ts
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions
6
...schema/cost-analysis/data-source/model.ts → ...cost-analysis/data-source/schema/model.ts
This file contains 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
2 changes: 1 addition & 1 deletion
2
.../schema/cost-analysis/data-source/type.ts → .../cost-analysis/data-source/schema/type.ts
This file contains 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
Empty file.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions
5
...web/src/schema/cost-analysis/job/model.ts → ...clients/cost-analysis/job/schema/model.ts
This file contains 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
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 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,14 @@ | ||
import type { PrivateFolderCreateParameters } from '@/api-clients/dashboard/private-folder/schema/api-verbs/create'; | ||
import type { PrivateFolderDeleteParameters } from '@/api-clients/dashboard/private-folder/schema/api-verbs/delete'; | ||
import type { PrivateFolderUpdateParameters } from '@/api-clients/dashboard/private-folder/schema/api-verbs/update'; | ||
import type { PrivateFolderModel } from '@/api-clients/dashboard/private-folder/schema/model'; | ||
import type { PublicFolderCreateParameters } from '@/api-clients/dashboard/public-folder/schema/api-verbs/create'; | ||
import type { PublicFolderDeleteParameters } from '@/api-clients/dashboard/public-folder/schema/api-verbs/delete'; | ||
import type { PublicFolderUpdateParameters } from '@/api-clients/dashboard/public-folder/schema/api-verbs/update'; | ||
import type { PublicFolderModel } from '@/api-clients/dashboard/public-folder/schema/model'; | ||
|
||
|
||
export type FolderModel = PublicFolderModel | PrivateFolderModel; | ||
export type FolderCreateParams = PublicFolderCreateParameters | PrivateFolderCreateParameters; | ||
export type FolderUpdateParams = PublicFolderUpdateParameters | PrivateFolderUpdateParameters; | ||
export type FolderDeleteParams = PublicFolderDeleteParameters | PrivateFolderDeleteParameters; |
This file contains 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
Oops, something went wrong.