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

IApiRegisterClient.onProfilesUpdate() does not work #3078

Closed
FrankSu1996 opened this issue Aug 29, 2024 · 8 comments
Closed

IApiRegisterClient.onProfilesUpdate() does not work #3078

FrankSu1996 opened this issue Aug 29, 2024 · 8 comments
Assignees
Labels
bug Something isn't working priority-high Production outage - this quarter or at least next quarter severity-high Bug for which there may be workaround but limits the usage of the Zowe for major use cases

Comments

@FrankSu1996
Copy link

Describe the bug

IApiRegisterClient.onProfilesUpdate() does not work. Our extension uses it currently to detect team config creation/deletion events. We are using our own vscode file watcher to detect change events, because previously onProfilesUpdate() was not robust for changes in the secure properties. I know when we first adopted it, things were working ok. However, currently, using zowe-explorer-api 2.17.0 (also tried with 2.16.0), the event listener barely works. It might detect an event maybe 1/10 times, but mostly will fail to fire for any sort of team config changes. Note that when I test with our own vscode file watcher for the same create/update/delete events, they always fire.

To Reproduce

  1. have extension call IApiRegisterClient.onProfilesUpdate()
  2. Create/delete/change a zowe team config file. Doesn't matter if global or project level.

Expected behavior

onProfilesUpdate() should fire with corresponding event, but doesn't

Screenshots

Desktop (please complete the following information):

  • OS: Windows 11
  • Zowe Explorer Version: v3.0.0-next.202404242037
  • (Optional) Are you using Secure Credential Store? yes
  • zowe-explorer-api v2.17.0

Additional context

@FrankSu1996 FrankSu1996 added the bug Something isn't working label Aug 29, 2024
@FrankSu1996
Copy link
Author

bug_recording.mp4

screen capture showing how the vscode watchers do get triggered, but not onProfilesUpdate()

@traeok
Copy link
Member

traeok commented Aug 29, 2024

Hi @FrankSu1996,

I noticed that the issue description mentions a v3 snapshot for the Zowe Explorer version, but v2.17.0 for Zowe Explorer API - have you encountered this issue when using the same v3 snapshot for both Zowe Explorer and Zowe Explorer API?

@FrankSu1996
Copy link
Author

There are alot of breaking changes from v2-v3 which I haven't had time to fix. Some things, like EventTypes seem to be missing altogether when I try v3 pre-release.

@traeok
Copy link
Member

traeok commented Aug 29, 2024

@FrankSu1996 Thanks for the quick response. We'll do some testing with v2 and v3 to make sure onProfilesUpdate is behaving as intended - will report back on this issue with an update.

For v3, the EventTypes enum was renamed & moved into the Validation namespace in Zowe Explorer API - you can now reference it using Validation.EventType.

@FrankSu1996
Copy link
Author

Thanks, as a side note. I noticed zowe/cli is not a dependency anymore for zowe-explorer-api v3. Was this intended? We depend on a method zowe.getImperativeConfig() from zowe/cli when creating team configs. It would be nice if zowe/cli could be kept as a dependency, otherwise we would have to install it ourselves. This might lead to some unintended side effects if our zowe/cli version is different than the ones ZE/api uses.

@adam-wolfe adam-wolfe added priority-high Production outage - this quarter or at least next quarter severity-high Bug for which there may be workaround but limits the usage of the Zowe for major use cases and removed Research Needed labels Sep 3, 2024
@traeok
Copy link
Member

traeok commented Sep 4, 2024

Thanks, as a side note. I noticed zowe/cli is not a dependency anymore for zowe-explorer-api v3. Was this intended? We depend on a method zowe.getImperativeConfig() from zowe/cli when creating team configs. It would be nice if zowe/cli could be kept as a dependency, otherwise we would have to install it ourselves. This might lead to some unintended side effects if our zowe/cli version is different than the ones ZE/api uses.

Sorry for the delay @FrankSu1996 - this change was intentional and was done in #2730 to avoid pulling in some of the CLI-specific code (that's in the CLI package and unused in ZE API). I do understand your concern regarding the dependency on getImperativeConfig when creating team configs in your extension. However, you will still be able import the imperative namespace from Zowe Explorer API and can leverage the imperative.Config class to load and save new team configs. But if you rely on information that's exclusive to the getImperativeConfig function, we might have to expose this within the Imperative namespace so that extenders can still access it moving forward.

If you don't mind me asking, what information are you currently leveraging from getImperativeConfig? We might be able to provide alternatives depending on what properties you are referencing.

@FrankSu1996
Copy link
Author

Thanks for the reply. I'm aware I still have access to the imperative namespace. Currently, since our extension adds a new treeview as part of the Zowe Explorer activity bar, we wanted the same functionality to create new zowe team configs when clicking on our "+" button in the treeview, exactly the same as the 3 Zowe Explorer treeviews (Data Sets/USS/Jobs). Since Zowe Explorer does not expose the createZoweSchema() function from Profiles.ts, we are forced to essentially copy-paste the code in order to create team configs ourselves. That function has a single call to zowe/cli: zowe.getImperativeConfig, hence why we still need to depend on zowe/cli.

@traeok
Copy link
Member

traeok commented Sep 4, 2024

In v3, we no longer use the zowe.getImperativeConfig function within Profiles.createZoweSchema. That said, that does sound inconvenient and I think extenders should get access to this feature out of the box without needing to duplicate code. I'll create an issue to track this - thanks for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-high Production outage - this quarter or at least next quarter severity-high Bug for which there may be workaround but limits the usage of the Zowe for major use cases
Projects
Status: Closed
Development

No branches or pull requests

4 participants