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

Show library code in function tooltip #34675

Merged
merged 6 commits into from
May 19, 2020
Merged

Show library code in function tooltip #34675

merged 6 commits into from
May 19, 2020

Conversation

ajpal
Copy link
Contributor

@ajpal ajpal commented May 6, 2020

Adds a link in the function tooltip for library functions that says "Show code". Clicking the link opens the LibraryViewCodeModal
May-07-2020 12-12-05

Links

Testing story

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@ajpal ajpal added the star-labs label May 7, 2020
@ajpal ajpal marked this pull request as ready for review May 7, 2020 19:14
<% linkText = "Show code" %>
<div class="tooltip-code-link">
<a href="javascript:void(0);">
<%= linkText %>
Copy link
Contributor

@jmkulwik jmkulwik May 13, 2020

Choose a reason for hiding this comment

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

nit: this can be simplified by using the string literal directly. i.e. something like <% "Show code" %> (I don't think my syntax is exactly right)
I think linkText was created to shortcut an if statement, but is probably no longer needed.

);
}

if (tooltip.showCodeLink) {
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 an else if? i.e. It seems like we wouldn't want both, right?

var projectLibraries = dashboard.project.getProjectLibraries();
var libraryName = funcName.split('.')[0];
var library = projectLibraries.find(
lib => lib.name === libraryName
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: (definitely not required) - consider using library or something similar instead of abbreviated lib

document.querySelector('#libraryFunctionTooltipModal')
);
}
}.bind(this)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Rather than binding, consider using arrow notation

Copy link
Contributor

@jmkulwik jmkulwik left a comment

Choose a reason for hiding this comment

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

Looks awesome!

@ajpal ajpal merged commit b910a02 into staging May 19, 2020
@ajpal ajpal deleted the may6-dropletTooltip branch May 19, 2020 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants