Skip to content

Content Usage Metrics Dashboard #79

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

toph-allen
Copy link
Contributor

@toph-allen toph-allen commented Apr 25, 2025

The long foretold "megadashboard".

This dashboard merges the "outer" most-used-content and inner who-is-viewing-this-content dashboards. It contains all the features and functionality from those dashboards.

You can find links to view the dashboard in the attached issue.

The code is pretty complex, but I went through and did a close read at the end of the process to try to organize it in a way that makes sense, erring on the side of verbose comments.

Features:

  • View metrics.
  • Click on a content item to navigate to a detail view, click the Back button to return to the overview.
  • Select a date range to view, adjust visit merge window. These controls operate both on the outer list and the inner detail view.
  • View-specific controls:
    • The outer list lets you filter by content type, show/hide the GUID column, and export data.
    • The inner view lets you filter by user and send an email to all selected users.
  • Shiny Bookmarking is enabled: navigating directly to a content item's URL (when in "open solo" mode) will load that content item's data*
  • Improved user experience upon initial deploy / when no Viewer API Key integration is selected: Instead of crashing, the app displays an undismissable modal dialog with setup instructions.

* I couldn't get this to actually update the browser history entry, so your browser's back button won't work to navigate back.


Bugs / new features to fix:

  • When navigating "back", state in conditional sidebar filters is lost.
  • Bookmarking is not working (restore does not work)
  • Fail gracefully on first deploy (display a specific screen when client creation fails due to missing integration)

Subsequent issue:

- bookmarking
- state preservation of conditional controls
- better first run (no integration) experience
@toph-allen toph-allen marked this pull request as ready for review April 25, 2025 18:52
@toph-allen toph-allen force-pushed the toph/content-usage-metrics-megadashboard branch from c3b8b88 to 318c936 Compare April 25, 2025 19:15
dotNomad
dotNomad previously approved these changes Apr 25, 2025
Copy link
Collaborator

@dotNomad dotNomad left a comment

Choose a reason for hiding this comment

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

I'm not sure if this would be helpful, but now that these are combined I miss the supplying the GUID/URL functionality. I wonder if we can bring that back in someway?

We can search the content (can't search the GUID though). You may have an idea of how that could be incorporated again.


Fantastic work. I had a couple things (mainly CSS) that I had questions on. I did find I missed the URL/GUID input method if I knew what I wanted to look at immediately. Getting this into a megadashboard is fantastic.

Comment on lines 50 to 52
#visit_merge_window_text {
margin-top: -10px !important;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I never like seeing negative margin or !important. They have there uses, but this is usually a code smell for me.

Looks like this is getting around the bslib-gap-spacing but could we combine the Visit Merge Window bits into a single form group to avoid negative margin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this is trying to shrink the spacing between the text and slider input for the visit merge window.

Experimentally, the !important isn't required, but negative margin is probably still not ideal.

I think it would be much more fiddly to try to combine them (and I'm not even sure how that'd actually work in the R code). The default styling applied to sidebar input items is only applied to the direct children of the sidebar, and I've had a bunch of other back and forth with this merge working on getting elements to look and behave correctly (e.g. the auto-hiding elements — they were originally in a div and everything looked wrong).

I would also definitely be open to deleting the text input for the visit merge window. The text input was a request from Katie back when the maximum range was 600, and it was impossible to get consistent increments. The maximum range is now lower, and it's much easier to step the slider up and down by increments of 1. And the code to sync the slider and text input can still cause some finicky behavior in my experience.

Comment on lines +244 to +252
HTML(paste(
"In the Access panel to the right, click <strong>\"Add integration\"</strong>,",
"then select a <strong>Visitor API Key</strong> integration.",
"If you don't see one in the list, an administrator must enable this feature on your Connect server.",
"See the <a href='https://docs.posit.co/connect/admin/integrations/oauth-integrations/connect/' target='_blank'>Admin Guide</a> for setup instructions.",
"<br><br>",
"For guidance on using visitor-scoped permissions in your own Connect apps, see the",
"<a href='https://docs.posit.co/connect/user/oauth-integrations/#obtaining-a-visitor-api-key' target='_blank'>User Guide</a>.",
sep = " "
Copy link
Collaborator

Choose a reason for hiding this comment

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

This improvement is HUGE for Gallery users. 🎉


# Global UI elements ----

output$page_title_bar <- renderUI({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps we can provide a URL / GUID somewhere in this title bar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this idea! I'll put the GUID there for now, as it seems like reasonable info to have while not being so long that it makes things difficult to lay out. (Plus, the Open in Connect button has the URL).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screen Shot 2025-04-28 at 05 34 50 PM@2x

@toph-allen
Copy link
Contributor Author

toph-allen commented Apr 28, 2025

I'm not sure if this would be helpful, but now that these are combined I miss the supplying the GUID/URL functionality. I wonder if we can bring that back in someway?

We can search the content (can't search the GUID though). You may have an idea of how that could be incorporated again.

Fantastic work. I had a couple things (mainly CSS) that I had questions on. I did find I missed the URL/GUID input method if I knew what I wanted to look at immediately. Getting this into a megadashboard is fantastic.

@dotNomad I do kind of miss that functionality too. When I was initially thinking of adding it, I thought forward to how to add it in the combined dashboard. Talking to @jonkeane, we thought about using reactable's built in filters. (You can add custom filters that use arbitrary functions to filter the table, so we could process the entered text to extract any GUIDs and search multiple columns, I think.)

Some caveats:

  • Given that the GUID is hidden by default, would we use the Content column? How would you make it clear you could paste in a URL to filter the list?)
  • I was originally gonna write that it's too slow, but it seems faster now. Oh — maybe it's slow in Safari.

Two ideas:

  • We could have an external search box like in the Basic custom search method example, with placeholder text that says something like "Search title, GUID, or URL". I'm not sure if these can search hidden columns — but it looks like you might be able to.
  • We could have a button in the title bar on the outer screen that launches a modal to paste in a URL / GUID, and brings up the inner dashboard when clicked.

Initially I liked the idea of a button in the title bar, but filtering the table might be better.

Open questions:

  • Worth including vanity URLs? Might be a "nice to have" but ultimately much more fiddly to implement feature

@toph-allen toph-allen force-pushed the toph/content-usage-metrics-megadashboard branch from c87bbf5 to 24b64d3 Compare April 28, 2025 23:18
@toph-allen
Copy link
Contributor Author

toph-allen commented Apr 28, 2025

@dotNomad I created a global search field that searches the title, GUID, dashboard URL, and owner username. (As a result, I removed the filter fields at the top of title and owner username, but could add them back.)

I can't figure out the CSS to make reactable's default search widget wider — any ideas @dotNomad?

Vanity URLs are not included currently, because of a connectapi issue: posit-dev/connectapi#398. I could add them in a more hacky way, but better to wait and do it the right way.

@toph-allen toph-allen requested a review from dotNomad April 28, 2025 23:20
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.

2 participants