Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
"vitest": "^3"
},
"packageManager": "[email protected]"
}
}
14 changes: 13 additions & 1 deletion webapp/packages/core-blocks/src/useErrorDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { DetailsError } from '@cloudbeaver/core-sdk';
import { errorOf, LoadingError } from '@cloudbeaver/core-utils';

import { ErrorDetailsDialog } from './ErrorDetailsDialog/ErrorDetailsDialog.js';

Check failure on line 15 in webapp/packages/core-blocks/src/useErrorDetails.ts

View workflow job for this annotation

GitHub Actions / Frontend / Lint

Don't import/export .tsx files from .ts files directly, use React.lazy()
import { useTranslate } from './localization/useTranslate.js';

interface IErrorDetailsHook {
Expand All @@ -26,6 +26,7 @@
open: () => void;
refresh?: () => void;
errorCode?: string;
workflowId?: string;
}

type HookType =
Expand Down Expand Up @@ -54,9 +55,19 @@
}
};
const name = typeof error === 'string' ? translate('core_blocks_exception_message_error_message') : error?.name;
const message = typeof error === 'string' ? error : error?.message;
let message = (typeof error === 'string' ? error : error?.message) ?? undefined;
const executionFailedMessage = (error as any)?.execution_failed_message as string;
const errorCode = (error as any)?.errorCode as string;
let workflowId: string | undefined;

if (typeof message === 'string') {
const match = message.match(/workflow_id:(\d+)/);

if (match) {
workflowId = match[1];
message = message.replace(/workflow_id:\d+,?\s*/g, '').trim();
}
}

return {
name,
Expand All @@ -69,5 +80,6 @@
refresh: loadingError?.refresh,
executionFailedMessage,
errorCode,
workflowId,
};
}
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default [
['ui_processing_cancel', 'Cancel'],
['ui_processing_canceling', 'Cancelling...'],
['ui_create_workflow', 'Create Workflow'],
['ui_workflow_detail', 'Workflow Detail'],
['ui_processing_canceled', 'Canceled'],
['ui_processing_reload', 'Reload'],
['ui_processing_retry', 'Retry'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default [
['ui_processing_loading', '加载中...'],
['ui_processing_cancel', '取消'],
['ui_create_workflow', '发起变更工单'],
['ui_workflow_detail', '工单详情'],
['ui_processing_canceling', '取消中...'],
['ui_processing_canceled', '已取消'],
['ui_processing_retry', '重试'],
Expand Down
32 changes: 28 additions & 4 deletions webapp/packages/plugin-data-viewer/src/TableViewer/TableError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ interface ErrorInfo {
show: () => void;
}

const WORKFLOW_EXEC_SUCCESS_ERROR_CODE = 'workflow_success';

export const TableError = observer<Props>(function TableError({ model, loading, className }) {
const translate = useTranslate();

Expand Down Expand Up @@ -68,7 +70,6 @@ export const TableError = observer<Props>(function TableError({ model, loading,
},
false,
);

const internalServerError = errorOf(model.source.error, ServerInternalError);
const error = useErrorDetails(model.source.error);
const animated = useStateDelay(!!errorInfo.error && !loading, 1);
Expand All @@ -94,12 +95,22 @@ export const TableError = observer<Props>(function TableError({ model, loading,
);
};

const onWorkflowDetailNavigate = (workflowId: string) => {
const [projectName] = connectionSchemaManagerService.currentConnection?.name.split(':') ?? [];

window.open(`/transit?from=cloudbeaver&to=workflow_detail&workflow_id=${workflowId}&project_name=${projectName}`);
};

let icon = '/icons/error_icon.svg';

if (quote) {
icon = '/icons/info_icon.svg';
}

if (error.errorCode === WORKFLOW_EXEC_SUCCESS_ERROR_CODE) {
icon = '/icons/success_icon.svg';
}

let onRetry = () => model.retry();

if (error.refresh) {
Expand Down Expand Up @@ -176,6 +187,11 @@ export const TableError = observer<Props>(function TableError({ model, loading,
{error.executionFailedMessage && (
<div className={s(style, { errorSubMessage: true })}>{`${translate('ui_audit_error_tips')}:${error.executionFailedMessage}`}</div>
)}
{error.workflowId && (
<div className={s(style, { errorSubMessage: true })}>
{translate('ui_workflow_id')}: {error.workflowId}
</div>
)}
</div>
</div>
<div className={s(style, { controls: true })}>
Expand All @@ -189,12 +205,20 @@ export const TableError = observer<Props>(function TableError({ model, loading,
{translate('ui_errors_details')}
</Button>
)}

<Button className={s(style, { button: true })} type="button" onClick={onRetry}>
{translate('ui_processing_retry')}
</Button>
<Button className={s(style, { button: true })} type="button" onClick={onCreateWorkflowNavigate}>
{translate('ui_create_workflow')}
</Button>

{error.workflowId ? (
<Button className={s(style, { button: true })} type="button" onClick={() => onWorkflowDetailNavigate(error.workflowId!)}>
{translate('ui_workflow_detail')}
</Button>
) : (
<Button className={s(style, { button: true })} type="button" onClick={onCreateWorkflowNavigate}>
{translate('ui_create_workflow')}
</Button>
)}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/product-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
"tailwindcss": "4.0.7",
"typescript": "^5"
}
}
}
Loading