Skip to content

Commit 9913ab6

Browse files
Merge pull request #8 from actiontech/fix/audit-rule-execution-failed-message
Fix/audit rule execution failed message
2 parents 7a21419 + e30b4df commit 9913ab6

7 files changed

Lines changed: 19 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface IErrorDetailsHook {
1717
name?: string;
1818
message?: string;
1919
error: Error | null;
20+
executionFailedMessage?: string;
2021
details?: DetailsError;
2122
hasDetails: boolean;
2223
isOpen: boolean;
@@ -50,6 +51,7 @@ export function useErrorDetails(error: Error | null): HookType {
5051
};
5152
const name = error?.name;
5253
const message = error?.message;
54+
const executionFailedMessage = (error as any)?.execution_failed_message as string;
5355

5456
return {
5557
name,
@@ -60,5 +62,6 @@ export function useErrorDetails(error: Error | null): HookType {
6062
isOpen,
6163
open,
6264
refresh: loadingError?.refresh,
65+
executionFailedMessage,
6366
};
6467
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default [
3535
['ui_error', 'Error'],
3636
['ui_error_message', 'Error:'],
3737
['ui_error_close', 'Close'],
38+
['ui_audit_error_tips', '审核异常'],
3839
['ui_clear', 'Clear'],
3940
['ui_remove', 'Remove'],
4041
['ui_close', 'Close'],

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default [
3030
['ui_error', 'Errore'],
3131
['ui_error_message', 'Errore:'],
3232
['ui_error_close', 'Chiudi'],
33+
['ui_audit_error_tips', '审核异常'],
3334
['ui_clear', 'Clear'],
3435
['ui_remove', 'Remove'],
3536
['ui_close', 'Chiudi'],

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default [
2929
['ui_error', 'Ошибка'],
3030
['ui_error_message', 'Ошибка:'],
3131
['ui_error_close', 'Закрыть'],
32+
['ui_audit_error_tips', '审核异常'],
3233
['ui_clear', 'Очистить'],
3334
['ui_remove', 'Убрать'],
3435
['ui_close', 'Закрыть'],

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default [
3232
['ui_error', '错误'],
3333
['ui_error_message', '错误:'],
3434
['ui_error_close', '关闭'],
35+
['ui_audit_error_tips', '审核异常'],
3536
['ui_clear', 'Clear'],
3637
['ui_remove', 'Remove'],
3738
['ui_close', '关闭'],

webapp/packages/core-sdk/src/ServerInternalError.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class ServerInternalError extends DetailsError implements ServerError {
2424
this.errorCode = error.errorCode;
2525
this.errorType = error.errorType as ServerErrorType;
2626
this.causedBy = error.causedBy;
27+
(this as any).execution_failed_message = (error as any).execution_failed_message;
2728
}
2829

2930
hasDetails(): boolean {

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ const style = css`
7070
error-message {
7171
white-space: pre-wrap;
7272
}
73+
error-sub-message {
74+
display: block;
75+
font-size: 0.9em;
76+
margin-top: 8px;
77+
}
7378
IconOrImage {
7479
width: 40px;
7580
height: 40px;
@@ -174,7 +179,12 @@ export const TableError = observer<Props>(function TableError({ model, loading,
174179
<error {...use({ animated, collapsed: !errorInfo.display, errorHidden })} className={className}>
175180
<error-body>
176181
<IconOrImage icon={icon} title={error.message} onClick={() => errorInfo.show()} />
177-
<error-message>{error.message}</error-message>
182+
<div>
183+
<error-message>{error.message}</error-message>
184+
{error.executionFailedMessage && (
185+
<error-sub-message>{`${translate('ui_audit_error_tips')}${error.executionFailedMessage}`}</error-sub-message>
186+
)}
187+
</div>
178188
</error-body>
179189
<controls>
180190
<Button type="button" mod={['outlined']} onClick={() => errorInfo.hide()}>

0 commit comments

Comments
 (0)