This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git
The following commit(s) were added to refs/heads/master by this push: new 84c0a02a make sure scope apply is invoked if we change scope vars in a promise callback new 796a4c56 Merge branch 'master' of https://gitbox.apache.org/repos/asf/brooklyn-ui 84c0a02a is described below commit 84c0a02a42096105a8e4c66c75100a9c45a5ca5b Author: Alex Heneveld <g...@alex.heneveld.org> AuthorDate: Thu Sep 5 16:49:39 2024 +0100 make sure scope apply is invoked if we change scope vars in a promise callback --- ui-modules/utils/quick-launch/quick-launch.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui-modules/utils/quick-launch/quick-launch.js b/ui-modules/utils/quick-launch/quick-launch.js index 6f8c341f..f3b1568d 100644 --- a/ui-modules/utils/quick-launch/quick-launch.js +++ b/ui-modules/utils/quick-launch/quick-launch.js @@ -43,11 +43,11 @@ export function quickLaunchDirective() { args: '=?', // default behaviour of code is: { noEditButton: false, noComposerButton: false, noCreateLocationLink: false, location: null } callback: '=?', }, - controller: ['$scope', '$http', '$location', 'brSnackbar', 'brBrandInfo' , 'quickLaunchOverrides', controller], + controller: ['$scope', '$http', '$location', '$timeout', 'brSnackbar', 'brBrandInfo' , 'quickLaunchOverrides', controller], controllerAs: 'vm', }; - function controller($scope, $http, $location, brSnackbar, brBrandInfo, quickLaunchOverrides) { + function controller($scope, $http, $location, $timeout, brSnackbar, brBrandInfo, quickLaunchOverrides) { let quickLaunch = this; @@ -210,6 +210,7 @@ export function quickLaunchDirective() { brSnackbar.create('Application Deployed'); } $scope.deploying = false; + applyScope(); }) .catch((senderError) => { // handling API error response. data attribute contains failure message @@ -365,7 +366,7 @@ export function quickLaunchDirective() { $scope.editorYaml = appPlan.yaml; $scope.editorFormat = appPlan.format || quickLaunch.getOriginalPlanFormat; $scope.yamlViewDisplayed = true; - $scope.$apply(); // making sure that $scope is updated from async context + applyScope(); }) .catch(error => { console.error('Problem with Editor YAML generation:', error); @@ -416,12 +417,18 @@ export function quickLaunchDirective() { function setComposerLink() { Promise.resolve(getComposerLinkWithFallback(false)).then(href => { $scope.composerLink = href; + applyScope(); }); Promise.resolve(getComposerLinkWithFallback(true)).then(href => { $scope.composerLinkExpanded = href; + applyScope(); }); } + function applyScope() { // making sure that $scope is updated from async context + $timeout(() => $scope.$apply()); + } + function openComposer($event, expanded) { $event.preventDefault(); Promise.resolve(getComposerLinkWithFallback(expanded)).then(href => {