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

Commit

Permalink
Merge branch 'HAWKULAR-806' of https://github.com/Jiri-Kremser/hawkular
Browse files Browse the repository at this point in the history
… into Jiri-Kremser-HAWKULAR-806
  • Loading branch information
jmazzitelli committed Nov 13, 2015
2 parents b4d5a22 + 38b7d9c commit 10595bd
Show file tree
Hide file tree
Showing 9 changed files with 381 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
<li ng-class="getClass('/hawkular-ui/topology/')">
<a href="/hawkular-ui/topology/view">Topology</a>
</li>
<li ng-class="getClass('/hawkular-ui/agent-installer/')" ng-show="$root.isExperimental">
<a href="/hawkular-ui/agent-installer/view">Install Agent</a>
</li>
</ul>
107 changes: 107 additions & 0 deletions console/src/main/scripts/plugins/metrics/html/agent-installer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<div ng-controller="AgentInstallerController as aic" class="hk-agent-installer">
<div class="hk-heading">
<h1>Agent Installer</h1>
</div>

<div class="container">

<div class="col-lg-9 col-md-8">
<form class="panel panel-default clearfix">
<fieldset>
<div class="panel-heading">
<h2>Required</h2>
</div>
<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>

<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"/>
</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>

<div class="col-sm-5">
<div class="input-group">
<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>
</div>


<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label" for="username">Username</label>

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

<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label" for="password">Password</label>

<div class="col-sm-5">
<div class="hk-input-text">
<input class="form-control" type="password" ng-model="aic.password" id="password"/>
</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)">
Download Installer
</button>
</div>
</div>

</fieldset>
</form>
</div>
</div>

</div>
29 changes: 29 additions & 0 deletions console/src/main/scripts/plugins/metrics/less/metrics.less
Original file line number Diff line number Diff line change
Expand Up @@ -2424,3 +2424,32 @@ section {
padding-left: 15px;
}
}

// Agent installer screen

.hk-agent-installer {

.btn-file {
position: relative;
overflow: hidden;
width: 1%;
white-space: nowrap;
vertical-align: middle;
display: table-cell;
}
.btn-file input[type=file] {
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;
display: block;
}
}
69 changes: 69 additions & 0 deletions console/src/main/scripts/plugins/metrics/ts/agentInstaller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
///
/// Copyright 2015 Red Hat, Inc. and/or its affiliates
/// and other contributors as indicated by the @author tags.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

/// <reference path='metricsPlugin.ts'/>
/// <reference path='services/notificationsService.ts'/>

module HawkularMetrics {

export class AgentInstallerController {

private httpUriPart = 'http://';
private hawkularServerUrl: string;
private wildflyHome: string;
private moduleZip: string;

private username: string;
private password: string;

constructor(private $location:ng.ILocationService,
private $scope:any,
private $rootScope:any,
private $log:ng.ILogService,
private $modal:any,
private NotificationsService:INotificationsService) {
$scope.aic = this;
this.hawkularServerUrl = this.httpUriPart;
}

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;
}

public download(): void {
var newPath = '/hawkular/wildfly-agent/download?installer=true&wildfly-home='
+ encodeURIComponent(this.wildflyHome) + '&hawkular-server-url=' + encodeURIComponent(this.hawkularServerUrl);
if (this.moduleZip) {
newPath += '&module-zip=' + encodeURIComponent(this.moduleZip);
}
if (this.username) {
newPath += '&username=' + encodeURIComponent(this.username);
}
if (this.password) {
newPath += '&password=' + encodeURIComponent(this.password);
}
this.$log.info('downloading agent installer..');
window.location.href = newPath;
}

}
_module.controller('AgentInstallerController', AgentInstallerController);

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

export class GlobalController {

public static $inject = ['$scope', '$log', '$rootScope'];

constructor(private $scope:any,
private $log:ng.ILogService,
private $rootScope:IHawkularRootScope
private $rootScope:IHawkularRootScope,
private NotificationsService:INotificationsService
) {
$scope.global = this;

Expand All @@ -40,6 +39,7 @@ module HawkularMetrics {
this.$rootScope.isExperimental = !this.$rootScope.isExperimental;
if (this.$rootScope.isExperimental) {
this.$log.info('Starting Experimental Mode');
this.NotificationsService.info('Entering Experimental Mode');
} else {
this.$log.info('Ending Experimental Mode');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ module HawkularMetrics {
controller: 'ThresholdTriggerSetupController',
controllerAs: 'tc'
}).
when('/hawkular-ui/agent-installer/view', {templateUrl: 'plugins/metrics/html/agent-installer.html'}).
otherwise({redirectTo: '/hawkular-ui/app/app-list'});
}]);

Expand Down
13 changes: 13 additions & 0 deletions dist/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,19 @@
<directoryMode>0755</directoryMode>
</dependencySet>

<!-- put the agent installer to the same directory as previous artefact from the same reason -->
<dependencySet>
<outputDirectory>${hawkular.dist.zip.root.dir}/standalone/configuration</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>org.hawkular.agent:hawkular-wildfly-agent-installer:jar</include>
</includes>
<outputFileNameMapping>agent-installer.${artifact.extension}</outputFileNameMapping>
<unpack>false</unpack>
<fileMode>0644</fileMode>
<directoryMode>0755</directoryMode>
</dependencySet>

<!-- TODO Make the unpacking conditional == only for the dev profile -->
<dependencySet>
<outputDirectory>${hawkular.dist.zip.root.dir}/modules/org/hawkular/nest/main/deployments/${artifact.artifactId}.war</outputDirectory>
Expand Down
6 changes: 6 additions & 0 deletions dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.hawkular.agent</groupId>
<artifactId>hawkular-wildfly-agent-installer</artifactId>
<version>${version.org.hawkular.agent}</version>
</dependency>

<dependency>
<groupId>org.hawkular.inventory</groupId>
<artifactId>hawkular-inventory-dist</artifactId>
Expand Down

0 comments on commit 10595bd

Please sign in to comment.