Skip to content
Snippets Groups Projects
Commit 1eb1b4f6 authored by John Cowen's avatar John Cowen
Browse files

ui: Enable recovery from a unreachable datacenter (500 error)

For URL maintenance reasons we store the last visited DC in
localStorage incase you come back to a page (for example settings) that
doesn't have a dc in the URL.

A problem arises here if the last DC you tried to visit is unreachable.

The first fix here clears out the last visited DC from localStorage if
the API has errored out.

Secondly, our `href-mut` helper which mutates the current current and
replaces 'parts' in the URL rather than the whole thing functioned by
detecting the current route/URL you are on an 'mutating' that. A problem
arose here as even though you might be on the `/ui/dc-1/services` URL the
actual route is the 'error' route which does not have a URL that can be
changed properly.

The second fix here changes the arguments that href-mut accepts to
`{{href-mut fallbackRouteName, hashOfThingsToReplace}}`. If the route is the
error route it will use the fallbackRouteName. Although it seems strange
we decided to put the fallbackRoute as the first argument so it looks
similar to the normal `{{href-to}}` helper.

Acceptance tests included here to replicate the original bug report.
parent c5fe112e
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment