Skip to content

Commit

Permalink
allow the view to connect to in a remote JVM to be configured; lets d…
Browse files Browse the repository at this point in the history
…efault to the default page; though when connecting from the containers/profiles view, default to logs - then on the MQ view lets go to the broker view
  • Loading branch information
jstrachan committed Oct 8, 2013
1 parent 7b9bf7d commit 62bcb5e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
14 changes: 9 additions & 5 deletions hawtio-web/src/main/webapp/app/core/js/helpers.ts
Expand Up @@ -890,6 +890,7 @@ module Core {
public jolokiaUrl:string;
public userName:string;
public password:string;
public view:string;
}

export function getDocHeight() {
Expand All @@ -901,7 +902,7 @@ module Core {
);
}

export function connectToServer(localSturage, options:ConnectToServerOptions) {
export function connectToServer(localStorage, options:ConnectToServerOptions) {
var connectUrl = options.jolokiaUrl;

var userDetails = {
Expand All @@ -921,6 +922,7 @@ module Core {
// TODO we should replace this and just store the real, final connectUrl!

localStorage[connectUrl] = angular.toJson(userDetails);
var view = options.view;
if (connectUrl) {

if (options.useProxy) {
Expand All @@ -944,7 +946,9 @@ module Core {

var full = "?url=" + encodeURIComponent(connectUrl);

full += "#/logs";
if (view) {
full += "#" + view;
}
window.open(full);
} else {

Expand All @@ -969,9 +973,9 @@ module Core {
localStorage[connectUrl] = angular.toJson(userDetails);

var full = "?url=" + encodeURIComponent(connectUrl);

// default the osgi view
//full += "#/osgi/bundle-list";
if (view) {
full += "#" + view;
}
console.log("Full URL is: " + full);
window.open(full);
}
Expand Down
8 changes: 5 additions & 3 deletions hawtio-web/src/main/webapp/app/fabric/html/brokers.html
Expand Up @@ -115,13 +115,15 @@
<i class="icon-plus clickable" ng-show="container.root && container.alive"
title="Create a new child container"
ng-click="createChildContainer(container)"></i>
-->

<i class="icon-signin clickable" ng-show="container.jolokiaUrl && container.alive"
title="Open a new window and connect to this broker"
ng-click="doConnect(container)"></i>
title="Connect to the Broker inside Container: {{container.id}}"
ng-click="connectToBroker(container, broker)"></i>

<!--
<i class="icon-star mq-master" title="Master broker" ng-show="container.master"></i>
-->
-->
</div>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions hawtio-web/src/main/webapp/app/fabric/js/brokers.ts
Expand Up @@ -17,6 +17,12 @@ module Fabric {
$location.path(path);
};

$scope.connectToBroker = (container, broker) => {
var view = "/jmx/attributes?tab=activemq";
$scope.doConnect(container, view);
};


$scope.createBroker = (group) => {
var args = {};
if (group) {
Expand Down
16 changes: 10 additions & 6 deletions hawtio-web/src/main/webapp/app/fabric/js/helpers.ts
Expand Up @@ -129,6 +129,8 @@ module Fabric {
userName: null,
password: null,
container: null,
view: null,

onOK: () => {
var userName = $scope.connect.userName;
var password = $scope.connect.password;
Expand All @@ -139,17 +141,20 @@ module Fabric {
localStorage['fabric.password'] = password;
}
console.log("Connecting as user " + userName);
Fabric.connect(localStorage, container, userName, password, true);
var options = new Core.ConnectToServerOptions();
options.view = $scope.connect.view;
Fabric.connect(localStorage, container, userName, password, true, options);
$scope.connect.container = {};
$scope.connect.dialog.close();
}
};

$scope.doConnect = (container) => {
$scope.doConnect = (container, view) => {
// TODO at least obfusicate this
$scope.connect.userName = localStorage['fabric.userName']
$scope.connect.password = localStorage['fabric.password']
$scope.connect.userName = localStorage['fabric.userName'];
$scope.connect.password = localStorage['fabric.password'];
$scope.connect.container = container;
$scope.connect.view = view || "/logs";
$scope.connect.dialog.open();
};

Expand Down Expand Up @@ -564,8 +569,7 @@ module Fabric {
/**
* Opens a window connecting to the given container row details if the jolokiaUrl is available
*/
export function connect(localStorage, row, userName = "", password = "", useProxy = true) {
var options:Core.ConnectToServerOptions = new Core.ConnectToServerOptions();
export function connect(localStorage, row, userName = "", password = "", useProxy = true, options:Core.ConnectToServerOptions = new Core.ConnectToServerOptions()) {
options.jolokiaUrl = row.jolokiaUrl;
options.userName = userName;
options.password = password;
Expand Down

0 comments on commit 62bcb5e

Please sign in to comment.