forked from actiontech/cloudbeaver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSqlEditorSessionClosedDialog.tsx
More file actions
65 lines (61 loc) · 2.12 KB
/
SqlEditorSessionClosedDialog.tsx
File metadata and controls
65 lines (61 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import {
Button,
Fill,
Translate,
CommonDialogBody,
CommonDialogHeader,
CommonDialogWrapper,
s,
CommonDialogFooter,
useS,
} from '@cloudbeaver/core-blocks';
import style from './SqlEditorSessionClosedDialog.module.css';
import type { DialogComponent } from '@cloudbeaver/core-dialogs';
export interface SqlEditorSessionClosedDialogPayload {
query?: string;
}
export const SqlEditorSessionClosedDialog: DialogComponent<SqlEditorSessionClosedDialogPayload, boolean> = function SqlSessionClosedDialog({
payload,
resolveDialog,
rejectDialog,
className,
}) {
const styles = useS(style);
return (
<CommonDialogWrapper size="medium" className={className} fixedWidth>
<CommonDialogHeader title="plugin_data_viewer_sql_session_closed_title" icon="/icons/info_icon.svg" onReject={rejectDialog} />
<CommonDialogBody>
<div className={s(styles, { container: true })}>
<div className={s(styles, { message: true })}>
<Translate token="plugin_data_viewer_sql_session_closed_message" />
</div>
{payload.query && (
<div className={s(styles, { queryInfo: true })}>
<div className={s(styles, { queryLabel: true })}>
<Translate token="plugin_data_viewer_sql_session_closed_query_label" />
</div>
<div className={s(styles, { queryPreview: true })} title={payload.query}>
{payload.query.length > 100 ? `${payload.query.substring(0, 100)}...` : payload.query}
</div>
</div>
)}
</div>
</CommonDialogBody>
<CommonDialogFooter className={s(styles, { footer: true })}>
<Button type="button" variant="secondary" onClick={rejectDialog}>
<Translate token="ui_processing_cancel" />
</Button>
<Fill />
<Button
type="button"
onClick={() => {
resolveDialog(true);
window.location.reload();
}}
>
<Translate token="plugin_data_viewer_sql_session_closed_open_editor" />
</Button>
</CommonDialogFooter>
</CommonDialogWrapper>
);
};