Skip to content
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

Ability to connect database multiple window #19

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

roth-dev
Copy link
Contributor

No description provided.

Copy link
Collaborator

@invisal invisal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit conflicted, at the moment, I want to keep only one main window at most database windows we can have multiple
But we have many code that can generate new windows and it is hard to control it in the future. At one point, we might make subtle mistake

export const mainWindow = new MainWindow();
app.whenReady(mainWindow.init)

We can expose several useful abstraction

// if main window is hidden, it will show and navigate to create connection
// if main window is destroyed, it will create window and navigate
mainWindow.navigate("/connection/mysql");  

mainWindow.hide();
mainWindow.show();
mainWindow.getWindow();  // this will give reference to window or null

Then we can break down IPC code in separate file in the future

bindDockerIpc(mainWindow)
bindMenuIpc(mainWindow)
bindOtherIpcInTheFuture(mainWindow)

Comment on lines 24 to 42
const connMenu: MenuItemConstructorOptions["submenu"] = connections.map(
(conn) => {
return {
label: conn.name,
click: () => {
const existingWindow = windowMap.get(conn.id);
if (existingWindow && !existingWindow.isDestroyed()) {
existingWindow.focus();
} else {
createDatabaseWindow({ win, conn });
win?.hide();
}
},
};
},
);

return connMenu;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you slice the connection let say last 10, if there is more than 10, you can put "See more connections"

Comment on lines 14 to 16
function handleClick() {
createWindow();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to maintain only one main windows. We can have multiple database windows, but should only have one main window

show: false,
width: 1024,
height: 768,
autoHideMenuBar: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autoHideMenuBar: false,

If it is true, Windows will never have menu

@roth-dev
Copy link
Contributor Author

All updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants