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

Function Resources

site/src/modules/resources/Resources.tsx:16–54  ·  view source on GitHub ↗
({ resources, agentRow })

Source from the content-addressed store, hash-verified

14}
15
16export const Resources: FC<ResourcesProps> = ({ resources, agentRow }) => {
17 const [shouldDisplayHideResources, setShouldDisplayHideResources] =
18 useState(false);
19 const displayResources = shouldDisplayHideResources
20 ? resources
21 : resources
22 .filter((resource) => !resource.hide)
23 // Display the resources with agents first
24 .sort((a, b) => countAgents(b) - countAgents(a));
25 const hasHideResources = resources.some((r) => r.hide);
26
27 return (
28 <div className="flex flex-col bg-surface-primary">
29 {displayResources.map((resource) => (
30 <ResourceCard
31 key={resource.id}
32 resource={resource}
33 agentRow={(agent) => agentRow(agent, countAgents(resource))}
34 />
35 ))}
36 {hasHideResources && (
37 <div className="flex items-center justify-center mt-4">
38 <Button
39 variant="outline"
40 className="rounded-full w-full max-w-[260px]"
41 size="sm"
42 onClick={() => setShouldDisplayHideResources((v) => !v)}
43 >
44 {shouldDisplayHideResources ? "Hide" : "Show hidden"} resources
45 <ChevronDownIcon
46 open={shouldDisplayHideResources}
47 className="ml-2"
48 />
49 </Button>
50 </div>
51 )}
52 </div>
53 );
54};

Callers

nothing calls this directly

Calls 2

filterMethod · 0.80
countAgentsFunction · 0.70

Tested by

no test coverage detected