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

Function WorkspacesTable

site/src/pages/WorkspacesPage/WorkspacesTable.tsx:101–305  ·  view source on GitHub ↗
({
	workspaces,
	checkedWorkspaces,
	isUsingFilter,
	onCheckChange,
	templates,
	canCreateTemplate,
	onActionSuccess,
	onActionError,
	chatsByWorkspace,
})

Source from the content-addressed store, hash-verified

99}
100
101export const WorkspacesTable: FC<WorkspacesTableProps> = ({
102 workspaces,
103 checkedWorkspaces,
104 isUsingFilter,
105 onCheckChange,
106 templates,
107 canCreateTemplate,
108 onActionSuccess,
109 onActionError,
110 chatsByWorkspace,
111}) => {
112 const dashboard = useDashboard();
113 const isLoading = !workspaces;
114 const isEmpty = workspaces && workspaces.length === 0;
115 const hideHeaders = isLoading || isEmpty;
116
117 return (
118 <Table>
119 <TableHeader>
120 <TableRow>
121 <TableHead className="w-1/3">
122 {isLoading ? (
123 <Skeleton className="h-4 w-40" />
124 ) : (
125 <div
126 className={cn(
127 "flex items-center gap-5",
128 isEmpty && "invisible",
129 )}
130 >
131 <Checkbox
132 disabled={isEmpty}
133 checked={
134 !isEmpty && checkedWorkspaces.length === workspaces.length
135 }
136 onCheckedChange={(checked) => {
137 if (!checked) {
138 onCheckChange([]);
139 } else {
140 onCheckChange(workspaces);
141 }
142 }}
143 aria-label="Select all workspaces"
144 className="my-0"
145 />
146 Name
147 </div>
148 )}
149 </TableHead>
150 <TableHead className={cn("w-1/3", hideHeaders && "invisible")}>
151 Template
152 </TableHead>
153 <TableHead className={cn("w-1/3", hideHeaders && "invisible")}>
154 Status
155 </TableHead>
156 <TableHead className="w-0">
157 <span className="sr-only">Actions</span>
158 </TableHead>

Callers

nothing calls this directly

Calls 6

useDashboardFunction · 0.90
cnFunction · 0.90
cantBeCheckedFunction · 0.85
findMethod · 0.80
filterMethod · 0.80

Tested by

no test coverage detected