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

feat(unix-cmd): User Experience improvements #2662

Merged
merged 23 commits into from
Feb 20, 2024
Merged

Conversation

likhithanimma1
Copy link
Contributor

Proposed changes

Fixes #2643
Enhanced Unix user experience, addressing feedback and improving usability.

Release Notes

Milestone:

Changelog:

Types of changes

What types of changes does your code introduce to Zowe Explorer?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Updates to Documentation or Tests (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This checklist will be used as reference for both the contributor and the reviewer

  • I have read the CONTRIBUTOR GUIDANCE wiki
  • PR title follows Conventional Commits Guidelines
  • PR Description is included
  • gif or screenshot is included if visual changes are made
  • yarn workspace vscode-extension-for-zowe vscode:prepublish has been executed
  • All checks have passed (DCO, Jenkins and Code Coverage)
  • I have added unit test and it is passing
  • I have added integration test and it is passing
  • There is coverage for the code that I have added
  • I have tested it manually and there are no regressions found
  • I have added necessary documentation (if appropriate)
  • Any PR dependencies have been merged and published (if appropriate)

Further comments

Signed-off-by: Likhitha Nimma <[email protected]>
Copy link

codecov bot commented Jan 12, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (26b8ded) 93.36% compared to head (522aaf9) 93.37%.

Files Patch % Lines
...es/zowe-explorer/src/command/UnixCommandHandler.ts 91.56% 7 Missing ⚠️
packages/zowe-explorer/src/Profiles.ts 66.66% 1 Missing ⚠️
packages/zowe-explorer/src/utils/ProfilesUtils.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             next    #2662   +/-   ##
=======================================
  Coverage   93.36%   93.37%           
=======================================
  Files         109      109           
  Lines       10193    10192    -1     
  Branches     2150     2146    -4     
=======================================
  Hits         9517     9517           
+ Misses        675      674    -1     
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

Thanks @likhithanimma1! Left a couple comments regarding variable naming and input box logic.

packages/zowe-explorer/src/command/UnixCommandHandler.ts Outdated Show resolved Hide resolved
packages/zowe-explorer/src/command/UnixCommandHandler.ts Outdated Show resolved Hide resolved
packages/zowe-explorer/src/command/UnixCommandHandler.ts Outdated Show resolved Hide resolved
Comment on lines 261 to 275
if (obj.argValue) {
sshProfile.profile[p] = obj.argValue;
} else {
const options: vscode.InputBoxOptions = {
prompt: `Enter the ${p} of the ssh profile`,
value: "",
ignoreFocusOut: true,
password: true,
};
const response = await Gui.showInputBox(options);
if (!response) {
Gui.showMessage(localize("issueUnixCommand.enter.command", `No command entered.`));
return;
}
sshProfile.profile[p] = response;
Copy link
Member

@traeok traeok Jan 16, 2024

Choose a reason for hiding this comment

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

I'm not sure how common this would be, but if I do not have a specific property specified and the profile property expects a type other than string, this may cause undefined behavior. To avoid this possibility, the validateInput option in InputBoxOptions can be used to ensure the property is set with a proper value.

Since this is unlikely to surface in this scenario, this isn't a requested change, but I wanted to mention this for future reference.

Copy link
Contributor

@JillieBeanSim JillieBeanSim left a comment

Choose a reason for hiding this comment

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

Thanks @likhithanimma1 for working on these polish items. I left a couple comments mainly on localization. I was also wondering a couple things:

  1. this doesn't seem to support using the base profile stored credentials with ssh profile even when they share host and ru values.
  2. when prompted for ssh credentials are we planning to write them to file/store securely? When I tested I was prompted but after checked config and no updates under ssh profile.

return;
if (cwd == "") {
cwd = await vscode.window.showInputBox({
prompt: "Enter the path of the directory in order to execute the command",
Copy link
Contributor

Choose a reason for hiding this comment

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

this text should be localized

sshProfile.profile[p] = obj.argValue;
} else {
const options: vscode.InputBoxOptions = {
prompt: `Enter the ${p} of the ssh profile`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be localized

@likhithanimma1
Copy link
Contributor Author

Thanks @likhithanimma1 for working on these polish items. I left a couple comments mainly on localization. I was also wondering a couple things:

  1. this doesn't seem to support using the base profile stored credentials with ssh profile even when they share host and ru values.
  2. when prompted for ssh credentials are we planning to write them to file/store securely? When I tested I was prompted but after checked config and no updates under ssh profile.

Hey @JillieBeanSim !

  1. This way of implementation will not support the stored credentials of the base profile with the ssh profile but if wanted can be modified to pick the username and password from the base profile for the default ssh profile. And if the base not containing them(user and pw) can be prompted for it.
  2. We are not planning to write them to any file or store them billie!

@JillieBeanSim
Copy link
Contributor

@likhithanimma1 we will need this to behave similarly as if using the team configuration file with cli commands for ssh.

likhithanimma1 and others added 12 commits January 29, 2024 22:55
Signed-off-by: Likhitha Nimma <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Copy link
Member

@t1m0thyj t1m0thyj left a comment

Choose a reason for hiding this comment

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

This looks pretty good, thanks @likhithanimma1!

Will re-review after merge conflicts have been resolved. A few questions:

  • What is the expected behavior when the ssh profile does not have user or password? I'm seeing that nothing happens when I click "Issue Unix Command". But when my ssh profile has credentials, then it works as expected.
  • For the prompt shown in the terminal output, it is currently formatted like this:
    > ibmuser @ lpar1.ssh : ~ ls
    Personally I think the spaces in between symbols look kind of weird. Would it make sense to use a format similar to most Linux terminals?
    [email protected]:~$ ls OR [[email protected] ~]$ ls

Copy link
Member

Choose a reason for hiding this comment

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

Can this empty file be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the ssh profile doesn't have the user or password it will prompt you to enter the credentials and the corresponding profile in the config file will be updated with credentials

Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

Changes LGTM, had a question about the use of the profType variable in promptCredentials 👍 will approve once conflicts are resolved

Comment on lines 548 to 558
let profType = "";
if (typeof profile !== "string") {
profType = profile.type;
}
const userInputBoxOptions: vscode.InputBoxOptions = {
placeHolder: vscode.l10n.t(`User Name`),
prompt: vscode.l10n.t(`Enter the user name for the connection. Leave blank to not store.`),
prompt: vscode.l10n.t(`Enter the user name for the {0} connection.`, profType),
};
const passwordInputBoxOptions: vscode.InputBoxOptions = {
placeHolder: vscode.l10n.t(`Password`),
prompt: vscode.l10n.t(`Enter the password for the connection. Leave blank to not store.`),
prompt: vscode.l10n.t(`Enter the password for the {0} connection.`, profType),
Copy link
Member

Choose a reason for hiding this comment

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

If profile is of type string, profType will be an empty string and the prompt will say "Enter the password for the connection" (with two spaces between "the" and "connection"). Is this intended behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, that would not be the intended behaviour. Just missed that case. Addressed the scenario and changed the prompt.

Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
@likhithanimma1 likhithanimma1 added the no-changelog Add to PR's that don't require a CHANGELOG update label Feb 20, 2024
Copy link

sonarcloud bot commented Feb 20, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
18.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

Tested and LGTM - thanks @likhithanimma1!

I like that the quick pick keeps track of your recent commands, this is really convenient if you have to run the same command frequently 😋

I filed #2728 as a possible future enhancement to allow adding/removing from this quick pick.

@JillieBeanSim JillieBeanSim merged commit 1e34354 into next Feb 20, 2024
13 of 15 checks passed
@JillieBeanSim JillieBeanSim deleted the Unix-User-Experience branch February 20, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Add to PR's that don't require a CHANGELOG update
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

4 participants