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

stacklok / codegate-ui / 13808282424

12 Mar 2025 09:43AM UTC coverage: 66.452% (+0.1%) from 66.347%
13808282424

Pull #379

github

web-flow
Merge d1ad42c49 into 0fb0ba74f
Pull Request #379: feat: shareable workspaces MVP (frontend)

428 of 707 branches covered (60.54%)

Branch coverage included in aggregate %.

36 of 72 new or added lines in 14 files covered. (50.0%)

1 existing line in 1 file now uncovered.

913 of 1311 relevant lines covered (69.64%)

40.19 hits per line

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

18.75
/src/features/workspace/components/workspace-download-button.tsx
1
import { Button } from '@stacklok/ui-kit'
2
import { Download01 } from '@untitled-ui/icons-react'
3
import { useQueryGetWorkspaceByName } from '../hooks/use-query-get-workspace-by-name'
4

5
interface WorkspaceDownloadButtonProps {
6
  workspaceName: string
7
}
8

9
export const WorkspaceDownloadButton = ({
3✔
10
  workspaceName,
11
}: WorkspaceDownloadButtonProps) => {
12
  const { data: workspace, isLoading } = useQueryGetWorkspaceByName({
13✔
13
    path: {
14
      workspace_name: workspaceName,
15
    },
16
  })
17

18
  const handleDownload = () => {
13✔
NEW
19
    if (!workspace) return
×
20

NEW
21
    const jsonString = JSON.stringify(workspace, null, 2)
×
NEW
22
    const blob = new Blob([jsonString], { type: 'application/json' })
×
NEW
23
    const url = URL.createObjectURL(blob)
×
24

NEW
25
    const a = document.createElement('a')
×
NEW
26
    a.href = url
×
NEW
27
    a.download = `${workspaceName}.json`
×
NEW
28
    document.body.appendChild(a)
×
NEW
29
    a.click()
×
NEW
30
    document.body.removeChild(a)
×
NEW
31
    URL.revokeObjectURL(url)
×
32
  }
33

34
  return (
35
    <Button
36
      isIcon
37
      variant="secondary"
38
      onPress={handleDownload}
39
      isPending={isLoading}
40
      isDisabled={!workspace}
41
    >
42
      <Download01 />
43
    </Button>
44
  )
45
}
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