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

Implemented getting metadata for profiletypes #2471

Merged
merged 10 commits into from
Oct 2, 2023

Conversation

likhithanimma1
Copy link
Contributor

Proposed changes

Fixed the issue of getting the meta data of profile types for creating the config files by adding the setters and getters in the zowe-explorer-api.

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

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

All modified lines are covered by tests ✅

Files Coverage Δ
...es/zowe-explorer-api/src/profiles/ProfilesCache.ts 99.59% <100.00%> (+0.01%) ⬆️
packages/zowe-explorer/src/Profiles.ts 84.18% <100.00%> (+0.01%) ⬆️
packages/zowe-explorer/src/ZoweExplorerExtender.ts 86.20% <100.00%> (-0.16%) ⬇️

📢 Thoughts on this report? Let us know!.

Signed-off-by: Likhitha Nimma <[email protected]>
Comment on lines 87 to 91
public setConfigArray(extendermetadata: zowe.imperative.ICommandProfileTypeConfiguration[]): void {
extendermetadata?.forEach((item) => {
this.profileTypeConfigurations.push(item);
});
}
Copy link
Member

Choose a reason for hiding this comment

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

If the method is named setConfigArray, I think it should replace the contents of the entire array. Since we are appending items to the array instead, perhaps it could be called updateConfigArray or addToConfigArray instead?

Also are we certain that this method won't be called more than once for the same profile type? Wondering if we should check to see whether an item already exists in the array before pushing a duplicate item (or we could use a Set for this).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handled duplicate item. Made the required changes.

t1m0thyj
t1m0thyj previously approved these changes Sep 29, 2023
packages/zowe-explorer-api/src/profiles/ProfilesCache.ts Outdated Show resolved Hide resolved
awharn
awharn previously approved these changes Sep 29, 2023
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.

see comment, @t1m0thyj raises a good concern

packages/zowe-explorer-api/src/profiles/ProfilesCache.ts Outdated Show resolved Hide resolved
t1m0thyj
t1m0thyj previously approved these changes Sep 29, 2023
Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

LGTM! 😋

Comment on lines 89 to 90
let index = this.profileTypeConfigurations.findIndex((ele) => ele.type == item.type)
if(index!=-1){
Copy link
Member

@zFernand0 zFernand0 Sep 30, 2023

Choose a reason for hiding this comment

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

Apologies for being picky, and I know this does not have any negative effects in this particular situation, but should we use strict equality when comparing anything other than == null ?

I know this didn't show up in the Lint failures though, that's why I left the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Thanks for letting me know. Fixed it

Comment on lines +169 to +171
profilemetadata.push(profilemetadata[0]);
profCache.addToConfigArray(profilemetadata);
expect(profCache.profileTypeConfigurations).toEqual(profilemetadata.filter((a, index) => index == 0));
Copy link
Member

Choose a reason for hiding this comment

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

clever way to test that the addToConfigArray method is intended to avoid duplicates 😋

Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

I forgot to mentiong that there is only one lint error

 /home/runner/work/vscode-extension-for-zowe/vscode-extension-for-zowe/packages/zowe-explorer-api/src/profiles/ProfilesCache.ts
 
[_eslint_]   89:17  error  'index' is never reassigned. Use 'const' instead  prefer-const

Signed-off-by: Likhitha Nimma <[email protected]>
zFernand0
zFernand0 previously approved these changes Sep 30, 2023
Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

LGTM! 😋
Thanks for the quick fixes! 🥳

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.

Left a comment regarding addToConfigArray - aside from that, LGTM!

Signed-off-by: Likhitha Nimma <[email protected]>
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!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
1.1% 1.1% Duplication

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.

LGTM! Thanks @likhithanimma1 for this new API for extenders and for addressing all of the feedback.

@JillieBeanSim JillieBeanSim merged commit 4b30095 into zowe:main Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ZE Extenders cannot create config file that includes all of ZE extenders
6 participants