Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first spike of #212 so we can at least make a GET on the JBoss manage…
…ment API on a remote container using the proxy servlet; though it seems we can only do GET and the POST is not authorised for some reason. e.g. try using something like: http://localhost:8000/hawtio/#/jboss/dmr?_user=foo&_pwd=something - no attempt yet to view/navigate the data too much yet; wanted to get the basics going first
- Loading branch information
Showing
6 changed files
with
604 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
declare var dmr: any; |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div ng-controller="JBoss.DmrController"> | ||
Name: {{row.name}} | ||
Version: {{row["release-version"]}} | ||
</div> |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module JBoss { | ||
|
||
export function DmrController($scope, $location, workspace:Workspace) { | ||
var search = $location.search(); | ||
var url = "/hawtio/proxy/localhost/9990/management"; | ||
var user = search["_user"] || ""; | ||
var pwd = search["_pwd"] || ""; | ||
|
||
// create an operation | ||
var op = new dmr.ModelNode(); | ||
op.get("operation").set("read-attribute"); | ||
op.get("address").setEmptyList(); | ||
op.get("name").set("release-version"); | ||
|
||
var data = op.toBase64String(); | ||
|
||
$.ajax({ | ||
url: url, | ||
data: data, | ||
/* | ||
dataType: "text", | ||
dataType: "application/dmr-encoded", | ||
*/ | ||
processData: false, | ||
contentType: "application/dmr-encoded", | ||
accepts: "application/dmr-encoded", | ||
//type: "POST", | ||
headers: { | ||
"Content-type": "application/dmr-encoded", | ||
"Accept": "application/dmr-encoded" | ||
}, | ||
username: user, | ||
password: pwd | ||
}).done(onData); | ||
|
||
function onData(data) { | ||
var response = dmr.ModelNode.fromBase64(data); | ||
|
||
var jsonText = response.toJSONString(); | ||
var json = JSON.parse(jsonText); | ||
$scope.row = json; | ||
Core.$apply($scope); | ||
console.log("Response: " + JSON.stringify(json, null, " ")); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.