Skip to content

Commit 83788e7

Browse files
committed
Merge branch 'mes/filter-work-1' into mes/filter-work-2
2 parents 5a0c523 + c8f9226 commit 83788e7

File tree

4 files changed

+261
-121
lines changed

4 files changed

+261
-121
lines changed

site/src/api/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1684,11 +1684,13 @@ class ApiMethods {
16841684
};
16851685

16861686
getWorkspaceQuota = async (
1687+
organizationName: string,
16871688
username: string,
16881689
): Promise<TypesGen.WorkspaceQuota> => {
16891690
const response = await this.axios.get(
1690-
`/api/v2/workspace-quota/${encodeURIComponent(username)}`,
1691+
`/api/v2/organizations/${encodeURIComponent(organizationName)}/members/${encodeURIComponent(username)}/workspace-quota`,
16911692
);
1693+
16921694
return response.data;
16931695
};
16941696

site/src/api/queries/workspaceQuota.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { API } from "api/api";
22

3-
export const getWorkspaceQuotaQueryKey = (username: string) => [
4-
username,
5-
"workspaceQuota",
6-
];
3+
export const getWorkspaceQuotaQueryKey = (
4+
organizationName: string,
5+
username: string,
6+
) => {
7+
return [organizationName, username, "workspaceQuota"];
8+
};
79

8-
export const workspaceQuota = (username: string) => {
10+
export const workspaceQuota = (organizationName: string, username: string) => {
911
return {
10-
queryKey: getWorkspaceQuotaQueryKey(username),
11-
queryFn: () => API.getWorkspaceQuota(username),
12+
queryKey: getWorkspaceQuotaQueryKey(organizationName, username),
13+
queryFn: () => API.getWorkspaceQuota(organizationName, username),
1214
};
1315
};
1416

site/src/pages/WorkspacePage/WorkspaceTopbar.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { expect, screen, userEvent, waitFor, within } from "@storybook/test";
33
import { getWorkspaceQuotaQueryKey } from "api/queries/workspaceQuota";
44
import { addHours, addMinutes } from "date-fns";
55
import {
6+
MockOrganization,
67
MockTemplate,
78
MockTemplateVersion,
89
MockUser,
@@ -266,7 +267,10 @@ export const WithQuota: Story = {
266267
parameters: {
267268
queries: [
268269
{
269-
key: getWorkspaceQuotaQueryKey(MockUser.username),
270+
key: getWorkspaceQuotaQueryKey(
271+
MockOrganization.name,
272+
MockUser.username,
273+
),
270274
data: {
271275
credits_consumed: 2,
272276
budget: 40,

0 commit comments

Comments
 (0)