selfhost debugger support part 3 - frontend change (#3420)
This commit is contained in:
@@ -296,6 +296,7 @@ export type DebugSessionApiResponse = {
|
||||
workflow_permanent_id: string | null;
|
||||
created_at: string;
|
||||
modified_at: string;
|
||||
vnc_streaming_supported: boolean | null;
|
||||
};
|
||||
|
||||
export type WorkflowRunApiResponse = {
|
||||
|
||||
@@ -78,7 +78,6 @@ import {
|
||||
layout,
|
||||
} from "./workflowEditorUtils";
|
||||
import { useAutoPan } from "./useAutoPan";
|
||||
import { useUser } from "@/hooks/useUser";
|
||||
|
||||
const nextTick = () => new Promise((resolve) => setTimeout(resolve, 0));
|
||||
|
||||
@@ -256,14 +255,13 @@ function FlowRenderer({
|
||||
}: Props) {
|
||||
const reactFlowInstance = useReactFlow();
|
||||
const debugStore = useDebugStore();
|
||||
const user = useUser().get();
|
||||
const { title, initializeTitle } = useWorkflowTitleStore();
|
||||
// const [parameters] = useState<ParametersState>(initialParameters);
|
||||
const parameters = useWorkflowParametersStore((state) => state.parameters);
|
||||
const nodesInitialized = useNodesInitialized();
|
||||
const [shouldConstrainPan, setShouldConstrainPan] = useState(false);
|
||||
const onNodesChangeTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const flowIsConstrained = debugStore.isDebugMode && Boolean(user);
|
||||
const flowIsConstrained = debugStore.isDebugMode;
|
||||
|
||||
useEffect(() => {
|
||||
if (nodesInitialized) {
|
||||
@@ -520,10 +518,6 @@ function FlowRenderer({
|
||||
};
|
||||
|
||||
useOnChange(debugStore.isDebugMode, (newValue) => {
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
const xLock = getXLock();
|
||||
|
||||
if (newValue) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AxiosError } from "axios";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useEffect, useRef, useState, useMemo } from "react";
|
||||
import { nanoid } from "nanoid";
|
||||
import {
|
||||
ChevronRightIcon,
|
||||
@@ -137,6 +137,12 @@ function Workspace({
|
||||
const blockScriptStore = useBlockScriptStore();
|
||||
const cacheKey = workflow?.cache_key ?? "";
|
||||
|
||||
const enableDebugBrowser = useMemo(() => {
|
||||
return (
|
||||
showBrowser || (activeDebugSession?.vnc_streaming_supported ?? false)
|
||||
);
|
||||
}, [showBrowser, activeDebugSession?.vnc_streaming_supported]);
|
||||
|
||||
const [cacheKeyValue, setCacheKeyValue] = useState(
|
||||
cacheKey === ""
|
||||
? ""
|
||||
@@ -699,7 +705,7 @@ function Workspace({
|
||||
</div>
|
||||
|
||||
{/* infinite canvas and sub panels when not in debug mode */}
|
||||
{!showBrowser && (
|
||||
{!enableDebugBrowser && (
|
||||
<div className="relative flex h-full w-full overflow-hidden overflow-x-hidden">
|
||||
{/* infinite canvas */}
|
||||
<FlowRenderer
|
||||
@@ -763,7 +769,7 @@ function Workspace({
|
||||
)}
|
||||
|
||||
{/* infinite canvas, sub panels, browser, and timeline when in debug mode */}
|
||||
{showBrowser && (
|
||||
{enableDebugBrowser && (
|
||||
<div className="relative flex h-full w-full overflow-hidden overflow-x-hidden">
|
||||
<Splitter
|
||||
className="splittah"
|
||||
|
||||
@@ -88,13 +88,21 @@ async def _authenticate_helper(authorization: str) -> Organization:
|
||||
|
||||
async def get_current_user_id(
|
||||
authorization: Annotated[str | None, Header(include_in_schema=False)] = None,
|
||||
x_api_key: Annotated[str | None, Header(include_in_schema=False)] = None,
|
||||
x_user_agent: Annotated[str | None, Header(include_in_schema=False)] = None,
|
||||
) -> str:
|
||||
if not authorization:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="Invalid credentials",
|
||||
)
|
||||
return await _authenticate_user_helper(authorization)
|
||||
if authorization:
|
||||
return await _authenticate_user_helper(authorization)
|
||||
|
||||
if x_api_key and x_user_agent == "skyvern-ui":
|
||||
organization = await _get_current_org_cached(x_api_key, app.DATABASE)
|
||||
if organization:
|
||||
return f"{organization.organization_id}_user"
|
||||
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="Invalid credentials",
|
||||
)
|
||||
|
||||
|
||||
async def get_current_user_id_with_authentication(
|
||||
|
||||
Reference in New Issue
Block a user