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

Add setting to toggle PR icons in Graph #2450

Merged
merged 8 commits into from
Jan 18, 2023

Conversation

axosoft-ramint
Copy link
Contributor

We had a setting to enable/disable upstream status for local branches in the graph. This adds a setting to toggle the other metadata type: Pull Requests.

This also combines all the active metadata from settings into a single array to send to the graph. This requires a graph library update after the breaking change lands: https://github.com/gitkraken/GitKrakenComponents/pull/189

Once that merges, the dependency will be updated in this PR and it can leave draft state.

@axosoft-ramint axosoft-ramint added the area-graph Issues or features related to the commit graph label Jan 16, 2023
package.json Outdated
@@ -2250,6 +2250,13 @@
"scope": "window",
"order": 26
},
"gitlens.graph.showPullRequests": {
Copy link
Member

Choose a reason for hiding this comment

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

Lets call it gitlens.graph.pullRequests.enabled to align with the other PR related options

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in commit: Rename setting

Comment on lines 45 to 48
export const GraphRefMetadataTypes = {
Upstream: 'upstream',
PullRequest: 'pullRequests',
};
Copy link
Contributor Author

@axosoft-ramint axosoft-ramint Jan 16, 2023

Choose a reason for hiding this comment

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

A note on this piece: I originally had it pulling these strings directly from the graph library. However, this caused the GitLens extension to fail to load entirely when debugging, producing a document is not defined error:
image

I'm guessing it's because I was attempting to pull constants out of a typedef file, but not sure exactly why it failed (it built successfully).

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, can't use consts as values from d.ts files. d.ts are just types/shapes and are not available at runtime.

That's why https://github.dev/gitkraken/vscode-gitlens/blob/52d8b0ad6b5a0d33781410dae49af11c5fba1dc8/src/%40types/vscode.git.enums.ts#L1 exists, I had to separate out certain consts from the vscode.git.d.ts file so that they would get compiled in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! We'll definitely want an enums export in the Graph in general then - I'll add that in as a separate task.

Copy link
Member

Choose a reason for hiding this comment

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

I would also suggest changing this to:

export enum GraphRefMetadataTypes {
	Upstream = 'upstream',
	PullRequest = 'pullRequests',
}

export const supportedRefMetadataTypes: GraphRefMetadataType[] = Object.values(GraphRefMetadataTypes);

To avoid having to call Object.values each time when checking the metadata, and that will also make sure that enum stays in sync with the types, since the supportedRefMetadataTypes will fail if an enum/type value don't change together

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in commit: Use enum and values array

>Show associated pull requests on remote branches</label
>
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Add

<p class="setting__hint hidden" data-visibility="currentLine.pullRequests.enabled">
	<i class="icon icon__info"></i>Requires a connection to a supported remote service (e.g. GitHub)
</p>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Should I add that for the upstream indicator setting as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@eamodio eamodio Jan 17, 2023

Choose a reason for hiding this comment

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

Upstream, doesn't need an integration -- just the PRs

Upstream we get completely from Git, but the PRs require a rich integration to pull the details from GitHub/GitLab

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, thanks! Fixed in commit: Remove remote service hint from upstream setting

@@ -170,6 +170,20 @@ <h2>
</div>
</div>

<div class="setting">
Copy link
Member

Choose a reason for hiding this comment

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

Can do it outside this PR, but we should look at the UX/UI of the graph settings and group some of them up to make them easier for users to understand

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wrote up a task for it, thanks!

@axosoft-ramint axosoft-ramint marked this pull request as ready for review January 17, 2023 16:47
@axosoft-ramint
Copy link
Contributor Author

@eamodio The dependency on the graph side has been merged. Bumped the graph version in this PR to match it.

Copy link
Member

@eamodio eamodio left a comment

Choose a reason for hiding this comment

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

Looks good!

@axosoft-ramint axosoft-ramint merged commit 3992bc8 into main Jan 18, 2023
@axosoft-ramint axosoft-ramint deleted the feature/graph-pr-icons-setting branch January 18, 2023 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-graph Issues or features related to the commit graph
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants