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

Configuration to display an application banner #8416

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

josegar74
Copy link
Member

@josegar74 josegar74 commented Oct 9, 2024

In certain cases can be relevant to display a banner in the application to inform users, for example of a maintenance task.

This change request adds a new setting to enable an application banner and configure the text to display.

configuration-banner-1

configuration-banner-2

The banner is displayed in the public pages.

banner-1

banner-2

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

Copy link
Member

@fxprunayre fxprunayre left a comment

Choose a reason for hiding this comment

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

LGTM. One limitation is that the message is not multilingual. One option would be to use the service description of the catalogue like we do here https://github.com/geonetwork/core-geonetwork/blob/main/web-ui/src/main/resources/catalog/views/default/templates/home.html#L9 but not sure it worth it?

@josegar74
Copy link
Member Author

I was thinking to configure a translation-key in the database and use it. I'll check to update the pull request with this.

@fxprunayre
Copy link
Member

I was thinking to configure a translation-key in the database and use it. I'll check to update the pull request with this.

yep maybe a translation key can be good enough and will be display in main catalogue and portal more easily.

@josegar74
Copy link
Member Author

@fxprunayre updated to use a translation key

@MichelGabriel
Copy link
Contributor

@josegar74 I had a go at the styling and looked at how GitHub did it. I used the same yellow background for a better contrast of background and foreground.

For now the text is always displayed as bolder. I would leave that up to the user who writes the text for the banner. You can add html elements, like <b> in the translation.

This is the css I used:

.application-banner {
  background-color: #fff8c5;
  border: 1px solid #d4a72c66;
  margin: 15px;
  padding: 15px;
  border-radius: 4px;
  color: #000;
}

@josegar74
Copy link
Member Author

@MichelGabriel, thanks. I've updated the styling.

@josegar74 josegar74 merged commit cd50ded into geonetwork:main Nov 4, 2024
6 checks passed
@geonetworkbuild
Copy link
Collaborator

The backport to 4.2.x failed:

The process '/usr/bin/git' failed with exit code 1
stderr
error: could not apply 832a023532... Add configuration to display an application banner
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config advice.mergeConflict false"

stdout
Auto-merging web-ui/src/main/resources/catalog/locales/en-admin.json
Auto-merging web-ui/src/main/resources/catalog/templates/admin/settings/system.html
Auto-merging web-ui/src/main/resources/catalog/views/default/directives/directive.js
Auto-merging web/src/main/webapp/WEB-INF/classes/setup/sql/data/data-db-default.sql
CONFLICT (modify/delete): web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v446/migrate-default.sql deleted in HEAD and modified in 832a023532 (Add configuration to display an application banner).  Version 832a023532 (Add configuration to display an application banner) of web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v446/migrate-default.sql left in tree.

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.2.x 4.2.x
# Navigate to the new working tree
cd .worktrees/backport-4.2.x
# Create a new branch
git switch --create backport-8416-to-4.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 832a023532758c933374ceb590b0b5e2e93707fa,a4d680ed0e6615ea54d96b489a9dea22258536ff,59896f2dbd17a72acae9371989b1e7e1197b0fd2,33ec70b589eee50efb74732ad1324a50c096bf37
# Push it to GitHub
git push --set-upstream origin backport-8416-to-4.2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.2.x

Then, create a pull request where the base branch is 4.2.x and the compare/head branch is backport-8416-to-4.2.x.

josegar74 added a commit that referenced this pull request Nov 6, 2024
* Add configuration to display an application banner

* Add configuration to display an application banner - use translations for the message

* Application banner - update style
josegar74 added a commit to GeoCat/core-geonetwork that referenced this pull request Nov 6, 2024
josegar74 added a commit that referenced this pull request Nov 6, 2024
josegar74 added a commit that referenced this pull request Nov 6, 2024
* Add configuration to display an application banner

* Add configuration to display an application banner - use translations for the message

* Application banner - update style
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.

4 participants