Skip to content

Commit cc8470c

Browse files
authored
Merge pull request #18 from actiontech/feature/sql-workflow-no-dql
Feature/sql workflow no dql
2 parents 65cd055 + 2f24007 commit cc8470c

6 files changed

Lines changed: 45 additions & 7 deletions

File tree

webapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@
5555
"vitest": "^3"
5656
},
5757
"packageManager": "yarn@4.9.2"
58-
}
58+
}

webapp/packages/core-blocks/src/useErrorDetails.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ interface IErrorDetailsHook {
2626
open: () => void;
2727
refresh?: () => void;
2828
errorCode?: string;
29+
workflowId?: string;
2930
}
3031

3132
type HookType =
@@ -54,9 +55,19 @@ export function useErrorDetails(error: IErrorDetailsHook['error']): HookType {
5455
}
5556
};
5657
const name = typeof error === 'string' ? translate('core_blocks_exception_message_error_message') : error?.name;
57-
const message = typeof error === 'string' ? error : error?.message;
58+
let message = (typeof error === 'string' ? error : error?.message) ?? undefined;
5859
const executionFailedMessage = (error as any)?.execution_failed_message as string;
5960
const errorCode = (error as any)?.errorCode as string;
61+
let workflowId: string | undefined;
62+
63+
if (typeof message === 'string') {
64+
const match = message.match(/workflow_id:(\d+)/);
65+
66+
if (match) {
67+
workflowId = match[1];
68+
message = message.replace(/workflow_id:\d+,?\s*/g, '').trim();
69+
}
70+
}
6071

6172
return {
6273
name,
@@ -69,5 +80,6 @@ export function useErrorDetails(error: IErrorDetailsHook['error']): HookType {
6980
refresh: loadingError?.refresh,
7081
executionFailedMessage,
7182
errorCode,
83+
workflowId,
7284
};
7385
}

webapp/packages/core-localization/src/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default [
1414
['ui_processing_cancel', 'Cancel'],
1515
['ui_processing_canceling', 'Cancelling...'],
1616
['ui_create_workflow', 'Create Workflow'],
17+
['ui_workflow_detail', 'Workflow Detail'],
1718
['ui_processing_canceled', 'Canceled'],
1819
['ui_processing_reload', 'Reload'],
1920
['ui_processing_retry', 'Retry'],

webapp/packages/core-localization/src/locales/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default [
1313
['ui_processing_loading', '加载中...'],
1414
['ui_processing_cancel', '取消'],
1515
['ui_create_workflow', '发起变更工单'],
16+
['ui_workflow_detail', '工单详情'],
1617
['ui_processing_canceling', '取消中...'],
1718
['ui_processing_canceled', '已取消'],
1819
['ui_processing_retry', '重试'],

webapp/packages/plugin-data-viewer/src/TableViewer/TableError.tsx

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ interface ErrorInfo {
3939
show: () => void;
4040
}
4141

42+
const WORKFLOW_EXEC_SUCCESS_ERROR_CODE = 'workflow_success';
43+
4244
export const TableError = observer<Props>(function TableError({ model, loading, className }) {
4345
const translate = useTranslate();
4446

@@ -68,7 +70,6 @@ export const TableError = observer<Props>(function TableError({ model, loading,
6870
},
6971
false,
7072
);
71-
7273
const internalServerError = errorOf(model.source.error, ServerInternalError);
7374
const error = useErrorDetails(model.source.error);
7475
const animated = useStateDelay(!!errorInfo.error && !loading, 1);
@@ -94,12 +95,22 @@ export const TableError = observer<Props>(function TableError({ model, loading,
9495
);
9596
};
9697

98+
const onWorkflowDetailNavigate = (workflowId: string) => {
99+
const [projectName] = connectionSchemaManagerService.currentConnection?.name.split(':') ?? [];
100+
101+
window.open(`/transit?from=cloudbeaver&to=workflow_detail&workflow_id=${workflowId}&project_name=${projectName}`);
102+
};
103+
97104
let icon = '/icons/error_icon.svg';
98105

99106
if (quote) {
100107
icon = '/icons/info_icon.svg';
101108
}
102109

110+
if (error.errorCode === WORKFLOW_EXEC_SUCCESS_ERROR_CODE) {
111+
icon = '/icons/success_icon.svg';
112+
}
113+
103114
let onRetry = () => model.retry();
104115

105116
if (error.refresh) {
@@ -176,6 +187,11 @@ export const TableError = observer<Props>(function TableError({ model, loading,
176187
{error.executionFailedMessage && (
177188
<div className={s(style, { errorSubMessage: true })}>{`${translate('ui_audit_error_tips')}${error.executionFailedMessage}`}</div>
178189
)}
190+
{error.workflowId && (
191+
<div className={s(style, { errorSubMessage: true })}>
192+
{translate('ui_workflow_id')}: {error.workflowId}
193+
</div>
194+
)}
179195
</div>
180196
</div>
181197
<div className={s(style, { controls: true })}>
@@ -189,12 +205,20 @@ export const TableError = observer<Props>(function TableError({ model, loading,
189205
{translate('ui_errors_details')}
190206
</Button>
191207
)}
208+
192209
<Button className={s(style, { button: true })} type="button" onClick={onRetry}>
193210
{translate('ui_processing_retry')}
194211
</Button>
195-
<Button className={s(style, { button: true })} type="button" onClick={onCreateWorkflowNavigate}>
196-
{translate('ui_create_workflow')}
197-
</Button>
212+
213+
{error.workflowId ? (
214+
<Button className={s(style, { button: true })} type="button" onClick={() => onWorkflowDetailNavigate(error.workflowId!)}>
215+
{translate('ui_workflow_detail')}
216+
</Button>
217+
) : (
218+
<Button className={s(style, { button: true })} type="button" onClick={onCreateWorkflowNavigate}>
219+
{translate('ui_create_workflow')}
220+
</Button>
221+
)}
198222
</div>
199223
</div>
200224
);

webapp/packages/product-default/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@
5555
"tailwindcss": "4.0.7",
5656
"typescript": "^5"
5757
}
58-
}
58+
}

0 commit comments

Comments
 (0)