mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 11:52:30 +08:00
Merge branch 'v3.1.x'
This commit is contained in:
@ -9,7 +9,7 @@ page_keywords: grafana, plugins, documentation
|
|||||||
The easiest way to install plugins is by using the CLI tool grafana-cli which is bundled with grafana. Before any modification take place after modifying plugins, grafana-server needs to be restarted.
|
The easiest way to install plugins is by using the CLI tool grafana-cli which is bundled with grafana. Before any modification take place after modifying plugins, grafana-server needs to be restarted.
|
||||||
|
|
||||||
### Grafana plugin directory
|
### Grafana plugin directory
|
||||||
On Linux systems the grafana-cli will assume that the grafana plugin directory is `/var/lib/grafana/plugins`. It's possible to override the directory which grafana-cli will operate on by specifying the --path flag. On Windows systems this parameter have to be specified for every call.
|
On Linux systems the grafana-cli will assume that the grafana plugin directory is `/var/lib/grafana/plugins`. It's possible to override the directory which grafana-cli will operate on by specifying the --pluginsDir flag. On Windows systems this parameter have to be specified for every call.
|
||||||
|
|
||||||
### Grafana-cli commands
|
### Grafana-cli commands
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ export class AlertSrv {
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.$rootScope.onAppEvent('alert-error', (e, alert) => {
|
this.$rootScope.onAppEvent('alert-error', (e, alert) => {
|
||||||
this.set(alert[0], alert[1], 'error', 0);
|
this.set(alert[0], alert[1], 'error', 7000);
|
||||||
}, this.$rootScope);
|
}, this.$rootScope);
|
||||||
|
|
||||||
this.$rootScope.onAppEvent('alert-warning', (e, alert) => {
|
this.$rootScope.onAppEvent('alert-warning', (e, alert) => {
|
||||||
@ -27,10 +27,21 @@ export class AlertSrv {
|
|||||||
this.set(alert[0], alert[1], 'success', 3000);
|
this.set(alert[0], alert[1], 'success', 3000);
|
||||||
}, this.$rootScope);
|
}, this.$rootScope);
|
||||||
|
|
||||||
|
appEvents.on('alert-error', options => {
|
||||||
|
this.set(options[0], options[1], 'error', 7000);
|
||||||
|
});
|
||||||
|
|
||||||
appEvents.on('confirm-modal', this.showConfirmModal.bind(this));
|
appEvents.on('confirm-modal', this.showConfirmModal.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
set(title, text, severity, timeout) {
|
set(title, text, severity, timeout) {
|
||||||
|
if (_.isObject(text)) {
|
||||||
|
console.log('alert error', text);
|
||||||
|
if (text.statusText) {
|
||||||
|
text = `HTTP Error (${text.status}) ${text.statusText}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var newAlert = {
|
var newAlert = {
|
||||||
title: title || '',
|
title: title || '',
|
||||||
text: text || '',
|
text: text || '',
|
||||||
|
@ -9,6 +9,7 @@ import moment from 'moment';
|
|||||||
import gfunc from './gfunc';
|
import gfunc from './gfunc';
|
||||||
import {Parser} from './parser';
|
import {Parser} from './parser';
|
||||||
import {QueryCtrl} from 'app/plugins/sdk';
|
import {QueryCtrl} from 'app/plugins/sdk';
|
||||||
|
import appEvents from 'app/core/app_events';
|
||||||
|
|
||||||
export class GraphiteQueryCtrl extends QueryCtrl {
|
export class GraphiteQueryCtrl extends QueryCtrl {
|
||||||
static templateUrl = 'partials/query.editor.html';
|
static templateUrl = 'partials/query.editor.html';
|
||||||
@ -141,7 +142,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.error = err.message || 'Failed to issue metric query';
|
appEvents.emit('alert-error', ['Error', err]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +179,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
|
|||||||
altSegments.unshift(this.uiSegmentSrv.newSegment('*'));
|
altSegments.unshift(this.uiSegmentSrv.newSegment('*'));
|
||||||
return altSegments;
|
return altSegments;
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.error = err.message || 'Failed to issue metric query';
|
appEvents.emit('alert-error', ['Error', err]);
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user