Skip to content

Commit 3c85a63

Browse files
authored
Merge branch 'main' into web-console/fix-run-position
2 parents 799523d + e462e26 commit 3c85a63

File tree

5 files changed

+55
-14
lines changed

5 files changed

+55
-14
lines changed

packages/browser-tests/cypress/integration/console/editor.spec.js

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,36 +194,54 @@ describe("autocomplete", () => {
194194
.should("not.be.visible")
195195
.clearEditor();
196196

197-
cy.typeQuery('create table "my_secrets" ("secret" string)')
198-
.runLine()
199-
.clearEditor();
200-
201-
cy.typeQuery("select * from my_")
202-
.getAutocomplete()
203-
.should("contain", "my_secrets");
204-
205197
cy.matchImageSnapshot();
206-
cy.clearEditor().typeQuery('drop table "my_secrets"').runLine();
207198
});
208199

209200
it("should work when tables list is not empty", () => {
210201
cy.typeQuery('create table "my_secrets" ("secret" string);')
211202
.clickRun()
212203
.clearEditor();
213204

205+
// We're creating another table with the same column name.
206+
// The autocomplete should merge the column completions into one
207+
// and respond with something like `secret (my_secrets, my_secrets2)`
208+
cy.typeQuery('create table "my_secrets2" ("secret" string);')
209+
.clickRun()
210+
.clearEditor();
211+
214212
cy.typeQuery('create table "my_publics" ("public" string);')
215213
.clickRun()
216214
.clearEditor();
217215

218216
cy.visit(baseUrl);
219-
cy.typeQuery("\nselect * from ");
217+
cy.typeQuery("\nselect ");
220218
cy.getAutocomplete()
219+
// Tables
221220
.should("not.contain", "telemetry")
222221
.should("contain", "my_secrets")
223222
.should("contain", "my_publics")
223+
// Columns
224+
.should("contain", "secret")
225+
.should("contain", "public")
226+
// Tables list for the `secret` column
227+
// list the tables containing `secret` column
228+
.should("contain", "my_secrets, my_secrets2")
229+
.clearEditor();
230+
231+
cy.typeQuery("select * from my_secrets where ");
232+
cy.getAutocomplete()
233+
.should("contain", "secret")
234+
.should("not.contain", "public")
235+
.clearEditor();
236+
237+
cy.typeQuery("select * from my_secrets join my_publics on ");
238+
cy.getAutocomplete()
239+
.should("contain", "my_publics.public")
240+
.should("contain", "my_secrets.secret")
224241
.clearEditor();
225242

226243
cy.typeQuery('drop table "my_secrets"').runLine().clearEditor();
244+
cy.typeQuery('drop table "my_secrets2"').runLine().clearEditor();
227245
cy.typeQuery('drop table "my_publics"').runLine().clearEditor();
228246
});
229247
});

packages/web-console/src/components/ToggleButton/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ const baseStyles = css<Props>`
8484
color: ${({ selected, theme }) =>
8585
theme.color[selected ? "foreground" : "offWhite"]};
8686
87-
svg + span {
87+
svg + span,
88+
img + span {
8889
margin-left: 1rem;
8990
}
9091
`
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from "react"
2+
3+
export const Import = ({ size }: { size: string }) => (
4+
<svg
5+
width={size}
6+
height={size}
7+
viewBox="0 0 26 26"
8+
fill="currentColor"
9+
xmlns="http://www.w3.org/2000/svg"
10+
>
11+
<path d="M25 22.3704H1V24.1481H25V22.3704Z" fill="currentColor" />
12+
<path
13+
d="M1 19.2593V21.037H25V19.7037L21.8889 13.4815H16.1111V16.5926H9.88889V13.4815H4.11111L1 19.2593Z"
14+
fill="currentColor"
15+
/>
16+
<path
17+
d="M13 1.92593L6.33337 8.59259H11.2223V14.8148H14.3334V8.59259H19.6667L13 1.92593Z"
18+
fill="currentColor"
19+
/>
20+
</svg>
21+
)

packages/web-console/src/scenes/Console/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { PrimaryToggleButton } from "../../components"
2020
import { Import } from "./import"
2121
import { BottomPanel } from "../../store/Console/types"
2222
import { Allotment, AllotmentHandle } from "allotment"
23+
import { Import as ImportIcon } from "../../components/icons/import"
2324

2425
const Root = styled.div`
2526
display: flex;
@@ -218,7 +219,7 @@ const Console = () => {
218219
selected={activeBottomPanel === "import"}
219220
data-hook="import-panel-button"
220221
>
221-
<Upload2 size={BUTTON_ICON_SIZE} />
222+
<ImportIcon size={BUTTON_ICON_SIZE} />
222223
</PrimaryToggleButton>
223224
}
224225
>

packages/web-console/src/scenes/Editor/Monaco/questdb-sql/createSchemaCompletionProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ export const createSchemaCompletionProvider = (
3535
)
3636

3737
const fromMatch = queryAtCursor.query.match(/(?<=FROM\s)([^ )]+)/gim)
38-
const joinMatch = queryAtCursor.query.match(/(JOIN)\s+([^ ]+)/)
38+
const joinMatch = queryAtCursor.query.match(/(JOIN)\s+([^ ]+)/i)
3939
const alterTableMatch = queryAtCursor.query.match(
40-
/(ALTER TABLE)\s+([^ ]+)/,
40+
/(ALTER TABLE)\s+([^ ]+)/i,
4141
)
4242
if (fromMatch) {
4343
tableContext = uniq(fromMatch)

0 commit comments

Comments
 (0)