Skip to content

Commit f3fc49f

Browse files
authored
Merge branch 'main' into mg/OPS-3123
2 parents 255ad5a + 5214427 commit f3fc49f

8 files changed

Lines changed: 504 additions & 146 deletions

File tree

greptile.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"skipReview": "AUTOMATIC"
3+
}

packages/react-ui/src/app/features/builder/ai-chat/step-settings-assistant-ui-chat.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { useTheme } from '@/app/common/providers/theme-provider';
2+
import { blocksHooks } from '@/app/features/blocks/lib/blocks-hook';
23
import {
34
AI_CHAT_CONTAINER_SIZES,
45
AiCliChatContainerSizeState,
56
cn,
67
StepSettingsAssistantUiChatContainer,
78
} from '@openops/components/ui';
8-
import { FlowVersion } from '@openops/shared';
9-
import { useCallback } from 'react';
9+
import { flowHelper, FlowVersion } from '@openops/shared';
10+
import { useCallback, useMemo } from 'react';
1011
import { useAiModelSelector } from '../../ai/lib/ai-model-selector-hook';
1112
import { useNetworkStatusWithWarning } from '../../ai/lib/hooks/use-network-status-with-warning';
1213
import { useStepSettingsAssistantChat } from '../assistant-ui/hooks/use-step-settings-assistant-chat';
@@ -81,6 +82,16 @@ const StepSettingsAssistantUiChat = ({
8182
const { isShowingSlowWarning, connectionError } =
8283
useNetworkStatusWithWarning(chatStatus);
8384

85+
const { step, stepIndex } = useMemo(
86+
() => flowHelper.getStepWithIndex(flowVersion, selectedStep),
87+
[flowVersion, selectedStep],
88+
);
89+
90+
const { stepMetadata } = blocksHooks.useStepMetadata({
91+
step: step,
92+
enabled: !!step,
93+
});
94+
8495
return (
8596
<StepSettingsAssistantUiChatContainer
8697
parentHeight={middlePanelSize.height}
@@ -107,6 +118,10 @@ const StepSettingsAssistantUiChat = ({
107118
})}
108119
isShowingSlowWarning={isShowingSlowWarning}
109120
connectionError={connectionError}
121+
stepLogoUrl={stepMetadata?.logoUrl}
122+
stepDisplayName={step?.displayName}
123+
stepIndex={stepIndex}
124+
blockDisplayName={stepMetadata?.displayName}
110125
></StepSettingsAssistantUiChatContainer>
111126
);
112127
};

packages/react-ui/src/app/features/navigation/layout/global-layout.tsx

Lines changed: 75 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
import { useCallback, useEffect, useState } from 'react';
88
import { Outlet, useLocation } from 'react-router-dom';
99

10+
import { OpsErrorBoundary } from '@/app/common/error-boundaries/ops-error-boundary';
1011
import { AllowOnlyLoggedInUserOnlyGuard } from '@/app/common/guards/allow-logged-in-user-only-guard';
1112
import { FronteggAuthGuard } from '@/app/common/guards/frontegg-auth-guard';
1213
import { useResizablePanelGroup } from '@/app/common/hooks/use-resizable-panel-group';
@@ -103,78 +104,80 @@ export function GlobalLayout() {
103104
}
104105

