Skip to content
Snippets Groups Projects
Commit 1ad2cfdc authored by Leonardo Christino's avatar Leonardo Christino
Browse files

Merge branch 'fix/ui' into 'main'

fix(ui): fix add database not opening after adding one db

See merge request !71
parents 474e1be3 1d7723e0
No related branches found
No related tags found
1 merge request!71fix(ui): fix add database not opening after adding one db
Pipeline #127265 passed
...@@ -68,7 +68,6 @@ export const NewDatabaseForm = (props: { onClose(): void; open: boolean }) => { ...@@ -68,7 +68,6 @@ export const NewDatabaseForm = (props: { onClose(): void; open: boolean }) => {
/** Handles the submit button click. Calls the onSubmit in the props with all the fields. */ /** Handles the submit button click. Calls the onSubmit in the props with all the fields. */
function handleSubmitClicked(): void { function handleSubmitClicked(): void {
ref.current?.close();
if (!Object.values(hasError).some((e) => e === true)) { if (!Object.values(hasError).some((e) => e === true)) {
api api
.AddDatabase(state, { updateDatabaseCache: true, setAsCurrent: true }) .AddDatabase(state, { updateDatabaseCache: true, setAsCurrent: true })
...@@ -78,8 +77,8 @@ export const NewDatabaseForm = (props: { onClose(): void; open: boolean }) => { ...@@ -78,8 +77,8 @@ export const NewDatabaseForm = (props: { onClose(): void; open: boolean }) => {
.catch((e) => { .catch((e) => {
dispatch(addError(e.message)); dispatch(addError(e.message));
}); });
props.onClose();
} }
// props.onSubmit(state);
} }
return ( return (
......
...@@ -59,27 +59,18 @@ export const Navbar = (props: NavbarComponentProps) => { ...@@ -59,27 +59,18 @@ export const Navbar = (props: NavbarComponentProps) => {
const [menuOpen, setMenuOpen] = useState(false); const [menuOpen, setMenuOpen] = useState(false);
const [subMenuOpen, setSubMenuOpen] = useState<string | undefined>(undefined); const [subMenuOpen, setSubMenuOpen] = useState<string | undefined>(undefined);
/**
* Called when the user clicks on the 'submit' button of the add database form.
*/
function onAddDatabaseFormSubmit(request: AddDatabaseRequest): Promise<void | Response> {
return api
.AddDatabase(request, { updateDatabaseCache: true, setAsCurrent: true })
.then(() => {
schemaApi.RequestSchema(request.name);
})
.catch((e) => {
dispatch(addError(e.message));
});
}
const currentLogo = !'dark' ? logo_white : logo; // TODO: support dark mode const currentLogo = !'dark' ? logo_white : logo; // TODO: support dark mode
const buildInfo = import.meta.env.GRAPHPOLARIS_VERSION; const buildInfo = import.meta.env.GRAPHPOLARIS_VERSION;
return ( return (
<div className="w-full h-auto px-5"> <div className="w-full h-auto px-5">
<NewDatabaseForm open={addDatabaseFormOpen} onClose={() => setAddDatabaseFormOpen(false)} /> <NewDatabaseForm
open={addDatabaseFormOpen}
onClose={() => {
setAddDatabaseFormOpen(false);
}}
/>
<div title="GraphPolaris" className="navbar w-full"> <div title="GraphPolaris" className="navbar w-full">
<a href="https://graphpolaris.com/" className="w-full"> <a href="https://graphpolaris.com/" className="w-full">
<img src={currentLogo} /> <img src={currentLogo} />
...@@ -118,6 +109,7 @@ export const Navbar = (props: NavbarComponentProps) => { ...@@ -118,6 +109,7 @@ export const Navbar = (props: NavbarComponentProps) => {
setAddDatabaseFormOpen(true); setAddDatabaseFormOpen(true);
setMenuOpen(false); setMenuOpen(false);
setSubMenuOpen(undefined); setSubMenuOpen(undefined);
console.log('add database', addDatabaseFormOpen, menuOpen, subMenuOpen);
}} }}
> >
Add database Add database
...@@ -205,14 +197,6 @@ export const Navbar = (props: NavbarComponentProps) => { ...@@ -205,14 +197,6 @@ export const Navbar = (props: NavbarComponentProps) => {
</div> </div>
</div> </div>
</div> </div>
{/* <AddDatabaseForm
open={state.showAddDatabaseForm}
onClose={() => setState({ ...state, showAddDatabaseForm: false })}
onSubmit={(...params) => {
onAddDatabaseFormSubmit(...params);
setState({ ...state, showAddDatabaseForm: false });
}}
/> */}
</div> </div>
); );
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment