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

Function WorkspacesPageView

site/src/pages/WorkspacesPage/WorkspacesPageView.tsx:60–241  ·  view source on GitHub ↗
({
	workspaces,
	error,
	limit,
	count,
	filterState,
	onPageChange,
	page,
	checkedWorkspaces,
	onCheckChange,
	onBatchDeleteTransition,
	onBatchUpdateTransition,
	onBatchStopTransition,
	onBatchStartTransition,
	isRunningBatchAction,
	templates,
	templatesFetchStatus,
	canCreateTemplate,
	canChangeVersions,
	onActionSuccess,
	onActionError,
	chatsByWorkspace,
})

Source from the content-addressed store, hash-verified

58}
59
60export const WorkspacesPageView: FC<WorkspacesPageViewProps> = ({
61 workspaces,
62 error,
63 limit,
64 count,
65 filterState,
66 onPageChange,
67 page,
68 checkedWorkspaces,
69 onCheckChange,
70 onBatchDeleteTransition,
71 onBatchUpdateTransition,
72 onBatchStopTransition,
73 onBatchStartTransition,
74 isRunningBatchAction,
75 templates,
76 templatesFetchStatus,
77 canCreateTemplate,
78 canChangeVersions,
79 onActionSuccess,
80 onActionError,
81 chatsByWorkspace,
82}) => {
83 // Let's say the user has 5 workspaces, but tried to hit page 100, which
84 // does not exist. In this case, the page is not valid and we want to show a
85 // better error message.
86 const pageNumberIsInvalid = page !== 1 && workspaces?.length === 0;
87
88 return (
89 <Margins className="pb-12">
90 <PageHeader
91 actions={
92 <WorkspacesButton
93 templates={templates}
94 templatesFetchStatus={templatesFetchStatus}
95 >
96 New workspace
97 </WorkspacesButton>
98 }
99 >
100 <PageHeaderTitle>
101 <div className="flex flex-row gap-2 items-center">
102 <span>Workspaces</span>
103 <WorkspaceHelpPopover />
104 </div>
105 </PageHeaderTitle>
106 </PageHeader>
107
108 <div className="flex flex-col gap-4">
109 {hasError(error) && !isApiValidationError(error) && (
110 <ErrorAlert error={error} />
111 )}
112 <WorkspacesFilter
113 filter={filterState.filter}
114 error={error}
115 statusMenu={filterState.menus.status}
116 templateMenu={filterState.menus.template}
117 userMenu={filterState.menus.user}

Callers

nothing calls this directly

Calls 4

hasErrorFunction · 0.90
isApiValidationErrorFunction · 0.90
mustUpdateWorkspaceFunction · 0.90
onPageChangeFunction · 0.85

Tested by

no test coverage detected