-
Notifications
You must be signed in to change notification settings - Fork 21
1622 data query tool should have a refresh button #1635
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
Merged
krowvin
merged 7 commits into
develop
from
1622-data-query-tool-should-have-a-refresh-button
Apr 1, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8eefda6
Ensure we are using the appropriate env variables
krowvin ab55b4d
Enable the ability to disable cache with a toggle in a settings menu
krowvin ead0754
Disable auto complete/correct/capitalize - gets in the way of the sma…
krowvin 8ca8e9c
Add a toggle to enable/disable sort ascending in the table
krowvin 91e8f17
Make the table show newest values first
krowvin b5917fc
remove console
krowvin e0b32ea
Remove unused labels
krowvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| CDA_API_ROOT=https://water.dev.cwbi.us/cwms-data | ||
| VITE_CDA_API_ROOT=https://water.dev.cwbi.us/cwms-data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| CDA_API_ROOT=https://cwms-data.usace.army.mil/cwms-data | ||
| VITE_CDA_API_ROOT=https://cwms-data.usace.army.mil/cwms-data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| CDA_API_ROOT=https://cwms-data-test.cwbi.us/cwms-data | ||
| VITE_CDA_API_ROOT=https://cwms-data-test.cwbi.us/cwms-data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
cda-gui/src/pages/data-query/components/SettingsGearButton.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { forwardRef } from "react"; | ||
| import PropTypes from "prop-types"; | ||
| import { FiSettings } from "react-icons/fi"; | ||
|
|
||
| const SettingsGearButton = forwardRef(function SettingsGearButton( | ||
| { active = false, className = "", ...props }, | ||
| ref, | ||
| ) { | ||
| const activeClassName = active | ||
| ? "border-red-200 bg-red-50 text-red-600 hover:bg-red-100" | ||
| : "border-slate-300 bg-white text-slate-700 hover:bg-slate-50"; | ||
|
|
||
| return ( | ||
| <button | ||
| {...props} | ||
| ref={ref} | ||
| type="button" | ||
| className={`inline-flex items-center justify-center gap-2 rounded border px-3 py-2 shadow-sm transition ${activeClassName} ${className}`.trim()} | ||
| > | ||
| <span className="text-sm font-medium">Query Settings</span> | ||
| <FiSettings className="h-5 w-5" aria-hidden="true" /> | ||
| <span className="sr-only">Open query settings</span> | ||
| </button> | ||
| ); | ||
| }); | ||
|
|
||
| SettingsGearButton.propTypes = { | ||
| active: PropTypes.bool, | ||
| className: PropTypes.string, | ||
| }; | ||
|
|
||
| export default SettingsGearButton; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react"; | ||
| import PropTypes from "prop-types"; | ||
| import Toggle from "./Toggle"; | ||
| import SettingsGearButton from "./SettingsGearButton"; | ||
|
|
||
| export default function SettingsMenu({ | ||
| cacheEnabled, | ||
| setCacheEnabled, | ||
| sortAscending, | ||
| setSortAscending, | ||
| active, | ||
| }) { | ||
| return ( | ||
| <Menu as="div" className="relative inline-block text-left"> | ||
| <MenuButton as={SettingsGearButton} active={active} /> | ||
| <MenuItems className="absolute right-0 z-10 mt-2 w-72 rounded-md border border-slate-200 bg-white p-4 shadow-lg focus:outline-none"> | ||
| <MenuItem> | ||
| <div className="flex items-start justify-between gap-4"> | ||
| <div> | ||
| <div className="text-sm font-semibold text-slate-900">Enable cache</div> | ||
| <p className="text-xs text-slate-600"> | ||
| Use browser cache for repeated requests. Disable to force fresh fetches. | ||
| </p> | ||
| </div> | ||
| <Toggle | ||
| checked={cacheEnabled} | ||
| onChange={setCacheEnabled} | ||
| className="ml-0" | ||
| /> | ||
| </div> | ||
| </MenuItem> | ||
| <MenuItem> | ||
| <div className="mt-4 flex items-start justify-between gap-4"> | ||
| <div> | ||
| <div className="text-sm font-semibold text-slate-900"> | ||
| Descending table order | ||
| </div> | ||
| <p className="text-xs text-slate-600"> | ||
| Keep newest timestamps first. Disable to switch to oldest rows first. | ||
| </p> | ||
| </div> | ||
| <Toggle | ||
| checked={!sortAscending} | ||
| onChange={(checked) => setSortAscending(!checked)} | ||
| className="ml-0" | ||
|
krowvin marked this conversation as resolved.
|
||
| /> | ||
| </div> | ||
| </MenuItem> | ||
| </MenuItems> | ||
| </Menu> | ||
| ); | ||
| } | ||
|
|
||
| SettingsMenu.propTypes = { | ||
| active: PropTypes.bool, | ||
| cacheEnabled: PropTypes.bool.isRequired, | ||
| setCacheEnabled: PropTypes.func.isRequired, | ||
| setSortAscending: PropTypes.func.isRequired, | ||
| sortAscending: PropTypes.bool.isRequired, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.