Browse Source

UI: Improve dashboard state parsing.

pull/295/merge
Igor Kulikov 9 years ago
parent
commit
48c5f08097
  1. 12
      ui/src/app/dashboard/states/default-state-controller.js
  2. 9
      ui/src/app/dashboard/states/entity-state-controller.js

12
ui/src/app/dashboard/states/default-state-controller.js

@ -154,8 +154,18 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
result = newResult;
}
var rootStateId = dashboardUtils.getRootStateId(vm.states);
if (!result[0].id) {
result[0].id = dashboardUtils.getRootStateId(vm.states);
result[0].id = rootStateId;
}
if (!vm.states[result[0].id]) {
result[0].id = rootStateId;
}
var i = result.length;
while (i--) {
if (!result[i].id || !vm.states[result[i].id]) {
result.splice(i, 1);
}
}
return result;
}

9
ui/src/app/dashboard/states/entity-state-controller.js

@ -205,6 +205,15 @@ export default function EntityStateController($scope, $timeout, $location, $stat
if (!result[0].id) {
result[0].id = rootStateId;
}
if (!vm.states[result[0].id]) {
result[0].id = rootStateId;
}
var i = result.length;
while (i--) {
if (!result[i].id || !vm.states[result[i].id]) {
result.splice(i, 1);
}
}
return result;
}

Loading…
Cancel
Save