Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #660 from Jiri-Kremser/agent-installer-ui
Browse files Browse the repository at this point in the history
HAWKULAR-806 Removing browse buttons, because they are useles + addin…
  • Loading branch information
mtho11 committed Nov 16, 2015
2 parents c712a10 + c308624 commit cee4a4b
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 56 deletions.
4 changes: 3 additions & 1 deletion console/src/main/scripts/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"keycloak": "1.3.1",
"angular-truncate": "sparkalow/angular-truncate",
"angular-smart-truncate": "1.0.2",
"angular-wizard": "0.5.5"
"angular-wizard": "0.5.5",
"ng-clip": "~0.2.6",
"zeroclipboard": "~2.2.0"
},
"devDependencies": {
"hawtio-core-dts": "2.0.18"
Expand Down
77 changes: 45 additions & 32 deletions console/src/main/scripts/plugins/metrics/html/agent-installer.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,42 @@ <h2>Required</h2>
<div class="panel-body">
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label" for="hawkular-server-url">Hawkular Server URL</label>
<label class="col-sm-3 control-label" for="wildfly-home">Wildfly Home
<a class="hk-btn-icon" tabindex="-1" role="button" popover-append-to-body="true"
popover-placement="top" popover-trigger="mouseover mouseout"
popover="Path to your Wildfly server into which the wildfly agent should be installed.
This is the path on your monitored host.">
<i class="fa fa-info-circle"></i></a>
</label>

<div class="col-sm-5">
<div class="hk-input-text">
<input class="form-control" type="url" ng-model="aic.hawkularServerUrl"
placeholder="URL of Hawkular (e.g.: http://localhost:8080)" required hk-autofocus
id="hawkular-server-url"/>
<input class="form-control" ng-model="aic.wildflyHome" id="wildfly-home" required hk-autofocus
placeholder="Copy&paste here the path of the Wildfly server"/>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label" for="wildfly-home">Wildfly Home</label>

<div class="col-sm-5">
<div class="input-group">
<input ng-model="aic.wildflyHome"
class="form-control" id="wildfly-home"/>

<span class="btn btn-primary btn-file ">
Browse <input type="file" webkitdirectory directory multiple/>
</span>
</div>
</div>
</div>

</div>
</div>


<div class="panel-heading">
<h2>Optional</h2>
</div>
<div class="panel-body">

<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label" for="module-zip">Module zip</label>
<label class="col-sm-3 control-label" for="module-zip">Module zip
<a class="hk-btn-icon" tabindex="-1" role="button" popover-append-to-body="true"
popover-placement="top" popover-trigger="mouseover mouseout"
popover="Path to non-default zip file with agent module.
This way you can for instance deploy different version of the agent.">
<i class="fa fa-info-circle"></i></a>
</label>

<div class="col-sm-5">
<div class="input-group">
<div class="hk-input-text">
<input ng-model="aic.moduleZip" class="form-control" id="module-zip"/>
<span class="btn btn-primary btn-file ">
Browse <input type="file"/>
</span>
</div>
</div>
</div>
Expand All @@ -68,29 +58,40 @@ <h2>Optional</h2>

<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label" for="username">Username</label>
<label class="col-sm-3 control-label" for="username">Username
<a class="hk-btn-icon" tabindex="-1" role="button" popover-append-to-body="true"
popover-placement="top" popover-trigger="mouseover mouseout"
popover="Username for this Hawkular server.">
<i class="fa fa-info-circle"></i></a>
</label>

<div class="col-sm-5">
<div class="hk-input-text">
<input class="form-control" ng-model="aic.username" id="username"/>
<input class="form-control" ng-model="aic.username" id="username"
autocomplete="off"/>
</div>
</div>
</div>
</div>

<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label" for="password">Password</label>
<label class="col-sm-3 control-label" for="password">Password
<a class="hk-btn-icon" tabindex="-1" role="button" popover-append-to-body="true"
popover-placement="top" popover-trigger="mouseover mouseout"
popover="Password for this Hawkular server.">
<i class="fa fa-info-circle"></i></a>
</label>

<div class="col-sm-5">
<div class="hk-input-text">
<input class="form-control" type="password" ng-model="aic.password" id="password"/>
<input class="form-control" type="password" ng-model="aic.password" id="password"
autocomplete="off"/>
</div>
</div>
</div>
</div>


<div class="form-aictions hk-form-aictions-separator text-right">
<button type="button" class="btn btn-primary" ng-click="aic.download()"
ng-disabled="!aic.requiredFieldsFilled(hawkularServerUrl, wildflyHome)">
Expand All @@ -100,6 +101,18 @@ <h2>Optional</h2>
</div>

</fieldset>
<div class="code-snippet" ng-show="aic.codeSnippetShown">
To install the wildfly agent, run following command:
<!--
<div class="zero-clipboard" auto-hide-on-no-flash="true">
<span class="btn-clipboard">
Copy
</span>
</div>-->
<div class="highlight">
<pre>$ java -jar hawkular-wildfly-agent-installer-0.13.1.Final.jar</pre>
</div>
</div>
</form>
</div>
</div>
Expand Down
55 changes: 38 additions & 17 deletions console/src/main/scripts/plugins/metrics/less/metrics.less
Original file line number Diff line number Diff line change
Expand Up @@ -2428,28 +2428,49 @@ section {
// Agent installer screen

.hk-agent-installer {
.code-snippet {
margin-left: 15px;
margin-right: 15px;
margin-bottom: 40px;
}

.btn-file {
position: relative;
overflow: hidden;
width: 1%;
white-space: nowrap;
vertical-align: middle;
display: table-cell;
.highlight pre {
padding: 9px 14px;
margin-bottom: 14px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
border-radius: 4px;
}
.btn-file input[type=file] {

.btn-clipboard {
position: absolute;
top: 0;
right: 0;
min-width: 100%;
min-height: 100%;
font-size: 100px;
text-align: right;
filter: alpha(opacity=0);
opacity: 0;
outline: none;
background: white;
cursor: inherit;
z-index: 10;
display: block;
padding: 5px 8px;
font-size: 12px;
color: #767676;
background-color: #fff;
border: 1px solid #e1e1e8;
border-radius: 0 4px 0 4px;
}

.zero-clipboard {
position: relative;
display: none;
}

fieldset {
margin-bottom: 30px;
}

@media (min-width: 768px) {
.zero-clipboard {
display: block;
position: relative;

}
}

}
26 changes: 21 additions & 5 deletions console/src/main/scripts/plugins/metrics/ts/agentInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ module HawkularMetrics {
private username: string;
private password: string;

private codeSnippetShown: boolean;

constructor(private $location:ng.ILocationService,
private $scope:any,
private $rootScope:any,
Expand All @@ -41,15 +43,22 @@ module HawkularMetrics {
}

public requiredFieldsFilled(hawkularServerUrl: string, wildflyHome: string): boolean {
return this.hawkularServerUrl !== undefined
&& ((this.hawkularServerUrl.slice(0, 7) === 'http://' && this.hawkularServerUrl.length > 7)
|| (this.hawkularServerUrl.slice(0, 8) === 'https://' && this.hawkularServerUrl.length > 8))
&& this.wildflyHome !== undefined && this.wildflyHome.length > 2;
//return this.hawkularServerUrl !== undefined
// && ((this.hawkularServerUrl.slice(0, 7) === 'http://' && this.hawkularServerUrl.length > 7)
// || (this.hawkularServerUrl.slice(0, 8) === 'https://' && this.hawkularServerUrl.length > 8)) &&
return this.wildflyHome !== undefined && this.wildflyHome.length > 2;
}

public getTextToCopy(): string {
return 'java -jar hawkular-wildfly-agent-installer-0.13.1.Final.jar';
}

public download(): void {
var newPath = '/hawkular/wildfly-agent/download?installer=true&wildfly-home='
+ encodeURIComponent(this.wildflyHome) + '&hawkular-server-url=' + encodeURIComponent(this.hawkularServerUrl);
+ encodeURIComponent(this.wildflyHome);
if (this.hawkularServerUrl) {
newPath += '&hawkular-server-url=' + encodeURIComponent(this.hawkularServerUrl);
}
if (this.moduleZip) {
newPath += '&module-zip=' + encodeURIComponent(this.moduleZip);
}
Expand All @@ -61,9 +70,16 @@ module HawkularMetrics {
}
this.$log.info('downloading agent installer..');
window.location.href = newPath;
this.codeSnippetShown = true;
}

}
_module.config(['ngClipProvider', (ngClipProvider) => {
ngClipProvider.setConfig({
zIndex: 50
});
}]);

_module.controller('AgentInstallerController', AgentInstallerController);

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module HawkularMetrics {

export let _module = angular.module(HawkularMetrics.pluginName, ['ngResource', 'ngAnimate', 'ui.select',
'hawkular.services', 'ui.bootstrap', 'topbar', 'patternfly.select', 'angular-momentjs', 'angular-md5', 'toastr',
'infinite-scroll', 'mgo-angular-wizard', 'truncate', '500tech.smart-truncate', 'hawkular.charts']);
'infinite-scroll', 'mgo-angular-wizard', 'truncate', '500tech.smart-truncate', 'hawkular.charts', 'ngClipboard']);

_module.config(['$compileProvider', function ($compileProvider) {
//disable debug info
Expand Down

0 comments on commit cee4a4b

Please sign in to comment.