Skip to content

Add icons and main badge to Model Details View#2683

Merged
norascheuch merged 4 commits intomainfrom
nora/model-details-view-styling
Aug 11, 2023
Merged

Add icons and main badge to Model Details View#2683
norascheuch merged 4 commits intomainfrom
nora/model-details-view-styling

Conversation

@norascheuch
Copy link
Copy Markdown
Contributor

@norascheuch norascheuch commented Aug 9, 2023

Adds styling to the new Mode Details View.

image

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@norascheuch norascheuch requested a review from a team as a code owner August 9, 2023 13:23
@norascheuch norascheuch force-pushed the nora/model-details-view-styling branch from 2448f3c to df88049 Compare August 9, 2023 14:41
this.dataProvider.setState(externalApiUsages, databaseItem);
this.treeView.badge = {
value: externalApiUsages.length,
tooltip: "Number of unmodeled external APIs",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this tooltip isn't strictly true. We're showing all external APIs and not just the unmodeled ones.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's true, but a problem. We should only show unmodeled APIs in this view! Shall I make the change in this PR or create a new one, since the problem wasn't introduced here?

@robertbrignull
Copy link
Copy Markdown
Contributor

Talked about this in person with @norascheuch and we decided to:

  • Adjust the external API label to not use signature so it doesn't have the # in there and so it matches the method name used in the main data extensions editor.
  • Add a description field to usages indicating the file name (and line number if available).
  • Don't include the "number of usages" next to each external API.

} else {
return {
label: item.label,
label: `${item.label} at ${item.url.uri} [${item.url.startLine}, ${item.url.endLine}]`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good, but there's a couple of ways we can make it so it matches the planned designs a little better. I made a couple of tweaks and ended up with:

Screenshot 2023-08-10 at 14 22 29

I feel it's easiest to explain by just putting up the code for it, so you can have a look and see if you want to use this approach: https://github.com/github/vscode-codeql/compare/nora/model-details-view-styling...robertbrignull/nora/model-details-view-styling?expand=1

The two changes are:

  • If we use the description field for the path and line number, then it's rendered in grey and slightly smaller.
  • It would be great if we could not show the file:/ prefix and also not show absolute paths. Instead we should show the relative path inside the database source archive because this is going to be shorter and more understandable for users. Unfortunately it turned out to be a little annoying to compute this relative path. The sourceLocationPrefix is calculated from the DatabaseItem that we already have, but it needs a CodeQL CLI server to do so and is an async operation. I think the best thing to do is to pre-calculate it whenever the database item changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh I'm sorry 🤦‍♀️ you mentioned the description thing but I forgot. Thanks for making the changes! I was wondering about how to get the relative file path but didn't think as far as to add the cliServer and make all the following changes. Looks very good now!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was wondering about how to get the relative file path but didn't think as far as to add the cliServer and make all the following changes. Looks very good now!

I was hoping it would be easier than that. I basically just tried every field on DatabaseItem until I found the one that did what I wanted 😅 . Sadly that then required passing the cliServer around 😞 .

Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

LGTM and works for me locally

@norascheuch norascheuch merged commit 2171147 into main Aug 11, 2023
@norascheuch norascheuch deleted the nora/model-details-view-styling branch August 11, 2023 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants