remove feature toggle + add libraryPaneldefinition

pull/34488/head
Ying WANG 4 years ago
parent 99acbdd3c5
commit d01cfcc2ed
  1. 4
      cue/data/gen.cue
  2. 8
      pkg/api/dashboard.go
  3. 2
      pkg/api/plugins.go
  4. 6
      pkg/services/schemaloader/schemaloader.go
  5. 5
      pkg/setting/setting.go
  6. 9
      public/app/features/dashboard/components/ShareModal/ShareExport.tsx

@ -133,10 +133,6 @@ Family: scuemata.#Family & {
// The values depend on panel type
options: {...}
libraryPanel?: {
name: string,
uid: string
}
fieldConfig: {
defaults: {
...

@ -52,11 +52,9 @@ func (hs *HTTPServer) TrimDashboard(c *models.ReqContext, cmd models.TrimDashboa
meta := cmd.Meta
trimedResult := *dash
if !hs.LoadSchemaService.IsDisabled() {
trimedResult, err = hs.LoadSchemaService.DashboardTrimDefaults(*dash)
if err != nil {
return response.Error(500, "Error while trim default value from dashboard json", err)
}
trimedResult, err = hs.LoadSchemaService.DashboardTrimDefaults(*dash)
if err != nil {
return response.Error(500, "Error while trim default value from dashboard json", err)
}
dto := dtos.TrimDashboardFullWithMeta{

@ -213,7 +213,7 @@ func (hs *HTTPServer) ImportDashboard(c *models.ReqContext, apiCmd dtos.ImportDa
}
trimDefaults := c.QueryBoolWithDefault("trimdefaults", true)
if trimDefaults && !hs.LoadSchemaService.IsDisabled() {
if trimDefaults {
apiCmd.Dashboard, err = hs.LoadSchemaService.DashboardApplyDefaults(apiCmd.Dashboard)
if err != nil {
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
}
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) {
val, _ := input.Map()

@ -390,11 +390,6 @@ func (cfg Cfg) IsNgAlertEnabled() bool {
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.
func (cfg Cfg) IsDatabaseMetricsEnabled() bool {
return cfg.FeatureToggles["database_metrics"]

@ -7,7 +7,6 @@ import { DashboardExporter } from 'app/features/dashboard/components/DashExportM
import { appEvents } from 'app/core/core';
import { ShowModalReactEvent } from 'app/types/events';
import { ViewJsonModal } from './ViewJsonModal';
import { config } from '@grafana/runtime';
interface Props {
dashboard: DashboardModel;
@ -138,11 +137,9 @@ export class ShareExport extends PureComponent<Props, State> {
<Field label="Export for sharing externally">
<Switch value={shareExternally} onChange={this.onShareExternallyChange} />
</Field>
{config.featureToggles.trimDefaults && (
<Field label="Export with trimed dashboard json">
<Switch value={trimDefaults} onChange={this.onTrimDefaultsChange} />
</Field>
)}
<Field label="Export with trimed dashboard json">
<Switch value={trimDefaults} onChange={this.onTrimDefaultsChange} />
</Field>
<Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss} fill="outline">
Cancel

Loading…
Cancel
Save