From 3be11b9861cf4aa43778062897bdcf0d9f110481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 17 Jan 2015 08:27:55 +0100 Subject: [PATCH 01/20] Small cosmetic change --- src/app/features/annotations/partials/editor.html | 4 ++-- src/app/partials/dashboard.html | 2 +- src/app/partials/dasheditor.html | 2 +- src/app/partials/roweditor.html | 2 +- src/app/partials/templating_editor.html | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/features/annotations/partials/editor.html b/src/app/features/annotations/partials/editor.html index 14208dc2ab2..ae2d624edd9 100644 --- a/src/app/features/annotations/partials/editor.html +++ b/src/app/features/annotations/partials/editor.html @@ -26,7 +26,7 @@ {{annotation.name}} - + Edit @@ -34,7 +34,7 @@ - + diff --git a/src/app/partials/dashboard.html b/src/app/partials/dashboard.html index 5795c6e2c8f..d5118a3ee96 100644 --- a/src/app/partials/dashboard.html +++ b/src/app/partials/dashboard.html @@ -104,7 +104,7 @@
- + ADD ROW
diff --git a/src/app/partials/dasheditor.html b/src/app/partials/dasheditor.html index f19c5701c38..fdeb3a4db24 100644 --- a/src/app/partials/dasheditor.html +++ b/src/app/partials/dasheditor.html @@ -54,7 +54,7 @@ - + diff --git a/src/app/partials/roweditor.html b/src/app/partials/roweditor.html index e15f765d2af..450d8a01a3e 100644 --- a/src/app/partials/roweditor.html +++ b/src/app/partials/roweditor.html @@ -41,7 +41,7 @@ - + diff --git a/src/app/partials/templating_editor.html b/src/app/partials/templating_editor.html index c17d0259b2b..1fd600a5701 100644 --- a/src/app/partials/templating_editor.html +++ b/src/app/partials/templating_editor.html @@ -31,7 +31,7 @@ {{variable.query}} - + Edit @@ -39,7 +39,7 @@ - + From e411b8e423f42aa9c151e46a280d9601dd2b7617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 19 Jan 2015 13:07:55 +0100 Subject: [PATCH 02/20] Fixed icons in graph tooltip, not updated after recent font awesome upgrade, Closes #1355 --- src/app/panels/graph/graph.tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/panels/graph/graph.tooltip.js b/src/app/panels/graph/graph.tooltip.js index 9e750cb6a9c..67d6c601104 100644 --- a/src/app/panels/graph/graph.tooltip.js +++ b/src/app/panels/graph/graph.tooltip.js @@ -163,7 +163,7 @@ function ($) { value = series.formatValue(hoverInfo.value); seriesHtml += '
'; - seriesHtml += ' ' + series.label + ':
'; + seriesHtml += ' ' + series.label + ':
'; seriesHtml += '
' + value + '
'; plot.highlight(i, hoverInfo.hoverIndex); } @@ -174,7 +174,7 @@ function ($) { else if (item) { series = seriesList[item.seriesIndex]; group = '
'; - group += ' ' + series.label + ':
'; + group += ' ' + series.label + ':
'; if (scope.panel.stack && scope.panel.tooltip.value_type === 'individual') { value = item.datapoint[1] - item.datapoint[2]; From 5cef73331c4de86b6036b5e19b7b2f7c5e5f49d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 21 Jan 2015 07:27:27 +0100 Subject: [PATCH 03/20] Fixed asteric icon in graphite metric path selector, broken after resent font awesome upgrade, #1361 --- src/app/features/graphite/queryCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/features/graphite/queryCtrl.js b/src/app/features/graphite/queryCtrl.js index 0654c474af5..d878386d461 100644 --- a/src/app/features/graphite/queryCtrl.js +++ b/src/app/features/graphite/queryCtrl.js @@ -293,7 +293,7 @@ function (angular, _, config, gfunc, Parser) { function MetricSegment(options) { if (options === '*' || options.value === '*') { this.value = '*'; - this.html = $sce.trustAsHtml(''); + this.html = $sce.trustAsHtml(''); this.expandable = true; return; } From 83899eb884f2e821436b53aefeb57eafa06f5b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 21 Jan 2015 13:05:55 +0100 Subject: [PATCH 04/20] added hamburger --- src/app/partials/dashboard_topnav.html | 9 ++++++--- src/app/partials/login.html | 2 +- src/css/less/grafana.less | 10 ++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/app/partials/dashboard_topnav.html b/src/app/partials/dashboard_topnav.html index 0d3a8f30ee1..a0bba8c1a15 100644 --- a/src/app/partials/dashboard_topnav.html +++ b/src/app/partials/dashboard_topnav.html @@ -1,10 +1,13 @@ diff --git a/src/app/panels/timepicker/module.js b/src/app/panels/timepicker/module.js index eca4936ad00..2f0d9bd75b8 100644 --- a/src/app/panels/timepicker/module.js +++ b/src/app/panels/timepicker/module.js @@ -58,10 +58,14 @@ function (angular, app, _, moment, kbn) { $scope.init = function() { var time = timeSrv.timeRange(true); - if(time) { - $scope.panel.now = timeSrv.timeRange(false).to === "now" ? true : false; - $scope.time = getScopeTimeObj(time.from,time.to); + $scope.panel.now = false; + + var unparsed = timeSrv.timeRange(false); + if (_.isString(unparsed.to) && unparsed.to.indexOf('now') === 0) { + $scope.panel.now = true; } + + $scope.time = getScopeTimeObj(time.from, time.to); }; $scope.customTime = function() { @@ -142,6 +146,10 @@ function (angular, app, _, moment, kbn) { to: "now" }; + if ($scope.panel.nowDelay) { + _filter.to = 'now-' + $scope.panel.nowDelay; + } + timeSrv.setTime(_filter); $scope.time = getScopeTimeObj(kbn.parseDate(_filter.from),new Date()); diff --git a/src/test/specs/graph-tooltip-specs.js b/src/test/specs/graph-tooltip-specs.js index 16b4211921f..155469f18a7 100644 --- a/src/test/specs/graph-tooltip-specs.js +++ b/src/test/specs/graph-tooltip-specs.js @@ -19,8 +19,7 @@ define([ tooltip: { shared: true }, - legend: { - }, + legend: { }, stack: false }; diff --git a/src/test/specs/influxdb-datasource-specs.js b/src/test/specs/influxdb-datasource-specs.js index f8b545e7db2..028423ac1f4 100644 --- a/src/test/specs/influxdb-datasource-specs.js +++ b/src/test/specs/influxdb-datasource-specs.js @@ -17,7 +17,7 @@ define([ describe('When querying influxdb with one target using query editor target spec', function() { var results; var urlExpected = "/series?p=mupp&q=select+mean(value)+from+%22test%22"+ - "+where+time+%3E+now()+-+1h+group+by+time(1s)+order+asc"; + "+where+time+%3E+now()-1h+group+by+time(1s)+order+asc"; var query = { range: { from: 'now-1h', to: 'now' }, targets: [{ series: 'test', column: 'value', function: 'mean' }], @@ -50,7 +50,7 @@ define([ describe('When querying influxdb with one raw query', function() { var results; var urlExpected = "/series?p=mupp&q=select+value+from+series"+ - "+where+time+%3E+now()+-+1h"; + "+where+time+%3E+now()-1h"; var query = { range: { from: 'now-1h', to: 'now' }, targets: [{ query: "select value from series where $timeFilter", rawQuery: true }] @@ -73,7 +73,7 @@ define([ describe('When issuing annotation query', function() { var results; var urlExpected = "/series?p=mupp&q=select+title+from+events.backend_01"+ - "+where+time+%3E+now()+-+1h"; + "+where+time+%3E+now()-1h"; var range = { from: 'now-1h', to: 'now' }; var annotation = { query: 'select title from events.$server where $timeFilter' }; From 6fc451da9e0b55547f4f04b5d5de2b2202ad3856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sun, 25 Jan 2015 14:51:51 +0100 Subject: [PATCH 16/20] Small fix --- src/app/panels/timepicker/editor.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/panels/timepicker/editor.html b/src/app/panels/timepicker/editor.html index b6073c64998..8771bcadb20 100644 --- a/src/app/panels/timepicker/editor.html +++ b/src/app/panels/timepicker/editor.html @@ -16,7 +16,7 @@ now-
  • -
  • From 1c8ef716a2df95d1166e9cd6402abf8632e1d054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Jan 2015 10:57:08 +0100 Subject: [PATCH 17/20] Began work on time overrides for panels, to enable different time periods on the same dashboard, #171 --- .../dashboard/partials/panelTime.html | 43 +++++++++++++++++++ src/app/features/dashboard/timeSrv.js | 14 ++++-- src/app/panels/graph/module.html | 4 ++ src/app/panels/graph/module.js | 23 ++++++++++ src/css/less/graph.less | 13 +++++- src/css/less/panel.less | 4 +- 6 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 src/app/features/dashboard/partials/panelTime.html diff --git a/src/app/features/dashboard/partials/panelTime.html b/src/app/features/dashboard/partials/panelTime.html new file mode 100644 index 00000000000..7b8b507a2ae --- /dev/null +++ b/src/app/features/dashboard/partials/panelTime.html @@ -0,0 +1,43 @@ +
    +
    +
    +
      +
    • + +
    • +
    • + Override relative time +
    • +
    • + Last +
    • +
    • + +
    • +
    +
    +
    +
    +
      +
    • + +
    • +
    • + Add time shift +
    • +
    • + Amount +
    • +
    • + +
    • +
    +
    +
    +
    +
    + diff --git a/src/app/features/dashboard/timeSrv.js b/src/app/features/dashboard/timeSrv.js index e2f9f313d1e..0d8dc31567b 100644 --- a/src/app/features/dashboard/timeSrv.js +++ b/src/app/features/dashboard/timeSrv.js @@ -19,12 +19,23 @@ define([ this.time = dashboard.time; this._initTimeFromUrl(); + this._parseTime(); if(this.dashboard.refresh) { this.set_interval(this.dashboard.refresh); } }; + this._parseTime = function() { + // when absolute time is saved in json it is turned to a string + if (_.isString(this.time.from) && this.time.from.indexOf('Z') >= 0) { + this.time.from = new Date(this.time.from); + } + if (_.isString(this.time.to) && this.time.to.indexOf('Z') >= 0) { + this.time.to = new Date(this.time.to); + } + }; + this._parseUrlParam = function(value) { if (value.indexOf('now') !== -1) { return value; @@ -109,9 +120,6 @@ define([ this.timeRange = function(parse) { var _t = this.time; - if(_.isUndefined(_t) || _.isUndefined(_t.from)) { - return false; - } if(parse === false) { return { diff --git a/src/app/panels/graph/module.html b/src/app/panels/graph/module.html index fa205e488a6..20896fc5c83 100644 --- a/src/app/panels/graph/module.html +++ b/src/app/panels/graph/module.html @@ -3,6 +3,10 @@
    + + {{panelMeta.timeInfo}} + +
    No datapoints No datapoints returned from metric query diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js index 7fde36b475f..eac410360ad 100644 --- a/src/app/panels/graph/module.js +++ b/src/app/panels/graph/module.js @@ -26,6 +26,7 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) { $scope.panelMeta.addEditorTab('Axes & Grid', 'app/panels/graph/axisEditor.html'); $scope.panelMeta.addEditorTab('Display Styles', 'app/panels/graph/styleEditor.html'); + $scope.panelMeta.addEditorTab('Time range', 'app/features/dashboard/partials/panelTime.html'); $scope.panelMeta.addExtendedMenuItem('Export CSV', '', 'exportCsv()'); $scope.panelMeta.addExtendedMenuItem('Toggle legend', '', 'toggleLegend()'); @@ -88,6 +89,9 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) { value_type: 'cumulative', shared: false, }, + // time overrides + timeFrom: null, + timeShift: null, // metric queries targets: [{}], // series color overrides @@ -114,6 +118,25 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) { $scope.updateTimeRange = function () { $scope.range = timeSrv.timeRange(); $scope.rangeUnparsed = timeSrv.timeRange(false); + + $scope.panelMeta.timeInfo = ""; + + // check panel time overrrides + if ($scope.panel.timeFrom) { + if (_.isString($scope.rangeUnparsed.from)) { + $scope.panelMeta.timeInfo = "Last " + $scope.panel.timeFrom; + $scope.rangeUnparsed.from = 'now-' + $scope.panel.timeFrom; + $scope.range.from = kbn.parseDate($scope.rangeUnparsed.from); + } + } + // if ($scope.panel.timeShift) { + // // from: now-1h + // // to: now + // // timeshift: 1d + // // from: now-1d-1h + // // to: now-1d + // } + if ($scope.panel.maxDataPoints) { $scope.resolution = $scope.panel.maxDataPoints; } diff --git a/src/css/less/graph.less b/src/css/less/graph.less index 5ad38283689..46263a43988 100644 --- a/src/css/less/graph.less +++ b/src/css/less/graph.less @@ -141,7 +141,7 @@ vertical-align: top; position: relative; left: 4px; - top: -20px; + top: -25px; } .graph-legend { @@ -260,7 +260,6 @@ transform-origin: right top; } - .axisLabel { color: @textColor; font-size: @fontSizeSmall; @@ -269,3 +268,13 @@ font-size: 12px; } +.graph-time-info { + font-weight: bold; + float: right; + margin-right: 15px; + color: @blue; + font-size: 85%; + position: relative; + top: -20px; +} + diff --git a/src/css/less/panel.less b/src/css/less/panel.less index 7a9a8aba4ff..451431b9d76 100644 --- a/src/css/less/panel.less +++ b/src/css/less/panel.less @@ -49,8 +49,8 @@ .panel-loading { position:absolute; - top: 0px; - right: 4px; + top: -3px; + right: 0px; z-index: 800; } From ea5da627af111cc74c3c21a27233bdbe35cdf2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Jan 2015 11:49:18 +0100 Subject: [PATCH 18/20] Panel: Different time periods, panels can override dashboard relative time and/or add a time shift, #171, only works for graph panel for now, need feedback for how to do it for singlestat panel --- CHANGELOG.md | 1 + src/app/panels/graph/module.js | 17 +++++++++-------- src/test/specs/kbn-format-specs.js | 11 +++++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d56edad01a1..5d5721604c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ **New features** - [Issue #1331](https://github.com/grafana/grafana/issues/1331). Graph & Singlestat: New axis/unit format selector and more units (kbytes, Joule, Watt, eV), and new design for graph axis & grid tab and single stat options tab views - [Issue #1241](https://github.com/grafana/grafana/issues/1242). Timepicker: New option in timepicker (under dashboard settings), to change ``now`` to be for example ``now-1m``, usefull when you want to ignore last minute because it contains incomplete data +- [Issue #171](https://github.com/grafana/grafana/issues/171). Panel: Different time periods, panels can override dashboard relative time and/or add a time shift **Enhancements** - [Issue #1297](https://github.com/grafana/grafana/issues/1297). Graphite: Added cumulative and minimumBelow graphite functions diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js index eac410360ad..56a15a7b72e 100644 --- a/src/app/panels/graph/module.js +++ b/src/app/panels/graph/module.js @@ -124,18 +124,19 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) { // check panel time overrrides if ($scope.panel.timeFrom) { if (_.isString($scope.rangeUnparsed.from)) { - $scope.panelMeta.timeInfo = "Last " + $scope.panel.timeFrom; + $scope.panelMeta.timeInfo = "last " + $scope.panel.timeFrom; $scope.rangeUnparsed.from = 'now-' + $scope.panel.timeFrom; $scope.range.from = kbn.parseDate($scope.rangeUnparsed.from); } } - // if ($scope.panel.timeShift) { - // // from: now-1h - // // to: now - // // timeshift: 1d - // // from: now-1d-1h - // // to: now-1d - // } + + if ($scope.panel.timeShift) { + var timeShift = '-' + $scope.panel.timeShift; + $scope.panelMeta.timeInfo += ' timeshift ' + timeShift; + $scope.range.from = kbn.parseDateMath(timeShift, $scope.range.from); + $scope.range.to = kbn.parseDateMath(timeShift, $scope.range.to); + $scope.rangeUnparsed = $scope.range; + } if ($scope.panel.maxDataPoints) { $scope.resolution = $scope.panel.maxDataPoints; diff --git a/src/test/specs/kbn-format-specs.js b/src/test/specs/kbn-format-specs.js index 785d9376411..7c75e7eca93 100644 --- a/src/test/specs/kbn-format-specs.js +++ b/src/test/specs/kbn-format-specs.js @@ -69,4 +69,15 @@ define([ }); + describe('relative time to date parsing', function() { + it('should handle negative time', function() { + var date = kbn.parseDateMath('-2d', new Date(2014,1,5)); + expect(date.getTime()).to.equal(new Date(2014, 1, 3).getTime()); + }); + it('should handle multiple math expressions', function() { + var date = kbn.parseDateMath('-2d-6h', new Date(2014, 1, 5)); + expect(date.toString()).to.equal(new Date(2014, 1, 2, 18).toString()); + }); + }); + }); From ab7e2f89fb596d6adc9a28177feb97574e860ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Jan 2015 12:57:44 +0100 Subject: [PATCH 19/20] Corrected the use of POST vs PUT, POST creates something, PUT updates, got them mixed up --- src/app/controllers/loginCtrl.js | 2 +- src/app/features/account/accountUsersCtrl.js | 16 +++------------- src/app/features/account/apiKeysCtrl.js | 7 +------ src/app/features/profile/profileCtrl.js | 5 ++--- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/app/controllers/loginCtrl.js b/src/app/controllers/loginCtrl.js index 3f109709167..45d24987ca1 100644 --- a/src/app/controllers/loginCtrl.js +++ b/src/app/controllers/loginCtrl.js @@ -75,7 +75,7 @@ function (angular, config) { return; } - backendSrv.put('/api/user/signup', $scope.formModel).then(function() { + backendSrv.post('/api/user/signup', $scope.formModel).then(function() { window.location.href = config.appSubUrl + '/'; }); }; diff --git a/src/app/features/account/accountUsersCtrl.js b/src/app/features/account/accountUsersCtrl.js index 560b8ff4bc6..65ad8bcf847 100644 --- a/src/app/features/account/accountUsersCtrl.js +++ b/src/app/features/account/accountUsersCtrl.js @@ -24,22 +24,12 @@ function (angular) { }; $scope.removeUser = function(user) { - backendSrv.request({ - method: 'DELETE', - url: '/api/account/users/' + user.userId - }).then($scope.get); + backendSrv.delete('/api/account/users/' + user.userId).then($scope.get); }; $scope.addUser = function() { - if (!$scope.form.$valid) { - return; - } - - backendSrv.request({ - method: 'PUT', - url: '/api/account/users', - data: $scope.user, - }).then($scope.get); + if (!$scope.form.$valid) { return; } + backendSrv.post('/api/account/users', $scope.user).then($scope.get); }; $scope.init(); diff --git a/src/app/features/account/apiKeysCtrl.js b/src/app/features/account/apiKeysCtrl.js index 8878edc3506..64df055dd90 100644 --- a/src/app/features/account/apiKeysCtrl.js +++ b/src/app/features/account/apiKeysCtrl.js @@ -26,12 +26,7 @@ function (angular) { }; $scope.addToken = function() { - backendSrv.request({ - method: 'PUT', - url: '/api/tokens', - data: $scope.token, - desc: 'Add token' - }).then($scope.getTokens); + backendSrv.post('/api/tokens', $scope.token).then($scope.getTokens); }; $scope.init(); diff --git a/src/app/features/profile/profileCtrl.js b/src/app/features/profile/profileCtrl.js index 0a2ea70efe7..b028e48be1d 100644 --- a/src/app/features/profile/profileCtrl.js +++ b/src/app/features/profile/profileCtrl.js @@ -33,12 +33,11 @@ function (angular) { $scope.update = function() { if (!$scope.userForm.$valid) { return; } - - backendSrv.post('/api/user/', $scope.user); + backendSrv.put('/api/user/', $scope.user); }; $scope.createAccount = function() { - backendSrv.put('/api/account/', $scope.newAccount).then($scope.getUserAccounts); + backendSrv.post('/api/account/', $scope.newAccount).then($scope.getUserAccounts); }; $scope.init(); From a6b0856020847b6530b9d1505fe39f347988be57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Jan 2015 15:42:11 +0100 Subject: [PATCH 20/20] Worked on account update view --- src/app/controllers/sidemenuCtrl.js | 2 + src/app/features/account/accountCtrl.js | 29 ++++++ .../features/account/partials/account.html | 26 +++++- src/app/features/account/partials/users.html | 2 +- src/app/features/all.js | 1 + .../features/profile/partials/profile.html | 89 ++++++++++--------- src/app/partials/sidemenu.html | 2 +- src/app/routes/backend/all.js | 1 + src/css/less/p_pro.less | 8 ++ 9 files changed, 112 insertions(+), 48 deletions(-) create mode 100644 src/app/features/account/accountCtrl.js diff --git a/src/app/controllers/sidemenuCtrl.js b/src/app/controllers/sidemenuCtrl.js index 355783653cf..10b73e2458a 100644 --- a/src/app/controllers/sidemenuCtrl.js +++ b/src/app/controllers/sidemenuCtrl.js @@ -33,6 +33,7 @@ function (angular, _, $, config) { text: "Account", href: $scope.getUrl("/account"), icon: "fa fa-shield", links: [ + { text: 'Info', href: $scope.getUrl("/account"), icon: "fa fa-sitemap" }, { text: 'Data sources', href: $scope.getUrl("/account/datasources"), icon: "fa fa-sitemap" }, { text: 'Users', href: $scope.getUrl("/account/users"), icon: "fa fa-users" }, { text: 'API Keys', href: $scope.getUrl("/account/apikeys"), icon: "fa fa-key" }, @@ -42,6 +43,7 @@ function (angular, _, $, config) { text: "Profile", href: $scope.getUrl("/profile"), icon: "fa fa-user", links: [ + { text: 'Info', href: $scope.getUrl("/profile"), icon: "fa fa-sitemap" }, { text: 'Password', href:"", icon: "fa fa-lock" }, ] } diff --git a/src/app/features/account/accountCtrl.js b/src/app/features/account/accountCtrl.js new file mode 100644 index 00000000000..8d4130bda03 --- /dev/null +++ b/src/app/features/account/accountCtrl.js @@ -0,0 +1,29 @@ +define([ + 'angular', +], +function (angular) { + 'use strict'; + + var module = angular.module('grafana.controllers'); + + module.controller('AccountCtrl', function($scope, $http, backendSrv) { + + $scope.init = function() { + $scope.getAccount(); + }; + + $scope.getAccount = function() { + backendSrv.get('/api/account').then(function(account) { + $scope.account = account; + }); + }; + + $scope.update = function() { + if (!$scope.accountForm.$valid) { return; } + backendSrv.put('/api/account', $scope.account).then($scope.getAccount); + }; + + $scope.init(); + + }); +}); diff --git a/src/app/features/account/partials/account.html b/src/app/features/account/partials/account.html index f45138b9736..5465d0c7094 100644 --- a/src/app/features/account/partials/account.html +++ b/src/app/features/account/partials/account.html @@ -5,14 +5,32 @@
    - Account info + Account information
    - -

    TODO

    - +
    +
    +
    +
    +
    +
      +
    • + Account name +
    • +
    • + +
    • +
    +
    +
    +
    +
    + +
    +
    +
    diff --git a/src/app/features/account/partials/users.html b/src/app/features/account/partials/users.html index 9b54b33fea8..819e5ef76ba 100644 --- a/src/app/features/account/partials/users.html +++ b/src/app/features/account/partials/users.html @@ -5,7 +5,7 @@
    - Account users + Users
    diff --git a/src/app/features/all.js b/src/app/features/all.js index 54946bb0fc2..de8e1ac3a32 100644 --- a/src/app/features/all.js +++ b/src/app/features/all.js @@ -12,6 +12,7 @@ define([ './account/datasourcesCtrl', './account/apiKeysCtrl', './account/importCtrl', + './account/accountCtrl', './admin/adminUsersCtrl', './grafanaDatasource/datasource', ], function () {}); diff --git a/src/app/features/profile/partials/profile.html b/src/app/features/profile/partials/profile.html index 2f5df6146ed..800062c8453 100644 --- a/src/app/features/profile/partials/profile.html +++ b/src/app/features/profile/partials/profile.html @@ -7,51 +7,53 @@
    - Your info + Personal information
    +
    +
    +
    +
    +
      +
    • + Name +
    • +
    • + +
    • +
    +
    +
    +
    +
      +
    • + Email +
    • +
    • + +
    • +
    +
    +
    +
    +
      +
    • + Username +
    • +
    • + +
    • +
    +
    +
    +
    - - -
    -
      -
    • - Name -
    • -
    • - -
    • -
    -
    -
    -
    -
      -
    • - Email -
    • -
    • - -
    • -
    -
    -
    -
    -
      -
    • - Username -
    • -
    • - -
    • -
    -
    -
    - -
    - -
    +
    + + +
    @@ -59,7 +61,7 @@
    - Your accounts + Your accounts

    @@ -87,7 +89,7 @@
    - Add account + Add account

    @@ -111,5 +113,8 @@
    + + + diff --git a/src/app/partials/sidemenu.html b/src/app/partials/sidemenu.html index 980ed6b897e..0ba9c642686 100644 --- a/src/app/partials/sidemenu.html +++ b/src/app/partials/sidemenu.html @@ -17,7 +17,7 @@
  • diff --git a/src/app/routes/backend/all.js b/src/app/routes/backend/all.js index e52abb47f41..f97ca90ba04 100644 --- a/src/app/routes/backend/all.js +++ b/src/app/routes/backend/all.js @@ -32,6 +32,7 @@ define([ }) .when('/account', { templateUrl: 'app/features/account/partials/account.html', + controller : 'AccountCtrl', }) .when('/account/datasources', { templateUrl: 'app/features/account/partials/datasources.html', diff --git a/src/css/less/p_pro.less b/src/css/less/p_pro.less index b3d65e9acc5..678c2fba064 100644 --- a/src/css/less/p_pro.less +++ b/src/css/less/p_pro.less @@ -1,5 +1,8 @@ .pro-sidemenu { display: none; + a:focus { + text-decoration: none; + } } .pro-sidemenu-open { @@ -50,9 +53,14 @@ display: block; padding: 6px 0 6px 30px; font-size: 15px; + color: @gray; i { padding-right: 15px; } + &.active { + color: white; + font-weight: bold; + } } .sidemenu-user {