Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use 2 space indentation like the rest of the code
- Loading branch information
Showing
4 changed files
with
260 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
} | ||
|
||
} |
Oops, something went wrong.