remove feature toggle + add libraryPaneldefinition
This commit is contained in:
@@ -133,10 +133,6 @@ Family: scuemata.#Family & {
|
|||||||
|
|
||||||
// The values depend on panel type
|
// The values depend on panel type
|
||||||
options: {...}
|
options: {...}
|
||||||
libraryPanel?: {
|
|
||||||
name: string,
|
|
||||||
uid: string
|
|
||||||
}
|
|
||||||
fieldConfig: {
|
fieldConfig: {
|
||||||
defaults: {
|
defaults: {
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -52,11 +52,9 @@ func (hs *HTTPServer) TrimDashboard(c *models.ReqContext, cmd models.TrimDashboa
|
|||||||
meta := cmd.Meta
|
meta := cmd.Meta
|
||||||
|
|
||||||
trimedResult := *dash
|
trimedResult := *dash
|
||||||
if !hs.LoadSchemaService.IsDisabled() {
|
trimedResult, err = hs.LoadSchemaService.DashboardTrimDefaults(*dash)
|
||||||
trimedResult, err = hs.LoadSchemaService.DashboardTrimDefaults(*dash)
|
if err != nil {
|
||||||
if err != nil {
|
return response.Error(500, "Error while trim default value from dashboard json", err)
|
||||||
return response.Error(500, "Error while trim default value from dashboard json", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dto := dtos.TrimDashboardFullWithMeta{
|
dto := dtos.TrimDashboardFullWithMeta{
|
||||||
|
|||||||
+1
-1
@@ -213,7 +213,7 @@ func (hs *HTTPServer) ImportDashboard(c *models.ReqContext, apiCmd dtos.ImportDa
|
|||||||
}
|
}
|
||||||
|
|
||||||
trimDefaults := c.QueryBoolWithDefault("trimdefaults", true)
|
trimDefaults := c.QueryBoolWithDefault("trimdefaults", true)
|
||||||
if trimDefaults && !hs.LoadSchemaService.IsDisabled() {
|
if trimDefaults {
|
||||||
apiCmd.Dashboard, err = hs.LoadSchemaService.DashboardApplyDefaults(apiCmd.Dashboard)
|
apiCmd.Dashboard, err = hs.LoadSchemaService.DashboardApplyDefaults(apiCmd.Dashboard)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return response.Error(500, "Error while applying default value to the dashboard json", err)
|
return response.Error(500, "Error while applying default value to the dashboard json", err)
|
||||||
|
|||||||
@@ -50,12 +50,6 @@ func (rs *SchemaLoaderService) Init() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (rs *SchemaLoaderService) IsDisabled() bool {
|
|
||||||
if rs.Cfg == nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return !rs.Cfg.IsTrimDefaultsEnabled()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rs *SchemaLoaderService) DashboardApplyDefaults(input *simplejson.Json) (*simplejson.Json, error) {
|
func (rs *SchemaLoaderService) DashboardApplyDefaults(input *simplejson.Json) (*simplejson.Json, error) {
|
||||||
val, _ := input.Map()
|
val, _ := input.Map()
|
||||||
|
|||||||
@@ -390,11 +390,6 @@ func (cfg Cfg) IsNgAlertEnabled() bool {
|
|||||||
return cfg.FeatureToggles["ngalert"]
|
return cfg.FeatureToggles["ngalert"]
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsTrimDefaultsEnabled returns whether the standalone trim dashboard default feature is enabled.
|
|
||||||
func (cfg Cfg) IsTrimDefaultsEnabled() bool {
|
|
||||||
return cfg.FeatureToggles["trimDefaults"]
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsDatabaseMetricsEnabled returns whether the database instrumentation feature is enabled.
|
// IsDatabaseMetricsEnabled returns whether the database instrumentation feature is enabled.
|
||||||
func (cfg Cfg) IsDatabaseMetricsEnabled() bool {
|
func (cfg Cfg) IsDatabaseMetricsEnabled() bool {
|
||||||
return cfg.FeatureToggles["database_metrics"]
|
return cfg.FeatureToggles["database_metrics"]
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { DashboardExporter } from 'app/features/dashboard/components/DashExportM
|
|||||||
import { appEvents } from 'app/core/core';
|
import { appEvents } from 'app/core/core';
|
||||||
import { ShowModalReactEvent } from 'app/types/events';
|
import { ShowModalReactEvent } from 'app/types/events';
|
||||||
import { ViewJsonModal } from './ViewJsonModal';
|
import { ViewJsonModal } from './ViewJsonModal';
|
||||||
import { config } from '@grafana/runtime';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
dashboard: DashboardModel;
|
dashboard: DashboardModel;
|
||||||
@@ -138,11 +137,9 @@ export class ShareExport extends PureComponent<Props, State> {
|
|||||||
<Field label="Export for sharing externally">
|
<Field label="Export for sharing externally">
|
||||||
<Switch value={shareExternally} onChange={this.onShareExternallyChange} />
|
<Switch value={shareExternally} onChange={this.onShareExternallyChange} />
|
||||||
</Field>
|
</Field>
|
||||||
{config.featureToggles.trimDefaults && (
|
<Field label="Export with trimed dashboard json">
|
||||||
<Field label="Export with trimed dashboard json">
|
<Switch value={trimDefaults} onChange={this.onTrimDefaultsChange} />
|
||||||
<Switch value={trimDefaults} onChange={this.onTrimDefaultsChange} />
|
</Field>
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
<Modal.ButtonRow>
|
<Modal.ButtonRow>
|
||||||
<Button variant="secondary" onClick={onDismiss} fill="outline">
|
<Button variant="secondary" onClick={onDismiss} fill="outline">
|
||||||
Cancel
|
Cancel
|
||||||
|
|||||||
Reference in New Issue
Block a user