Skip to content

Various UI fixes, test refactoring, and feature improvements #68

Open
PaulJouvanceau wants to merge 24 commits into
opensvc:mainfrom
PaulJouvanceau:dev
Open

Various UI fixes, test refactoring, and feature improvements #68
PaulJouvanceau wants to merge 24 commits into
opensvc:mainfrom
PaulJouvanceau:dev

Conversation

@PaulJouvanceau
Copy link
Copy Markdown
Contributor

UI Improvements
Fix Safari badge overflow issue and align badges to the bottom of stat elements

Increase z-index of all action menus to appear above EventLog

Highlight destructive actions in red and move them to the bottom of menus

Features
Add replace mode to setInstanceStatuses and use it on initial fetch

Sort instances alphabetically in ObjectDetail

Testing & Refactoring
Reorganize ObjectDetails.test and reduce duplication

Refactor eventSourceManager test suite for brevity and maintainability

Rewrite Objects tests for clarity and maintainability

Improve test coverage for ActionDialogs

Optimize and fix App.test.jsx coverage

Other
Delete unused patch action

… cards

- StatCard: add `dynamicHeight` prop (default false) to toggle between fixed height (240px) and flexible height (auto with min-height 240px)
- StatCard: use flex layout with `justifyContent: flex-end` to push subtitle content (badges) to the bottom of the card
- StatCard: wrap subtitle in inner div with `overflowY: auto` and `maxHeight: 100%` to enable scrolling when many badges are present; add `minHeight: 0` for Safari overflow compatibility
- GridNamespaces & GridKinds: set `dynamicHeight={true}` to allow their cards to grow vertically when needed
- Other grids (Nodes, Objects, Heartbeats, Pools, Networks) keep fixed height (240px)
- NamespaceChip and KindChip retain absolute positioning for status indicators (colored circles) to preserve original design

This resolves the Safari-specific issue where badges would overflow outside the cards and ensures all badge content stays within the card boundaries. Badges are now consistently aligned at the bottom of each card, with scrollbars appearing only when necessary.
- Group mocks and helpers for better readability
- Add reusable helpers (renderReadySvc, executeObjectAction, mockNetworkFailure, captureSubscription)
- Replace repetitive test blocks with test.each and describe.each
- Consolidate console and action error handling tests
- Remove redundant assertions and improve overall test structure
…nability

- Extract `getHandler` helper to reduce repetitive mock access patterns
- Consolidate multiple similar test cases into single, data-driven tests
- Simplify `afterEach` state restoration (use `Object.assign` for console)
- Remove redundant assertions and duplicated coverage scenarios
- Improve test naming and grouping for better readability
- Extract a shared `setup` helper and a `defaultState` object to eliminate
  repetitive mock and state initialization
- Add utility functions (`waitForLoad`, `selectFilter`, `selectRow`,
  `openActionsMenu`, `clickMenuItem`, `confirmDialog`) to reduce boilerplate
- Parametrize filter tests using `test.each` instead of duplicating test cases
- Group related tests into logical `describe` blocks (filtering, actions,
  sorting, etc.)
- Remove redundant or overly specific tests while preserving coverage
- Simplify console.error suppression and mock lifecycle management
…etch

- Extend setInstanceStatuses with optional 'replace' parameter to fully
  overwrite instance data for a path instead of merging incrementally.
- Use replace=true in fetchInitialObjectData to replace stale instance
  statuses with fresh API data, eliminating display of obsolete nodes.
- Simplify nodesList computation to directly depend on objectInstanceStatus.
…m of menus

- Reorder OBJECT_ACTIONS: move 'delete' and 'purge' to the end, add color:'red'
- Reorder NODE_ACTIONS: move 'delete' to the end, add color:'red'

Apply red styling and bottom positioning in all menus:
- Objects.js: global actions menu and per-row actions menu
- HeaderSection.js: object actions menu (Popper)
- NodeRow.jsx: per-node actions menu
- NodesTable.jsx: batch actions menu on selected nodes
- ObjectDetail.js: instance actions and resource actions menus
- ObjectInstanceView.js: instance actions and resource actions menus

All destructive actions (purge, delete) now appear in red (error.main)
and are consistently placed at the bottom of action lists.
…gger

- Set zIndex: 10000 on all Menu and Popper components across the app
- EventLogger button has zIndex: 9999, menus now properly overlay it
- Affected files: Objects.js, HeaderSection.js, NodeRow.jsx, NodesTable.jsx,
  ObjectDetail.js, ObjectInstanceView.js

Previously, action menus were hidden behind the EventLogger button.
Now all action menus (global, per-object, per-node, instance, resource)
display correctly on top.
Added .sort() to nodesList useMemo to display instance cards in alphabetical order.
Refactor App.test.jsx for brevity and correctness without reducing coverage.

Optimizations:
- Extract setupBasicAuth(), setupOidcAuth(), and renderApp() helpers to
  eliminate repeated setup code across tests
- Collapse protected and unprotected route tests into two test.each blocks
- Merge redundant tests covering the same code paths from different angles
- Combine multi-assertion tests where behavior belongs to a single concern

Bug fixes:
- Mock logger.js directly instead of spying on console.* methods; logger
  captures a reference to console at import time so jest.spyOn patches
  arrive too late and assertions see 0 calls
- Replace jest.clearAllMocks() / mockReset() with mockClear() in beforeEach;
  mockReset strips mock implementations (including jest.mock factories and
  spy mockImplementation) causing oidcConfiguration and consoleSpy to lose
  their behavior between tests
- Replace mockImplementationOnce(() => null) on the authInfo hook with a
  persistent mockImplementation for the duration of the test; the hook is
  called on every re-render so a one-shot mock is exhausted before the
  effect under test fires
