Skip to content

feat: rework the NetworkMock UI for specs and versions #79

Description

@MaxMichel2

Part of #72

Depends on #2, #3, #4, #5.

Summary

Rework the devview-networkmock UI so tabs are one-per-spec instead of one-per-group×environment, add a version chip/filter driven by #5's version tag, and add search — the current UI has none, which was tolerable for a handful of hand-written endpoints but won't be once a real OpenAPI spec contributes potentially hundreds of operations.

Current state

  • NetworkMockScreen.kt (devview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/NetworkMockScreen.kt) renders a PrimaryScrollableTabRow (:151-165) with one tab per group×environment combination, labeled "${group.name} — ${environment.name}" (viewmodel/NetworkMockViewModel.kt:98). Each tab's HorizontalPager page (:166-203) shows a flat LazyColumn of EndpointCards (:182-193) — no search, no filter.
  • GroupEnvironmentUiModel (devview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/model/GroupEnvironmentUiModel.kt:19-27) carries groupId, environmentId, name, url, endpoints — becomes ApiSpecUiModel per ✨ Add Renovate config #3, dropping environmentId.
  • NetworkMockViewModel.loadConfiguration() (devview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/viewmodel/NetworkMockViewModel.kt:138-193) currently registers and discovers response files for every group × environment × endpoint combination eagerly — this loop simplifies once the environment axis (Feature/feature flip #2) and probing (Feature/analytics #4) are both gone, but double check the resulting complexity here (should now be roughly specs × operations, driven by declared responses rather than probed ones).
  • EndpointCard.kt, EndpointStateChip.kt — per-row display components that will need a version chip added.

What to build

  1. Tabs become one per spec. PrimaryScrollableTabRow renders ApiSpecUiModel.name (i.e. info.title) per tab, not "group — environment".
  2. Version chip per operation row, using Operation.version from Feature/documentation #5. Operations with version == null show no chip.
  3. Version filter — since one spec's tab can now contain both v1 and v2 operations side by side (per the epic's "one spec = one group" decision), add a filter control (chips or a dropdown) scoped to the currently-visible tab: "All / v1 / v2 / ...", derived from the distinct versions present among that tab's operations.
  4. Search — a search field (likely in the top bar or above the tab row) that filters the visible operation list by name/path/operationId, live as the user types. This is a plain client-side filter over already-loaded data; no new data-loading path needed.

Explicitly out of scope here

Acceptance criteria

  • Tabs are one per ApiSpec, no environment axis visible anywhere in the UI.
  • Each operation row shows a version chip when Operation.version != null.
  • A version filter narrows the visible operation list within the active tab.
  • A search field filters the visible operation list by name/path/operationId.
  • Existing device tests (NetworkMockScreenTest.kt, EndpointCardTest.kt, EndpointStateChipTest.kt) are updated for the new tab/model shape; new tests cover the version filter and search.
  • Manually verified in the sample app: run sample:androidApp, open DevView → Network Mock, confirm spec tabs (no environment tabs), version chips on the migrated sample's v1/v2 profile operations (see ⬆️ Update kotlin #8), and that search narrows the list as expected.

Files likely touched

  • devview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/NetworkMockScreen.kt
  • devview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/model/GroupEnvironmentUiModel.kt (renamed per ✨ Add Renovate config #3)
  • devview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/viewmodel/NetworkMockViewModel.kt
  • devview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/components/EndpointCard.kt
  • devview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/components/EndpointStateChip.kt
  • Device tests under devview-networkmock/src/androidDeviceTest/...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions