Created
November 1, 2017 20:06
-
-
Save anonymous/eae614f5c7be9e8de15c46aed31f503e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ba845a53e48615839bbac7dfef785011aa0f2163 Mon Sep 17 00:00:00 2001 | |
From: =?utf8?q?Mathieu=20Gagne=CC=81?= <mgagne@iweb.com> | |
Date: Tue, 11 Jul 2017 15:48:19 -0400 | |
Subject: [PATCH] Find latest index before splicing non-ready steps in wizard | |
When splicing more than 1 step, the index of the following steps | |
are shifted. This means index won't be valid anymore. | |
This change makes it so the index of the step to be removed is determined | |
against the current $scope.steps to avoid stalled index. | |
Change-Id: Iabfdd3445117b898251782969c3d915b802f440e | |
--- | |
horizon/static/framework/widgets/wizard/wizard.controller.js | 7 ++++++- | |
1 file changed, 6 insertions(+), 1 deletion(-) | |
diff --git a/horizon/static/framework/widgets/wizard/wizard.controller.js b/horizon/static/framework/widgets/wizard/wizard.controller.js | |
index e9f586e..e31d2fd 100644 | |
--- a/horizon/static/framework/widgets/wizard/wizard.controller.js | |
+++ b/horizon/static/framework/widgets/wizard/wizard.controller.js | |
@@ -192,7 +192,12 @@ | |
step.ready = true; | |
}, | |
function() { | |
- $scope.steps.splice(index, 1); | |
+ for (var i = $scope.steps.length - 1; i >= 0; i--) { | |
+ if ($scope.steps[i].id === step.id) { | |
+ $scope.steps.splice(i, 1); | |
+ break; | |
+ } | |
+ } | |
} | |
); | |
} | |
-- | |
1.9.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment