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(imperative): Enhanced ProfileInfo.updateProperty #1983

Merged
merged 3 commits into from
Dec 8, 2023
Merged

Conversation

zFernand0
Copy link
Member

What It Does

  • Add a forceUpdate optional property to the ProfileInfo.updateProperty method.
    • This property only works on V2 config files

How to Test

Check out the GIF at the bottom 😋
OR

  • Modify a property in a service profile that originally comes from a base profile (e.g. tokenType, tokenValue)
    • With forceUpdate: false: the base profile is updated
    • With forceUpdate: true: the apiml profile is updated

Use this config file for testing purposes

{
    "$schema": "./zowe.schema.json",
    "profiles": {
        "apiml": {
            "type": "zosmf",
            "properties": {
                "basePath": "/ibmzosmf/api/v1/"
            }
        },
        "base": {
            "type": "base",
            "properties": {
                "tokenType": "apimlAuthenticationToken"
            }
        }
    },
    "defaults": {
        "zosmf": "apiml",
        "base": "base"
    },
    "autoStore": true
}

Use this little test.mjs script for testing purposes

import { ProfileInfo } from "@zowe/imperative";
(async () => {
    const profInfo = new ProfileInfo("zowe");
    await profInfo.readProfilesFromDisk();
    await profInfo.updateProperty({
      profileName: "apiml", 
      profileType: "zosmf",
      property: "tokenType", 
      value: "test",
      forceUpdate: false
    })
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Review Checklist
I certify that I have:

Additional Comments

This is intended to help with the implementation of:

temp

…o allow for `forceUpdate`s

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

codecov bot commented Nov 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (599f6b3) 91.03% compared to head (7dd5a40) 91.03%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1983   +/-   ##
=======================================
  Coverage   91.03%   91.03%           
=======================================
  Files         636      636           
  Lines       18713    18718    +5     
  Branches     3898     3900    +2     
=======================================
+ Hits        17035    17040    +5     
  Misses       1677     1677           
  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.

Everything looks good - just left a small request below 😋
Thanks @zFernand0!

packages/imperative/src/config/src/ProfileInfo.ts Outdated Show resolved Hide resolved
Nice catch! Thank you, @traeok

Co-authored-by: Trae Yelovich <[email protected]>
Signed-off-by: Fernando Rijo Cedeno <[email protected]>
@zFernand0 zFernand0 requested a review from traeok December 1, 2023 15:15
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 for quickly addressing that @zFernand0 😁 LGTM

Signed-off-by: zFernand0 <[email protected]>
@zFernand0 zFernand0 requested a review from gejohnston December 8, 2023 13:14
Copy link

sonarqubecloud bot commented Dec 8, 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

92.3% 92.3% Coverage
0.0% 0.0% Duplication

@zFernand0 zFernand0 merged commit dd55a9e into master Dec 8, 2023
20 checks passed
@zFernand0 zFernand0 deleted the ze-2493 branch December 8, 2023 16:22
@zFernand0 zFernand0 added the release-minor Indicates a minor feature has been added label Dec 8, 2023
Copy link

github-actions bot commented Dec 8, 2023

Release succeeded for the master branch. 🎉

The following packages have been published:

Powered by Octorelease 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-minor Indicates a minor feature has been added released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants