From 17f10ffd0d42746de9eef97f4062eac7a0413ed3 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Wed, 8 Apr 2020 10:56:36 +0100 Subject: [PATCH] ui: Add tab navigation to the browser history/URLs (#7592) * ui: Add tab navigation to the browser history/URLs This commit changes all our tabbed UI interfaces in the catalog to use actual URL changes rather than only updating the content in the page using CSS. Originally we had decided not to add tab clicks into the browser history for a variety of reasons. As the UI has progressed these tabs are a fairly common pattern we are using and as the UI grows and stabilizes around certain UX patterns we've decided to make these tabs 'URL changing'. Pros: - Deeplinking - Potentially smaller Route files with a more concentrated scope of the contents of a tab rather than the entire page. - Tab clicks now go into your history meaning backwards and forwards buttons take you through the tabs not just the pages. - The majority of our partials are now fully fledged templates (Octane :tada:) Cons: - Tab clicks now go into your history meaning backwards and forwards buttons take you through the tabs not just the pages. (Could be good and bad from a UX perspective) - Many more Route and Controller files (yet as mentioned above each of these have a more reduced scope) - Moving around the contents of these tabs, or changing the visual names of them means updates to the URL structure, which then should potentially entail redirects, therefore what things that seem like straightforwards design reorganizations are now a little more impactful. It was getting to the point that the Pros outweight the Cons Apart from moving some files around we made a few more tiny tweaks to get this all working: - Our freetext-filter component now performs the initial search rather than this happening in the Controller (remove of the search method in the Controllers and the new didInsertElement hook in the component) - All of the 's were changed to use its alternative href approach. - s usage was mostly removed. This is th thing I dislike the most. I think this needs removing, but I'd also like to remove the HTML it creates. You'll see that every new page is wrappe din the HTML for the old , this is to continue to use the same HTML structure and id's as before to avoid making further changes to any CSS that might use this and being able to target things during testing. We could have also removed these here, but it would have meant a much larger changeset and can just as easily be done at a later date. - We made a new `tabgroup` page-object component, which is almost identical to the previous `radiogroup` one and injected that instead where needed during testing. * Make sure we pick up indexed routes when nspaces are enabled * Move session invalidation to the child (session) route * Revert back to not using didInsertElement for updating the searching This adds a way for the searchable to remember the last search result instead, which changes less and stick to the previous method of searching. --- ui-v2/app/components/tab-nav/index.hbs | 5 +- ui-v2/app/controllers/dc/nodes/show.js | 43 +------------ .../app/controllers/dc/nodes/show/services.js | 27 ++++++++ ui-v2/app/controllers/dc/nspaces/index.js | 2 +- ui-v2/app/controllers/dc/services/instance.js | 14 +---- ui-v2/app/controllers/dc/services/show.js | 40 +----------- .../controllers/dc/services/show/instances.js | 26 ++++++++ ui-v2/app/initializers/nspace.js | 35 +++++++---- ui-v2/app/router.js | 51 ++++++++++++++++ ui-v2/app/routes/dc/nodes/show.js | 26 +------- .../app/routes/dc/nodes/show/healthchecks.js | 14 +++++ ui-v2/app/routes/dc/nodes/show/index.js | 15 +++++ ui-v2/app/routes/dc/nodes/show/metadata.js | 14 +++++ ui-v2/app/routes/dc/nodes/show/rtt.js | 24 ++++++++ ui-v2/app/routes/dc/nodes/show/services.js | 14 +++++ ui-v2/app/routes/dc/nodes/show/sessions.js | 34 +++++++++++ .../routes/dc/services/instance/addresses.js | 24 ++++++++ .../dc/services/instance/exposedpaths.js | 27 ++++++++ .../app/routes/dc/services/instance/index.js | 6 ++ .../routes/dc/services/instance/metadata.js | 14 +++++ .../routes/dc/services/instance/nodechecks.js | 14 +++++ .../dc/services/instance/servicechecks.js | 14 +++++ ui-v2/app/routes/dc/services/instance/tags.js | 14 +++++ .../routes/dc/services/instance/upstreams.js | 24 ++++++++ ui-v2/app/routes/dc/services/notfound.js | 7 +++ ui-v2/app/routes/dc/services/show.js | 6 -- ui-v2/app/routes/dc/services/show/index.js | 6 ++ .../app/routes/dc/services/show/instances.js | 20 ++++++ .../app/routes/dc/services/show/intentions.js | 14 +++++ ui-v2/app/routes/dc/services/show/routing.js | 24 ++++++++ ui-v2/app/routes/dc/services/show/tags.js | 14 +++++ .../app/templates/dc/nodes/-healthchecks.hbs | 7 --- ui-v2/app/templates/dc/nodes/-rtt.hbs | 22 ------- ui-v2/app/templates/dc/nodes/-services.hbs | 45 -------------- ui-v2/app/templates/dc/nodes/show.hbs | 29 ++++----- .../templates/dc/nodes/show/healthchecks.hbs | 11 ++++ .../{-metadata.hbs => show/metadata.hbs} | 4 ++ ui-v2/app/templates/dc/nodes/show/rtt.hbs | 26 ++++++++ .../app/templates/dc/nodes/show/services.hbs | 49 +++++++++++++++ .../{-sessions.hbs => show/sessions.hbs} | 5 +- .../app/templates/dc/services/-addresses.hbs | 25 -------- .../templates/dc/services/-exposedpaths.hbs | 33 ---------- .../app/templates/dc/services/-instances.hbs | 57 ----------------- .../app/templates/dc/services/-nodechecks.hbs | 8 --- ui-v2/app/templates/dc/services/-routing.hbs | 1 - .../templates/dc/services/-servicechecks.hbs | 8 --- ui-v2/app/templates/dc/services/-tags.hbs | 7 --- .../app/templates/dc/services/-upstreams.hbs | 39 ------------ ui-v2/app/templates/dc/services/instance.hbs | 31 ++++------ .../dc/services/instance/addresses.hbs | 29 +++++++++ .../dc/services/instance/exposedpaths.hbs | 37 +++++++++++ .../dc/services/instance/metadata.hbs | 32 ++++++++++ .../dc/services/instance/nodechecks.hbs | 12 ++++ .../dc/services/instance/servicechecks.hbs | 11 ++++ .../templates/dc/services/instance/tags.hbs | 11 ++++ .../dc/services/instance/upstreams.hbs | 43 +++++++++++++ ui-v2/app/templates/dc/services/show.hbs | 23 +++---- .../templates/dc/services/show/instances.hbs | 61 +++++++++++++++++++ .../templates/dc/services/show/routing.hbs | 6 ++ ui-v2/app/templates/dc/services/show/tags.hbs | 11 ++++ ui-v2/app/utils/routing/redirect-to.js | 9 +++ ui-v2/app/utils/search/filterable.js | 6 +- .../acceptance/components/copy-button.feature | 2 +- .../tests/acceptance/dc/list-blocking.feature | 8 +-- .../dc/nodes/sessions/invalidate.feature | 6 +- ui-v2/tests/acceptance/dc/nodes/show.feature | 2 +- .../dc/services/instances/error.feature | 2 +- .../dc/services/instances/gateway.feature | 2 +- .../dc/services/instances/proxy.feature | 6 +- .../dc/services/instances/show.feature | 8 +-- .../services/instances/sidecar-proxy.feature | 2 +- .../dc/services/instances/with-proxy.feature | 2 +- .../services/instances/with-sidecar.feature | 4 +- .../dc/services/show-with-slashes.feature | 2 +- .../tests/acceptance/dc/services/show.feature | 1 + .../tests/acceptance/page-navigation.feature | 6 +- ui-v2/tests/lib/page-object/tabgroup.js | 24 ++++++++ ui-v2/tests/pages.js | 7 ++- ui-v2/tests/pages/dc/nodes/show.js | 4 +- ui-v2/tests/pages/dc/services/instance.js | 6 +- ui-v2/tests/pages/dc/services/show.js | 4 +- 81 files changed, 931 insertions(+), 477 deletions(-) create mode 100644 ui-v2/app/controllers/dc/nodes/show/services.js create mode 100644 ui-v2/app/controllers/dc/services/show/instances.js create mode 100644 ui-v2/app/routes/dc/nodes/show/healthchecks.js create mode 100644 ui-v2/app/routes/dc/nodes/show/index.js create mode 100644 ui-v2/app/routes/dc/nodes/show/metadata.js create mode 100644 ui-v2/app/routes/dc/nodes/show/rtt.js create mode 100644 ui-v2/app/routes/dc/nodes/show/services.js create mode 100644 ui-v2/app/routes/dc/nodes/show/sessions.js create mode 100644 ui-v2/app/routes/dc/services/instance/addresses.js create mode 100644 ui-v2/app/routes/dc/services/instance/exposedpaths.js create mode 100644 ui-v2/app/routes/dc/services/instance/index.js create mode 100644 ui-v2/app/routes/dc/services/instance/metadata.js create mode 100644 ui-v2/app/routes/dc/services/instance/nodechecks.js create mode 100644 ui-v2/app/routes/dc/services/instance/servicechecks.js create mode 100644 ui-v2/app/routes/dc/services/instance/tags.js create mode 100644 ui-v2/app/routes/dc/services/instance/upstreams.js create mode 100644 ui-v2/app/routes/dc/services/notfound.js create mode 100644 ui-v2/app/routes/dc/services/show/index.js create mode 100644 ui-v2/app/routes/dc/services/show/instances.js create mode 100644 ui-v2/app/routes/dc/services/show/intentions.js create mode 100644 ui-v2/app/routes/dc/services/show/routing.js create mode 100644 ui-v2/app/routes/dc/services/show/tags.js delete mode 100644 ui-v2/app/templates/dc/nodes/-healthchecks.hbs delete mode 100644 ui-v2/app/templates/dc/nodes/-rtt.hbs delete mode 100644 ui-v2/app/templates/dc/nodes/-services.hbs create mode 100644 ui-v2/app/templates/dc/nodes/show/healthchecks.hbs rename ui-v2/app/templates/dc/nodes/{-metadata.hbs => show/metadata.hbs} (63%) create mode 100644 ui-v2/app/templates/dc/nodes/show/rtt.hbs create mode 100644 ui-v2/app/templates/dc/nodes/show/services.hbs rename ui-v2/app/templates/dc/nodes/{-sessions.hbs => show/sessions.hbs} (96%) delete mode 100644 ui-v2/app/templates/dc/services/-addresses.hbs delete mode 100644 ui-v2/app/templates/dc/services/-exposedpaths.hbs delete mode 100644 ui-v2/app/templates/dc/services/-instances.hbs delete mode 100644 ui-v2/app/templates/dc/services/-nodechecks.hbs delete mode 100644 ui-v2/app/templates/dc/services/-routing.hbs delete mode 100644 ui-v2/app/templates/dc/services/-servicechecks.hbs delete mode 100644 ui-v2/app/templates/dc/services/-tags.hbs delete mode 100644 ui-v2/app/templates/dc/services/-upstreams.hbs create mode 100644 ui-v2/app/templates/dc/services/instance/addresses.hbs create mode 100644 ui-v2/app/templates/dc/services/instance/exposedpaths.hbs create mode 100644 ui-v2/app/templates/dc/services/instance/metadata.hbs create mode 100644 ui-v2/app/templates/dc/services/instance/nodechecks.hbs create mode 100644 ui-v2/app/templates/dc/services/instance/servicechecks.hbs create mode 100644 ui-v2/app/templates/dc/services/instance/tags.hbs create mode 100644 ui-v2/app/templates/dc/services/instance/upstreams.hbs create mode 100644 ui-v2/app/templates/dc/services/show/instances.hbs create mode 100644 ui-v2/app/templates/dc/services/show/routing.hbs create mode 100644 ui-v2/app/templates/dc/services/show/tags.hbs create mode 100644 ui-v2/app/utils/routing/redirect-to.js create mode 100644 ui-v2/tests/lib/page-object/tabgroup.js diff --git a/ui-v2/app/components/tab-nav/index.hbs b/ui-v2/app/components/tab-nav/index.hbs index 70c098f23..f50e91f45 100644 --- a/ui-v2/app/components/tab-nav/index.hbs +++ b/ui-v2/app/components/tab-nav/index.hbs @@ -1,7 +1,10 @@