Skip to content

Commit 5a81cf6

Browse files
committed
Merge branch 'master' of github.com:grafana/grafana
2 parents f772a5c + eeb7524 commit 5a81cf6

File tree

24 files changed

+142
-90
lines changed

24 files changed

+142
-90
lines changed

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
# 3.0.0-beta2 (unreleased)
1+
# 3.0.0-beta3 (unreleased)
2+
3+
### Enhancements
4+
* **InfluxDB**: Changed multi query encoding to work with InfluxDB 0.11 & 0.12, closes [#4533](https://github.com/grafana/grafana/issues/4533)
5+
6+
### Bug fixes
7+
* **Postgres**: Fixed page render crash when using postgres, fixes [#4558](https://github.com/grafana/grafana/issues/4558)
8+
* **Table panel**: Fixed table panel bug when trying to show annotations in table panel, fixes [#4563](https://github.com/grafana/grafana/issues/4563)
9+
* **App Config**: Fixed app config issue showing content of other app config, fixes [#4575](https://github.com/grafana/grafana/issues/4575)
10+
* **Graph Panel**: Fixed legend option max not updating, fixes [#4601](https://github.com/grafana/grafana/issues/4601)
11+
* **Graph Panel**: Fixed issue where newly added graph panels shared same axes config, fixes [#4582](https://github.com/grafana/grafana/issues/4582)
12+
* **Graph Panel**: Fixed issue with axis labels overlapping Y-axis, fixes [#4626](https://github.com/grafana/grafana/issues/4626)
13+
* **InfluxDB**: Fixed issue with templating query containing template variable, fixes [#4602](https://github.com/grafana/grafana/issues/4602)
14+
* **Graph Panel**: Fixed issue with hiding series and stacking, fixes [#4557](https://github.com/grafana/grafana/issues/4557)
15+
* **Graph Panel**: Fixed issue with legend height in table mode with few series, affected iframe embedding as well, fixes [#4640](https://github.com/grafana/grafana/issues/4640)
16+
17+
# 3.0.0-beta2 (2016-04-04)
218

319
### New Features (introduces since 3.0-beta1)
420
* **Preferences**: Set home dashboard on user and org level, closes [#1678](https://github.com/grafana/grafana/issues/1678)

pkg/api/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func Register(r *macaron.Macaron) {
3030
// authed views
3131
r.Get("/profile/", reqSignedIn, Index)
3232
r.Get("/profile/password", reqSignedIn, Index)
33+
r.Get("/profile/switch-org/:id", reqSignedIn, ChangeActiveOrgAndRedirectToHome)
3334
r.Get("/org/", reqSignedIn, Index)
3435
r.Get("/org/new", reqSignedIn, Index)
3536
r.Get("/datasources/", reqSignedIn, Index)

pkg/api/user.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/grafana/grafana/pkg/bus"
55
"github.com/grafana/grafana/pkg/middleware"
66
m "github.com/grafana/grafana/pkg/models"
7+
"github.com/grafana/grafana/pkg/setting"
78
"github.com/grafana/grafana/pkg/util"
89
)
910

@@ -109,6 +110,23 @@ func UserSetUsingOrg(c *middleware.Context) Response {
109110
return ApiSuccess("Active organization changed")
110111
}
111112

113+
// GET /profile/switch-org/:id
114+
func ChangeActiveOrgAndRedirectToHome(c *middleware.Context) {
115+
orgId := c.ParamsInt64(":id")
116+
117+
if !validateUsingOrg(c.UserId, orgId) {
118+
NotFoundHandler(c)
119+
}
120+
121+
cmd := m.SetUsingOrgCommand{UserId: c.UserId, OrgId: orgId}
122+
123+
if err := bus.Dispatch(&cmd); err != nil {
124+
NotFoundHandler(c)
125+
}
126+
127+
c.Redirect(setting.AppSubUrl + "/")
128+
}
129+
112130
func ChangeUserPassword(c *middleware.Context, cmd m.ChangeUserPasswordCommand) Response {
113131
userQuery := m.GetUserByIdQuery{Id: c.UserId}
114132

pkg/cmd/grafana-cli/commands/commands.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ func runCommand(command func(commandLine CommandLine) error) func(context *cli.C
2525
var pluginCommands = []cli.Command{
2626
{
2727
Name: "install",
28-
Usage: "install <plugin name>",
28+
Usage: "install <plugin id>",
2929
Action: runCommand(installCommand),
3030
}, {
3131
Name: "list-remote",
3232
Usage: "list remote available plugins",
3333
Action: runCommand(listremoteCommand),
3434
}, {
3535
Name: "upgrade",
36-
Usage: "upgrade <plugin name>",
36+
Usage: "upgrade <plugin id>",
3737
Action: runCommand(upgradeCommand),
3838
}, {
3939
Name: "upgrade-all",
@@ -43,9 +43,13 @@ var pluginCommands = []cli.Command{
4343
Name: "ls",
4444
Usage: "list all installed plugins",
4545
Action: runCommand(lsCommand),
46+
}, {
47+
Name: "uninstall",
48+
Usage: "uninstall <plugin id>",
49+
Action: runCommand(removeCommand),
4650
}, {
4751
Name: "remove",
48-
Usage: "remove <plugin name>",
52+
Usage: "remove <plugin id>",
4953
Action: runCommand(removeCommand),
5054
},
5155
}

pkg/metrics/report_usage.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/grafana/grafana/pkg/bus"
1111
"github.com/grafana/grafana/pkg/log"
1212
m "github.com/grafana/grafana/pkg/models"
13+
"github.com/grafana/grafana/pkg/plugins"
1314
"github.com/grafana/grafana/pkg/setting"
1415
)
1516

@@ -56,6 +57,9 @@ func sendUsageStats() {
5657
metrics["stats.users.count"] = statsQuery.Result.UserCount
5758
metrics["stats.orgs.count"] = statsQuery.Result.OrgCount
5859
metrics["stats.playlist.count"] = statsQuery.Result.PlaylistCount
60+
metrics["stats.plugins.apps.count"] = len(plugins.Apps)
61+
metrics["stats.plugins.panels.count"] = len(plugins.Panels)
62+
metrics["stats.plugins.datasources.count"] = len(plugins.DataSources)
5963

6064
dsStats := m.GetDataSourceStatsQuery{}
6165
if err := bus.Dispatch(&dsStats); err != nil {

public/app/core/components/sidemenu/sidemenu.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
<i class="{{::menuItem.icon}}" ng-show="::menuItem.icon"></i>
2222
{{::menuItem.text}}
2323
</a>
24-
<a ng-click="menuItem.click()" ng-show="::menuItem.click">
25-
<i class="{{::menuItem.icon}}"></i>
26-
{{::menuItem.text}}
27-
</a>
2824
</li>
2925
</ul>
3026
</li>

public/app/core/components/sidemenu/sidemenu.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ export class SideMenuCtrl {
7272
this.orgMenu.push({
7373
text: "Switch to " + org.name,
7474
icon: "fa fa-fw fa-random",
75-
click: () => {
76-
this.switchOrg(org.orgId);
77-
}
75+
url: this.getUrl('/profile/switch-org/' + org.orgId),
76+
target: '_self'
7877
});
7978
});
8079

@@ -83,12 +82,6 @@ export class SideMenuCtrl {
8382
}
8483
});
8584
}
86-
87-
switchOrg(orgId) {
88-
this.backendSrv.post('/api/user/using/' + orgId).then(() => {
89-
window.location.href = `${config.appSubUrl}/`;
90-
});
91-
};
9285
}
9386

9487
export function sideMenuDirective() {

public/app/core/components/switch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ export class SwitchCtrl {
2121
id: any;
2222

2323
/** @ngInject */
24-
constructor($scope) {
24+
constructor($scope, private $timeout) {
2525
this.show = true;
2626
this.id = $scope.$id;
2727
}
2828

2929
internalOnChange() {
3030
return new Promise(resolve => {
31-
setTimeout(() => {
31+
this.$timeout(() => {
3232
this.onChange();
3333
resolve();
3434
});

public/app/core/services/popover_srv.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ function popoverSrv($compile, $rootScope) {
4646
drop.on('close', () => {
4747
popoverScope.dismiss({fromDropClose: true});
4848
destroyDrop();
49+
if (options.onClose) {
50+
options.onClose();
51+
}
4952
});
5053

51-
drop.open();
54+
setTimeout(() => { drop.open(); }, 10);
5255
};
5356
}
5457

public/app/features/dashboard/partials/shareModal.html

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,26 @@ <h2 class="modal-header-title">
3838

3939
<div ng-include src="'shareLinkOptions.html'"></div>
4040

41-
<div class="gf-form-group position-center">
42-
<div class="gf-form width-30" >
41+
<div class="gf-form-group section">
42+
<div class="gf-form width-30">
4343
<textarea rows="5" data-share-panel-url class="gf-form-input width-30" ng-model='iframeHtml'></textarea>
4444
</div>
4545
</div>
46-
<div class="gf-form-group">
47-
<div class="gf-form position-center">
48-
<button class="btn btn-inverse" data-clipboard-text="{{iframeHtml}}" clipboard-button><i class="fa fa-clipboard"></i> Copy</button>
49-
</div>
50-
</div>
5146
</script>
5247

5348
<script type="text/ng-template" id="shareLinkOptions.html">
54-
<div class="gf-form-group position-center">
55-
<div class="gf-form">
56-
<span class="gf-form-label width-5">Include</span>
57-
<editor-checkbox text="Current time range" model="options.forCurrent" change="buildUrl()"></editor-checkbox>
58-
</div>
59-
<div class="gf-form">
60-
<span class="gf-form-label width-5">Include</span>
61-
<editor-checkbox text="Template variables" model="options.includeTemplateVars" change="buildUrl()"></editor-checkbox>
62-
</div>
49+
<div class="gf-form-group section">
50+
<gf-form-switch class="gf-form"
51+
label="Current time range" label-class="width-12" switch-class="max-width-6"
52+
checked="options.forCurrent" on-change="buildUrl()">
53+
</gf-form-switch>
54+
<gf-form-switch class="gf-form"
55+
label="Template variables" label-class="width-12" switch-class="max-width-6"
56+
checked="options.includeTemplateVars" on-change="buildUrl()">
57+
</gf-form-switch>
6358
<div class="gf-form">
64-
<span class="gf-form-label width-5">Theme</span>
65-
<div class="gf-form-select-wrapper max-width-10">
59+
<span class="gf-form-label width-12">Theme</span>
60+
<div class="gf-form-select-wrapper width-6">
6661
<select class="gf-form-input" ng-model="options.theme" ng-options="f as f for f in ['current', 'dark', 'light']" ng-change="buildUrl()"></select>
6762
</div>
6863
</div>
@@ -75,18 +70,19 @@ <h2 class="modal-header-title">
7570
</div>
7671

7772
<div ng-include src="'shareLinkOptions.html'"></div>
78-
<div class="gf-form-group position-center">
79-
<div class="gf-form-inline">
80-
81-
<div class="gf-form width-30">
82-
<input type="text" data-share-panel-url class="gf-form-input" ng-model="shareUrl"></input>
83-
</div>
84-
<div class="gf-form pull-right">
85-
<button class="btn btn-inverse pull-right" data-clipboard-text="{{shareUrl}}" clipboard-button><i class="fa fa-clipboard"></i> Copy</button>
73+
<div>
74+
<div class="gf-form-group section">
75+
<div class="gf-form-inline">
76+
<div class="gf-form width-30">
77+
<input type="text" data-share-panel-url class="gf-form-input" ng-model="shareUrl"></input>
78+
</div>
79+
<div class="gf-form pull-right">
80+
<button class="btn btn-inverse pull-right" data-clipboard-text="{{shareUrl}}" clipboard-button><i class="fa fa-clipboard"></i> Copy</button>
81+
</div>
8682
</div>
8783
</div>
8884
</div>
89-
<div class="gf-form position-center" ng-show="modeSharePanel">
85+
<div class="gf-form section" ng-show="modeSharePanel">
9086
<a href="{{imageUrl}}" target="_blank"><i class="fa fa-camera"></i> Direct link rendered image</a>
9187
</div>
9288
</script>
@@ -117,7 +113,7 @@ <h2 class="modal-header-title">
117113
</p>
118114
</div>
119115

120-
<div class="gf-form-group share-modal-options position-center">
116+
<div class="gf-form-group share-modal-options">
121117
<div class="gf-form" ng-if="step === 1">
122118
<span class="gf-form-label width-12">Snapshot name</span>
123119
<input type="text" ng-model="snapshot.name" class="gf-form-input max-width-15" >

public/app/features/panel/metrics_panel_ctrl.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ class MetricsPanelCtrl extends PanelCtrl {
184184
cacheTimeout: this.panel.cacheTimeout
185185
};
186186

187-
this.setTimeQueryStart();
188187
return datasource.query(metricsQuery);
189188
}
190189

@@ -252,8 +251,12 @@ class MetricsPanelCtrl extends PanelCtrl {
252251
}
253252

254253
addDataQuery(datasource) {
255-
var target = {
256-
};
254+
var target: any = {};
255+
256+
if (datasource) {
257+
target.datasource = datasource.name;
258+
}
259+
257260
this.panel.targets.push(target);
258261
}
259262
}

public/app/plugins/datasource/influxdb/datasource.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default class InfluxDatasource {
5555
query = query.replace(/\$interval/g, (target.interval || options.interval));
5656
return query;
5757

58-
}).join("\n");
58+
}).join(";");
5959

6060
// replace grafana variables
6161
allQueries = allQueries.replace(/\$timeFilter/g, timeFilter);
@@ -107,7 +107,7 @@ export default class InfluxDatasource {
107107

108108
var timeFilter = this.getTimeFilter({rangeRaw: options.rangeRaw});
109109
var query = options.annotation.query.replace('$timeFilter', timeFilter);
110-
query = this.templateSrv.replace(query);
110+
query = this.templateSrv.replace(query, null, 'regex');
111111

112112
return this._seriesQuery(query).then(data => {
113113
if (!data || !data.results || !data.results[0]) {
@@ -133,6 +133,17 @@ export default class InfluxDatasource {
133133
return this._influxRequest('GET', '/query', {q: query, epoch: 'ms'});
134134
}
135135

136+
137+
serializeParams(params) {
138+
if (!params) { return '';}
139+
140+
return _.reduce(params, (memo, value, key) => {
141+
if (value === null || value === undefined) { return memo; }
142+
memo.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
143+
return memo;
144+
}, []).join("&");
145+
}
146+
136147
testDatasource() {
137148
return this.metricFindQuery('SHOW MEASUREMENTS LIMIT 1').then(() => {
138149
return { status: "success", message: "Data source is working", title: "Success" };
@@ -166,6 +177,7 @@ export default class InfluxDatasource {
166177
data: data,
167178
precision: "ms",
168179
inspect: { type: 'influxdb' },
180+
paramSerializer: this.serializeParams,
169181
};
170182

171183
options.headers = options.headers || {};

public/app/plugins/datasource/opentsdb/config_ctrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class OpenTsConfigCtrl {
1616

1717
tsdbVersions = [
1818
{name: '<=2.1', value: 1},
19-
{name: '2.2', value: 2},
19+
{name: '>=2.2', value: 2},
2020
];
2121

2222
tsdbResolutions = [

public/app/plugins/panel/graph/graph.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
151151
}
152152

153153
function processOffsetHook(plot, gridMargin) {
154-
if (panel.yaxis) { gridMargin.left = 20; }
155-
if (panel.rightYAxisLabel) { gridMargin.right = 20; }
154+
var left = panel.yaxes[0];
155+
var right = panel.yaxes[1];
156+
if (left.show && left.label) { gridMargin.left = 20; }
157+
if (right.show && right.label) { gridMargin.right = 20; }
156158
}
157159

158160
// Function for rendering panel

0 commit comments

Comments
 (0)