allow hiding help-button for first ng workflow step
we have merged patch that will hide the help-button on workflow steps if helpUrl is not defined https://review.openstack.org/#/c/299705/ However, it forgot to factor in the 'first' step. With this patch, you can see it used on its parent patch: Create Volume action removed the helpUrl and the helpBtn doesn't show up either. Change-Id: I7e3ee4d03b9f5f1fa924d7f233e4fa4ea4ed12a7
This commit is contained in:
@@ -78,15 +78,8 @@
|
|||||||
from: $scope.currentIndex,
|
from: $scope.currentIndex,
|
||||||
to: index
|
to: index
|
||||||
});
|
});
|
||||||
/**
|
toggleHelpBtn(index);
|
||||||
* Toggle help icon button if a step's helpUrl is not defined
|
|
||||||
*/
|
|
||||||
/*eslint-disable angular/controller-as */
|
/*eslint-disable angular/controller-as */
|
||||||
if (angular.isUndefined(steps[index].helpUrl)) {
|
|
||||||
$scope.hideHelpBtn = true;
|
|
||||||
} else {
|
|
||||||
$scope.hideHelpBtn = false;
|
|
||||||
}
|
|
||||||
$scope.currentIndex = index;
|
$scope.currentIndex = index;
|
||||||
$scope.openHelp = false;
|
$scope.openHelp = false;
|
||||||
/*eslint-enable angular/controller-as*/
|
/*eslint-enable angular/controller-as*/
|
||||||
@@ -119,12 +112,24 @@
|
|||||||
|
|
||||||
function onInitSuccess() {
|
function onInitSuccess() {
|
||||||
$scope.$broadcast(wizardEvents.ON_INIT_SUCCESS);
|
$scope.$broadcast(wizardEvents.ON_INIT_SUCCESS);
|
||||||
|
if (steps.length > 0) {
|
||||||
|
toggleHelpBtn(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInitError() {
|
function onInitError() {
|
||||||
$scope.$broadcast(wizardEvents.ON_INIT_ERROR);
|
$scope.$broadcast(wizardEvents.ON_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleHelpBtn(index) {
|
||||||
|
// Toggle help icon button if a step's helpUrl is not defined
|
||||||
|
if (angular.isUndefined(steps[index].helpUrl)) {
|
||||||
|
$scope.hideHelpBtn = true;
|
||||||
|
} else {
|
||||||
|
$scope.hideHelpBtn = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each step in the workflow can provide an optional `checkReadiness`
|
* Each step in the workflow can provide an optional `checkReadiness`
|
||||||
* method, which should return a promise. When this method is provided
|
* method, which should return a promise. When this method is provided
|
||||||
@@ -186,7 +191,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
viewModel.ready = (stepReadyPromises.length === 0);
|
viewModel.ready = stepReadyPromises.length === 0;
|
||||||
return $q.all(stepReadyPromises);
|
return $q.all(stepReadyPromises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@
|
|||||||
steps: [ {}, {}, {} ]
|
steps: [ {}, {}, {} ]
|
||||||
};
|
};
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
expect(angular.element(element).find('.help-toggle').hasClass('ng-hide')).toBe(false);
|
expect(angular.element(element).find('.help-toggle').hasClass('ng-hide')).toBe(true);
|
||||||
|
|
||||||
$scope.workflow.steps[1] = {};
|
$scope.workflow.steps[1] = {};
|
||||||
$scope.switchTo(1);
|
$scope.switchTo(1);
|
||||||
|
Reference in New Issue
Block a user