mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 01:28:35 +02:00
Fix up export dialog
This commit is contained in:
@@ -84,63 +84,70 @@ function ExportDataDialogContent({
|
|||||||
const numSelected = Object.values(selectedWorkspaces).filter(Boolean).length;
|
const numSelected = Object.values(selectedWorkspaces).filter(Boolean).length;
|
||||||
const noneSelected = numSelected === 0;
|
const noneSelected = numSelected === 0;
|
||||||
return (
|
return (
|
||||||
<VStack space={3} className="w-full mb-3 px-4">
|
<div className="w-full grid grid-rows-[minmax(0,1fr)_auto]">
|
||||||
<table className="w-full mb-auto min-w-full max-w-full divide-y divide-surface-highlight">
|
<VStack space={3} className="overflow-auto px-5 pb-6">
|
||||||
<thead>
|
<table className="w-full mb-auto min-w-full max-w-full divide-y divide-surface-highlight">
|
||||||
<tr>
|
<thead>
|
||||||
<th className="w-6 min-w-0 py-2 text-left pl-1">
|
<tr>
|
||||||
<Checkbox
|
<th className="w-6 min-w-0 py-2 text-left pl-1">
|
||||||
checked={!allSelected && !noneSelected ? 'indeterminate' : allSelected}
|
|
||||||
hideLabel
|
|
||||||
title="All workspaces"
|
|
||||||
onChange={handleToggleAll}
|
|
||||||
/>
|
|
||||||
</th>
|
|
||||||
<th className="py-2 text-left pl-4" onClick={handleToggleAll}>
|
|
||||||
Workspace
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody className="divide-y divide-surface-highlight">
|
|
||||||
{workspaces.map((w) => (
|
|
||||||
<tr key={w.id}>
|
|
||||||
<td className="min-w-0 py-1 pl-1">
|
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={selectedWorkspaces[w.id] ?? false}
|
checked={!allSelected && !noneSelected ? 'indeterminate' : allSelected}
|
||||||
title={w.name}
|
|
||||||
hideLabel
|
hideLabel
|
||||||
onChange={() =>
|
title="All workspaces"
|
||||||
|
onChange={handleToggleAll}
|
||||||
|
/>
|
||||||
|
</th>
|
||||||
|
<th className="py-2 text-left pl-4" onClick={handleToggleAll}>
|
||||||
|
Workspace
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-surface-highlight">
|
||||||
|
{workspaces.map((w) => (
|
||||||
|
<tr key={w.id}>
|
||||||
|
<td className="min-w-0 py-1 pl-1">
|
||||||
|
<Checkbox
|
||||||
|
checked={selectedWorkspaces[w.id] ?? false}
|
||||||
|
title={w.name}
|
||||||
|
hideLabel
|
||||||
|
onChange={() =>
|
||||||
|
setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
className="py-1 pl-4 text whitespace-nowrap overflow-x-auto hide-scrollbars"
|
||||||
|
onClick={() =>
|
||||||
setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))
|
setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))
|
||||||
}
|
}
|
||||||
/>
|
>
|
||||||
</td>
|
{w.name} {w.id === activeWorkspace.id ? '(current workspace)' : ''}
|
||||||
<td
|
</td>
|
||||||
className="py-1 pl-4 text whitespace-nowrap overflow-x-auto hide-scrollbars"
|
</tr>
|
||||||
onClick={() => setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))}
|
))}
|
||||||
>
|
</tbody>
|
||||||
{w.name} {w.id === activeWorkspace.id ? '(current workspace)' : ''}
|
</table>
|
||||||
</td>
|
<DetailsBanner color="secondary" open summary="Extra Settings">
|
||||||
</tr>
|
<Checkbox
|
||||||
))}
|
checked={includePrivateEnvironments}
|
||||||
</tbody>
|
onChange={setIncludePrivateEnvironments}
|
||||||
</table>
|
title="Include private environments"
|
||||||
<DetailsBanner color="secondary" open summary="Extra Settings">
|
help='Environments marked as "sharable" will be exported by default'
|
||||||
<Checkbox
|
/>
|
||||||
checked={includePrivateEnvironments}
|
</DetailsBanner>
|
||||||
onChange={setIncludePrivateEnvironments}
|
</VStack>
|
||||||
title="Include private environments"
|
<footer className="px-5 grid grid-cols-[1fr_auto] items-center bg-surface-highlight py-2 border-t border-border-subtle">
|
||||||
help='Environments marked as "sharable" will be exported by default'
|
|
||||||
/>
|
|
||||||
</DetailsBanner>
|
|
||||||
<div className="grid grid-cols-[1fr_auto] items-center mt-6 pb-1.5">
|
|
||||||
<div>
|
<div>
|
||||||
<Link href="https://yaak.app/button/new" noUnderline className="text-text-subtle">Create Run Button</Link>
|
<Link href="https://yaak.app/button/new" noUnderline className="text-text-subtle">
|
||||||
|
Create Run Button
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<HStack space={2} justifyContent="end">
|
<HStack space={2} justifyContent="end">
|
||||||
<Button className="focus" variant="border" onClick={onHide}>
|
<Button size="sm" className="focus" variant="border" onClick={onHide}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
size="sm"
|
||||||
type="submit"
|
type="submit"
|
||||||
className="focus"
|
className="focus"
|
||||||
color="primary"
|
color="primary"
|
||||||
@@ -151,7 +158,7 @@ function ExportDataDialogContent({
|
|||||||
{pluralizeCount('Workspace', numSelected, { omitSingle: true, noneWord: 'Nothing' })}
|
{pluralizeCount('Workspace', numSelected, { omitSingle: true, noneWord: 'Nothing' })}
|
||||||
</Button>
|
</Button>
|
||||||
</HStack>
|
</HStack>
|
||||||
</div>
|
</footer>
|
||||||
</VStack>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,12 @@ export function DetailsBanner({ className, color, summary, children, ...extraPro
|
|||||||
'w-0 h-0 border-t-[0.3em] border-b-[0.3em] border-l-[0.5em] border-r-0',
|
'w-0 h-0 border-t-[0.3em] border-b-[0.3em] border-l-[0.5em] border-r-0',
|
||||||
'border-t-transparent border-b-transparent border-l-text-subtle',
|
'border-t-transparent border-b-transparent border-l-text-subtle',
|
||||||
)}
|
)}
|
||||||
></div>
|
/>
|
||||||
{summary}
|
{summary}
|
||||||
</summary>
|
</summary>
|
||||||
|
<div className="mt-1.5">
|
||||||
{children}
|
{children}
|
||||||
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</Banner>
|
</Banner>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user