mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-26 04:25:05 +01:00
Fixed some routing and introspection requests
This commit is contained in:
9280
package-lock.json
generated
9280
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -17,13 +17,17 @@
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "6.2.0",
|
||||
"@codemirror/commands": "^6.2.1",
|
||||
"@codemirror/lang-html": "^6.4.2",
|
||||
"@codemirror/lang-javascript": "^6.1.4",
|
||||
"@codemirror/lang-json": "^6.0.1",
|
||||
"@codemirror/lang-xml": "^6.0.2",
|
||||
"@codemirror/language": "^6.6.0",
|
||||
"@codemirror/language": "6.2.1",
|
||||
"@codemirror/lint": "6.2.1",
|
||||
"@codemirror/search": "^6.2.3",
|
||||
"@codemirror/state": "6.2.0",
|
||||
"@codemirror/view": "6.2.1",
|
||||
"@lezer/generator": "^1.2.2",
|
||||
"@lezer/highlight": "^1.1.3",
|
||||
"@lezer/lr": "^1.3.3",
|
||||
@@ -35,10 +39,9 @@
|
||||
"@tanstack/react-query-devtools": "^4.28.0",
|
||||
"@tanstack/react-query-persist-client": "^4.28.0",
|
||||
"@tauri-apps/api": "^1.5.1",
|
||||
"@vitejs/plugin-react": "^3.1.0",
|
||||
"buffer": "^6.0.3",
|
||||
"classnames": "^2.3.2",
|
||||
"cm6-graphql": "^0.0.4-canary-b30a2325.0",
|
||||
"cm6-graphql": "^0.0.10",
|
||||
"codemirror": "^6.0.1",
|
||||
"focus-trap-react": "^10.1.1",
|
||||
"format-graphql": "^1.4.0",
|
||||
@@ -56,7 +59,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
|
||||
"@tauri-apps/cli": "^1.5.4",
|
||||
"@tauri-apps/cli": "^1.5.6",
|
||||
"@types/node": "^18.7.10",
|
||||
"@types/papaparse": "^5.3.7",
|
||||
"@types/parse-color": "^1.0.1",
|
||||
@@ -66,6 +69,7 @@
|
||||
"@types/uuid": "^9.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
||||
"@typescript-eslint/parser": "^5.57.0",
|
||||
"@vitejs/plugin-react": "^3.1.0",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"eslint": "^8.34.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
|
||||
@@ -83,9 +83,13 @@ async fn actually_send_ephemeral_request(
|
||||
let environments = find_environments(&request.workspace_id, pool)
|
||||
.await
|
||||
.expect("Failed to find environments");
|
||||
let environment: models::Environment = environments.first().unwrap().clone();
|
||||
|
||||
let mut url_string = render::render(&request.url, environment.clone());
|
||||
// TODO: Use active environment
|
||||
let environment = environments.first();
|
||||
let mut url_string = match environment {
|
||||
Some(e) => render::render(&request.url, e.clone()),
|
||||
None => request.url.to_string(),
|
||||
};
|
||||
|
||||
if !url_string.starts_with("http://") && !url_string.starts_with("https://") {
|
||||
url_string = format!("http://{}", url_string);
|
||||
|
||||
@@ -4,8 +4,8 @@ use crate::models::Environment;
|
||||
|
||||
pub fn render(template: &str, environment: Environment) -> String {
|
||||
let variables = environment.data;
|
||||
let re = Regex::new(r"\$\{\[\s*([^]\s]+)\s*]}").expect("Failed to create regex");
|
||||
let rendered = re
|
||||
Regex::new(r"\$\{\[\s*([^]\s]+)\s*]}")
|
||||
.expect("Failed to create regex")
|
||||
.replace(template, |caps: &tauri::regex::Captures| {
|
||||
let key = caps.get(1).unwrap().as_str();
|
||||
match variables.get(key) {
|
||||
@@ -19,7 +19,5 @@ pub fn render(template: &str, environment: Environment) -> String {
|
||||
None => "".to_string(),
|
||||
}
|
||||
})
|
||||
.to_string();
|
||||
|
||||
rendered
|
||||
.to_string()
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ function WorkspaceOrRedirect() {
|
||||
const request = requests.find((r) => r.id === recentRequests[0]);
|
||||
const routes = useAppRoutes();
|
||||
|
||||
if (request === undefined || environmentId === null) {
|
||||
if (request === undefined) {
|
||||
return <Workspace />;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ function WorkspaceOrRedirect() {
|
||||
<Navigate
|
||||
to={routes.paths.request({
|
||||
workspaceId: request.workspaceId,
|
||||
environmentId,
|
||||
environmentId: environmentId ?? undefined,
|
||||
requestId: request.id,
|
||||
})}
|
||||
/>
|
||||
|
||||
@@ -57,7 +57,6 @@ export const DialogProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
function DialogInstance({ id, render, ...props }: DialogEntry) {
|
||||
const { actions } = useContext(DialogContext);
|
||||
const children = render({ hide: () => actions.hide(id) });
|
||||
console.log("ACITEV WORKSPAXCE ID 2", useActiveWorkspaceId());
|
||||
return (
|
||||
<Dialog open onClose={() => actions.hide(id)} {...props}>
|
||||
{children}
|
||||
|
||||
@@ -21,7 +21,9 @@ type Props = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({ className }: Props) {
|
||||
export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
className,
|
||||
}: Props) {
|
||||
const workspaces = useWorkspaces();
|
||||
const activeWorkspace = useActiveWorkspace();
|
||||
const activeWorkspaceId = activeWorkspace?.id ?? null;
|
||||
@@ -55,7 +57,10 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
color="gray"
|
||||
onClick={() => {
|
||||
hide();
|
||||
routes.navigate('workspace', { workspaceId: w.id, environmentId });
|
||||
routes.navigate('workspace', {
|
||||
workspaceId: w.id,
|
||||
environmentId: environmentId ?? undefined,
|
||||
});
|
||||
}}
|
||||
>
|
||||
This Window
|
||||
@@ -68,7 +73,10 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
onClick={async () => {
|
||||
hide();
|
||||
await invoke('new_window', {
|
||||
url: routes.paths.workspace({ workspaceId: w.id, environmentId }),
|
||||
url: routes.paths.workspace({
|
||||
workspaceId: w.id,
|
||||
environmentId: environmentId ?? undefined,
|
||||
}),
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -85,12 +93,12 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
workspaces.length <= 1
|
||||
? []
|
||||
: [
|
||||
...workspaceItems,
|
||||
{
|
||||
type: 'separator',
|
||||
label: activeWorkspace?.name,
|
||||
},
|
||||
];
|
||||
...workspaceItems,
|
||||
{
|
||||
type: 'separator',
|
||||
label: activeWorkspace?.name,
|
||||
},
|
||||
];
|
||||
|
||||
return [
|
||||
...activeWorkspaceItems,
|
||||
@@ -138,14 +146,15 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
},
|
||||
];
|
||||
}, [
|
||||
workspaces,
|
||||
activeWorkspace?.name,
|
||||
createWorkspace,
|
||||
deleteWorkspace.mutate,
|
||||
dialog,
|
||||
routes,
|
||||
environmentId,
|
||||
prompt,
|
||||
routes,
|
||||
updateWorkspace,
|
||||
createWorkspace,
|
||||
workspaces,
|
||||
]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Environment } from '../lib/models';
|
||||
|
||||
export type RouteParamsWorkspace = {
|
||||
workspaceId: string;
|
||||
environmentId: string | null;
|
||||
environmentId?: string;
|
||||
};
|
||||
|
||||
export type RouteParamsRequest = RouteParamsWorkspace & {
|
||||
@@ -55,7 +55,7 @@ export function useAppRoutes() {
|
||||
this.navigate('request', {
|
||||
workspaceId,
|
||||
environmentId: environmentId ?? null,
|
||||
requestId: requestId,
|
||||
requestId,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user