Commit 48c5f080972f1ddced55fdc74a5735d333170d2e

Authored by Igor Kulikov
1 parent 3ca0288f

UI: Improve dashboard state parsing.

... ... @@ -154,8 +154,18 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
154 154 result = newResult;
155 155 }
156 156
  157 + var rootStateId = dashboardUtils.getRootStateId(vm.states);
157 158 if (!result[0].id) {
158   - result[0].id = dashboardUtils.getRootStateId(vm.states);
  159 + result[0].id = rootStateId;
  160 + }
  161 + if (!vm.states[result[0].id]) {
  162 + result[0].id = rootStateId;
  163 + }
  164 + var i = result.length;
  165 + while (i--) {
  166 + if (!result[i].id || !vm.states[result[i].id]) {
  167 + result.splice(i, 1);
  168 + }
159 169 }
160 170 return result;
161 171 }
... ...
... ... @@ -205,6 +205,15 @@ export default function EntityStateController($scope, $timeout, $location, $stat
205 205 if (!result[0].id) {
206 206 result[0].id = rootStateId;
207 207 }
  208 + if (!vm.states[result[0].id]) {
  209 + result[0].id = rootStateId;
  210 + }
  211 + var i = result.length;
  212 + while (i--) {
  213 + if (!result[i].id || !vm.states[result[i].id]) {
  214 + result.splice(i, 1);
  215 + }
  216 + }
208 217 return result;
209 218 }
210 219
... ...