zowe / zowe-explorer-vscode

Visual Studio Code Extension for Zowe, which lets users interact with z/OS Data Sets, Unix System Services, and Jobs on a remote mainframe instance. Powered by Zowe SDKs.
Eclipse Public License 2.0
173 stars 92 forks source link

Change default credentials manager check and not-found dialog #3297

Closed phaumer closed 1 week ago

phaumer commented 2 weeks ago

Proposed changes

On systems on which the default credentials manager is not available, such as Eclipse Che, activation would run into an endless loop of prompting the user to accept disabling secure credentials, reload, and the same dialog again. This was caused by code that when reading the setting.json file would rewrite it again and triggering the new file watcher to reload it again. Asynchronous behavior would also intermingle prompts to the user of broken team configuration files as it tried to load credentials using the non-existent credentials manager.

I rewrote the code to add an independent check for the default credentials manager. It tests if it can be loaded by trying ProfilesCache.requireKeyring() and only calling the setupDefaultCredentialManager() when it succeeds. Before, it was always calling it wasting cycles by catching more exceptions.

I also changed the prompt to an info dialog (could discuss if it should be warning) with the Reload button only, to tell the user that credential management was disabled and they should consider installing a credentials manager (such as the K8s one). The reason is that the user really does not have a choice and prompting makes no difference. If they would select the No in the old dialog, it would just prompt them again after reload. Also storing the setting only makes sense for the global scope as the credentials manager would not be available for other workspaces either. So that button in the dialog is also not needed. Therefore, the only button left now is the Reload button. When clicked, the setting is stored, the settings.json is written, and the editor reloads without any additional prompts.

Release Notes

Milestone:

Changelog:

Types of changes

Checklist

General

Code coverage

Deployment

Further comments

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.97%. Comparing base (e07e839) to head (071ec81). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/zowe-explorer/src/utils/ProfilesUtils.ts 93.75% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3297 +/- ## ========================================== - Coverage 92.99% 92.97% -0.03% ========================================== Files 116 116 Lines 12008 12020 +12 Branches 2753 2742 -11 ========================================== + Hits 11167 11175 +8 - Misses 839 843 +4 Partials 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 2 weeks ago

📅 Suggested merge-by date: 11/21/2024