Skip to content

Commit

Permalink
HAWKULAR-26: Enter URL Screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtho11 committed Feb 13, 2015
1 parent 451b994 commit 9f1b9ad
Show file tree
Hide file tree
Showing 16 changed files with 200 additions and 126 deletions.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"hawtio-core": "2.0.9",
"hawtio-core-navigation": "2.0.17",
"hawtio-utilities": "2.0.16",
"hawkular-charts": "~0.1.13"
"hawkular-charts": "~0.1.13",
"hawkular-ui-services": "~0.1.3"
},
"devDependencies": {
"bootstrap": "3.3.2",
Expand Down
198 changes: 109 additions & 89 deletions dist/hawkular-metrics.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions plugins/metrics/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
"angular-bootstrap": "0.11.0",
"toastr": "2.1.0",
"lodash": "2.4.1",
"d3": "3.4.8",
"d3-tip": "0.6.4",
"hawkular-charts": "~0.1.13"
"hawkular-charts": "~0.1.13",
"hawkular-ui-services": "~0.1.3"
},
"devDependencies": {
"bootstrap": "3.3.2",
Expand Down
2 changes: 2 additions & 0 deletions plugins/metrics/d.ts/includes.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/// <reference path="../libs/hawtio-utilities/defs.d.ts" />
/// <reference path="../libs/hawtio-core-dts/defs.d.ts" />
/// <reference path="../vendor/moment/moment.d.ts" />
7 changes: 7 additions & 0 deletions plugins/metrics/defs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// <reference path="d.ts/includes.d.ts"/>
/// <reference path="d.ts/metrics/ts/metricsGlobals.d.ts"/>
/// <reference path="d.ts/metrics/ts/metricsPlugin.d.ts"/>
/// <reference path="d.ts/metrics/ts/addUrl.d.ts"/>
/// <reference path="d.ts/metrics/ts/metricDataService.d.ts"/>
/// <reference path="d.ts/metrics/ts/metricsView.d.ts"/>
/// <reference path="d.ts/metrics/ts/overview.d.ts"/>
4 changes: 3 additions & 1 deletion plugins/metrics/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
<script src="libs/d3-tip/index.js"></script>
<script src="libs/numeral/numeral.js"></script>
<script src="libs/hawkular-charts/hawkular-charts.js"></script>
<script src="libs/angular-resource/angular-resource.js"></script>
<script src="libs/hawkular-ui-services/dist/hawkular-ui-service.js"></script>
<!-- endbower -->

<script src="libs/bootstrap/dist/js/bootstrap.js"></script>
Expand All @@ -58,7 +60,7 @@

</head>

<body>
<body data-ng-strict-di>
<nav class="navbar navbar-default navbar-pf" role="navigation">
<ul class="nav navbar-nav navbar-primary" hawtio-main-nav></ul>
<ul class="nav navbar-nav" hawtio-sub-tabs></ul>
Expand Down
25 changes: 25 additions & 0 deletions plugins/metrics/plugins/metrics/html/add-url.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="row" ng-controller="HawkularMetrics.AddUrlController" style="margin-left: 10px;">
<h1>Welcome Brian!</h1>

<h2>Collect metrics from a website that you want to monitor.</h2>

<form class="form-horizontal" name="addUrlForm" role="form" novalidate>
<div class="form-group input">
<div class="col-lg-6 col-sm-8 col-xs-12 align-center">
<div class="input-group">
<input type="url" class="form-control input-lg" name="resourceUrl" ng-model="vm.resourceUrl"
ng-model-options="{ updateOn: 'default blur'}"
placeholder="Enter a website URL" required >
<span class="error-message"
ng-show="addUrlForm.resourceUrl.$dirty && addUrlForm.resourceUrl.$error.required">The URL you entered is not valid. Please enter a valid URL.</span>

<span class="input-group-btn">
<button class="btn btn-primary btn-lg" type="button" ng-disabled="!addUrlForm.$valid"
ng-click="vm.addUrl(vm.resourceUrl)">Get Metrics
</button>
</span>
</div>
</div>
</div>
</form>
</div>
6 changes: 0 additions & 6 deletions plugins/metrics/plugins/metrics/html/advanced.html

This file was deleted.

7 changes: 0 additions & 7 deletions plugins/metrics/plugins/metrics/html/config.html

This file was deleted.

6 changes: 6 additions & 0 deletions plugins/metrics/plugins/metrics/html/metrics-selection.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="row" ng-controller="HawkularMetrics.MetricsSelectionController">
<div class="col-md-12">
<h1>Metrics Selection: TBD</h1>
TBD
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="panel panel-default" style="width:880px" ng-controller="ChartController as vm">
<div class="panel panel-default" style="width:880px" ng-controller="MetricsViewController as vm">
<div class="panel-body">
<div class="well">
<small style="margin-left: 15px" class="graphDateTimeRangeLabel"></small>
Expand All @@ -11,7 +11,6 @@
<div class="col-sm-5">
<input type="text" class="form-control" name="searchId" ng-model="vm.searchId"
ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 700, 'blur': 0 } }"
ng-enter="vm.refreshChartDataNow();"
placeholder="Enter Id..." required ng-minlength="1">
<span class="error-message"
ng-show="chartForm.searchId.$dirty && chartForm.searchId.$error.required"> * Required.</span>
Expand Down
6 changes: 6 additions & 0 deletions plugins/metrics/plugins/metrics/html/overview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="row" ng-controller="HawkularMetrics.OverviewController">
<div class="col-md-12">
<h1>Overview: TBD</h1>
TBD
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,29 @@

module HawkularMetrics {

export class AddUrlController {
public static $inject = ['$scope', '$log'];

export var AdvancedController = _module.controller("HawkularMetrics.AdvancedController", ['$scope', ($scope) => {
$scope.advancedName = "Advanced Stuff";
constructor(private $scope:any,
private $log:ng.ILogService,
public resourceUrl:string) {
$scope.vm = this;
this.resourceUrl = '';

}]);
$scope.$watch('vm.resourceUrl', (newValue) => {
if(angular.isDefined(newValue)){
this.$log.debug("Add New Resource Url: " + newValue);
}
});

}

addUrl(url:string):void {
this.$log.debug("Adding Url to backend: "+ url);
}

}

_module.controller('HawkularMetrics.AddUrlController', AddUrlController);

}
7 changes: 4 additions & 3 deletions plugins/metrics/plugins/metrics/ts/metricsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ module HawkularMetrics {
.id(HawkularMetrics.pluginName)
.title(() => "Metrics")
.href(() => "/metrics")
.subPath("Graphs", "graphs", navBuilder.join(HawkularMetrics.templatePath, 'graphs.html'))
.subPath("Advanced", "advanced", navBuilder.join(HawkularMetrics.templatePath, 'advanced.html'))
.subPath("Config", "config", navBuilder.join(HawkularMetrics.templatePath, 'config.html'))
.subPath("Add Url", "addUrl", navBuilder.join(HawkularMetrics.templatePath, 'add-url.html'))
.subPath("Metrics Selection", "metricsSelection", navBuilder.join(HawkularMetrics.templatePath, 'metrics-selection.html'))
.subPath("Overview", "overview", navBuilder.join(HawkularMetrics.templatePath, 'overview.html'))
.subPath("Metrics View", "metricsView", navBuilder.join(HawkularMetrics.templatePath, 'metrics-view.html'))
.build();

navBuilder.configureRouting($routeProvider, metricsTab);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module HawkularMetrics {
/// chartTypes: string[];
///
/// }
export interface IChartController {
export interface IMetricsViewController {
searchId: string;
startTimeStamp: Date;
endTimeStamp: Date;
Expand Down Expand Up @@ -80,7 +80,7 @@ module HawkularMetrics {
* @param $log
* @param metricDataService
*/
export class ChartController implements IChartController {
export class MetricsViewController implements IMetricsViewController {
public static $inject = ['$scope', '$rootScope', '$interval', '$log', 'metricDataService'];

searchId = '';
Expand Down Expand Up @@ -143,7 +143,7 @@ module HawkularMetrics {
}

showPreviousTimeRange():void {
var previousTimeRange = ChartController.calculatePreviousTimeRange(this.startTimeStamp, this.endTimeStamp);
var previousTimeRange = MetricsViewController.calculatePreviousTimeRange(this.startTimeStamp, this.endTimeStamp);

this.startTimeStamp = previousTimeRange[0];
this.endTimeStamp = previousTimeRange[1];
Expand All @@ -163,7 +163,7 @@ module HawkularMetrics {


showNextTimeRange():void {
var nextTimeRange = ChartController.calculateNextTimeRange(this.startTimeStamp, this.endTimeStamp);
var nextTimeRange = MetricsViewController.calculateNextTimeRange(this.startTimeStamp, this.endTimeStamp);

this.startTimeStamp = nextTimeRange[0];
this.endTimeStamp = nextTimeRange[1];
Expand All @@ -173,11 +173,11 @@ module HawkularMetrics {


hasNext():boolean {
var nextTimeRange = ChartController.calculateNextTimeRange(this.startTimeStamp, this.endTimeStamp);
var nextTimeRange = MetricsViewController.calculateNextTimeRange(this.startTimeStamp, this.endTimeStamp);
// unsophisticated test to see if there is a next; without actually querying.

//@fixme: pay the price, do the query!
return nextTimeRange[1].getTime() < _.now();
return nextTimeRange[1].getTime() < new Date().getTime();
}


Expand Down Expand Up @@ -265,7 +265,7 @@ module HawkularMetrics {


overlayPreviousRangeData():void {
var previousTimeRange = ChartController.calculatePreviousTimeRange(this.startTimeStamp, this.endTimeStamp);
var previousTimeRange = MetricsViewController.calculatePreviousTimeRange(this.startTimeStamp, this.endTimeStamp);

if (this.searchId !== '') {
this.metricDataService.getMetricsForTimeRange(this.searchId, previousTimeRange[0], previousTimeRange[1])
Expand Down Expand Up @@ -324,7 +324,7 @@ module HawkularMetrics {
refreshContextChart():void {
// unsophisticated default time range to avoid DB checking right now
// @fixme: add a real service to determine unbounded range
var endTime = _.now(),
var endTime = moment().valueOf(),
startTime = moment().subtract('months', 24).valueOf();

this.$log.debug('refreshChartContext');
Expand Down Expand Up @@ -362,6 +362,6 @@ module HawkularMetrics {
}
}

_module.controller('ChartController', ChartController);
_module.controller('MetricsViewController', MetricsViewController);

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


export var ConfigController = _module.controller("HawkularMetrics.ConfigController", ['$scope', ($scope) => {
$scope.configName = "My Configuration";
export var OverviewController = _module.controller("HawkularMetrics.OverviewController", ['$scope', ($scope) => {
$scope.overview = "Over View";

}]);

Expand Down

0 comments on commit 9f1b9ad

Please sign in to comment.