Skip to content

Add metadata dashboard buttons to designated pages.#951

Merged
svogt0511 merged 7 commits intomainfrom
pb575-metadata-completeness
Mar 18, 2026
Merged

Add metadata dashboard buttons to designated pages.#951
svogt0511 merged 7 commits intomainfrom
pb575-metadata-completeness

Conversation

@svogt0511
Copy link
Copy Markdown
Contributor

@svogt0511 svogt0511 commented Mar 12, 2026

Purpose

closes: https://github.com/datacite/product-backlog/issues/575

preview: #951

Approach

  • Adds the "MetadataDashboardButton" component.
  • Adds the appropriate styles for the button component.
  • Updates the necessary templates to show the button.
  • Updates config/environment to add METADATA_DASHBOARD_URL as a new environment variable and make it available throughout Fabrica. The default will be "https://metadata.stage.doi.org". This variable will be set to nil for the test environment. Additionally the fabricaDeployTarget variable will be made available throughout Fabrica. Both of these variables will be used to suppress the button in the test environment.

Open Questions and Pre-Merge TODOs

Learning

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

Summary by CodeRabbit

  • New Features
    • Added a Metadata Dashboard button to provider and repository detail pages. It opens the dashboard in a new tab (noopener noreferrer) and is shown only for non-test deployments when a dashboard URL is configured.
  • Style
    • Adjusted button spacing to align the new control with existing sidebar buttons.

@svogt0511 svogt0511 self-assigned this Mar 12, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a MetadataDashboardButton Glimmer component (template, JS, styles), inserts it into provider and repository show templates, and adds METADATA_DASHBOARD_URL plus fabricaDeployTarget to environment config (test target sets URL to empty).

Changes

