-
-
Notifications
You must be signed in to change notification settings - Fork 475
add-server: Make adding server dynamic [WIP]. #496
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
base: main
Are you sure you want to change the base?
Conversation
This is getting really close, to be done..., The issue needs to be addressed, is that when adding a server, previous we add them beforehand so we can assume that |
app/renderer/js/main.js
Outdated
@@ -572,6 +600,7 @@ window.onload = () => { | |||
serverManagerView.init(); | |||
|
|||
window.serverManagerView = serverManagerView; | |||
window.FunctionalTab = FunctionalTab; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These here, are just for testing, provides a great way see what happens underneath the hood using dev-tools.
Just leaving a comment so I know to remove them when cleaning up.
This does couple of things, to make this works: - First of all we make sure that `this.tabs` in ServerManagerView class has correct order of tabs, when we dynamically add a server there will be one FunctionTab if not more, which we need to move to the end of array. The reasons we need to do that, if because the click handlers need to have correct index values. What we do to fix this in `addServer` is we filter out all the FunctionalTabs and remove them from this.tabs temporarily then add a server, which will have correct index, and shortcut, then we iterate over each functional tabs tabs, we updae this.functionTabs to have correct new index, and update the webview to also have correct new index in its data-tab-id attribute. - When adding a new server, we call webview.init() to make sure it's appended into the webview containers. - Lastly we just remove the codepath that reloads the app, and then forward the new server when its done, parsing using ipcRenderer.
9154a16
to
3309f09
Compare
Heads up @akashnimare, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the |
@priyankp10 let's spend some time to finish this. |
abd41fb
to
94cbc78
Compare
Fixes: #488.
This refactors the code for adding and removing the server so that the app doesn't reload when adding/removing a server.