Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/dashboard/features/dashboard/filter/dropdown-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export function DropdownFilter(props: DropdownFilterProps) {
return (
<CommandItem
key={option.value}
onSelect={onSelect}
onSelect={() => {
onSelect(option.value);
}}
value={option.value}
>
<div
Expand Down
14 changes: 8 additions & 6 deletions src/dashboard/features/dashboard/filter/header-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ export function Filters() {
allItems={allEditors}
onSelect={(e) => dashboardStore.filterEditor(e)}
/>{" "}
<DropdownFilter
name={"Team"}
allItems={allTeams}
onSelect={(e) => dashboardStore.filterTeam(e)}
onClose={() => dashboardStore.refreshTeamDataIfNeeded()}
/>
{allTeams.length > 0 && (
<DropdownFilter
name={"Team"}
allItems={allTeams}
onSelect={(e) => dashboardStore.filterTeam(e)}
onClose={() => dashboardStore.refreshTeamDataIfNeeded()}
/>
)}
<Button
variant={"secondary"}
size={"icon"}
Expand Down
11 changes: 6 additions & 5 deletions src/dashboard/services/copilot-metrics-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface IFilter {

export const getCopilotMetrics = async (
filter: IFilter
): Promise<ServerActionResponse<CopilotUsageOutput[]>> => {
): Promise<ServerActionResponse<CopilotUsageOutput[]>> => {
const env = ensureGitHubEnvConfig();
const isCosmosConfig = cosmosConfiguration();

Expand All @@ -40,16 +40,17 @@ export const getCopilotMetrics = async (
filter.organization = organization;
}
break;
} if (isCosmosConfig) {
return getCopilotMetricsFromDatabase(filter);
}
if (isCosmosConfig) {
return await getCopilotMetricsFromDatabase(filter);
}

// If teams are specified, use the teams-specific API function
if (filter.team && filter.team.length > 0) {
return getCopilotTeamsMetricsFromApi(filter);
return await getCopilotTeamsMetricsFromApi(filter);
}

return getCopilotMetricsFromApi(filter);
return await getCopilotMetricsFromApi(filter);
} catch (e) {
return unknownResponseError(e);
}
Expand Down
18 changes: 9 additions & 9 deletions src/dashboard/services/copilot-seat-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface IFilter {

export const getCopilotSeats = async (
filter: IFilter
): Promise<ServerActionResponse<CopilotSeatsData>> => {
): Promise<ServerActionResponse<CopilotSeatsData>> => {
const env = ensureGitHubEnvConfig();
const isCosmosConfig = cosmosConfiguration();

Expand All @@ -40,10 +40,10 @@ export const getCopilotSeats = async (
}
break;
}
if (isCosmosConfig) {
return getCopilotSeatsFromDatabase(filter);
if (isCosmosConfig) {
return await getCopilotSeatsFromDatabase(filter);
}
return getCopilotSeatsFromApi(filter);
return await getCopilotSeatsFromApi(filter);
} catch (e) {
return unknownResponseError(e);
}
Expand Down Expand Up @@ -150,11 +150,11 @@ const getCopilotSeatsFromDatabase = async (
};
}

const seatsData = aggregateSeatsData(data.response, filter.team);
const seatsData = await aggregateSeatsData(data.response, filter.team);

return {
status: "OK",
response: seatsData as CopilotSeatsData,
response: seatsData,
};
} catch (e) {
return unknownResponseError(e);
Expand Down Expand Up @@ -309,11 +309,11 @@ const getCopilotSeatsFromApi = async (
};
}

const seatsData = aggregateSeatsData(data.response, filter.team);
const seatsData = await aggregateSeatsData(data.response, filter.team);

return {
status: "OK",
response: seatsData as CopilotSeatsData,
response: seatsData,
};
} catch (e) {
return unknownResponseError(e);
Expand All @@ -322,7 +322,7 @@ const getCopilotSeatsFromApi = async (

export const getCopilotSeatsManagement = async (
filter: IFilter
): Promise<ServerActionResponse<CopilotSeatsData>> => {
): Promise<ServerActionResponse<CopilotSeatsData>> => {
const env = ensureGitHubEnvConfig();
const isCosmosConfig = cosmosConfiguration();

Expand Down