Skip to content

feat(web-console): instance naming UI #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
94 changes: 52 additions & 42 deletions packages/browser-tests/cypress/integration/auth/auth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ const interceptSettings = (payload) => {
describe("OSS", () => {
before(() => {
interceptSettings({
"release.type": "OSS",
"release.version": "1.2.3",
"config": {
"release.type": "OSS",
"release.version": "1.2.3",
}
});
cy.visit(baseUrl);
});
Expand All @@ -27,16 +29,18 @@ describe("OSS", () => {
describe("Auth - UI", () => {
before(() => {
interceptSettings({
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": true,
"acl.basic.auth.realm.enabled": false,
"acl.oidc.enabled": false,
"acl.oidc.client.id": null,
"acl.oidc.authorization.endpoint": null,
"acl.oidc.token.endpoint": null,
"acl.oidc.pkce.required": null,
"acl.oidc.groups.encoded.in.token": false,
"config": {
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": true,
"acl.basic.auth.realm.enabled": false,
"acl.oidc.enabled": false,
"acl.oidc.client.id": null,
"acl.oidc.authorization.endpoint": null,
"acl.oidc.token.endpoint": null,
"acl.oidc.pkce.required": null,
"acl.oidc.groups.encoded.in.token": false,
}
});
cy.visit(baseUrl);
});
Expand All @@ -52,16 +56,18 @@ describe("Auth - UI", () => {
describe("Auth - OIDC", () => {
before(() => {
interceptSettings({
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": true,
"acl.basic.auth.realm.enabled": false,
"acl.oidc.enabled": true,
"acl.oidc.client.id": "test",
"acl.oidc.authorization.endpoint": "https://host:9999/auth",
"acl.oidc.token.endpoint": "https://host:9999/token",
"acl.oidc.pkce.required": true,
"acl.oidc.groups.encoded.in.token": false,
"config": {
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": true,
"acl.basic.auth.realm.enabled": false,
"acl.oidc.enabled": true,
"acl.oidc.client.id": "test",
"acl.oidc.authorization.endpoint": "https://host:9999/auth",
"acl.oidc.token.endpoint": "https://host:9999/token",
"acl.oidc.pkce.required": true,
"acl.oidc.groups.encoded.in.token": false,
}
});
cy.visit(baseUrl);
});
Expand All @@ -77,16 +83,18 @@ describe("Auth - OIDC", () => {
describe("Auth - Basic", () => {
before(() => {
interceptSettings({
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": true,
"acl.basic.auth.realm.enabled": true,
"acl.oidc.enabled": false,
"acl.oidc.client.id": null,
"acl.oidc.authorization.endpoint": null,
"acl.oidc.token.endpoint": null,
"acl.oidc.pkce.required": null,
"acl.oidc.groups.encoded.in.token": false,
"config": {
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": true,
"acl.basic.auth.realm.enabled": true,
"acl.oidc.enabled": false,
"acl.oidc.client.id": null,
"acl.oidc.authorization.endpoint": null,
"acl.oidc.token.endpoint": null,
"acl.oidc.pkce.required": null,
"acl.oidc.groups.encoded.in.token": false,
}
});
cy.visit(baseUrl);
});
Expand All @@ -100,16 +108,18 @@ describe("Auth - Basic", () => {
describe("Auth - Disabled", () => {
before(() => {
interceptSettings({
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": false,
"acl.basic.auth.realm.enabled": true,
"acl.oidc.enabled": false,
"acl.oidc.client.id": null,
"acl.oidc.authorization.endpoint": null,
"acl.oidc.token.endpoint": null,
"acl.oidc.pkce.required": null,
"acl.oidc.groups.encoded.in.token": false,
"config": {
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": false,
"acl.basic.auth.realm.enabled": true,
"acl.oidc.enabled": false,
"acl.oidc.client.id": null,
"acl.oidc.authorization.endpoint": null,
"acl.oidc.token.endpoint": null,
"acl.oidc.pkce.required": null,
"acl.oidc.groups.encoded.in.token": false,
}
});
cy.visit(baseUrl);
});
Expand Down
66 changes: 66 additions & 0 deletions packages/browser-tests/cypress/integration/console/topbar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/// <reference types="cypress" />

describe("TopBar", () => {
beforeEach(() => {
cy.loadConsoleWithAuth();
});

it("should show the instance warning and no description", () => {
cy.getByDataHook("topbar-instance-name").should(
"have.text",
"Instance name is not set"
);
cy.getByDataHook("topbar-instance-badge").should(
"have.css",
"background-color",
"rgb(40, 42, 54)"
);
});

it("should preview the color, show error when instance name is empty, and don't save changes on cancel", () => {
cy.getByDataHook("topbar-instance-name").realHover();
cy.getByDataHook("topbar-instance-edit-icon").should("be.visible");
cy.getByDataHook("topbar-instance-edit-icon").click();
cy.getByDataHook("topbar-instance-color-option-r").click();
cy.getByDataHook("topbar-instance-badge").should(
"have.css",
"background-color",
"rgb(199, 7, 45)"
);
cy.getByDataHook("topbar-instance-save-button").click();
cy.contains("Instance name is required").should("be.visible");
cy.getByDataHook("topbar-instance-cancel-button").click();
cy.getByDataHook("topbar-instance-name").should(
"have.text",
"Instance name is not set"
);
cy.getByDataHook("topbar-instance-badge").should(
"have.css",
"background-color",
"rgb(40, 42, 54)"
);
});

it("should change the instance name, description, and type", () => {
cy.getByDataHook("topbar-instance-badge").realHover();
cy.getByDataHook("topbar-instance-edit-icon").should("be.visible");
cy.getByDataHook("topbar-instance-edit-icon").click();
cy.getByDataHook("topbar-instance-name-input").type("test-instance");
cy.getByDataHook("topbar-instance-type-select").select("production");
cy.getByDataHook("topbar-instance-description-input").type(
"test description of the test instance"
);
cy.getByDataHook("topbar-instance-color-option-g").click();
cy.getByDataHook("topbar-instance-save-button").click();
cy.getByDataHook("topbar-instance-save-button").should("not.exist");
cy.getByDataHook("topbar-instance-name").should(
"have.text",
"test-instance"
);
cy.getByDataHook("topbar-instance-icon").realHover();
cy.contains("test description of the test instance").should("be.visible");
cy.contains(
"You are connected to a QuestDB instance for production"
).should("be.visible");
});
});
24 changes: 13 additions & 11 deletions packages/browser-tests/cypress/integration/enterprise/oidc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,19 @@ describe("OIDC authentication", () => {

// load login page
interceptSettings({
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": true,
"acl.basic.auth.realm.enabled": false,
"acl.oidc.enabled": true,
"acl.oidc.client.id": "client1",
"acl.oidc.authorization.endpoint": oidcAuthorizationCodeUrl,
"acl.oidc.token.endpoint": oidcTokenUrl,
"acl.oidc.pkce.required": true,
"acl.oidc.state.required": false,
"acl.oidc.groups.encoded.in.token": false,
"config": {
"release.type": "EE",
"release.version": "1.2.3",
"acl.enabled": true,
"acl.basic.auth.realm.enabled": false,
"acl.oidc.enabled": true,
"acl.oidc.client.id": "client1",
"acl.oidc.authorization.endpoint": oidcAuthorizationCodeUrl,
"acl.oidc.token.endpoint": oidcTokenUrl,
"acl.oidc.pkce.required": true,
"acl.oidc.state.required": false,
"acl.oidc.groups.encoded.in.token": false,
}
});
cy.visit(baseUrl);

Expand Down
2 changes: 1 addition & 1 deletion packages/browser-tests/questdb
Submodule questdb updated 215 files
17 changes: 16 additions & 1 deletion packages/web-console/src/components/PopperToggle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ export const PopperToggle = ({
[container, onToggle, triggerElement],
)

const handleKeyDown = useCallback(
(event: KeyboardEvent) => {
if (event.key === "Escape" && _active) {
setActive(false)

if (onToggle) {
onToggle(false)
}
}
},
[_active, onToggle],
)

usePopperStyles(container, styles.popper)

useTransition(container, _active, transitionTimeoutId)
Expand All @@ -106,15 +119,17 @@ export const PopperToggle = ({
useEffect(() => {
document.addEventListener("mousedown", handleMouseDown)
document.addEventListener("touchstart", handleMouseDown)
document.addEventListener("keydown", handleKeyDown)

return () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
clearTimeout(transitionTimeoutId.current)
document.removeEventListener("mousedown", handleMouseDown)
document.removeEventListener("touchstart", handleMouseDown)
document.removeEventListener("keydown", handleKeyDown)
document.body.contains(container) && document.body.removeChild(container)
}
}, [container, handleMouseDown])
}, [container, handleMouseDown, handleKeyDown])

return (
<>
Expand Down
Loading
Loading