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

Commit

Permalink
HAWKULAR-442 typescript max line width set to 120
Browse files Browse the repository at this point in the history
  • Loading branch information
Viliam Rockai committed Jul 9, 2015
1 parent c3625c1 commit 023eced
Show file tree
Hide file tree
Showing 18 changed files with 156 additions and 68 deletions.
13 changes: 9 additions & 4 deletions console/src/main/scripts/plugins/accounts/ts/accountsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,27 @@ module HawkularAccounts {
var accountsTab:any = undefined;
var currentPersona:any = undefined;

_module.config(['$locationProvider', '$routeProvider', '$httpProvider', 'HawtioNavBuilderProvider', ($locationProvider, $routeProvider:ng.route.IRouteProvider, $httpProvider:ng.IHttpProvider, builder:HawtioMainNav.BuilderFactory) => {
_module.config(['$locationProvider', '$routeProvider', '$httpProvider', 'HawtioNavBuilderProvider', (
$locationProvider, $routeProvider:ng.route.IRouteProvider, $httpProvider:ng.IHttpProvider,
builder:HawtioMainNav.BuilderFactory) => {
accountsTab = builder.create()
.id(HawkularAccounts.pluginName)
.title(() => "Accounts")
.href(() => "/accounts")
.subPath("My account", "accounts", builder.join(HawkularAccounts.templatePath, 'accounts.html'))
.subPath("Organizations", "organizations", builder.join(HawkularAccounts.templatePath, 'organizations.html'))
.subPath("Organizations", "organizations", builder.join(HawkularAccounts.templatePath,
'organizations.html'))
.build();
builder.configureRouting($routeProvider, accountsTab);

$routeProvider.when('/accounts/organizations/new', {templateUrl: builder.join(HawkularAccounts.templatePath, 'organization_new.html')});
$routeProvider.when('/accounts/organizations/new', {templateUrl: builder.join(HawkularAccounts.templatePath,
'organization_new.html')});
$locationProvider.html5Mode(true);
$httpProvider.interceptors.push(PersonaInterceptorService.Factory);
}]);

_module.run(['$rootScope', '$log', '$modal', '$document', 'userDetails', 'HawtioNav', ($rootScope, $log, $modal, $document, userDetails, HawtioNav:HawtioMainNav.Registry) => {
_module.run(['$rootScope', '$log', '$modal', '$document', 'userDetails', 'HawtioNav',
($rootScope, $log, $modal, $document, userDetails, HawtioNav:HawtioMainNav.Registry) => {
HawtioNav.add(accountsTab);
$rootScope.userDetails = userDetails;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ module Sidebar {
*/

export var SidebarController = _module.controller("Sidebar.SidebarController",
['$scope', '$rootScope', '$location', 'HawkularNav', 'HawkularInventory', ($scope, $rootScope, $location, HawkularNav, HawkularInventory) => {
['$scope', '$rootScope', '$location', 'HawkularNav', 'HawkularInventory', ($scope, $rootScope, $location,
HawkularNav, HawkularInventory) => {

$scope.isSinglePage = function() {
return $location.path().indexOf('/metrics') !== 0;
Expand Down Expand Up @@ -81,7 +82,8 @@ module Sidebar {
var momEnd = moment();

if (diff < 24 * 60 * 60 * 1000) {
return momStart.format('D MMM YYYY') + ' ' + momStart.format('HH:mm') + ' - ' + (momStart.day() !== momEnd.day() ? momEnd.format('D MMM YYYY ') : '') + momEnd.format('HH:mm');
return momStart.format('D MMM YYYY') + ' ' + momStart.format('HH:mm') + ' - ' +
(momStart.day() !== momEnd.day() ? momEnd.format('D MMM YYYY ') : '') + momEnd.format('HH:mm');
} else {
return momStart.format('D MMM YYYY') + ' - ' + momEnd.format('D MMM YYYY');
}
Expand All @@ -93,7 +95,8 @@ module Sidebar {

$scope.getUrlFromId = function(id) {
if(!$scope.resource) {
$scope.resource = HawkularInventory.Resource.get({environmentId: globalEnvironmentId, resourceId: id}, function(data) {
$scope.resource = HawkularInventory.Resource.get({environmentId: globalEnvironmentId, resourceId: id},
function(data) {
$scope.resourceName = data.properties.url;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ module Topbar {
}

export var TopbarController = _module.controller("Topbar.TopbarController",
['$scope', '$rootScope', '$location', '$route', '$routeParams', 'HawkularNav', 'HawkularInventory', ($scope, $rootScope, $location, $route, $routeParams, HawkularNav, HawkularInventory) => {
['$scope', '$rootScope', '$location', '$route', '$routeParams', 'HawkularNav', 'HawkularInventory',
($scope, $rootScope, $location, $route, $routeParams, HawkularNav, HawkularInventory) => {

$scope.getClass = function(path) {
return $location.path().indexOf(path) === 0 ? 'active' : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module Topbar {
public static $inject = ['$rootScope', '$route', '$routeParams', 'HawkularInventory'];


constructor(private $rootScope: any, private $route: any, private $routeParams: any, private HawkularInventory: any) {
constructor(private $rootScope: any, private $route: any, private $routeParams: any,
private HawkularInventory: any) {
$rootScope.hkParams = $routeParams || [];

// default time period set to 24 hours
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Type definitions for Moment.js 2.8.0
// Project: https://github.com/timrwood/moment
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>,
// Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>,
// Adi Dahiya <https://github.com/adidahiya>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

declare module moment {
Expand Down
20 changes: 14 additions & 6 deletions console/src/main/scripts/plugins/metrics/ts/addUrlPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ module HawkularMetrics {

export class AddUrlController {
/// this is for minification purposes
public static $inject = ['$location', '$scope', '$rootScope', '$interval', '$log', '$filter', '$modal', 'HawkularInventory', 'HawkularMetric', 'HawkularAlert', 'HawkularAlertsManager','HawkularErrorManager', '$q', 'md5', 'HkHeaderParser'];
public static $inject = ['$location', '$scope', '$rootScope', '$interval', '$log', '$filter', '$modal',
'HawkularInventory', 'HawkularMetric', 'HawkularAlert', 'HawkularAlertsManager','HawkularErrorManager', '$q',
'md5', 'HkHeaderParser'];

private httpUriPart = 'http://';
public addProgress: boolean = false;
Expand Down Expand Up @@ -60,7 +62,8 @@ module HawkularMetrics {
this.getResourceList(this.$rootScope.currentPersona.id);
} else {
// currentPersona hasn't been injected to the rootScope yet, wait for it..
$rootScope.$watch('currentPersona', (currentPersona) => currentPersona && this.getResourceList(currentPersona.id));
$rootScope.$watch('currentPersona', (currentPersona) =>
currentPersona && this.getResourceList(currentPersona.id));
}

this.autoRefresh(20);
Expand Down Expand Up @@ -148,11 +151,13 @@ module HawkularMetrics {
(e) => err(e, 'Error during saving metrics.'))

// Create threshold trigger for newly created metrics
.then(() => this.HawkularAlertsManager.createTrigger(metricId + '_trigger_thres', true, 'THRESHOLD', defaultEmail),
.then(() => this.HawkularAlertsManager.createTrigger(metricId + '_trigger_thres', true, 'THRESHOLD',
defaultEmail),
(e) => err(e, 'Error saving email action.'))

// Create availability trigger for newly created metrics
.then((alert) => this.HawkularAlertsManager.createTrigger(metricId + '_trigger_avail', false, 'AVAILABILITY', defaultEmail),
.then((alert) => this.HawkularAlertsManager.createTrigger(metricId + '_trigger_avail', false, 'AVAILABILITY',
defaultEmail),
(e) => err(e, 'Error saving threshold trigger.'))

//this.$location.url('/hawkular/' + metricId);
Expand All @@ -168,7 +173,9 @@ module HawkularMetrics {

getResourceList(currentTenantId?: TenantId):any {
var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'URL', per_page: this.resPerPage, page: this.resCurPage}, (aResourceList, getResponseHeaders) => {
this.HawkularInventory.ResourceOfType.query(
{resourceTypeId: 'URL', per_page: this.resPerPage, page: this.resCurPage},
(aResourceList, getResponseHeaders) => {
// FIXME: hack.. make expanded out of list
this.headerLinks = this.HkHeaderParser.parse(getResponseHeaders());

Expand Down Expand Up @@ -243,7 +250,8 @@ module HawkularMetrics {

class DeleteResourceModalController {

static $inject = ['$scope', '$rootScope', '$modalInstance', '$q', 'HawkularInventory', 'HawkularAlertsManager', 'resource'];
static $inject = ['$scope', '$rootScope', '$modalInstance', '$q', 'HawkularInventory', 'HawkularAlertsManager',
'resource'];

constructor(private $scope: any,
private $rootScope: any,
Expand Down
9 changes: 6 additions & 3 deletions console/src/main/scripts/plugins/metrics/ts/alertsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ module HawkularMetrics {
setEmail(triggerId: string, email: string): ng.IPromise<void>;
setResponseTime(triggerId: string, treshold: number, duration: number, enabled: boolean): ng.IPromise<void>;
setDowntime(triggerId: string, duration: number, enabled: boolean): ng.IPromise<void>;
queryConsoleAlerts(metricId: string, startTime?:TimestampInMillis, endTime?:TimestampInMillis, type?:AlertType, currentPage?:number, perPage?:number): any;
queryConsoleAlerts(metricId: string, startTime?:TimestampInMillis, endTime?:TimestampInMillis, type?:AlertType,
currentPage?:number, perPage?:number): any;
}

export class HawkularAlertsManager implements IHawkularAlertsManager{
Expand All @@ -54,7 +55,8 @@ module HawkularMetrics {
private $moment: any) {
}

public createTrigger(triggerName: string, enabled: boolean, conditionType: string, email: string): ng.IPromise<void> {
public createTrigger(triggerName: string, enabled: boolean,
conditionType: string, email: string): ng.IPromise<void> {
// Create a trigger
var triggerId: string;
var DEFAULT_RESOLVE_THRESHOLD = 1000;
Expand Down Expand Up @@ -225,7 +227,8 @@ module HawkularMetrics {
return undefined;
}

queryConsoleAlerts(metricId: string, startTime?:TimestampInMillis, endTime?:TimestampInMillis, alertType?:AlertType, currentPage?:number, perPage?:number): any {
queryConsoleAlerts(metricId: string, startTime?:TimestampInMillis, endTime?:TimestampInMillis, alertType?:AlertType,
currentPage?:number, perPage?:number): any {
var alertList = [];
var headers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module HawkularMetrics {
export class AppServerDatasourcesDetailsController {

/// for minification only
public static $inject = ['$scope','$rootScope','$routeParams','$interval','$q','HawkularInventory','HawkularMetric'];
public static $inject = ['$scope','$rootScope','$routeParams','$interval','$q','HawkularInventory',
'HawkularMetric'];

public static AVAILABLE_COLOR = '#1884c7'; /// blue
public static IN_USE_COLOR = '#49a547'; /// green
Expand Down Expand Up @@ -58,7 +59,8 @@ module HawkularMetrics {
this.getDatasources(this.$rootScope.currentPersona.id);
} else {
// currentPersona hasn't been injected to the rootScope yet, wait for it..
$rootScope.$watch('currentPersona', (currentPersona) => currentPersona && this.getDatasources(currentPersona.id));
$rootScope.$watch('currentPersona', (currentPersona) => currentPersona &&
this.getDatasources(currentPersona.id));
}

this.autoRefresh(20);
Expand Down Expand Up @@ -87,7 +89,8 @@ module HawkularMetrics {
this.startTimeStamp = this.endTimeStamp - (this.$routeParams.timeOffset || 3600000);

var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'Datasource'}, (aResourceList, getResponseHeaders) => {
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'Datasource'},
(aResourceList, getResponseHeaders) => {
var promises = [];
var tmpResourceList = [];
angular.forEach(aResourceList, function(res, idx) {
Expand Down Expand Up @@ -129,36 +132,46 @@ module HawkularMetrics {
start: this.startTimeStamp,
end: this.endTimeStamp, buckets:60}, (data) => {
this.chartAvailData[res.id] = this.chartAvailData[res.id] || [];
this.chartAvailData[res.id][0] = { key: 'Available Count', color: AppServerDatasourcesDetailsController.AVAILABLE_COLOR, values: this.formatBucketedChartOutput(data) };
this.chartAvailData[res.id][0] = { key: 'Available Count',
color: AppServerDatasourcesDetailsController.AVAILABLE_COLOR,
values: this.formatBucketedChartOutput(data) };
}, this);
this.HawkularMetric.GaugeMetricData(this.$rootScope.currentPersona.id).queryMetrics({
gaugeId: 'MI~R~' + res.id + '~MT~Datasource Pool Metrics~In Use Count',
start: this.startTimeStamp,
end: this.endTimeStamp, buckets:60}, (data) => {
this.chartAvailData[res.id] = this.chartAvailData[res.id] || [];
this.chartAvailData[res.id][1] = { key: 'In Use', color: AppServerDatasourcesDetailsController.IN_USE_COLOR, values: this.formatBucketedChartOutput(data) };
this.chartAvailData[res.id][1] = { key: 'In Use',
color: AppServerDatasourcesDetailsController.IN_USE_COLOR,
values: this.formatBucketedChartOutput(data) };
}, this);
this.HawkularMetric.GaugeMetricData(this.$rootScope.currentPersona.id).queryMetrics({
gaugeId: 'MI~R~' + res.id + '~MT~Datasource Pool Metrics~Timed Out',
start: this.startTimeStamp,
end: this.endTimeStamp, buckets:60}, (data) => {
this.chartAvailData[res.id] = this.chartAvailData[res.id] || [];
this.chartAvailData[res.id][2] = { key: 'Timed Out', color: AppServerDatasourcesDetailsController.TIMED_OUT_COLOR, values: this.formatBucketedChartOutput(data) };
this.chartAvailData[res.id][2] = { key: 'Timed Out',
color: AppServerDatasourcesDetailsController.TIMED_OUT_COLOR,
values: this.formatBucketedChartOutput(data) };
}, this);

this.HawkularMetric.GaugeMetricData(this.$rootScope.currentPersona.id).queryMetrics({
gaugeId: 'MI~R~' + res.id + '~MT~Datasource Pool Metrics~Average Get Time',
start: this.startTimeStamp,
end: this.endTimeStamp, buckets:60}, (data) => {
this.chartRespData[res.id] = this.chartRespData[res.id] || [];
this.chartRespData[res.id][0] = { key: 'Wait Time (Avg.)', color: AppServerDatasourcesDetailsController.WAIT_COLOR, values: this.formatBucketedChartOutput(data) };
this.chartRespData[res.id][0] = { key: 'Wait Time (Avg.)',
color: AppServerDatasourcesDetailsController.WAIT_COLOR,
values: this.formatBucketedChartOutput(data) };
}, this);
this.HawkularMetric.GaugeMetricData(this.$rootScope.currentPersona.id).queryMetrics({
gaugeId: 'MI~R~' + res.id + '~MT~Datasource Pool Metrics~Average Creation Time',
start: this.startTimeStamp,
end: this.endTimeStamp, buckets:60}, (data) => {
this.chartRespData[res.id] = this.chartRespData[res.id] || [];
this.chartRespData[res.id][1] = { key: 'Creation Time (Avg.)', color: AppServerDatasourcesDetailsController.CREATION_COLOR, values: this.formatBucketedChartOutput(data) };
this.chartRespData[res.id][1] = { key: 'Creation Time (Avg.)',
color: AppServerDatasourcesDetailsController.CREATION_COLOR,
values: this.formatBucketedChartOutput(data) };
}, this);
}, this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ module HawkularMetrics {

export class AppServerDeploymentsDetailsController {
/// this is for minification purposes
public static $inject = ['$location', '$scope', '$rootScope', '$interval', '$log', '$filter', '$routeParams', '$modal', 'HawkularInventory', 'HawkularMetric', 'HawkularAlert', 'HawkularAlertsManager', 'HawkularErrorManager', '$q', 'md5'];
public static $inject = ['$location', '$scope', '$rootScope', '$interval', '$log', '$filter', '$routeParams',
'$modal', 'HawkularInventory', 'HawkularMetric', 'HawkularAlert', 'HawkularAlertsManager', 'HawkularErrorManager',
'$q', 'md5'];

private resourceList;
private metricsList;
Expand Down Expand Up @@ -56,7 +58,8 @@ module HawkularMetrics {
this.getResourceList(this.$rootScope.currentPersona.id);
} else {
// currentPersona hasn't been injected to the rootScope yet, wait for it..
$rootScope.$watch('currentPersona', (currentPersona) => currentPersona && this.getResourceList(currentPersona.id));
$rootScope.$watch('currentPersona', (currentPersona) => currentPersona &&
this.getResourceList(currentPersona.id));
}

this.autoRefresh(20);
Expand All @@ -82,7 +85,8 @@ module HawkularMetrics {
getResourceList(currentTenantId?: TenantId): any {
this.alertList = []; // FIXME: when we have alerts for app server
var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'Deployment'}, (aResourceList, getResponseHeaders) => {
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'Deployment'},
(aResourceList, getResponseHeaders) => {
var promises = [];
var tmpResourceList = [];
angular.forEach(aResourceList, function(res, idx) {
Expand Down
Loading

0 comments on commit 023eced

Please sign in to comment.