Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Add support for adding and changing Themes-- and dark mode - #566

Merged
MikeNeilson merged 24 commits into
mainfrom
themes
Oct 25, 2025
Merged

Add support for adding and changing Themes-- and dark mode#566
MikeNeilson merged 24 commits into
mainfrom
themes

Conversation

@MikeNeilson

@MikeNeilson MikeNeilson commented Oct 11, 2025

Copy link
Copy Markdown
Collaborator

Problem Description

Fixes #562
Fixes #432

Describe the problem you are trying to solve.

Solution

  • Created SPI mechanism and jspf page to handle pulling themes from embedded jars.

  • Dark Mode Toggle

  • Adjusted modal background color classes to use generic bootstrap5 background classes instead of specific color

  • Made decodescript modal modal-xl; even on a 4k monitor it felt unusable.

  • Made all tables have stripes

  • Remove "OpenDCS -" prefix from every modal; if you don't know you're in OpenDCS by that point no additional text in a sub section header is going to help you.

  • NOTE: sidebar no longer collapses, will correct in followup PR.

Additionally corrected some incorrectly scoped jar dependencies

how you tested the change

Describe what was done to test the change. This section can be left blank
if automated tests demonstrating usage are provided in the PR.

Where the following done:

  • Tests. Check all that apply:
    • Unit tests created or modified that run during ant test.
    • Integration tests created or modified that run during integration testing
      (Formerly called regression tests.)
    • Test procedure descriptions for manual testing
  • Was relevant documentation updated?
  • Were relevant config element (e.g. XML data) updated as appropriate

If you aren't sure leave unchecked and we will help guide you to want needs changing where.

@MikeNeilson
MikeNeilson requested review from a team, krowvin and wjonassen October 11, 2025 12:53
@MikeNeilson MikeNeilson linked an issue Oct 11, 2025 that may be closed by this pull request
@MikeNeilson MikeNeilson changed the title Add support for adding and changing Themes Add support for adding and changing Themes-- and dark mode Oct 12, 2025
@MikeNeilson MikeNeilson linked an issue Oct 18, 2025 that may be closed by this pull request
@MikeNeilson

Copy link
Copy Markdown
Collaborator Author

@wjonassen FYI plan to merge this in sometime Monday morning (Pacific) baring any additional PRs with related code that was changed.

@krowvin krowvin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Few comments, but I did not pull this down and run it. Let me know if you'd like me to do an actual test.

As for the code itself, if it works I wouldn't call any of them blockers. You decide. But things like the global css on .active could bite us.

<li>
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-link="${theme.link}" aria-pressed="false">
${theme.name}
<button type="button" class="dropdown-item d-flex align-items-center ${theme.name.contains("Default") ? 'true' : 'false' }" data-bs-theme-link="${theme.link}" aria-pressed="${theme.name.contains("Default") ? 'true' : 'false' }">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I spent a minute staring at this...

Am I reading correctly that you are using a css class called true and false to set the unchecked state?

I'm sure this works but i've never really seen it done this way. Does Bootstrap use this?

I would have thought this would have been used:
https://getbootstrap.com/docs/5.0/forms/checks-radios/

Unless there's a styling thing i'm missing.

Looking at the logic you have a dynamic list of themes. You loop through them. if it is the default theme it is checked, otherwise it is not.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

... wait, no, I think that should be active.

<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-link="${theme.link}" aria-pressed="false">
${theme.name}
<button type="button" class="dropdown-item d-flex align-items-center ${theme.name.contains("Default") ? 'true' : 'false' }" data-bs-theme-link="${theme.link}" aria-pressed="${theme.name.contains("Default") ? 'true' : 'false' }">
${theme.name} <svg class="bi ms-auto d-none theme-icon" aria-hidden="true"><use href="#check2"></use></svg>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Initially I did not know what check2 was for, then I recalled it's how the icons are referenced from the rendered svg elsewhere in the page.

For future re-use perhaps checkmark instead of check2?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I considered it, may do in a follow up. Wanted to keep the elements copied from bootstrap example as close to the example as possible so I didn't just confuse myself.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Oh I see it's the second checkmark in their icon list

I didn't know what two was for us

width: 24px;
height: 24px;
width: 1.5em;
height: 1.5em;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Might be worth going through the entire codebase at some point and looking for fixed vs relative sizes (for fonts too)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Already an issue for that. #568

}

.active .bi {
display:block!important

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Important when you have to, but you can get clever with css nesting to avoid important

Many things use active and you'll end up in a place where it bites you if you make all things .active be !important

This ends up being global

Perhaps you can do

.dropdown-menu .active {
  display:block!important
}

To afford some wiggle room and prevent something else later on down the line getting forced to a block?

element.classList.remove('active')
element.setAttribute('aria-pressed', 'false')
})
console.log("hello")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Toss your logs out imo on PR so they don't get lost, harmless but not very professional in the final product

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oops, thanks.

// }
const btnToActive = document.querySelector(`[data-bs-theme-link="${theme}"]`)

document.querySelectorAll('[data-bs-theme-link]').forEach(element => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm probably missing it in this commit

But i would add a comment somewhere that this
// Resets the theme state for all clicked themes and applies the current user's selected themes

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

no, that's a good idea. I copied that from bootstrap but it took me a few minutes as well.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
12.6% Coverage on New Code (required ≥ 30%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@MikeNeilson
MikeNeilson merged commit 1c55324 into main Oct 25, 2025
9 of 10 checks passed
@MikeNeilson
MikeNeilson deleted the themes branch October 25, 2025 01:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow user to select theme (color scheme) change colors on alternating table rows

2 participants