mirror of https://github.com/grafana/grafana
parent
373118c5ee
commit
b3b096e204
@ -0,0 +1,25 @@ |
||||
define([ |
||||
'angular', |
||||
'services/pro/backendSrv', |
||||
], |
||||
function (angular) { |
||||
'use strict'; |
||||
|
||||
var module = angular.module('grafana.controllers'); |
||||
|
||||
module.controller('DataSourcesCtrl', function($scope, $http, backendSrv) { |
||||
|
||||
$scope.init = function() { |
||||
}; |
||||
|
||||
$scope.getAccount = function() { |
||||
backendSrv.get('/api/account/').then(function(account) { |
||||
$scope.account = account; |
||||
$scope.collaborators = account.collaborators; |
||||
}); |
||||
}; |
||||
|
||||
$scope.init(); |
||||
|
||||
}); |
||||
}); |
||||
@ -1,31 +0,0 @@ |
||||
<div ng-controller='OverviewCtrl'> |
||||
|
||||
<h2>hello</h2> |
||||
<div class="overview-series-list"> |
||||
<div class="overview-series-item" ng-repeat="series in series"> |
||||
<h2>{{series.info.alias}}</h2> |
||||
<strong>{{series.info.avg}} Avg</strong> |
||||
</div> |
||||
</div> |
||||
<div class="clearfix"></div> |
||||
|
||||
<div style="margin-top: 30px" ng-if="editMode"> |
||||
<div class="dashboard-editor-header"> |
||||
<div class="dashboard-editor-title"> |
||||
<i class="icon icon-bar-chart"></i> |
||||
Panel settings |
||||
</div> |
||||
|
||||
<div ng-model="editor.index" bs-tabs> |
||||
<div ng-repeat="tab in editorTabs" data-title="{{tab}}"> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="dashboard-editor-body"> |
||||
<div ng-repeat="tab in panelMeta.fullEditorTabs" ng-if="editorTabs[editor.index] == tab.title"> |
||||
<div ng-include src="tab.src"></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
@ -1,97 +0,0 @@ |
||||
define([ |
||||
'angular', |
||||
'app', |
||||
'lodash', |
||||
'components/timeSeries', |
||||
'services/panelSrv', |
||||
], |
||||
function (angular, app, _, timeSeries) { |
||||
'use strict'; |
||||
|
||||
var module = angular.module('grafana.panels.overview', []); |
||||
app.useModule(module); |
||||
|
||||
module.controller('OverviewCtrl', function($scope, panelSrv, timeSrv) { |
||||
|
||||
$scope.panelMeta = { |
||||
description : "A panel to show an overview of different metrics through avg, total, current numbers and sparklines", |
||||
fullEditorTabs : [ |
||||
{ |
||||
title: 'General', |
||||
src:'app/partials/panelgeneral.html' |
||||
}, |
||||
{ |
||||
title: 'Metrics', |
||||
src:'app/partials/metrics.html' |
||||
} |
||||
], |
||||
fullscreenEdit: true, |
||||
}; |
||||
|
||||
// Set and populate defaults
|
||||
var _d = { |
||||
targets: [{}] |
||||
}; |
||||
|
||||
_.defaults($scope.panel, _d); |
||||
|
||||
$scope.init = function() { |
||||
}; |
||||
|
||||
$scope.get_data = function() { |
||||
$scope.rangeUnparsed = timeSrv.timeRange(false); |
||||
|
||||
var metricsQuery = { |
||||
range: $scope.rangeUnparsed, |
||||
interval: '1min', |
||||
targets: $scope.panel.targets, |
||||
maxDataPoints: 100, |
||||
}; |
||||
|
||||
return $scope.datasource.query($scope.filter, metricsQuery) |
||||
.then($scope.dataHandler) |
||||
.then(null, function(err) { |
||||
$scope.panelMeta.loading = false; |
||||
$scope.panel.error = err.message || "Timeseries data request error"; |
||||
$scope.inspector.error = err; |
||||
$scope.render([]); |
||||
}); |
||||
}; |
||||
|
||||
$scope.dataHandler = function(results) { |
||||
$scope.panelMeta.loading = false; |
||||
$scope.series = _.map(results.data, $scope.seriesHandler); |
||||
|
||||
console.log($scope.series); |
||||
}; |
||||
|
||||
$scope.seriesHandler = function(seriesData) { |
||||
var datapoints = seriesData.datapoints; |
||||
var alias = seriesData.target; |
||||
|
||||
var seriesInfo = { |
||||
alias: alias, |
||||
enable: true, |
||||
}; |
||||
|
||||
var series = new timeSeries.ZeroFilled({ |
||||
datapoints: datapoints, |
||||
info: seriesInfo, |
||||
}); |
||||
|
||||
series.points = series.getFlotPairs('connected', 'short'); |
||||
|
||||
return series; |
||||
}; |
||||
|
||||
$scope.render = function() { |
||||
|
||||
}; |
||||
|
||||
$scope.openEditor = function() { |
||||
}; |
||||
|
||||
panelSrv.init($scope); |
||||
|
||||
}); |
||||
}); |
||||
@ -0,0 +1,2 @@ |
||||
|
||||
<div ng-include="'app/partials/pro/navbar.html'" ng-init="pageTitle='Data sources'"></div> |
||||
@ -1,8 +1,7 @@ |
||||
define([ |
||||
'./dashboard-from-db', |
||||
'./solo-panel-route', |
||||
'./dashboard-from-file', |
||||
'./dashboard-from-script', |
||||
'./dashboard-default', |
||||
'./pro/dashboard', |
||||
'./pro/admin', |
||||
'./pro/solo-panel', |
||||
'./pro/login', |
||||
], |
||||
function () {}); |
||||
|
||||
@ -1,7 +0,0 @@ |
||||
define([ |
||||
'./p_dashboard', |
||||
'./pro/solo-panel', |
||||
'./p_admin', |
||||
'./p_login', |
||||
], |
||||
function () {}); |
||||
@ -1,6 +1,6 @@ |
||||
define([ |
||||
'angular', |
||||
'../controllers/pro/loginCtrl', |
||||
'controllers/pro/loginCtrl', |
||||
], |
||||
function (angular) { |
||||
"use strict"; |
||||
Loading…
Reference in new issue