mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Moved things around, started work on datasources view
This commit is contained in:
parent
373118c5ee
commit
b3b096e204
25
src/app/controllers/pro/datasourcesCtrl.js
Normal file
25
src/app/controllers/pro/datasourcesCtrl.js
Normal file
@ -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();
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
@ -85,7 +85,7 @@ function (angular, $, _, appLevelRequire, config) {
|
|||||||
'directives/all',
|
'directives/all',
|
||||||
'filters/all',
|
'filters/all',
|
||||||
'components/partials',
|
'components/partials',
|
||||||
'routes/p_all',
|
'routes/all',
|
||||||
];
|
];
|
||||||
|
|
||||||
_.each(config.plugins.dependencies, function(dep) {
|
_.each(config.plugins.dependencies, function(dep) {
|
||||||
|
@ -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);
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,15 +1,5 @@
|
|||||||
<div class="navbar navbar-static-top">
|
|
||||||
<div class="navbar-inner">
|
<div ng-include="'app/partials/pro/navbar.html'" ng-init="pageTitle='Account Settings'"></div>
|
||||||
<div class="container-fluid">
|
|
||||||
<span class="brand">
|
|
||||||
<a ng-click="toggleProSideMenu()">
|
|
||||||
<img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img>
|
|
||||||
</a>
|
|
||||||
<span class="page-title">Account Settings</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dashboard-edit-view">
|
<div class="dashboard-edit-view">
|
||||||
<div class="editor-row">
|
<div class="editor-row">
|
||||||
|
2
src/app/partials/pro/datasources.html
Normal file
2
src/app/partials/pro/datasources.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
<div ng-include="'app/partials/pro/navbar.html'" ng-init="pageTitle='Data sources'"></div>
|
@ -3,9 +3,9 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<span class="brand">
|
<span class="brand">
|
||||||
<a ng-click="toggleProSideMenu()">
|
<a ng-click="toggleProSideMenu()">
|
||||||
<img src="img/small.png">
|
<img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img>
|
||||||
</a>
|
</a>
|
||||||
Admin / Data sources
|
<span class="page-title">{{pageTitle}}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,8 +1,7 @@
|
|||||||
define([
|
define([
|
||||||
'./dashboard-from-db',
|
'./pro/dashboard',
|
||||||
'./solo-panel-route',
|
'./pro/admin',
|
||||||
'./dashboard-from-file',
|
'./pro/solo-panel',
|
||||||
'./dashboard-from-script',
|
'./pro/login',
|
||||||
'./dashboard-default',
|
|
||||||
],
|
],
|
||||||
function () {});
|
function () {});
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
define([
|
|
||||||
'./p_dashboard',
|
|
||||||
'./pro/solo-panel',
|
|
||||||
'./p_admin',
|
|
||||||
'./p_login',
|
|
||||||
],
|
|
||||||
function () {});
|
|
@ -1,6 +1,7 @@
|
|||||||
define([
|
define([
|
||||||
'angular',
|
'angular',
|
||||||
'controllers/pro/accountCtrl',
|
'controllers/pro/accountCtrl',
|
||||||
|
'controllers/pro/datasourcesCtrl',
|
||||||
],
|
],
|
||||||
function (angular) {
|
function (angular) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -10,8 +11,8 @@ function (angular) {
|
|||||||
module.config(function($routeProvider) {
|
module.config(function($routeProvider) {
|
||||||
$routeProvider
|
$routeProvider
|
||||||
.when('/admin/datasources', {
|
.when('/admin/datasources', {
|
||||||
templateUrl: 'app/partials/pro/admin_datasources.html',
|
templateUrl: 'app/partials/pro/datasources.html',
|
||||||
controller : 'AdminCtrl',
|
controller : 'DataSourcesCtrl',
|
||||||
})
|
})
|
||||||
.when('/account', {
|
.when('/account', {
|
||||||
templateUrl: 'app/partials/pro/account.html',
|
templateUrl: 'app/partials/pro/account.html',
|
@ -1,6 +1,6 @@
|
|||||||
define([
|
define([
|
||||||
'angular',
|
'angular',
|
||||||
'../controllers/pro/loginCtrl',
|
'controllers/pro/loginCtrl',
|
||||||
],
|
],
|
||||||
function (angular) {
|
function (angular) {
|
||||||
"use strict";
|
"use strict";
|
Loading…
Reference in New Issue
Block a user