- Add missing branch coverage for handleCheckAuthOnResume: OIDC resume with
  no token on focus, OIDC resume with null userManager, silent renew
  returning a still-expired user, and the warn log on that path
- Simplify storage event test to assert on localStorage.getItem instead of
  filtering console.debug call history, removing fragile coupling to logger
  internals
… cards

- StatCard: add `dynamicHeight` prop (default false) to toggle between fixed height (240px) and flexible height (auto with min-height 240px)
- StatCard: use flex layout with `justifyContent: flex-end` to push subtitle content (badges) to the bottom of the card
- StatCard: wrap subtitle in inner div with `overflowY: auto` and `maxHeight: 100%` to enable scrolling when many badges are present; add `minHeight: 0` for Safari overflow compatibility
- GridNamespaces & GridKinds: set `dynamicHeight={true}` to allow their cards to grow vertically when needed
- Other grids (Nodes, Objects, Heartbeats, Pools, Networks) keep fixed height (240px)
- NamespaceChip and KindChip retain absolute positioning for status indicators (colored circles) to preserve original design

This resolves the Safari-specific issue where badges would overflow outside the cards and ensures all badge content stays within the card boundaries. Badges are now consistently aligned at the bottom of each card, with scrollbars appearing only when necessary.
- Group mocks and helpers for better readability
- Add reusable helpers (renderReadySvc, executeObjectAction, mockNetworkFailure, captureSubscription)
- Replace repetitive test blocks with test.each and describe.each
- Consolidate console and action error handling tests
- Remove redundant assertions and improve overall test structure
…nability

- Extract `getHandler` helper to reduce repetitive mock access patterns
- Consolidate multiple similar test cases into single, data-driven tests
- Simplify `afterEach` state restoration (use `Object.assign` for console)
- Remove redundant assertions and duplicated coverage scenarios
- Improve test naming and grouping for better readability
- Extract a shared `setup` helper and a `defaultState` object to eliminate
  repetitive mock and state initialization
- Add utility functions (`waitForLoad`, `selectFilter`, `selectRow`,
  `openActionsMenu`, `clickMenuItem`, `confirmDialog`) to reduce boilerplate
- Parametrize filter tests using `test.each` instead of duplicating test cases
- Group related tests into logical `describe` blocks (filtering, actions,
  sorting, etc.)
- Remove redundant or overly specific tests while preserving coverage
- Simplify console.error suppression and mock lifecycle management
…etch

- Extend setInstanceStatuses with optional 'replace' parameter to fully
  overwrite instance data for a path instead of merging incrementally.
- Use replace=true in fetchInitialObjectData to replace stale instance
  statuses with fresh API data, eliminating display of obsolete nodes.
- Simplify nodesList computation to directly depend on objectInstanceStatus.
…m of menus

- Reorder OBJECT_ACTIONS: move 'delete' and 'purge' to the end, add color:'red'
- Reorder NODE_ACTIONS: move 'delete' to the end, add color:'red'

Apply red styling and bottom positioning in all menus:
- Objects.js: global actions menu and per-row actions menu
- HeaderSection.js: object actions menu (Popper)
- NodeRow.jsx: per-node actions menu
- NodesTable.jsx: batch actions menu on selected nodes
- ObjectDetail.js: instance actions and resource actions menus
- ObjectInstanceView.js: instance actions and resource actions menus

All destructive actions (purge, delete) now appear in red (error.main)
and are consistently placed at the bottom of action lists.
…gger

- Set zIndex: 10000 on all Menu and Popper components across the app
- EventLogger button has zIndex: 9999, menus now properly overlay it
- Affected files: Objects.js, HeaderSection.js, NodeRow.jsx, NodesTable.jsx,
  ObjectDetail.js, ObjectInstanceView.js

Previously, action menus were hidden behind the EventLogger button.
Now all action menus (global, per-object, per-node, instance, resource)
display correctly on top.
Added .sort() to nodesList useMemo to display instance cards in alphabetical order.
Refactor App.test.jsx for brevity and correctness without reducing coverage.

Optimizations:
- Extract setupBasicAuth(), setupOidcAuth(), and renderApp() helpers to
  eliminate repeated setup code across tests
- Collapse protected and unprotected route tests into two test.each blocks
- Merge redundant tests covering the same code paths from different angles
- Combine multi-assertion tests where behavior belongs to a single concern

Bug fixes:
- Mock logger.js directly instead of spying on console.* methods; logger
  captures a reference to console at import time so jest.spyOn patches
  arrive too late and assertions see 0 calls
- Replace jest.clearAllMocks() / mockReset() with mockClear() in beforeEach;
  mockReset strips mock implementations (including jest.mock factories and
  spy mockImplementation) causing oidcConfiguration and consoleSpy to lose
  their behavior between tests
- Replace mockImplementationOnce(() => null) on the authInfo hook with a
  persistent mockImplementation for the duration of the test; the hook is
  called on every re-render so a one-shot mock is exhausted before the
  effect under test fires
- Add missing branch coverage for handleCheckAuthOnResume: OIDC resume with
  no token on focus, OIDC resume with null userManager, silent renew
  returning a still-expired user, and the warn log on that path
- Simplify storage event test to assert on localStorage.getItem instead of
  filtering console.debug call history, removing fragile coupling to logger
  internals
…ltering

Previously, ObjectDetail manually constructed event filter strings with
path=... but these were invalidated by createQueryString, causing SSE to
receive events for all objects. Now startEventReception accepts an optional
objectName parameter that is correctly handled by createQueryString to
generate proper path-specific filters.

- eventSourceManager.jsx: startEventReception now takes a third argument
  objectName and passes it to configureEventSource.
- ObjectDetail.jsx: simplified useEffect to call startEventReception with
  decodedObjectName instead of manually building filter strings.
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.

1 participant