File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 151151 };
152152
153153 $scope.enableButtonForItemFn = function(action, item) {
154- return (action.name !=='Action 2') || (item.name !== "Frank Livingston");
154+ return !((action.name ==='Action 2') && (item.name === "Frank Livingston")) &&
155+ !(action.name === 'Start' && item.started);
155156 };
156157
157158 $scope.updateMenuActionForItemFn = function(action, item) {
258259 $scope.eventText = item.name + " : " + action.name + "\r\n" + $scope.eventText;
259260 };
260261
261- var buttonInclude = '<span class="fa fa-plus"></span>{{actionButton.name}}';
262+ var startServer = function (action, item) {
263+ $scope.eventText = item.name + " : " + action.name + "\r\n" + $scope.eventText;
264+ item.started = true;
265+ };
262266
267+ var buttonInclude = '<span class="fa fa-plus"></span>{{actionButton.name}}';
263268 $templateCache.put('my-button-template', buttonInclude);
269+
270+ var startButtonInclude = '<span ng-disabled="item.started">{{item.started ? "Starting" : "Start"}}</span>';
271+ $templateCache.put('start-button-template', startButtonInclude);
272+
264273 $scope.actionButtons = [
274+ {
275+ name: 'Start',
276+ class: 'btn-primary',
277+ include: 'start-button-template',
278+ title: 'Start the server',
279+ actionFn: startServer
280+ },
265281 {
266282 name: 'Action 1',
267283 title: 'Perform an action',
268284 actionFn: performAction
269285 },
270286 {
271287 name: 'Action 2',
272- class: 'btn-primary',
273288 title: 'Do something else',
274289 actionFn: performAction
275290 },
Original file line number Diff line number Diff line change 99 < div class ="list-view-pf-actions "
1010 ng-if ="(actionButtons && actionButtons.length > 0) || (menuActions && menuActions.length > 0) ">
1111 < button class ="btn btn-default {{actionButton.class}} " ng-repeat ="actionButton in actionButtons "
12- title ="actionButton.title "
12+ title ="{{ actionButton.title}} "
1313 ng-class ="{'disabled' : checkDisabled(item) || !enableButtonForItem(actionButton, item)} "
1414 ng-click ="handleButtonAction(actionButton, item) ">
1515 < div ng-if ="actionButton.include " class ="actionButton.includeClass " ng-include src ="actionButton.include "> </ div >
You can’t perform that action at this time.
0 commit comments