105106
return (
106-
<FronteggAuthGuard>
107-
<AllowOnlyLoggedInUserOnlyGuard>
108-
<div className="h-screen w-screen overflow-hidden">
109-
<ResizablePanelGroup
110-
direction="horizontal"
111-
id="page-container"
112-
onLayout={onResize}
113-
className="h-full"
114-
>
115-
<LeftSidebarResizablePanel
116-
minSize={
117-
isMinimized
118-
? GLOBAL_SIDEBAR_MINIMIZED_WIDTH
119-
: GLOBAL_SIDEBAR_MIN_SIZE
120-
}
121-
maxSize={
122-
isMinimized
123-
? GLOBAL_SIDEBAR_MINIMIZED_WIDTH
124-
: LEFT_SIDEBAR_MAX_SIZE
125-
}
126-
collapsedSize={
127-
isMinimized
128-
? GLOBAL_SIDEBAR_MINIMIZED_WIDTH
129-
: LEFT_SIDEBAR_MIN_SIZE
130-
}
131-
isDragging={isDragging}
132-
className={cn(
133-
LEFT_SIDEBAR_MIN_EFFECTIVE_WIDTH,
134-
'shadow-sidebar z-[12]',
135-
{
136-
'min-w-[70px] max-w-[70px]': isMinimized,
137-
},
138-
{
139-
'max-w-[400px]': !isMinimized,
140-
},
141-
)}
107+
<OpsErrorBoundary>
108+
<FronteggAuthGuard>
109+
<AllowOnlyLoggedInUserOnlyGuard>
110+
<div className="h-screen w-screen overflow-hidden">
111+
<ResizablePanelGroup
112+
direction="horizontal"
113+
id="page-container"
114+
onLayout={onResize}
115+
className="h-full"
142116
>
143-
<DashboardSideMenu />
144-
</LeftSidebarResizablePanel>
145-
146-
<ResizableHandle
147-
className="bg-transparent"
148-
disabled={isMinimized}
149-
onDragging={setIsDragging}
150-
style={{
151-
width: '0px',
152-
}}
153-
/>
154-
155-
<AiChatResizablePanel onDragging={setIsDragging} />
156-
157-
<ResizablePanel
158-
id={RESIZABLE_PANEL_IDS.MAIN}
159-
order={3}
160-
className="flex-1 h-full overflow-hidden min-w-[900px] contain-layout"
161-
defaultSize={GLOBAL_MAIN_PANEL_DEFAULT_SIZE}
162-
minSize={GLOBAL_MAIN_PANEL_MIN_SIZE}
163-
>
164-
<div className="relative h-full w-full">
165-
<AiConfigurationPrompt
166-
className={cn({
167-
'bottom-[60px]':
168-
location.pathname.startsWith('/flows/') ||
169-
location.pathname.startsWith('/runs/'),
170-
})}
171-
/>
172-
<Outlet />
173-
</div>
174-
</ResizablePanel>
175-
</ResizablePanelGroup>
176-
</div>
177-
</AllowOnlyLoggedInUserOnlyGuard>
178-
</FronteggAuthGuard>
117+
<LeftSidebarResizablePanel
118+
minSize={
119+
isMinimized
120+
? GLOBAL_SIDEBAR_MINIMIZED_WIDTH
121+
: GLOBAL_SIDEBAR_MIN_SIZE
122+
}
123+
maxSize={
124+
isMinimized
125+
? GLOBAL_SIDEBAR_MINIMIZED_WIDTH
126+
: LEFT_SIDEBAR_MAX_SIZE
127+
}
128+
collapsedSize={
129+
isMinimized
130+
? GLOBAL_SIDEBAR_MINIMIZED_WIDTH
131+
: LEFT_SIDEBAR_MIN_SIZE
132+
}
133+
isDragging={isDragging}
134+
className={cn(
135+
LEFT_SIDEBAR_MIN_EFFECTIVE_WIDTH,
136+
'shadow-sidebar z-[12]',
137+
{
138+
'min-w-[70px] max-w-[70px]': isMinimized,
139+
},
140+
{
141+
'max-w-[400px]': !isMinimized,
142+
},
143+
)}
144+
>
145+
<DashboardSideMenu />
146+
</LeftSidebarResizablePanel>
147+
148+
<ResizableHandle
149+
className="bg-transparent"
150+
disabled={isMinimized}
151+
onDragging={setIsDragging}
152+
style={{
153+
width: '0px',
154+
}}
155+
/>
156+
157+
<AiChatResizablePanel onDragging={setIsDragging} />
158+
159+
<ResizablePanel
160+
id={RESIZABLE_PANEL_IDS.MAIN}
161+
order={3}
162+
className="flex-1 h-full overflow-hidden min-w-[900px] contain-layout"
163+
defaultSize={GLOBAL_MAIN_PANEL_DEFAULT_SIZE}
164+
minSize={GLOBAL_MAIN_PANEL_MIN_SIZE}
165+
>
166+
<div className="relative h-full w-full">
167+
<AiConfigurationPrompt
168+
className={cn({
169+
'bottom-[60px]':
170+
location.pathname.startsWith('/flows/') ||
171+
location.pathname.startsWith('/runs/'),
172+
})}
173+
/>
174+
<Outlet />
175+
</div>
176+
</ResizablePanel>
177+
</ResizablePanelGroup>
178+
</div>
179+
</AllowOnlyLoggedInUserOnlyGuard>
180+
</FronteggAuthGuard>
181+
</OpsErrorBoundary>
179182
);
180183
}

packages/shared/src/lib/flows/flow-helper.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,25 @@ function getStep(
336336
);
337337
}
338338

339+
function getStepWithIndex(
340+
flowVersion: FlowVersion,
341+
stepName: string,
342+
): {
343+
step: Action | TriggerWithOptionalId | undefined;
344+
stepIndex: number | undefined;
345+
} {
346+
const step = getStep(flowVersion, stepName);
347+
348+
if (!step) {
349+
return { step: undefined, stepIndex: undefined };
350+
}
351+
352+
const steps = getAllSteps(flowVersion.trigger);
353+
const stepIndex = steps.findIndex((s) => s.name === step.name) + 1;
354+
355+
return { step, stepIndex };
356+
}
357+
339358
function getSplitBranches(step: SplitActionSchema): SplitBranch[] {
340359
return step.settings?.options.map((option) => ({
341360
optionId: option.id,
@@ -1295,6 +1314,7 @@ export const flowHelper = {
12951314
},
12961315

12971316
getStep,
1317+
getStepWithIndex,
12981318
isAction,
12991319
isTrigger,
13001320
getAllSteps,

0 commit comments

Comments
 (0)