Skip to content

Commit

Permalink
use 2 space indentation like the rest of the code
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Apr 18, 2013
1 parent 28058da commit e4561b3
Show file tree
Hide file tree
Showing 4 changed files with 260 additions and 256 deletions.
172 changes: 86 additions & 86 deletions hawtio-web/src/main/webapp/app/jetty/js/connectors.ts
@@ -1,105 +1,105 @@
module Jetty {

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

var stateTemplate = '<div class="ngCellText pagination-centered" title="{{row.getProperty(col.field)}}"><i class="{{row.getProperty(col.field) | jettyIconClass}}"></i></div>';
var stateTemplate = '<div class="ngCellText pagination-centered" title="{{row.getProperty(col.field)}}"><i class="{{row.getProperty(col.field) | jettyIconClass}}"></i></div>';

$scope.connectors = [];
$scope.search = "";
$scope.connectors = [];
$scope.search = "";

var columnDefs: any[] = [
{
field: 'running',
displayName: 'State',
cellTemplate: stateTemplate,
width: 56,
minWidth: 56,
maxWidth: 56,
resizable: false
},
{
field: 'port',
displayName: 'Port',
cellFilter: null,
width: "*",
resizable: true
},
{
field: 'scheme',
displayName: 'Scheme',
cellFilter: null,
width: "*",
resizable: true
},
];
var columnDefs:any[] = [
{
field: 'running',
displayName: 'State',
cellTemplate: stateTemplate,
width: 56,
minWidth: 56,
maxWidth: 56,
resizable: false
},
{
field: 'port',
displayName: 'Port',
cellFilter: null,
width: "*",
resizable: true
},
{
field: 'scheme',
displayName: 'Scheme',
cellFilter: null,
width: "*",
resizable: true
},
];

$scope.gridOptions = {
data: 'connectors',
displayFooter: false,
displaySelectionCheckbox: false,
canSelectRows: false,
columnDefs: columnDefs,
filterOptions: {
filterText: 'search'
}
};
$scope.gridOptions = {
data: 'connectors',
displayFooter: false,
displaySelectionCheckbox: false,
canSelectRows: false,
columnDefs: columnDefs,
filterOptions: {
filterText: 'search'
}
};

function render(response) {
$scope.connectors = [];
function render(response) {
$scope.connectors = [];

function onAttributes(response) {
var obj = response.value;
if (obj) {
// split each into 2 rows as we want http and https on each row
obj.mbean = response.request.mbean;
obj.scheme = "http";
obj.port = obj.port;
obj.running = obj['running'] !== undefined ? obj['running'] : true;
$scope.connectors.push(obj);
if (obj.confidentialPort) {
// create a clone of obj for https
var copyObj = {
scheme: "https",
port: obj.confidentialPort,
running: obj.running,
mbean: obj.mbean
}
$scope.connectors.push(copyObj);
}
Core.$apply($scope);
}
function onAttributes(response) {
var obj = response.value;
if (obj) {
// split each into 2 rows as we want http and https on each row
obj.mbean = response.request.mbean;
obj.scheme = "http";
obj.port = obj.port;
obj.running = obj['running'] !== undefined ? obj['running'] : true;
$scope.connectors.push(obj);
if (obj.confidentialPort) {
// create a clone of obj for https
var copyObj = {
scheme: "https",
port: obj.confidentialPort,
running: obj.running,
mbean: obj.mbean
}

// create structure for each response
angular.forEach(response, function(value, key) {
var mbean = value;
jolokia.request( {type: "read", mbean: mbean, attribute: []}, onSuccess(onAttributes));
});
$scope.connectors.push(copyObj);
}
Core.$apply($scope);
};
}
}

// function to trigger reloading page
$scope.onResponse = function (response) {
//console.log("got response: " + response);
loadData();
};
// create structure for each response
angular.forEach(response, function (value, key) {
var mbean = value;
jolokia.request({type: "read", mbean: mbean, attribute: []}, onSuccess(onAttributes));
});
Core.$apply($scope);
};

$scope.$on('jmxTreeUpdated', reloadFunction);
$scope.$watch('workspace.tree', reloadFunction);
// function to trigger reloading page
$scope.onResponse = function (response) {
//console.log("got response: " + response);
loadData();
};

function reloadFunction() {
// if the JMX tree is reloaded its probably because a new MBean has been added or removed
// so lets reload, asynchronously just in case
setTimeout(loadData, 50);
}
$scope.$on('jmxTreeUpdated', reloadFunction);
$scope.$watch('workspace.tree', reloadFunction);

function reloadFunction() {
// if the JMX tree is reloaded its probably because a new MBean has been added or removed
// so lets reload, asynchronously just in case
setTimeout(loadData, 50);
}

function loadData() {
console.log("Loading Jetty connector data...");
var tree = workspace.tree;

jolokia.search("org.eclipse.jetty.server.nio:type=selectchannelconnector,*", onSuccess(render));
}
function loadData() {
console.log("Loading Jetty connector data...");
var tree = workspace.tree;

jolokia.search("org.eclipse.jetty.server.nio:type=selectchannelconnector,*", onSuccess(render));
}

}
}
18 changes: 9 additions & 9 deletions hawtio-web/src/main/webapp/app/jetty/js/helpers.ts
@@ -1,15 +1,15 @@
module Jetty {

export function iconClass(state:string) {
if (state) {
switch (state.toString().toLowerCase()) {
case 'started':
return "green icon-play";
case 'true':
return "green icon-play";
}
export function iconClass(state:string) {
if (state) {
switch (state.toString().toLowerCase()) {
case 'started':
return "green icon-play";
case 'true':
return "green icon-play";
}
return "red icon-stop";
}
return "red icon-stop";
}

}

0 comments on commit e4561b3

Please sign in to comment.