mirror of https://github.com/hashicorp/consul
Browse Source
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 uses route.currentRoute.name over route.currentRouteName. The latter is equal to error when an error occurs whereas the former gives you the name of the route before the error happened, which is actually what we want/the intent here. ie. when `router.currentRouteName === 'error'` then `router.currentRoute.name === Name Of Route Before It Errored` it seemspull/7415/head
John Cowen
5 years ago
committed by
GitHub
7 changed files with 46 additions and 4 deletions
@ -0,0 +1,26 @@
|
||||
@setupApplicationTest |
||||
Feature: dc / error: Recovering from a dc 500 error |
||||
Background: |
||||
Given 2 datacenter models from yaml |
||||
--- |
||||
- dc-1 |
||||
- dc-500 |
||||
--- |
||||
And 3 service models |
||||
And the url "/v1/internal/ui/services" responds with a 500 status |
||||
When I visit the services page for yaml |
||||
--- |
||||
dc: dc-500 |
||||
--- |
||||
Then the url should be /dc-500/services |
||||
And the title should be "Consul" |
||||
Then I see the text "500 (The backend responded with an error)" in "[data-test-error]" |
||||
Scenario: Clicking the back to root button |
||||
Given the url "/v1/internal/ui/services" responds with a 200 status |
||||
When I click home |
||||
Then I see 3 service models |
||||
Scenario: Choosing a different dc from the dc menu |
||||
Given the url "/v1/internal/ui/services" responds with a 200 status |
||||
When I click dc on the navigation |
||||
And I click dcs.0.name |
||||
Then I see 3 service models |
@ -0,0 +1,10 @@
|
||||
import steps from '../steps'; |
||||
|
||||
// step definitions that are shared between features should be moved to the
|
||||
// tests/acceptance/steps/steps.js file
|
||||
|
||||
export default function(assert) { |
||||
return steps(assert).then('I should find a file', function() { |
||||
assert.ok(true, this.step); |
||||
}); |
||||
} |
Loading…
Reference in new issue