Skip to content

Commit

Permalink
Fix #593
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Oct 17, 2013
1 parent 234f8cc commit ef0f2c9
Show file tree
Hide file tree
Showing 8 changed files with 595 additions and 9 deletions.
50 changes: 45 additions & 5 deletions hawtio-web/src/main/webapp/app/fabric/html/container.html
Expand Up @@ -79,7 +79,7 @@ <h2 style="display: inline-block; margin: 0"><i ng-class="statusIcon()"></i> Con
</div>

<div class="span5 offset1 container-settings">
<div class="tabbable hawtio-form-tabs">
<div class="tabbable hawtio-form-tabs" ng-model="tab">

<div class="tab-pane" title="Status">
<dl class="dl-horizontal">
Expand Down Expand Up @@ -209,19 +209,59 @@ <h2 style="display: inline-block; margin: 0"><i ng-class="statusIcon()"></i> Con
<div class="tab-pane" title="URLs">
<dl class="dl-horizontal">
<dt>Git:</dt>
<dd>{{getGitURL(row.jolokiaUrl)}}</dd>
<dd>
<input class="no-bottom-margin"
type="text" readonly
value="{{getGitURL(row.jolokiaUrl)}}">
<button class="btn"
zero-clipboard
data-clipboard-text="{{getGitURL(row.jolokiaUrl)}}"
title="Click to copy this command to the clipboard">
<i class="icon-copy"></i>
</button>
</dd>
</dl>
<dl class="dl-horizontal">
<dt>SSH:</dt>
<dd>{{row.sshUrl}}</dd>
<dd>
<input class="no-bottom-margin"
type="text" readonly
value="{{getSshURL(row.sshUrl)}}">
<button class="btn"
zero-clipboard
data-clipboard-text="{{getSshURL(row.sshUrl)}}"
title="Click to copy this command to the clipboard">
<i class="icon-copy"></i>
</button>
</dd>
</dl>
<dl class="dl-horizontal">
<dt>JMX:</dt>
<dd>{{row.jmxUrl}}</dd>
<dd>
<input class="no-bottom-margin"
type="text" readonly
value="{{getJmxURL(row.jmxUrl)}}">
<button class="btn"
zero-clipboard
data-clipboard-text="{{getJmxURL(row.jmxUrl)}}"
title="Click to copy this URL to the clipboard">
<i class="icon-copy"></i>
</button>
</dd>
</dl>
<dl class="dl-horizontal">
<dt>Jolokia:</dt>
<dd>{{row.jolokiaUrl}}</dd>
<dd>
<input class="no-bottom-margin"
type="text" readonly
value="{{row.jolokiaUrl}}">
<button class="btn"
zero-clipboard
data-clipboard-text="{{row.jolokiaUrl}}"
title="Click to copy this URL to the clipboard">
<i class="icon-copy"></i>
</button>
</dd>
</dl>
</div>

Expand Down
45 changes: 43 additions & 2 deletions hawtio-web/src/main/webapp/app/fabric/js/container.ts
@@ -1,6 +1,6 @@
module Fabric {

export function ContainerController($scope, $routeParams, $location, localStorage, jolokia, workspace) {
export function ContainerController($scope, $routeParams, $location, localStorage, jolokia, workspace, userDetails) {

Fabric.initScope($scope, $location, jolokia, workspace);

Expand All @@ -10,6 +10,22 @@ module Fabric {
$scope.operation = 'getContainer(java.lang.String)';
}

$scope.username = userDetails.username;
$scope.password = userDetails.password;

$scope.tab = $routeParams['tab'];
if (!$scope.tab) {
$scope.tab = 'Status';
}


$scope.$watch('tab', (newValue, oldValue) => {
if (newValue !== oldValue) {
$location.search({tab: newValue});
}
});


/*
// handy for working around any randomly added fields that won't marshal
$scope.fields = jolokia.execute(Fabric.managerMBean, 'getFields(java.lang.String)', 'org.fusesource.fabric.api.Container');
Expand Down Expand Up @@ -65,9 +81,34 @@ module Fabric {
};

$scope.getGitURL = (jolokiaUrl) => {
return jolokiaUrl ? jolokiaUrl.replace("jolokia", "git/fabric") : null;
var answer = jolokiaUrl ? jolokiaUrl.replace("jolokia", "git/fabric") : null;
if (answer !== null) {
var command = "git clone -b 1.0 " + answer;
if ($scope.username !== null && $scope.password !== null) {
command = command.replace("://", "://" + $scope.username + ":" + $scope.password + "@"); }
answer = command;
}
return answer;
};


$scope.getSshURL = (sshUrl) => {
var answer = sshUrl;
if ($scope.username !== null && $scope.password !== null) {
var parts = sshUrl.split(":");
if (parts.length === 2) {
answer = "ssh -p " + parts[1] + " " + $scope.username + "@" + parts[0];
}
}
return answer;
};


$scope.getJmxURL = (jmxUrl) => {
return jmxUrl;
};


$scope.getType = () => {
if ($scope.row) {
if ($scope.row.ensembleServer) {
Expand Down
2 changes: 2 additions & 0 deletions hawtio-web/src/main/webapp/app/ui/js/uiPlugin.ts
Expand Up @@ -40,6 +40,8 @@ module UI {
return new UI.JSPlumb();
//}).directive('connectTo', () => {
// return new UI.JSPlumbConnection();
}).directive('zeroClipboard', () => {
return new UI.ZeroClipboardDirective();
}).run(function (helpRegistry) {
helpRegistry.addDevDoc("ui", 'app/ui/doc/developer.md');
});
Expand Down
17 changes: 17 additions & 0 deletions hawtio-web/src/main/webapp/app/ui/js/zeroclipboard.ts
@@ -0,0 +1,17 @@
module UI {

export class ZeroClipboardDirective {
public restrict = 'A';

public link = ($scope, $element, $attr) => {
var clip = new (<any>window).ZeroClipboard($element.get(0), {
moviePath: "img/ZeroClipboard.swf"
});

clip.on('complete', (client, args) => {
notification('info', "Copied text to clipboard: " + args.text);
});

};
}
}
Binary file added hawtio-web/src/main/webapp/img/ZeroClipboard.swf
Binary file not shown.
12 changes: 10 additions & 2 deletions hawtio-web/src/main/webapp/index.html
Expand Up @@ -304,8 +304,6 @@ <h2 title="Status Code: {{connectFailure.status}}">Cannot Connect: {{connectFail
<!-- helper libraries -->
<script type="text/javascript" src="lib/sugar-1.3.6-custom.min.js"></script>

<script type="text/javascript" src="app/app.js"></script>

<!-- camel model definition -->
<script type="text/javascript" src="app/camel/js/camelModel.js"></script>

Expand All @@ -324,5 +322,15 @@ <h2 title="Status Code: {{connectFailure.status}}">Cannot Connect: {{connectFail
<!-- JBoss DMR -->
<script type="text/javascript" src="lib/dmr.js.nocache.js"></script>

<!-- zeroclipboard -->
<script type="text/javascript" src="lib/ZeroClipboard.min.js"></script>


<!-- And finally the main app -->
<script type="text/javascript" src="app/app.js"></script>




</body>
</html>
9 changes: 9 additions & 0 deletions hawtio-web/src/main/webapp/lib/ZeroClipboard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ef0f2c9

Please sign in to comment.