grafana/public/app/plugins/panel/barchart/models.cue

77 lines
2.6 KiB
CUE
Raw Normal View History

// Copyright 2022 Grafana Labs
Schema: get all devenv dashboards passing validation (#37857) * Strip nulls (again) * Add stripnulls script * Add transformations field * Close FieldConfig struct; proper plugin validating * s/graph/viz/ field in histogram dashboard * Use ui.GraphFieldConfig in histogram model * Add models for stat, gauge, barguage panel plugins Also toss necessary shared types into cue/ui/gen.cue, with TODOs to move them appropriately later. * Add required license headers * Heap of updates to cue UI components * Fix barchart types and one old devenv input * Use the GraphFieldConfig directly for timeseries * Add models.cue for a few panel plugins Barchart, state-timeline, and status-history * Enable the test validating all devenv dashboards!! * Fix effects of not checking after making comments * Update packages/grafana-ui/src/options/models.gen.ts Co-authored-by: Ryan McKinley <ryantxu@gmail.com> * Realign and unalign cue with ts types * Update devenv test to sniff for null errors Best option we have right now for helping people to know they need to strip nulls from devenv dashboards. * Add speculative default for barchart stacking * Fixup some dated devenv dashboards timeline-modes needed to be regenerated with the appropriate tooltip values included, per typing requirements, and timeline-demo needed to have the `mode` field removed, as it is not intended to be persisted. * Add necessary missing options for various panels * Regenerate devenv dashboards Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-08-17 06:11:57 -05:00
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
plugins: New static scanner and validator, with Thema slot support (#53754) * coremodels: Convert plugin-metadata schema to a coremodel * Newer cuetsy; try quoting field name * Add slot definitions * Start sketching out pfs package * Rerun codegen with fixes, new cuetsy * Catch up dashboard with new cuetsy * Update to go1.18 * Use new vmuxers in thema * Add slot system in Go * Draft finished implementation of pfs * Collapse slot pkg into coremodel dir; add PluginInfo * Add the mux type on top of kernel * Refactor plugin generator for extensibility * Change models.cue package, numerous debugs * Bring new output to parity with old * Remove old plugin generation logic * Misc tweaking * Reintroduce generation of shared schemas * Drop back to go1.17 * Add globbing to tsconfig exclude * Introduce pfs test on existing testdata * Make most existing testdata tests pass with pfs * coremodels: Convert plugin-metadata schema to a coremodel * Newer cuetsy; try quoting field name * Add APIType control concept, regen pluginmeta * Use proper numeric types for schema fields * Make pluginmeta schema follow Go type breakdown * More decomposition into distinct types * Add test case for no plugin.json file * Fix missing ref to #Dependencies * Remove generated TS for pluginmeta * Update dependencies, rearrange go.mod * Regenerate without Model prefix * Use updated thema loader; this is now runnable * Skip app plugin with weird include * Make plugin tree extractor reusable * Split out slot lineage load/validate logic * Add myriad tests for new plugin validation failures * Add test for zip fixtures * One last run of codegen * Proper delinting * Ensure validation order is deterministic * Let there actually be sorting * Undo reliance on builtIn field (#54009) * undo builtIn reliance * fix tests Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-08-22 11:11:45 -05:00
package grafanaplugin
Schema: get all devenv dashboards passing validation (#37857) * Strip nulls (again) * Add stripnulls script * Add transformations field * Close FieldConfig struct; proper plugin validating * s/graph/viz/ field in histogram dashboard * Use ui.GraphFieldConfig in histogram model * Add models for stat, gauge, barguage panel plugins Also toss necessary shared types into cue/ui/gen.cue, with TODOs to move them appropriately later. * Add required license headers * Heap of updates to cue UI components * Fix barchart types and one old devenv input * Use the GraphFieldConfig directly for timeseries * Add models.cue for a few panel plugins Barchart, state-timeline, and status-history * Enable the test validating all devenv dashboards!! * Fix effects of not checking after making comments * Update packages/grafana-ui/src/options/models.gen.ts Co-authored-by: Ryan McKinley <ryantxu@gmail.com> * Realign and unalign cue with ts types * Update devenv test to sniff for null errors Best option we have right now for helping people to know they need to strip nulls from devenv dashboards. * Add speculative default for barchart stacking * Fixup some dated devenv dashboards timeline-modes needed to be regenerated with the appropriate tooltip values included, per typing requirements, and timeline-demo needed to have the `mode` field removed, as it is not intended to be persisted. * Add necessary missing options for various panels * Regenerate devenv dashboards Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-08-17 06:11:57 -05:00
import (
"github.com/grafana/thema"
ui "github.com/grafana/grafana/packages/grafana-schema/src/common"
Schema: get all devenv dashboards passing validation (#37857) * Strip nulls (again) * Add stripnulls script * Add transformations field * Close FieldConfig struct; proper plugin validating * s/graph/viz/ field in histogram dashboard * Use ui.GraphFieldConfig in histogram model * Add models for stat, gauge, barguage panel plugins Also toss necessary shared types into cue/ui/gen.cue, with TODOs to move them appropriately later. * Add required license headers * Heap of updates to cue UI components * Fix barchart types and one old devenv input * Use the GraphFieldConfig directly for timeseries * Add models.cue for a few panel plugins Barchart, state-timeline, and status-history * Enable the test validating all devenv dashboards!! * Fix effects of not checking after making comments * Update packages/grafana-ui/src/options/models.gen.ts Co-authored-by: Ryan McKinley <ryantxu@gmail.com> * Realign and unalign cue with ts types * Update devenv test to sniff for null errors Best option we have right now for helping people to know they need to strip nulls from devenv dashboards. * Add speculative default for barchart stacking * Fixup some dated devenv dashboards timeline-modes needed to be regenerated with the appropriate tooltip values included, per typing requirements, and timeline-demo needed to have the `mode` field removed, as it is not intended to be persisted. * Add necessary missing options for various panels * Regenerate devenv dashboards Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-08-17 06:11:57 -05:00
)
Panel: thema.#Lineage & {
name: "barchart"
seqs: [
{
schemas: [
// v0.0
{
PanelOptions: {
ui.OptionsWithLegend
ui.OptionsWithTooltip
ui.OptionsWithTextFormatting
// TODO docs
xField?: string
// TODO docs
colorByField?: string
// TODO docs
orientation: ui.VizOrientation | *"auto"
// TODO docs
barRadius?: float64 & >= 0 & <= 0.5 | *0
// TODO docs
xTickLabelRotation: int32 & >= -90 & <= 90 | *0
// TODO docs
xTickLabelMaxLength: int32 & >= 0
// TODO docs
// negative values indicate backwards skipping behavior
xTickLabelSpacing?: int32 | *0
// TODO docs
stacking: ui.StackingMode | *"none"
// This controls whether values are shown on top or to the left of bars.
showValue: ui.VisibilityMode | *"auto"
// Controls the width of bars. 1 = Max width, 0 = Min width.
barWidth: float64 & >= 0 & <= 1 | *0.97
// Controls the width of groups. 1 = max with, 0 = min width.
groupWidth: float64 & >= 0 & <= 1 | *0.7
// Enables mode which highlights the entire bar area and shows tooltip when cursor hovers over highlighted area
fullHighlight: bool | *false
} @cuetsy(kind="interface")
PanelFieldConfig: {
ui.AxisConfig
ui.HideableFieldConfig
// Controls line width of the bars.
lineWidth?: int32 & >= 0 & <= 10 | *1
// Controls the fill opacity of the bars.
fillOpacity?: int32 & >= 0 & <= 100 | *80
// Set the mode of the gradient fill. Fill gradient is based on the line color. To change the color, use the standard color scheme field option.
// Gradient appearance is influenced by the Fill opacity setting.
gradientMode?: ui.GraphGradientMode | *"none"
// Threshold rendering
thresholdsStyle?: ui.GraphThresholdsStyleConfig
} @cuetsy(kind="interface")
},
]
},
]
}