Skip to content

Add visibility options for record view custom menu items#9415

Open
tylerjmchugh wants to merge 7 commits into
geonetwork:mainfrom
tylerjmchugh:static-page-workflow-visibility
Open

Add visibility options for record view custom menu items#9415
tylerjmchugh wants to merge 7 commits into
geonetwork:mainfrom
tylerjmchugh:static-page-workflow-visibility

Conversation

@tylerjmchugh

@tylerjmchugh tylerjmchugh commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Static page menu items displayed in the record view menu cannot currently be configured based on the record's workflow state. This prevents custom menu items from being restricted to approved records, working copies, or records with workflow disabled.

This PR aims to fix this issue by adding the following workflow-based visibility options for record_view_menu items:

  • showWhenWorkflowDisabled
  • showOnApproved
  • showOnNonApproved

These options allow custom menu items to control whether they are displayed for each workflow state.

This is required for our custom external publishing link, which should only be displayed for approved records and should remain hidden for working copies, other non-approved records, and records with workflow disabled.

All three options default to true to maintain backwards compatibility. Existing menu items will therefore continue to display in the same workflow states as before unless the new options are explicitly configured.

Checklist

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

@tylerjmchugh
tylerjmchugh force-pushed the static-page-workflow-visibility branch from 9f93292 to 3c1256d Compare July 10, 2026 12:39
@tylerjmchugh
tylerjmchugh force-pushed the static-page-workflow-visibility branch from 6649b21 to 8c5a31d Compare July 10, 2026 13:16
@tylerjmchugh
tylerjmchugh marked this pull request as ready for review July 10, 2026 13:16
@josegar74

Copy link
Copy Markdown
Member

@tylerjmchugh please check some formatting issues in web-ui/src/main/resources/catalog/components/utility/UtilityDirective.js

See https://github.com/geonetwork/core-geonetwork/actions/runs/29095471994/job/86370837094?pr=9415

@josegar74 josegar74 added this to the 4.4.13 milestone Jul 10, 2026
return icon;
}

@Column(nullable = false, columnDefinition = "boolean default true")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When using db.migration_onstartup=false which sets hibernate.hbm2ddl.auto=validate, the new columns will not be created, probably better to add the new columns in the migration scripts.

On upgrade, Hibernate will find the entity declaring the new columns that don't exist in the DB and fail startup.

With the default db.migration_onstartup=true this problem will not happen.

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.

Fixed in latest push

var currentRecord = $scope.context.currentRecord;
if (!currentRecord.isWorkflowEnabled())
return page.showWhenWorkflowDisabled === true;
if (currentRecord.mdStatus === "2") return page.showOnApproved === true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Other places comparing mdStatus use a number value. If that is the case, strict string comparison will fail. Can you check this?

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.

Fixed in latest push

);

// Rebuild visibility-dependent menu items when context or any nested value changes.
$scope.$watch(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Deep $watch over the entire metadata record, which can be a large object, dirty-checks the whole graph on every digest and rebuilds the menu on any nested change.

Not sure why context has been changed to include all the metadata, it should be more efficient to keep as previously adding the mdStatus field that is required now.

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.

Fixed in latest push

@josegar74

Copy link
Copy Markdown
Member

@tylerjmchugh I never used the record view menu, but I have tried to created this page, that it shows properly in the header and footer, but not in the record page.

Do I miss anything?

image image

@tylerjmchugh

Copy link
Copy Markdown
Contributor Author

@tylerjmchugh please check some formatting issues in web-ui/src/main/resources/catalog/components/utility/UtilityDirective.js

See https://github.com/geonetwork/core-geonetwork/actions/runs/29095471994/job/86370837094?pr=9415

Fixed in latest push

@tylerjmchugh

tylerjmchugh commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@tylerjmchugh I never used the record view menu, but I have tried to created this page, that it shows properly in the header and footer, but not in the record page.

Do I miss anything?

image image

@josegar74 The record view custom menu field seems to be documented incorrectly. The ui help text says:

When a list is not provided, all static pages configured for the record view section are displayed, with no guaranteed order.

But this does not seem to be correct. If not provided it seems to use the standard menus and does not include any static pages. For my testing I had set the recordviewCustomMenu field to include my static page.

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