MCPcopy Index your code
hub / github.com/coder/coder / workspaceUsage

Function workspaceUsage

site/src/api/queries/workspaces.ts:505–533  ·  view source on GitHub ↗
(options: WorkspaceUsageOptions)

Source from the content-addressed store, hash-verified

503}
504
505export const workspaceUsage = (options: WorkspaceUsageOptions) => {
506 return {
507 queryKey: [
508 "workspaces",
509 options.workspaceId,
510 "agents",
511 options.agentId,
512 "usage",
513 options.usageApp,
514 ],
515 enabled:
516 options.workspaceId !== undefined &&
517 options.agentId !== undefined &&
518 options.connectionStatus === "connected",
519 queryFn: () => {
520 if (options.workspaceId === undefined || options.agentId === undefined) {
521 return Promise.reject();
522 }
523
524 return API.postWorkspaceUsage(options.workspaceId, {
525 agent_id: options.agentId,
526 app_name: options.usageApp,
527 });
528 },
529 // ...disabledRefetchOptions,
530 refetchInterval: 60000,
531 refetchIntervalInBackground: true,
532 };
533};
534
535export const workspacePermissions = (workspace?: Workspace) => {
536 return {

Callers 3

TerminalPageFunction · 0.90
TerminalPanelFunction · 0.90

Calls 1

postWorkspaceUsageMethod · 0.80

Tested by 1