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

Retrieve default org's metadata types #1237

Merged
merged 15 commits into from
Apr 10, 2019
Merged

Retrieve default org's metadata types #1237

merged 15 commits into from
Apr 10, 2019

Conversation

AnanyaJha
Copy link
Collaborator

What does this PR do?

This PR adds the functionality to get the metadataTypes for the default org and save the results in the .sfdx/orgs folder. It does not include the activation of this process so this code will not get triggered.

What issues does this PR fix or reference?

@W-5980289@

const workspaceChecker = new SfdxWorkspaceChecker();
const parameterGatherer = new EmptyParametersGatherer();

export async function forceDescribeMetadata(outputPath?: string) {
Copy link
Collaborator Author

@AnanyaJha AnanyaJha Apr 5, 2019

Choose a reason for hiding this comment

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

This should get called whenever the view is refreshed

xmlName: string;
};

export function buildTypesList(metadataTypesPath: string): string[] {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This would be used to populate the top level child nodes for the metadata types

return metadataTypes;
} else {
const err =
'There was an error retrieving metadata type information. Refresh the view to retry.';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ruthemmanuelle If we run into an error when trying to retrieve the metadata types from the generated output file, I think we should throw an error. If the user runs into this scenario, they should be able to refresh the view to generate the output file and load the view again.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I just saw this. Can we tell them how to refresh the view? Or is it obvious? Not sure what this UI looks like.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've taken out this message with my latest change, but at some point we will have to display a message similar to this. I think the view will include a refresh button in the top right corner, so we would want to point the user to that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, it sounds like refreshing will be intuitive, so the message you had (or something similar to it) should be good. Let me know when you're ready to add the new message.

@codecov
Copy link

codecov bot commented Apr 5, 2019

Codecov Report

Merging #1237 into develop will decrease coverage by 0.03%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1237      +/-   ##
===========================================
- Coverage    70.98%   70.95%   -0.04%     
===========================================
  Files          196      198       +2     
  Lines         7397     7471      +74     
  Branches       781      788       +7     
===========================================
+ Hits          5251     5301      +50     
- Misses        1990     2012      +22     
- Partials       156      158       +2
Impacted Files Coverage Δ
...ages/salesforcedx-vscode-core/src/util/authInfo.ts 69.69% <100%> (ø) ⬆️
...s/salesforcedx-vscode-core/src/orgBrowser/index.ts 100% <100%> (ø)
...sforcedx-vscode-core/src/orgBrowser/orgMetadata.ts 63.23% <63.23%> (ø)
...forcedx-vscode-core/src/channels/channelService.ts 83.33% <0%> (-2.39%) ⬇️
...edx-vscode-core/src/telemetry/telemetryReporter.ts 53.52% <0%> (+2.81%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea102fc...d05fbc8. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 5, 2019

Codecov Report

Merging #1237 into develop will decrease coverage by 0.04%.
The diff coverage is 65.75%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1237      +/-   ##
===========================================
- Coverage       71%   70.95%   -0.05%     
===========================================
  Files          196      198       +2     
  Lines         7397     7469      +72     
  Branches       781      787       +6     
===========================================
+ Hits          5252     5300      +48     
- Misses        1989     2012      +23     
- Partials       156      157       +1
Impacted Files Coverage Δ
...ages/salesforcedx-vscode-core/src/util/authInfo.ts 69.69% <100%> (ø) ⬆️
...s/salesforcedx-vscode-core/src/orgBrowser/index.ts 100% <100%> (ø)
...sforcedx-vscode-core/src/orgBrowser/orgMetadata.ts 62.12% <62.12%> (ø)
...forcedx-vscode-core/src/channels/channelService.ts 85.71% <0%> (+2.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a4362a...faf24fb. Read the comment docs.

};

export function buildTypesList(metadataTypesPath: string): string[] {
if (fs.existsSync(metadataTypesPath)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're parsing a json, I think we should wrap the method on a try catch that surfaces that throws the error and have the code calling this handle surfacing the message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, that works

@@ -164,6 +164,19 @@ export class TelemetryService {
}
}

public sendMetadataTypes(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a more generic method that we use to log things that are not errors or command executions ? It could be something like sendEventData or something like that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I think that's a good idea!

getUsernameStub.restore();
});

it('returns the path for a given username', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, change the title to Should return ... to follow the current test conventions.

@AnanyaJha AnanyaJha requested a review from lcampos April 9, 2019 21:20
});

it('should return the path for a given username', async () => {
getDefaultUsernameStub.returns('defaultUsername');
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 always return an username in email format e.g. test-audskbqx3kttjb@example.com

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I kept the getDefaultUsernameStub as defaultAlias because it can return an alias or a username, but I updated the getUsername stub to be in an email format, since that ensures we only have the username.

@@ -164,6 +164,16 @@ export class TelemetryService {
}
}

public sendEventData(
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to add a test for this in test/vscode-integration/telemetry/index.test.ts since no other method is testing sending measures.

@AnanyaJha AnanyaJha requested a review from lcampos April 10, 2019 20:30
Copy link
Contributor

@lcampos lcampos left a comment

Choose a reason for hiding this comment

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

🚢

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.

None yet

3 participants