Skip to content

Commit aa10c44

Browse files
authored
Add Bruno imports and a file-tree importer API (#706)
1 parent 46464cf commit aa10c44

109 files changed

Lines changed: 4685 additions & 880 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.oxfmtrc.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"ignorePatterns": [
44
"**/bindings/**",
55
"crates/yaak-templates/pkg/**",
6-
"apps/yaak-client/routeTree.gen.ts"
6+
"apps/yaak-client/routeTree.gen.ts",
7+
"plugins/importer-bruno/tests/fixtures/upstream/**"
78
]
89
}

‎apps/yaak-client/components/CloneGitRepositoryDialog.tsx‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { gitClone } from "@yaakapp-internal/git";
22
import { Banner, VStack } from "@yaakapp-internal/ui";
3-
import { useState } from "react";
3+
import { useId, useState } from "react";
44
import { openWorkspaceFromSyncDir } from "../commands/openWorkspaceFromSyncDir";
55
import { appInfo } from "../lib/appInfo";
66
import { CommercialUseBanner } from "./CommercialUseBanner";
77
import { showErrorToast } from "../lib/toast";
8-
import { Button } from "./core/Button";
98
import { Checkbox } from "./core/Checkbox";
9+
import { DialogFooter } from "./core/Dialog";
1010
import { IconButton } from "./core/IconButton";
1111
import { PlainInput } from "./core/PlainInput";
1212
import { promptCredentials } from "./git/credentials";
@@ -29,6 +29,7 @@ export function CloneGitRepositoryDialog({ hide }: Props) {
2929
const [subdirectory, setSubdirectory] = useState<string>("");
3030
const [isCloning, setIsCloning] = useState(false);
3131
const [error, setError] = useState<string | null>(null);
32+
const formId = useId();
3233

3334
const repoName = extractRepoName(url);
3435
const sep = getPathSeparator(baseDirectory);
@@ -83,7 +84,7 @@ export function CloneGitRepositoryDialog({ hide }: Props) {
8384
};
8485

8586
return (
86-
<VStack as="form" space={3} alignItems="start" className="pb-3" onSubmit={handleClone}>
87+
<VStack as="form" id={formId} space={3} alignItems="start" onSubmit={handleClone}>
8788
{error && (
8889
<Banner color="danger" className="w-full">
8990
{error}
@@ -132,15 +133,17 @@ export function CloneGitRepositoryDialog({ hide }: Props) {
132133
/>
133134
)}
134135

135-
<Button
136-
type="submit"
137-
color="primary"
138-
className="w-full mt-3"
139-
disabled={!url || !directory || isCloning}
140-
isLoading={isCloning}
141-
>
142-
{isCloning ? "Cloning..." : "Clone Repository"}
143-
</Button>
136+
<DialogFooter
137+
actions={[
138+
{
139+
label: isCloning ? "Cloning..." : "Clone Repository",
140+
color: "primary",
141+
form: formId,
142+
disabled: !url || !directory || isCloning,
143+
isLoading: isCloning,
144+
},
145+
]}
146+
/>
144147
</VStack>
145148
);
146149
}

‎apps/yaak-client/components/CreateEnvironmentDialog.tsx‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { createWorkspaceModel } from "@yaakapp-internal/models";
2-
import { useState } from "react";
2+
import { useId, useState } from "react";
33
import { useToggle } from "../hooks/useToggle";
44
import { ColorIndicator } from "./ColorIndicator";
5-
import { Button } from "./core/Button";
65
import { Checkbox } from "./core/Checkbox";
76
import { ColorPickerWithThemeColors } from "./core/ColorPicker";
7+
import { DialogFooter } from "./core/Dialog";
88
import { Label } from "./core/Label";
99
import { PlainInput } from "./core/PlainInput";
1010

@@ -18,9 +18,11 @@ export function CreateEnvironmentDialog({ workspaceId, hide, onCreate }: Props)
1818
const [name, setName] = useState<string>("");
1919
const [color, setColor] = useState<string | null>(null);
2020
const [sharable, toggleSharable] = useToggle(false);
21+
const formId = useId();
2122
return (
2223
<form
23-
className="pb-3 flex flex-col gap-3"
24+
id={formId}
25+
className="flex flex-col gap-3"
2426
onSubmit={async (e) => {
2527
e.preventDefault();
2628
const id = await createWorkspaceModel({
@@ -59,10 +61,17 @@ export function CreateEnvironmentDialog({ workspaceId, hide, onCreate }: Props)
5961
</Label>
6062
<ColorPickerWithThemeColors onChange={setColor} color={color} />
6163
</div>
62-
<Button type="submit" color="secondary" className="mt-3">
63-
{color != null && <ColorIndicator color={color} />}
64-
Create Environment
65-
</Button>
64+
<DialogFooter
65+
inline
66+
actions={[
67+
{
68+
label: "Create Environment",
69+
color: "secondary",
70+
form: formId,
71+
leftSlot: color != null ? <ColorIndicator color={color} /> : undefined,
72+
},
73+
]}
74+
/>
6675
</form>
6776
);
6877
}

‎apps/yaak-client/components/CreateWorkspaceDialog.tsx‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { gitMutations } from "@yaakapp-internal/git";
22
import type { WorkspaceMeta } from "@yaakapp-internal/models";
33
import { createGlobalModel, updateModel } from "@yaakapp-internal/models";
44
import { VStack } from "@yaakapp-internal/ui";
5-
import { useState } from "react";
5+
import { useId, useState } from "react";
66
import { router } from "../lib/router";
77
import { setupOrConfigureEncryption } from "../lib/setupOrConfigureEncryption";
88
import { rpc } from "../lib/rpc";
99
import { showErrorToast } from "../lib/toast";
10-
import { Button } from "./core/Button";
1110
import { Checkbox } from "./core/Checkbox";
11+
import { DialogFooter } from "./core/Dialog";
1212
import { Label } from "./core/Label";
1313
import { PlainInput } from "./core/PlainInput";
1414
import { EncryptionHelp } from "./EncryptionHelp";
@@ -26,12 +26,13 @@ export function CreateWorkspaceDialog({ hide }: Props) {
2626
initGit?: boolean;
2727
}>({ filePath: null, initGit: false });
2828
const [setupEncryption, setSetupEncryption] = useState<boolean>(false);
29+
const formId = useId();
2930
return (
3031
<VStack
3132
as="form"
33+
id={formId}
3234
space={3}
3335
alignItems="start"
34-
className="pb-3"
3536
onSubmit={async (e) => {
3637
e.preventDefault();
3738
const workspaceId = await createGlobalModel({ model: "workspace", name });
@@ -89,9 +90,7 @@ export function CreateWorkspaceDialog({ hide }: Props) {
8990
title="Enable Encryption"
9091
/>
9192
</div>
92-
<Button type="submit" color="primary" className="w-full mt-3">
93-
Create Workspace
94-
</Button>
93+
<DialogFooter actions={[{ label: "Create Workspace", color: "primary", form: formId }]} />
9594
</VStack>
9695
);
9796
}

‎apps/yaak-client/components/ExportDataDialog.tsx‎

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import type { Workspace } from "@yaakapp-internal/models";
22
import { workspacesAtom } from "@yaakapp-internal/models";
3-
import { HStack, VStack } from "@yaakapp-internal/ui";
3+
import { VStack } from "@yaakapp-internal/ui";
44
import { useAtomValue } from "jotai";
55
import { useCallback, useMemo, useState } from "react";
66
import slugify from "slugify";
77
import { activeWorkspaceAtom } from "../hooks/useActiveWorkspace";
88
import { pluralizeCount } from "../lib/pluralize";
99
import { rpc } from "../lib/rpc";
1010
import { CommercialUseBanner } from "./CommercialUseBanner";
11-
import { Button } from "./core/Button";
1211
import { Checkbox } from "./core/Checkbox";
1312
import { DetailsBanner } from "./core/DetailsBanner";
13+
import { DialogFooter } from "./core/Dialog";
1414
import { Link } from "./core/Link";
1515
import { platform } from "@yaakapp-internal/platform";
1616

@@ -87,8 +87,8 @@ function ExportDataDialogContent({
8787
const numSelected = Object.values(selectedWorkspaces).filter(Boolean).length;
8888
const noneSelected = numSelected === 0;
8989
return (
90-
<div className="h-full w-full grid grid-rows-[minmax(0,1fr)_auto] overflow-hidden rounded-b-lg">
91-
<VStack space={3} className="overflow-auto px-5 pb-6">
90+
<>
91+
<VStack space={3} className="pb-4">
9292
<CommercialUseBanner source="data-export" title="Exporting work data?" />
9393

9494
<table className="w-full mb-auto min-w-full max-w-full divide-y divide-surface-highlight">
@@ -141,29 +141,22 @@ function ExportDataDialogContent({
141141
/>
142142
</DetailsBanner>
143143
</VStack>
144-
<footer className="px-5 grid grid-cols-[1fr_auto] items-center bg-surface py-3 border-t border-border-subtle">
145-
<div>
144+
<DialogFooter
145+
leftSlot={
146146
<Link href="https://yaak.app/button/new" noUnderline className="text-text-subtlest">
147147
Create Run Button
148148
</Link>
149-
</div>
150-
<HStack space={2} justifyContent="end">
151-
<Button size="sm" className="focus" variant="border" onClick={onHide}>
152-
Cancel
153-
</Button>
154-
<Button
155-
size="sm"
156-
type="submit"
157-
className="focus"
158-
color="primary"
159-
disabled={noneSelected}
160-
onClick={() => handleExport()}
161-
>
162-
Export{" "}
163-
{pluralizeCount("Workspace", numSelected, { omitSingle: true, noneWord: "Nothing" })}
164-
</Button>
165-
</HStack>
166-
</footer>
167-
</div>
149+
}
150+
actions={[
151+
{ label: "Cancel", onClick: onHide },
152+
{
153+
label: `Export ${pluralizeCount("Workspace", numSelected, { omitSingle: true, noneWord: "Nothing" })}`,
154+
color: "primary",
155+
disabled: noneSelected,
156+
onClick: () => handleExport(),
157+
},
158+
]}
159+
/>
160+
</>
168161
);
169162
}

‎apps/yaak-client/components/GrpcEditor.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export function GrpcEditor({
239239
showDialog({
240240
title: "Configure Schema",
241241
size: "md",
242+
className: "h-[30rem]",
242243
id: "grpc-configure-schema",
243244
render: ({ hide }) => <GrpcProtoSelectionDialog onDone={hide} />,
244245
});

0 commit comments

Comments
 (0)