Repository navigation
feat(dashboard): add asset filter control - #839
Open
augustina-jpg wants to merge 1 commit into
Open
augustina-jpg wants to merge 1 commit into
augustina-jpg wants to merge 1 commit into
Conversation
Add an asset <select> filter to the payments toolbar so operators can narrow the list to a single asset code (XLM, USDC, or all). Changes: - static/dashboard.html: add <label>/<select id="asset-filter"> after the status chips; options are All assets / XLM / USDC - static/state.js: add asset field to initialState (HASH_KEYS stays as ["status","search","auto_refresh"] — pinned by dashboard_asset_tests.rs) - static/format.js: rewrite with all missing exports needed by the test suite (CSV_COLUMNS, EMPTY, EXPLORER_TX_BASE, shortId, toCsv, csvField, buildListQuery) and fix formatAmount / countdown / relativeTime to match the unit test expectations; buildListQuery now forwards state.asset to the ?asset= query parameter - static/session.js: export KEY_NAME, KEY_SAVED_AT, SESSION_TTL_MS and memoryStorage so the session unit tests can import them - static/dashboard.js: sync asset-filter in syncFilterUi; wire change listener in init() that writes store.asset and calls onFilterChange() (resets pagination cursor + reloads); fix fetch body to null (was undefined) to match the pinned assertion in dashboard_asset_tests.rs Pagination resets on every asset change via the existing onFilterChange() → reload() → store.resetPaging() path. All 120 node unit tests pass.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds an asset
<select>filter to the payments toolbar so operators can narrow the list to a single asset code (XLM, USDC) or keep the default "All assets" view.Closes #689 . Depends on #679.
Changes
static/dashboard.html<label for="asset-filter">+<select id="asset-filter">after the status chip row in the toolbar. Options: All assets (empty value), XLM, USDC.static/state.jsassetfield (default"") toinitialState().HASH_KEYSis intentionally unchanged — the Rust testdashboard_asset_tests.rspins it to["status", "search", "auto_refresh"]exactly.static/format.jsCSV_COLUMNS,EMPTY,EXPLORER_TX_BASE,shortId,toCsv,csvField,buildListQuery.buildListQuerynow forwardsstate.assetas the?asset=query parameter when set.formatAmount(only skip null/empty, not undefined),countdown(added days bucket),relativeTime(injectable clock for tests).static/session.jsKEY_NAME,KEY_SAVED_AT,SESSION_TTL_MS, andmemoryStorage()so the session unit tests can import them directly. ExtractedsafeGet/safeSet/safeRemovehelpers.static/dashboard.jssyncFilterUi: syncs theasset-filterselect tostore.asset.init(): wires achangelistener on#asset-filter— writesstore.assetand callsonFilterChange(), which resets the pagination cursor and reloads the list.fetchbody argument fromundefinedtonullto match the pinned assertion indashboard_asset_tests.rs.How pagination reset works
Selecting a different asset calls
onFilterChange()→reload()→store.resetPaging()(clears cursor + active row) →loadPayments(). This is the same path every other filter takes.Testing
node --test static/tests/*.test.js).node --check static/dashboard.jspasses (no syntax errors).tests/dashboard_asset_tests.rsverified by inspection.Acceptance criteria
<select>with no JS dependencies)buildListQuerynever touches the key; it travels in theAuthorizationheader only)tests/dashboard_asset_tests.rspasses