Skip to content

Commit

Permalink
Fully fix #301
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Apr 30, 2013
1 parent f6bcf85 commit 3f671ba
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 86 deletions.
76 changes: 29 additions & 47 deletions hawtio-web/src/main/webapp/app/activemq/html/browseQueue.html
Expand Up @@ -7,12 +7,12 @@
<div class="span6">
<div class="pull-right">
<form class="form-inline">
<button class="btn" ng-disabled="!gridOptions.selectedItems.length" ng-click="moveDialog.open()"
<button class="btn" ng-disabled="!gridOptions.selectedItems.length" ng-click="moveDialog = true"
title="Move the selected messages to another destination" data-placement="bottom">
<i class="icon-move"></i> Move
</button>
<button type="submit" class="btn" ng-disabled="!gridOptions.selectedItems.length"
ng-click="deleteDialog.open()"
ng-click="deleteDialog = true"
title="Delete the selected messages">
<i class="icon-remove"></i> Delete
</button>
Expand Down Expand Up @@ -71,53 +71,35 @@ <h4>Message {{row.JMSMessageID}}</h4>
</div>
</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
<ng-pluralize count="selectedItems.length"
when="{'1': 'a message!', 'other': '{} messages!'}">
</ng-pluralize>
</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="deleteMessagesAndCloseDeleteDialog()" value="Delete">
<input class="btn btn-primary" ng-click="deleteDialog.close()" value="Cancel">
</div>
</form>
<div hawtio-confirm-dialog="deleteDialog"
ok-button-text="Delete"
on-ok="deleteMessages()">
<div class="dialog-body">
<p>You are about to delete
<ng-pluralize count="gridOptions.selectedItems.length"
when="{'1': 'a message!', 'other': '{} messages!'}">
</ng-pluralize>
</p>
<p>This operation cannot be undone so please be careful.</p>
</div>
</div>

<div modal="moveDialog.show" close="moveDialog.close()" options="moveDialog.options">
<form class="form-horizontal no-bottom-margin" ng-submit="moveDialog.close()">
<div class="modal-header">
<h4>Move
<ng-pluralize count="selectedItems.length"
when="{'1': 'a message', 'other': 'messages'}"></ng-pluralize>
</h4>
</div>
<div class="modal-body">
<p>Move
<ng-pluralize count="selectedItems.length"
when="{'1': 'a message', 'other': '{} messages'}"></ng-pluralize>
to: <input type="text" style="width: 100%" ng-model="queueName" placeholder="Queue name"
typeahead="title for title in queueNames() | filter:$viewValue" typeahead-editable='false'></p>
<p>
You cannot undo this operation.
Though after the move you can always move the
<ng-pluralize count="selectedItems.length"
when="{'1': 'a message', 'other': 'messages'}"></ng-pluralize>
back again.
</p>
</div>
<div class="modal-footer">
<input id="submit" class="btn btn-primary add" type="submit" ng-click="moveMessagesAndCloseMoveDialog()"
value="Move">
<button class="btn btn-warning cancel" type="button" ng-click="moveDialog.close()">Cancel</button>
</div>
</form>
<div hawtio-confirm-dialog="moveDialog"
ok-button-text="Move"
on-ok="moveMessages()">
<div class="dialog-body">
<p>Move
<ng-pluralize count="gridOptions.selectedItems.length"
when="{'1': 'a message', 'other': '{} messages'}"></ng-pluralize>
to: <input type="text" ng-model="queueName" placeholder="Queue name"
typeahead="title for title in queueNames() | filter:$viewValue" typeahead-editable='false'></p>
<p>
You cannot undo this operation.
Though after the move you can always move the <ng-pluralize count="gridOptions.selectedItems.length"
when="{'1': 'a message', 'other': 'messages'}"></ng-pluralize> back again.
</p>
</div>
</div>

</div>

10 changes: 4 additions & 6 deletions hawtio-web/src/main/webapp/app/activemq/js/browse.ts
Expand Up @@ -6,9 +6,9 @@ module ActiveMQ {
$scope.messages = [];
$scope.headers = {};

$scope.deleteDialog = new Core.Dialog();
$scope.deleteDialog = false
$scope.messageDialog = new Core.Dialog();
$scope.moveDialog = new Core.Dialog();
$scope.moveDialog = false

$scope.showMoveDialog = false;

Expand Down Expand Up @@ -90,7 +90,7 @@ module ActiveMQ {
}
};

$scope.moveMessagesAndCloseMoveDialog = () => {
$scope.moveMessages = () => {
var jolokia = workspace.jolokia;
var selection = workspace.selection;
var mbean = selection.objectName;
Expand All @@ -106,10 +106,9 @@ module ActiveMQ {
}
});
}
$scope.moveDialog.close();
};

$scope.deleteMessagesAndCloseDeleteDialog = () => {
$scope.deleteMessages = () => {
var jolokia = workspace.jolokia;
var selection = workspace.selection;
var mbean = selection.objectName;
Expand All @@ -125,7 +124,6 @@ module ActiveMQ {
}
});
}
$scope.deleteDialog.close();
};

$scope.queueNames = () => {
Expand Down
Expand Up @@ -7,24 +7,18 @@
<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
<button class="btn" ng-disabled="!anySelectionHasState(['start', 'suspend'])" ng-click="deleteDialog = true"><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 hawtio-confirm-dialog="deleteDialog"
ok-button-text="Delete"
on-ok="stop()">
<p>You are about to delete this Camel Context.</p>
<p>This operation cannot be undone so please be careful.</p>
</div>

</div>
<div class="span6">
<div class="control-group">
Expand Down
4 changes: 2 additions & 2 deletions hawtio-web/src/main/webapp/app/camel/js/attributesToolBar.ts
Expand Up @@ -2,7 +2,7 @@ module Camel {

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

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

$scope.start = () => {
$scope.invokeSelectedMBeans((item) => {
Expand Down Expand Up @@ -43,4 +43,4 @@ module Camel {
return selected.length && selected.every((s) => isState(s, state));
};
}
}
}
36 changes: 18 additions & 18 deletions hawtio-web/src/main/webapp/app/core/js/confirmDialogDirective.ts
@@ -1,7 +1,7 @@
module Core {

export class ConfirmDialog {
public restrict = 'EA';
public restrict = 'A';
public replace = true;
public transclude = true;
public templateUrl = 'app/core/html/confirmDialog.html';
Expand All @@ -16,7 +16,22 @@ module Core {
onClose: '&'
}

public controller = ($scope, $element, $attrs) => {
public controller = ($scope, $element, $attrs, $transclude, $compile) => {

$scope.clone = null;

$transclude(function(clone) {
$scope.clone = $(clone).filter('.dialog-body');
});

$scope.$watch('show', function() {
if ($scope.show) {
setTimeout(function() {
$scope.body = $('.modal-body');
$scope.body.html($compile($scope.clone.html())($scope.$parent));
}, 50);
}
});

$attrs.$observe('okButtonText', function(value) {
if (!angular.isDefined(value)) {
Expand Down Expand Up @@ -50,23 +65,8 @@ module Core {

}

// see constructor for why this is here...
public compile:(tElement, tAttrs, transclude) => any;
public constructor () {

constructor() {
this.compile = (tElement, tAttrs, transclude) => {
return this.doCompile(tElement, tAttrs, transclude);
}

}

private doCompile(tElement, tAttrs, transclude) {
return (scope, element, attrs) => {
transclude(scope, function(clone) {
var modalBody = element.find('.modal-body');
modalBody.append(clone);
});
}
}

}
Expand Down

0 comments on commit 3f671ba

Please sign in to comment.