Revert "Add check for old options"

This reverts commit 24e56dfe78. Caused https://github.com/weaveworks/service-ui/issues/401 and was meant to be temprorary anyway.
This commit is contained in:
jpellizzari
2017-05-02 17:18:40 -07:00
parent ee084dffd6
commit bf83f2eaff

View File

@@ -1,5 +1,4 @@
import page from 'page';
import { each } from 'lodash';
import { route } from '../actions/app-actions';
import { storageGet, storageSet } from './storage-utils';
@@ -89,20 +88,6 @@ export function updateRoute(getState) {
}
}
// Temporarily detect old topology options to avoid breaking things between releases
// Related to https://github.com/weaveworks/scope/pull/2404
function detectOldOptions(topologyOptions) {
let bad = false;
each(topologyOptions, (topology) => {
each(topology, (option) => {
if (typeof option === 'string') {
bad = true;
}
});
});
return bad;
}
export function getRouter(dispatch, initialState) {
// strip any trailing '/'s.
@@ -112,16 +97,11 @@ export function getRouter(dispatch, initialState) {
// recover from storage state on empty URL
const storageState = storageGet(STORAGE_STATE_KEY);
if (storageState) {
// push storage state to URL
window.location.hash = `!/state/${storageState}`;
const parsedState = JSON.parse(decodeURL(storageState));
const dirtyOptions = detectOldOptions(parsedState.topologyOptions);
if (dirtyOptions) {
dispatch(route(initialState));
} else {
const mergedState = Object.assign(initialState, parsedState);
// push storage state to URL
window.location.hash = `!/state/${JSON.stringify(mergedState)}`;
dispatch(route(mergedState));
}
const mergedState = Object.assign(initialState, parsedState);
dispatch(route(mergedState));
} else {
dispatch(route(initialState));
}
@@ -129,12 +109,7 @@ export function getRouter(dispatch, initialState) {
page('/state/:state', (ctx) => {
const state = JSON.parse(decodeURL(ctx.params.state));
const dirtyOptions = detectOldOptions(state.topologyOptions);
if (dirtyOptions) {
dispatch(route(initialState));
} else {
dispatch(route(state));
}
dispatch(route(state));
});
return page;