-
Notifications
You must be signed in to change notification settings - Fork 33
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
Feature/Restore last opened files #159
base: v1.x/staging
Are you sure you want to change the base?
Conversation
…[email protected]> Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh Goplani [email protected] Signed-off-by: Mitesh <[email protected]>
21491ba
to
1424ded
Compare
Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh <[email protected]>
The concept works but there are some issues
|
Signed-off-by: Mitesh <[email protected]>
Resolved the first issue |
Signed-off-by: Mitesh <[email protected]>
For the second issue, added a window storage object |
Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh <[email protected]>
webClient/src/app/shared/editor-control/editor-control.service.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh <[email protected]>
Signed-off-by: Mitesh <[email protected]>
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.
Great work so far. For some reason,
Save file path on file/dataset open
Delete file path on file/dataset close
this seemed to work for 1 time, and then stopped working? I wonder if it's related to my comment
However, saved tabs do indeed open back up.
webClient/src/app/app.component.ts
Outdated
this.log.debug(`Monaco object=`,monaco); | ||
let openWindowsStorageString : string = window.localStorage.getItem("org.zowe.editor-openWindows") |
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.
You don't have to hardcode the plugin name. You can get this from the PLUGIN_DEFINITION
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.
this.pluginDefinition.getBasePlugin().getIdentifier() should work
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.
Okay, I'll use this
webClient/src/app/app.component.ts
Outdated
dataToSave = activeZluxEditorsCount.toString() + ":" + Date.now() | ||
window.localStorage.setItem("org.zowe.editor-openWindows",dataToSave) | ||
window.addEventListener("beforeunload", () => { | ||
activeZluxEditorsCount = +window.localStorage.getItem("org.zowe.editor-openWindows").split(":")[0] |
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.
Is this not a copy for what you do in NgOnDestroy? Don't they attempt to accomplish the same thing or do you need both?
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.
Additionally, if you want to use the JS event listeners, you'll need to initialize them to a variable and manually removeEventListener() otherwise, they will continue existing until something else wipes them
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.
Sometimes ngOnDestroy() for Editor is not called when we close the browser tab directly with the editor open.
So, to handle that case I was using JS event listener
The editor would stop saving tabs when we have more than one instance of editor running in same/multiple windows |
Signed-off-by: Mitesh <[email protected]>
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.
Changes look good to me 🍨 (code) just need to test/QA this. Please reach out to @struga0258 if I don't get to it
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.
This looks good to me now so we'll just merge when automation has been written which is something that James and I are looking into who will be doing that.
Update: This PR is good, but doesn't address dealing with multiple Editor sessions and across multiple Desktops. It needs extending & may be groomed later by the team |
This PR serves as a feature enhancement for Zlux Editor - Restore last openend files/datasets in Editor on next launch
Dependent-on: zowe/zlux-app-manager#274
Signed-off-by: Mitesh Goplani [email protected]