mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-23 19:15:00 +01:00
Add ability to exclude environments from data export
This commit is contained in:
@@ -420,7 +420,7 @@ export function CommandPaletteDialog({ onClose }: { onClose: () => void }) {
|
||||
<div className="h-full px-1.5 overflow-y-auto pt-2 pb-1">
|
||||
{filteredGroups.map((g) => (
|
||||
<div key={g.key} className="mb-1.5 w-full">
|
||||
<Heading size={2} className="!text-xs uppercase px-1.5 h-sm flex items-center">
|
||||
<Heading level={2} className="!text-xs uppercase px-1.5 h-sm flex items-center">
|
||||
{g.label}
|
||||
</Heading>
|
||||
{g.items.map((v) => (
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useActiveWorkspace } from '../hooks/useActiveWorkspace';
|
||||
import { useWorkspaces } from '../hooks/useWorkspaces';
|
||||
import { pluralizeCount } from '../lib/pluralize';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { Banner } from './core/Banner';
|
||||
import { Button } from './core/Button';
|
||||
import { Checkbox } from './core/Checkbox';
|
||||
import { HStack, VStack } from './core/Stacks';
|
||||
@@ -39,6 +40,7 @@ function ExportDataDialogContent({
|
||||
allWorkspaces: Workspace[];
|
||||
activeWorkspace: Workspace;
|
||||
}) {
|
||||
const [includeEnvironments, setIncludeEnvironments] = useState<boolean>(true);
|
||||
const [selectedWorkspaces, setSelectedWorkspaces] = useState<Record<string, boolean>>({
|
||||
[activeWorkspace.id]: true,
|
||||
});
|
||||
@@ -67,10 +69,14 @@ function ExportDataDialogContent({
|
||||
return;
|
||||
}
|
||||
|
||||
await invokeCmd('cmd_export_data', { workspaceIds: ids, exportPath });
|
||||
await invokeCmd('cmd_export_data', {
|
||||
workspaceIds: ids,
|
||||
exportPath,
|
||||
includeEnvironments: includeEnvironments,
|
||||
});
|
||||
onHide();
|
||||
onSuccess(exportPath);
|
||||
}, [onHide, onSuccess, selectedWorkspaces, workspaces]);
|
||||
}, [includeEnvironments, onHide, onSuccess, selectedWorkspaces, workspaces]);
|
||||
|
||||
const allSelected = workspaces.every((w) => selectedWorkspaces[w.id]);
|
||||
const numSelected = Object.values(selectedWorkspaces).filter(Boolean).length;
|
||||
@@ -117,6 +123,18 @@ function ExportDataDialogContent({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
<Banner className="!p-0">
|
||||
<details open>
|
||||
<summary className="px-3 py-2">Extra Settings</summary>
|
||||
<div className="px-3 pb-2">
|
||||
<Checkbox
|
||||
checked={includeEnvironments}
|
||||
onChange={setIncludeEnvironments}
|
||||
title="Include environments"
|
||||
/>
|
||||
</div>
|
||||
</details>
|
||||
</Banner>
|
||||
<HStack space={2} justifyContent="end">
|
||||
<Button className="focus" variant="border" onClick={onHide}>
|
||||
Cancel
|
||||
@@ -128,7 +146,8 @@ function ExportDataDialogContent({
|
||||
disabled={noneSelected}
|
||||
onClick={() => handleExport()}
|
||||
>
|
||||
Export {pluralizeCount('Workspace', numSelected, { omitSingle: true, noneWord: 'Nothing' })}
|
||||
Export{' '}
|
||||
{pluralizeCount('Workspace', numSelected, { omitSingle: true, noneWord: 'Nothing' })}
|
||||
</Button>
|
||||
</HStack>
|
||||
</VStack>
|
||||
|
||||
@@ -89,7 +89,7 @@ export function SettingsGeneral() {
|
||||
|
||||
<Separator className="my-4" />
|
||||
|
||||
<Heading size={2}>
|
||||
<Heading level={2}>
|
||||
Workspace{' '}
|
||||
<div className="inline-block ml-1 bg-surface-highlight px-2 py-0.5 rounded text text-shrink">
|
||||
{workspace.name}
|
||||
@@ -134,7 +134,7 @@ export function SettingsGeneral() {
|
||||
|
||||
<Separator className="my-4" />
|
||||
|
||||
<Heading size={2}>App Info</Heading>
|
||||
<Heading level={2}>App Info</Heading>
|
||||
<KeyValueRows>
|
||||
<KeyValueRow label="Version">{appInfo.version}</KeyValueRow>
|
||||
<KeyValueRow
|
||||
|
||||
@@ -84,7 +84,7 @@ export function Dialog({
|
||||
)}
|
||||
>
|
||||
{title ? (
|
||||
<Heading className="px-6 mt-4 mb-2" size={1} id={titleId}>
|
||||
<Heading className="px-6 mt-4 mb-2" level={1} id={titleId}>
|
||||
{title}
|
||||
</Heading>
|
||||
) : (
|
||||
|
||||
@@ -2,19 +2,19 @@ import classNames from 'classnames';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
|
||||
interface Props extends HTMLAttributes<HTMLHeadingElement> {
|
||||
size?: 1 | 2 | 3;
|
||||
level?: 1 | 2 | 3;
|
||||
}
|
||||
|
||||
export function Heading({ className, size = 1, ...props }: Props) {
|
||||
const Component = size === 1 ? 'h1' : size === 2 ? 'h2' : 'h3';
|
||||
export function Heading({ className, level = 1, ...props }: Props) {
|
||||
const Component = level === 1 ? 'h1' : level === 2 ? 'h2' : 'h3';
|
||||
return (
|
||||
<Component
|
||||
className={classNames(
|
||||
className,
|
||||
'font-semibold text',
|
||||
size === 1 && 'text-2xl',
|
||||
size === 2 && 'text-xl',
|
||||
size === 3 && 'text-lg',
|
||||
level === 1 && 'text-2xl',
|
||||
level === 2 && 'text-xl',
|
||||
level === 3 && 'text-lg',
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user