Cohort / File(s) Summary
New Component
app/components/metadata-dashboard-button.js, app/components/metadata-dashboard-button.hbs
Adds a Glimmer component exposing metadataDashboardUrl and fabricaDeployTarget; template conditionally renders a small "Metadata Dashboard" external-link button (opens new tab, rel="noopener noreferrer", id metadata-dashboard) when URL exists and deploy target is not test.
Template Integrations
app/templates/providers/show/index.hbs, app/templates/repositories/show/index.hbs
Renders MetadataDashboardButton in the action/button areas of provider and repository show pages (UI-only insertion).
Styling
app/styles/local.css
Adds .metadata-dashboard-button with margin-left: 5px and margin-bottom: 15px.
Environment & Examples
config/environment.js, .env.example
Adds fabricaDeployTarget to ENV and METADATA_DASHBOARD_URL (default from env var or https://metadata.stage.datacite.org), sets METADATA_DASHBOARD_URL to "" for the test deploy target and to https://metadata.datacite.org in production; documents variable in .env.example.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a new MetadataDashboardButton component to designated pages (providers/show and repositories/show templates).
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pb575-metadata-completeness
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
config/environment.js (1)

236-252: ⚠️ Potential issue | 🟠 Major

Missing METADATA_DASHBOARD_URL override for production environment.

The production environment block sets explicit URLs for API_URL, FABRICA_URL, SEARCH_URL, etc., but does not set METADATA_DASHBOARD_URL. This means production will use the default stage URL (https://metadata.stage.datacite.org) instead of a production metadata dashboard URL.

If there's a production metadata dashboard, add the appropriate URL:

🐛 Proposed fix (if production URL exists)
   if (fabricaDeployTarget === 'production') {
     ENV.SITE_TITLE = 'DataCite Fabrica';
     ENV.API_URL = 'https://api.datacite.org';
     ENV.ORCID_URL = 'https://orcid.org';
     ENV.FABRICA_URL = 'https://doi.datacite.org';
     ENV.CROSSREF_API_URL = 'https://api.crossref.org';
     ENV.EVENTDATA_URL = 'https://api.datacite.org';
     ENV.SEARCH_URL = 'https://search.datacite.org';
     ENV.CDN_URL = process.env.CDN_URL || 'https://assets.datacite.org'
     ENV.HOME_URL = 'https://datacite.org';
     ENV.COOKIE_DOMAIN = '.datacite.org';
+    ENV.METADATA_DASHBOARD_URL = 'https://metadata.datacite.org'; // Adjust URL as needed
     ENV.HANDLE_SERVER =
       typeof process.env.HANDLE_SERVER === 'undefined' ||
       process.env.HANDLE_SERVER == ''
         ? 'https://doi.org'
         : normalizeURL(process.env.HANDLE_SERVER);
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/environment.js` around lines 236 - 252, The production block for
fabricaDeployTarget omits setting ENV.METADATA_DASHBOARD_URL so production falls
back to the stage URL; add a production override by setting
ENV.METADATA_DASHBOARD_URL (e.g., to process.env.METADATA_DASHBOARD_URL ||
'https://metadata.datacite.org') inside the if (fabricaDeployTarget ===
'production') branch so the app uses the correct production metadata dashboard;
reference the fabricaDeployTarget check and the ENV object
(ENV.METADATA_DASHBOARD_URL) when making the change.
🧹 Nitpick comments (1)
app/components/metadata-dashboard-button.hbs (1)

1-7: Consider handling the case when metadataDashboardUrl is empty.

When fabricaDeployTarget is something other than "test" but METADATA_DASHBOARD_URL is empty or undefined, the button will render with an empty/invalid href. While the current logic hides the button for the "test" environment, you might want to add an additional check to ensure the URL is valid before rendering:

♻️ Proposed enhancement
-{{`#if` (not-eq this.fabricaDeployTarget "test")}}
+{{`#if` (and (not-eq this.fabricaDeployTarget "test") this.metadataDashboardUrl)}}
 <div class="btn-group btn-group-sm metadata-dashboard-button">
   <a href={{this.metadataDashboardUrl}} target="_blank" rel="noopener noreferrer" class="btn btn-warning" id="metadata-dashboard">
     <i class="fas fa-external-link-alt"></i>
     Metadata Dashboard
   </a>
 </div>
 {{/if}}

Alternatively, if the URL is always guaranteed to be set when not in test environment, the current implementation is fine.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/metadata-dashboard-button.hbs` around lines 1 - 7, The button
currently renders whenever this.fabricaDeployTarget !== "test" even if
this.metadataDashboardUrl is empty; update the template to also check that
this.metadataDashboardUrl is truthy before rendering the anchor (e.g., combine
the existing fabri caDeployTarget check with a presence check for
this.metadataDashboardUrl using an and/compound helper) so the
metadata-dashboard anchor (id "metadata-dashboard") is only output when a valid
URL exists, or alternatively render a disabled/hidden button when
this.metadataDashboardUrl is missing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@config/environment.js`:
- Line 4: Remove the unused import of the minimatch module: delete the line that
declares the constant M from require('minimatch') (the import symbol "M" created
by the statement const M = require('minimatch')). Ensure no other references to
M/minimatch remain in this file before committing so the file has no unused
imports.

---

Outside diff comments:
In `@config/environment.js`:
- Around line 236-252: The production block for fabricaDeployTarget omits
setting ENV.METADATA_DASHBOARD_URL so production falls back to the stage URL;
add a production override by setting ENV.METADATA_DASHBOARD_URL (e.g., to
process.env.METADATA_DASHBOARD_URL || 'https://metadata.datacite.org') inside
the if (fabricaDeployTarget === 'production') branch so the app uses the correct
production metadata dashboard; reference the fabricaDeployTarget check and the
ENV object (ENV.METADATA_DASHBOARD_URL) when making the change.

---

Nitpick comments:
In `@app/components/metadata-dashboard-button.hbs`:
- Around line 1-7: The button currently renders whenever
this.fabricaDeployTarget !== "test" even if this.metadataDashboardUrl is empty;
update the template to also check that this.metadataDashboardUrl is truthy
before rendering the anchor (e.g., combine the existing fabri caDeployTarget
check with a presence check for this.metadataDashboardUrl using an and/compound
helper) so the metadata-dashboard anchor (id "metadata-dashboard") is only
output when a valid URL exists, or alternatively render a disabled/hidden button
when this.metadataDashboardUrl is missing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2282fc79-c9ad-4eb2-a08f-1eb87456d7e2

📥 Commits

Reviewing files that changed from the base of the PR and between 62017af and 8c3f041.

📒 Files selected for processing (6)
  • app/components/metadata-dashboard-button.hbs
  • app/components/metadata-dashboard-button.js
  • app/styles/local.css
  • app/templates/providers/show/index.hbs
  • app/templates/repositories/show/index.hbs
  • config/environment.js

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
config/environment.js (1)

209-211: Normalize METADATA_DASHBOARD_URL from env input.

At Line 210, env-provided URLs are used raw while defaults are normalized elsewhere. Applying normalizeURL here avoids trailing-slash inconsistencies.

♻️ Proposed refactor
-    METADATA_DASHBOARD_URL:
-      process.env.METADATA_DASHBOARD_URL ||
-      'https://metadata.stage.datacite.org'
+    METADATA_DASHBOARD_URL:
+      typeof process.env.METADATA_DASHBOARD_URL === 'undefined' ||
+      process.env.METADATA_DASHBOARD_URL == ''
+        ? 'https://metadata.stage.datacite.org'
+        : normalizeURL(process.env.METADATA_DASHBOARD_URL)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/environment.js` around lines 209 - 211, The METADATA_DASHBOARD_URL
value uses the raw env input causing trailing-slash inconsistencies; wrap the
environment value with normalizeURL so the assigned value is normalized (e.g.,
set METADATA_DASHBOARD_URL to normalizeURL(process.env.METADATA_DASHBOARD_URL ||
'https://metadata.stage.datacite.org')), and ensure normalizeURL is
imported/available in this module before using it.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@config/environment.js`:
- Line 231: The METADATA_DASHBOARD_URL is only cleared when fabricaDeployTarget
=== 'test', which misses Ember test runs where environment === 'test' but
FABRICA_DEPLOY_TARGET is unset; update the config to also set
ENV.METADATA_DASHBOARD_URL = "" when environment === 'test' (in the same block
that handles other test-specific settings) or change the existing condition to
clear the URL when either fabricaDeployTarget === 'test' OR environment ===
'test' so the dashboard is reliably disabled during Ember tests; refer to
ENV.METADATA_DASHBOARD_URL, fabricaDeployTarget (derived from
process.env.FABRICA_DEPLOY_TARGET), and environment to implement the fix.

---

Nitpick comments:
In `@config/environment.js`:
- Around line 209-211: The METADATA_DASHBOARD_URL value uses the raw env input
causing trailing-slash inconsistencies; wrap the environment value with
normalizeURL so the assigned value is normalized (e.g., set
METADATA_DASHBOARD_URL to normalizeURL(process.env.METADATA_DASHBOARD_URL ||
'https://metadata.stage.datacite.org')), and ensure normalizeURL is
imported/available in this module before using it.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e2523bab-7c71-4c49-9de2-1c38dc9bdcbf

📥 Commits

Reviewing files that changed from the base of the PR and between 495cd26 and 8e323ac.

📒 Files selected for processing (1)
  • config/environment.js

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@config/environment.js`:
- Around line 209-212: METADATA_DASHBOARD_URL currently defaults to the stage
URL and is missing the production override; update the fabricaDeployTarget ===
'production' block to set METADATA_DASHBOARD_URL to the production dashboard
(e.g. 'https://metadata.datacite.org') just like
API_URL/SEARCH_URL/HOME_URL/HANDLE_SERVER are overridden there, ensuring
normalizeURL(process.env.METADATA_DASHBOARD_URL) is used if relying on an env
var and falling back to the hardcoded production URL when not provided.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c9f3489-0f37-4cd7-ac1a-f956e09d541d

📥 Commits

Reviewing files that changed from the base of the PR and between 8e323ac and 45a7d14.

📒 Files selected for processing (2)
  • app/components/metadata-dashboard-button.hbs
  • config/environment.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/components/metadata-dashboard-button.hbs

@svogt0511 svogt0511 temporarily deployed to vercel-bracco-preview March 13, 2026 15:05 — with GitHub Actions Inactive

export default class MetadataDashboardButton extends Component {
get metadataDashboardUrl() {
return ENV.METADATA_DASHBOARD_URL;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The link should go to the specific account’s view on the metadata dashboard. Right now, it always goes to https://metadata.stage.datacite.org. Instead, the relevant view on would be https://metadata.stage.datacite.org/{account-id}, or https://metadata.datacite.org/{account-id} on production. This structure will work for both client and provider account types.

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.

I will take a look!

Copy link
Copy Markdown
Contributor Author

@svogt0511 svogt0511 Mar 13, 2026

Choose a reason for hiding this comment

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

For example - account id could be datacite.test, datacite, dc, etc. So for example,

https://metadata.datacite.org/dc
https://metadata.datacite.org/datacite
https://metadata.datacite.org/datacite.test

I have it doing that. I am assuming this is correct. If not, let me know.

A couple of questions:

  1. What about admin? I assume there should be no button for admin? (I just checked and the button does not show up for the admin user.)
  2. If staging uses production data, we will end up with a lot of urls in staging that produce '404', 'page not found' errors.

Let me know what you think.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes, that's correct!

  1. It's fine if we don't have a button for admin.
  2. Yes, that's true. But since we don't share stage.datacite.org with users (only test.datacite.org) I think this is acceptable.

@codycooperross
Copy link
Copy Markdown
Contributor

Looking good! One question (in addition to Kelly's points above):

Correct me if I'm wrong, @KellyStathis , but were we also intending to add the button to the DOIs tab? As in routes like the following: /repositories/hnaj.iajgqc/dois Seeing this in the Figma here: https://www.figma.com/design/QvJSFgQzqj1139YAuooMGd/Fabrica-Links-to-Dashboard?node-id=2-90&p=f&t=GCWXAmOEj7WWJOru-0

@KellyStathis
Copy link
Copy Markdown
Collaborator

Looking good! One question (in addition to Kelly's points above):

Correct me if I'm wrong, @KellyStathis , but were we also intending to add the button to the DOIs tab? As in routes like the following: /repositories/hnaj.iajgqc/dois Seeing this in the Figma here: https://www.figma.com/design/QvJSFgQzqj1139YAuooMGd/Fabrica-Links-to-Dashboard?node-id=2-90&p=f&t=GCWXAmOEj7WWJOru-0

Yes that's right! I overlooked this in my review. It should be in both places.

@svogt0511 svogt0511 temporarily deployed to vercel-bracco-preview March 13, 2026 23:54 — with GitHub Actions Inactive
@svogt0511 svogt0511 temporarily deployed to vercel-bracco-preview March 17, 2026 00:13 — with GitHub Actions Inactive
@svogt0511 svogt0511 merged commit 00ee964 into main Mar 18, 2026
12 checks passed
@svogt0511 svogt0511 deleted the pb575-metadata-completeness branch March 18, 2026 15:21
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.

3 participants