mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 00:01:22 +02:00
Run oxfmt across repo, add format script and docs
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
import type { BatchUpsertResult } from '@yaakapp-internal/models';
|
||||
import { Button } from '../components/core/Button';
|
||||
import { FormattedError } from '../components/core/FormattedError';
|
||||
import { VStack } from '../components/core/Stacks';
|
||||
import { ImportDataDialog } from '../components/ImportDataDialog';
|
||||
import { activeWorkspaceAtom } from '../hooks/useActiveWorkspace';
|
||||
import { createFastMutation } from '../hooks/useFastMutation';
|
||||
import { showAlert } from './alert';
|
||||
import { showDialog } from './dialog';
|
||||
import { jotaiStore } from './jotai';
|
||||
import { pluralizeCount } from './pluralize';
|
||||
import { router } from './router';
|
||||
import { invokeCmd } from './tauri';
|
||||
import type { BatchUpsertResult } from "@yaakapp-internal/models";
|
||||
import { Button } from "../components/core/Button";
|
||||
import { FormattedError } from "../components/core/FormattedError";
|
||||
import { VStack } from "../components/core/Stacks";
|
||||
import { ImportDataDialog } from "../components/ImportDataDialog";
|
||||
import { activeWorkspaceAtom } from "../hooks/useActiveWorkspace";
|
||||
import { createFastMutation } from "../hooks/useFastMutation";
|
||||
import { showAlert } from "./alert";
|
||||
import { showDialog } from "./dialog";
|
||||
import { jotaiStore } from "./jotai";
|
||||
import { pluralizeCount } from "./pluralize";
|
||||
import { router } from "./router";
|
||||
import { invokeCmd } from "./tauri";
|
||||
|
||||
export const importData = createFastMutation({
|
||||
mutationKey: ['import_data'],
|
||||
mutationKey: ["import_data"],
|
||||
onError: (err: string) => {
|
||||
showAlert({
|
||||
id: 'import-failed',
|
||||
title: 'Import Failed',
|
||||
size: 'md',
|
||||
id: "import-failed",
|
||||
title: "Import Failed",
|
||||
size: "md",
|
||||
body: <FormattedError>{err}</FormattedError>,
|
||||
});
|
||||
},
|
||||
mutationFn: async () => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
showDialog({
|
||||
id: 'import',
|
||||
title: 'Import Data',
|
||||
size: 'sm',
|
||||
id: "import",
|
||||
title: "Import Data",
|
||||
size: "sm",
|
||||
render: ({ hide }) => {
|
||||
const importAndHide = async (filePath: string) => {
|
||||
try {
|
||||
@@ -51,7 +51,7 @@ export const importData = createFastMutation({
|
||||
|
||||
async function performImport(filePath: string): Promise<boolean> {
|
||||
const activeWorkspace = jotaiStore.get(activeWorkspaceAtom);
|
||||
const imported = await invokeCmd<BatchUpsertResult>('cmd_import_data', {
|
||||
const imported = await invokeCmd<BatchUpsertResult>("cmd_import_data", {
|
||||
filePath,
|
||||
workspaceId: activeWorkspace?.id,
|
||||
});
|
||||
@@ -59,31 +59,31 @@ async function performImport(filePath: string): Promise<boolean> {
|
||||
const importedWorkspace = imported.workspaces[0];
|
||||
|
||||
showDialog({
|
||||
id: 'import-complete',
|
||||
title: 'Import Complete',
|
||||
size: 'sm',
|
||||
id: "import-complete",
|
||||
title: "Import Complete",
|
||||
size: "sm",
|
||||
hideX: true,
|
||||
render: ({ hide }) => {
|
||||
return (
|
||||
<VStack space={3} className="pb-4">
|
||||
<ul className="list-disc pl-6">
|
||||
{imported.workspaces.length > 0 && (
|
||||
<li>{pluralizeCount('Workspace', imported.workspaces.length)}</li>
|
||||
<li>{pluralizeCount("Workspace", imported.workspaces.length)}</li>
|
||||
)}
|
||||
{imported.environments.length > 0 && (
|
||||
<li>{pluralizeCount('Environment', imported.environments.length)}</li>
|
||||
<li>{pluralizeCount("Environment", imported.environments.length)}</li>
|
||||
)}
|
||||
{imported.folders.length > 0 && (
|
||||
<li>{pluralizeCount('Folder', imported.folders.length)}</li>
|
||||
<li>{pluralizeCount("Folder", imported.folders.length)}</li>
|
||||
)}
|
||||
{imported.httpRequests.length > 0 && (
|
||||
<li>{pluralizeCount('HTTP Request', imported.httpRequests.length)}</li>
|
||||
<li>{pluralizeCount("HTTP Request", imported.httpRequests.length)}</li>
|
||||
)}
|
||||
{imported.grpcRequests.length > 0 && (
|
||||
<li>{pluralizeCount('GRPC Request', imported.grpcRequests.length)}</li>
|
||||
<li>{pluralizeCount("GRPC Request", imported.grpcRequests.length)}</li>
|
||||
)}
|
||||
{imported.websocketRequests.length > 0 && (
|
||||
<li>{pluralizeCount('Websocket Request', imported.websocketRequests.length)}</li>
|
||||
<li>{pluralizeCount("Websocket Request", imported.websocketRequests.length)}</li>
|
||||
)}
|
||||
</ul>
|
||||
<div>
|
||||
@@ -99,7 +99,7 @@ async function performImport(filePath: string): Promise<boolean> {
|
||||
if (importedWorkspace != null) {
|
||||
const environmentId = imported.environments[0]?.id ?? null;
|
||||
await router.navigate({
|
||||
to: '/workspaces/$workspaceId',
|
||||
to: "/workspaces/$workspaceId",
|
||||
params: { workspaceId: importedWorkspace.id },
|
||||
search: { environment_id: environmentId },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user