• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / codegate-ui / 13091302721

01 Feb 2025 06:28PM CUT coverage: 73.907% (+0.1%) from 73.779%
13091302721

Pull #246

github

web-flow
Merge 6d6ec0bdb into 276591710
Pull Request #246: chore(deps): bump actions/setup-node from 4.1.0 to 4.2.0

365 of 560 branches covered (65.18%)

Branch coverage included in aggregate %.

785 of 996 relevant lines covered (78.82%)

76.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/features/workspace/components/table-workspaces.tsx
1
import {
2
  Badge,
3
  Cell,
4
  Column,
5
  Row,
6
  Table,
7
  TableBody,
8
  TableHeader,
9
} from "@stacklok/ui-kit";
10

11
import { useListAllWorkspaces } from "../hooks/use-query-list-all-workspaces";
12
import { useActiveWorkspaceName } from "../hooks/use-active-workspace-name";
13
import { TableActionsWorkspaces } from "./table-actions-workspaces";
14
import { hrefs } from "@/lib/hrefs";
15

16
function CellName({
17
  name,
18
  isArchived = false,
×
19
  isActive = false,
×
20
}: {
21
  name: string;
22
  isArchived: boolean;
23
  isActive: boolean;
24
}) {
25
  if (isArchived)
26
    return (
27
      <Cell className="text-disabled">
28
        <span>{name}</span>
29
        &nbsp;&nbsp;
30
        <Badge size="sm" className="text-tertiary">
31
          Archived
32
        </Badge>
33
      </Cell>
34
    );
35

36
  if (isActive)
37
    return (
38
      <Cell>
39
        <span>{name}</span>
40
        &nbsp;&nbsp;
41
        <Badge size="sm" variant="inverted">
42
          Active
43
        </Badge>
44
      </Cell>
45
    );
46

47
  return <Cell>{name}</Cell>;
48
}
49

50
export function TableWorkspaces() {
51
  const { data: workspaces } = useListAllWorkspaces();
7✔
52
  const { data: activeWorkspaceName } = useActiveWorkspaceName();
7✔
53

54
  return (
55
    <Table aria-label="List of workspaces">
56
      <Row>
57
        <TableHeader>
58
          <Column id="name" isRowHeader>
59
            Name
60
          </Column>
61
          <Column id="configuration"></Column>
62
        </TableHeader>
63
      </Row>
64
      <TableBody>
65
        {workspaces.map((workspace) => (
66
          <Row key={workspace.id} href={hrefs.workspaces.edit(workspace.name)}>
67
            <CellName
68
              name={workspace.name}
69
              isActive={workspace.is_active}
70
              isArchived={workspace.isArchived}
71
            />
72
            <Cell alignment="end">
73
              <TableActionsWorkspaces
74
                activeWorkspaceName={activeWorkspaceName}
75
                workspace={workspace}
76
              />
77
            </Cell>
78
          </Row>
79
        ))}
80
      </TableBody>
81
    </Table>
82
  );
83
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc