Skip to content

Commit 8cf4126

Browse files
author
Marco
committed
latest
1 parent 9dca18f commit 8cf4126

File tree

8 files changed

+52
-36
lines changed

8 files changed

+52
-36
lines changed

components/webui/client/src/components/SqlEditor/index.tsx

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
useEffect,
44
useImperativeHandle,
55
useRef,
6+
useState,
67
} from "react";
78

89
import {
@@ -53,21 +54,31 @@ const SqlEditor = (props: SqlEditorProps) => {
5354
onEditorReady?.();
5455
}, [onEditorReady]);
5556

56-
// Define disabled theme for monaco editor
57+
// Define default and disabled themes for monaco editor
5758
useEffect(() => {
5859
if (null === monacoEditor) {
5960
return;
6061
}
62+
// Default theme to match AntD input
63+
monacoEditor.editor.defineTheme("default-theme", {
64+
base: "vs",
65+
inherit: true,
66+
rules: [],
67+
colors: {
68+
"editor.background": color(token.colorBgContainer).hexa(),
69+
"editor.foreground": color(token.colorText).hexa(),
70+
"focusBorder": "#0000", // transparent
71+
},
72+
});
73+
// Disabled theme uses vs as base
6174
monacoEditor.editor.defineTheme("disabled-theme", {
6275
base: "vs",
6376
inherit: true,
6477
rules: [],
6578
colors: {
6679
"editor.background": color(token.colorBgContainerDisabled).hexa(),
6780
"editor.foreground": color(token.colorTextDisabled).hexa(),
68-
69-
// transparent
70-
"focusBorder": "#00000000",
81+
"focusBorder": "#0000", // transparent
7182
},
7283
});
7384
}, [
@@ -77,39 +88,44 @@ const SqlEditor = (props: SqlEditorProps) => {
7788

7889
return (
7990
<div
80-
style={
81-
disabled ?
82-
{pointerEvents: "none"} :
83-
{}
91+
style={{
92+
border: `1px solid ${token.colorBorder}`,
93+
borderRadius: token.borderRadius,
94+
pointerEvents: disabled ? "none" : "auto",
95+
}
8496
}
8597
>
8698
<Editor
8799
language={"sql"}
88100
loading={
89101
<div
90-
style={{
91-
backgroundColor: "white",
92-
height: "100%",
93-
width: "100%",
94-
}}/>
102+
style={{
103+
backgroundColor: token.colorBgContainer,
104+
height: "100%",
105+
width: "100%",
106+
}}/>
95107
}
96108
options={{
97109
automaticLayout: true,
98110
folding: false,
99-
fontSize: 16,
100111
lineNumbers: "off",
101112
minimap: {enabled: false},
102113
overviewRulerBorder: false,
103114
placeholder: "Enter your SQL query",
104-
renderLineHighlightOnlyWhenFocus: true,
115+
renderLineHighlight: "none",
105116
scrollBeyondLastLine: false,
106117
wordWrap: "on",
118+
padding: {
119+
top: token.paddingXS,
120+
bottom: token.paddingXS,
121+
},
107122
}}
108123
theme={disabled ?
109124
"disabled-theme" :
110-
"light"}
125+
"default-theme"}
111126
onMount={handleEditorDidMount}
112-
{...editorProps}/>
127+
{...editorProps}
128+
/>
113129
</div>
114130
);
115131
};

components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/CancelButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const CancelButton = () => {
3434
className={styles["cancelButton"] || ""}
3535
color={"red"}
3636
icon={<CloseOutlined/>}
37-
size={"large"}
37+
size={"middle"}
3838
variant={"solid"}
3939
onClick={handleClick}
4040
>

components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlSearchButton/RunButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const RunButton = () => {
3636
className={styles["runButton"] || ""}
3737
color={"green"}
3838
icon={<CaretRightOutlined/>}
39-
size={"large"}
39+
size={"middle"}
4040
variant={"solid"}
4141
disabled={isQueryStringEmpty ||
4242
searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.runButtonContainer {
2-
width: 130px;
2+
width: 100px;
33
}
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
.status {
2-
margin-left: 2px;
3-
padding-top: 4px;
4-
margin-bottom: -4px;
5-
}
6-
71
.badge {
82
padding-bottom: 4px;
93
}

components/webui/client/src/pages/SearchPage/SearchControls/QueryStatus/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const QueryStatus = () => {
2020
} = useSearchStore();
2121

2222
return (
23-
<div className={styles["status"]}>
23+
<div>
2424
{(searchUiState === SEARCH_UI_STATE.QUERYING ||
2525
searchUiState === SEARCH_UI_STATE.DONE) && (
2626
<Text type={"secondary"}>

components/webui/client/src/pages/SearchPage/SearchControls/index.module.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@
1111

1212
.buttonAndStatusRow {
1313
display: flex;
14-
align-items: flex-start; /* Align items to the top */
15-
justify-content: space-between; /* Put space between status and button */
14+
align-items: flex-start;
15+
justify-content: space-between;
1616
gap: 10px;
1717
}
1818

19+
.status {
20+
margin-left: 2px;
21+
padding-top: 4px;
22+
}
23+
24+
.statusPresto {
25+
margin-left: 2px;
26+
}

components/webui/client/src/pages/SearchPage/SearchControls/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,19 @@ const SearchControls = () => {
4040
<TimeRangeInput/>
4141
<SearchButton/>
4242
</div>
43-
<QueryStatus/>
43+
<div className={styles["status"]}>
44+
<QueryStatus/>
45+
</div>
4446
</div>
4547
) :
4648
(
47-
4849
<div className={styles["prestoSearchControlsContainer"]}>
4950
<SqlQueryInput/>
5051
<div className={styles["buttonAndStatusRow"]}>
51-
<div style={{ alignSelf: "flex-start" }}>
52+
<div className={styles["statusPresto"]}>
5253
<QueryStatus/>
5354
</div>
54-
<div style={{ flex: 1 }} />
55-
<div style={{ alignSelf: "flex-end" }}>
56-
<SqlSearchButton/>
57-
</div>
55+
<SqlSearchButton/>
5856
</div>
5957
</div>
6058
)}

0 commit comments

Comments
 (0)