Commit 3fb4eb73 by Marcus Efraimsson Committed by GitHub

Merge pull request #12175 from grafana/davkal/12168-fix-explore-setting

Respect explore settings in config ini
parents 82ae7c6e 3bd58446
...@@ -151,6 +151,7 @@ func getFrontendSettingsMap(c *m.ReqContext) (map[string]interface{}, error) { ...@@ -151,6 +151,7 @@ func getFrontendSettingsMap(c *m.ReqContext) (map[string]interface{}, error) {
"authProxyEnabled": setting.AuthProxyEnabled, "authProxyEnabled": setting.AuthProxyEnabled,
"ldapEnabled": setting.LdapEnabled, "ldapEnabled": setting.LdapEnabled,
"alertingEnabled": setting.AlertingEnabled, "alertingEnabled": setting.AlertingEnabled,
"exploreEnabled": setting.ExploreEnabled,
"googleAnalyticsId": setting.GoogleAnalyticsId, "googleAnalyticsId": setting.GoogleAnalyticsId,
"disableLoginForm": setting.DisableLoginForm, "disableLoginForm": setting.DisableLoginForm,
"externalUserMngInfo": setting.ExternalUserMngInfo, "externalUserMngInfo": setting.ExternalUserMngInfo,
......
...@@ -16,6 +16,7 @@ class Settings { ...@@ -16,6 +16,7 @@ class Settings {
defaultDatasource: string; defaultDatasource: string;
alertingEnabled: boolean; alertingEnabled: boolean;
authProxyEnabled: boolean; authProxyEnabled: boolean;
exploreEnabled: boolean;
ldapEnabled: boolean; ldapEnabled: boolean;
oauth: any; oauth: any;
disableUserSignUp: boolean; disableUserSignUp: boolean;
......
import $ from 'jquery'; import $ from 'jquery';
import _ from 'lodash'; import _ from 'lodash';
import config from 'app/core/config';
import coreModule from 'app/core/core_module'; import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events'; import appEvents from 'app/core/app_events';
import { encodePathComponent } from 'app/core/utils/location_util'; import { encodePathComponent } from 'app/core/utils/location_util';
...@@ -178,7 +179,7 @@ export class KeybindingSrv { ...@@ -178,7 +179,7 @@ export class KeybindingSrv {
}); });
// jump to explore if permissions allow // jump to explore if permissions allow
if (this.contextSrv.isEditor) { if (this.contextSrv.isEditor && config.exploreEnabled) {
this.bind('x', async () => { this.bind('x', async () => {
if (dashboard.meta.focusPanelId) { if (dashboard.meta.focusPanelId) {
const panel = dashboard.getPanelById(dashboard.meta.focusPanelId); const panel = dashboard.getPanelById(dashboard.meta.focusPanelId);
......
...@@ -314,7 +314,7 @@ class MetricsPanelCtrl extends PanelCtrl { ...@@ -314,7 +314,7 @@ class MetricsPanelCtrl extends PanelCtrl {
getAdditionalMenuItems() { getAdditionalMenuItems() {
const items = []; const items = [];
if (this.contextSrv.isEditor && this.datasource && this.datasource.supportsExplore) { if (config.exploreEnabled && this.contextSrv.isEditor && this.datasource && this.datasource.supportsExplore) {
items.push({ items.push({
text: 'Explore', text: 'Explore',
click: 'ctrl.explore();', click: 'ctrl.explore();',
......
jest.mock('app/core/core', () => ({})); jest.mock('app/core/core', () => ({}));
jest.mock('app/core/config', () => {
return {
exploreEnabled: true,
panels: {
test: {
id: 'test',
name: 'test',
},
},
};
});
import { MetricsPanelCtrl } from '../metrics_panel_ctrl';
import q from 'q'; import q from 'q';
import { PanelModel } from 'app/features/dashboard/panel_model'; import { PanelModel } from 'app/features/dashboard/panel_model';
import { MetricsPanelCtrl } from '../metrics_panel_ctrl';
describe('MetricsPanelCtrl', () => { describe('MetricsPanelCtrl', () => {
let ctrl; let ctrl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment