Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add an "Are you sure?" dialog for #287 to warn users before they dele…
…te a camel context
  • Loading branch information
jstrachan committed Apr 26, 2013
1 parent 4767256 commit dea6ccf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
@@ -1,9 +1,29 @@
<div class="row-fluid">
<div class="span6">
<div class="control-group" ng-controller="Camel.AttributesToolBarController">
<button class="btn" ng-disabled="!anySelectionHasState(['stop', 'suspend'])" ng-click="start()"><i class="icon-play-circle"></i> Start</button>
<button class="btn" ng-disabled="!anySelectionHasState('start')" ng-click="pause()"><i class="icon-pause"></i> Pause</button>
<button class="btn" ng-disabled="!anySelectionHasState(['start', 'suspend'])" ng-click="stop()"><i class="icon-remove"></i> Destroy</button>
<div class="span6" ng-controller="Camel.AttributesToolBarController">
<div class="control-group">
<button class="btn" ng-disabled="!anySelectionHasState(['stop', 'suspend'])" ng-click="start()"><i
class="icon-play-circle"></i> Start
</button>
<button class="btn" ng-disabled="!anySelectionHasState('start')" ng-click="pause()"><i class="icon-pause"></i>
Pause
</button>
<button class="btn" ng-disabled="!anySelectionHasState(['start', 'suspend'])" ng-click="deleteDialog.open()"><i
class="icon-remove"></i> Destroy
</button>
</div>

<div modal="deleteDialog.show" close="deleteDialog.close()" options="deleteDialog.options">
<form class="form-horizontal no-bottom-margin" ng-submit="deleteDialog.close()">
<div class="modal-header"><h4>Are you sure?</h4></div>
<div class="modal-body">
<p>You are about to delete this Camel Context.</p>
<p>This operation cannot be undone so please be careful.</p>
</div>
<div class="modal-footer">
<input class="btn btn-danger" type="submit" ng-click="stop()" value="Delete">
<input class="btn btn-primary" ng-click="deleteDialog.close()" value="Cancel">
</div>
</form>
</div>
</div>
<div class="span6">
Expand Down
5 changes: 5 additions & 0 deletions hawtio-web/src/main/webapp/app/camel/js/attributesToolBar.ts
Expand Up @@ -2,6 +2,8 @@ module Camel {

export function AttributesToolBarController($scope, workspace:Workspace, jolokia) {

$scope.deleteDialog = new Core.Dialog();

$scope.start = () => {
$scope.invokeSelectedMBeans((item) => {
return isState(item, "suspend") ? "resume()" :"start()";
Expand All @@ -16,6 +18,9 @@ module Camel {
$scope.invokeSelectedMBeans("stop()");
};

/**
* Only for routes!
*/
$scope.delete = () => {
$scope.invokeSelectedMBeans("remove()", () => {
// force a reload of the tree
Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/camel/js/camelPlugin.ts
Expand Up @@ -10,7 +10,7 @@ module Camel {
var contextToolBar = "app/camel/html/attributeToolBarContext.html";


angular.module(pluginName, ['bootstrap', 'ui.bootstrap', 'ngResource', 'hawtioCore']).
angular.module(pluginName, ['bootstrap', 'ui.bootstrap', 'ui.bootstrap.dialog', 'ngResource', 'hawtioCore']).
config(($routeProvider) => {
$routeProvider.
when('/camel/browseEndpoint', {templateUrl: 'app/camel/html/browseEndpoint.html'}).
Expand Down

0 comments on commit dea6ccf

Please sign in to comment.