grafana/public/app/plugins/panel/canvas/panelcfg.gen.ts

165 lines
3.2 KiB
TypeScript
Raw Normal View History

2023-06-17 10:56:23 +08:00
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
//
// Generated by:
// public/app/plugins/gen.go
// Using jennies:
// TSTypesJenny
// PluginTsTypesJenny
2023-06-17 10:56:23 +08:00
//
// Run 'make gen-cue' from repository root to regenerate.
import * as ui from '@grafana/schema';
export enum HorizontalConstraint {
Center = 'center',
Left = 'left',
LeftRight = 'leftright',
Right = 'right',
Scale = 'scale',
}
export enum VerticalConstraint {
Bottom = 'bottom',
Center = 'center',
Scale = 'scale',
Top = 'top',
TopBottom = 'topbottom',
}
export interface Constraint {
horizontal?: HorizontalConstraint;
vertical?: VerticalConstraint;
}
export interface Placement {
bottom?: number;
height?: number;
left?: number;
right?: number;
rotation?: number;
2023-06-17 10:56:23 +08:00
top?: number;
width?: number;
}
export enum BackgroundImageSize {
Contain = 'contain',
Cover = 'cover',
Fill = 'fill',
Original = 'original',
Tile = 'tile',
}
export interface BackgroundConfig {
color?: ui.ColorDimensionConfig;
image?: ui.ResourceDimensionConfig;
size?: BackgroundImageSize;
}
export interface LineConfig {
color?: ui.ColorDimensionConfig;
radius?: number;
2023-06-17 10:56:23 +08:00
width?: number;
}
export enum HttpRequestMethod {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
}
2023-06-17 10:56:23 +08:00
export interface ConnectionCoordinates {
x: number;
y: number;
}
export enum ConnectionPath {
Straight = 'straight',
}
export interface CanvasConnection {
color?: ui.ColorDimensionConfig;
direction?: ui.DirectionDimensionConfig;
2023-06-17 10:56:23 +08:00
path: ConnectionPath;
size?: ui.ScaleDimensionConfig;
source: ConnectionCoordinates;
sourceOriginal?: ConnectionCoordinates;
2023-06-17 10:56:23 +08:00
target: ConnectionCoordinates;
targetName?: string;
targetOriginal?: ConnectionCoordinates;
vertices?: Array<ConnectionCoordinates>;
2023-06-17 10:56:23 +08:00
}
export const defaultCanvasConnection: Partial<CanvasConnection> = {
vertices: [],
};
2023-06-17 10:56:23 +08:00
export interface CanvasElementOptions {
background?: BackgroundConfig;
border?: LineConfig;
/**
* TODO: figure out how to define this (element config(s))
*/
config?: unknown;
connections?: Array<CanvasConnection>;
constraint?: Constraint;
name: string;
placement?: Placement;
type: string;
}
export const defaultCanvasElementOptions: Partial<CanvasElementOptions> = {
connections: [],
};
export interface CanvasTooltip {
mode: ui.TooltipDisplayMode;
}
2023-06-17 10:56:23 +08:00
export interface Options {
/**
* Enable inline editing
*/
inlineEditing: boolean;
Canvas: Add Pan and Zoom (#76705) * Canvas: Add Zoom * Scale selecto components based on zoom state * Fix pan by reverting to 3.1.0 for zoom-pan * Update to latest library that fixes pan regression * Add mini map to canvas pan zoom * Fix selecto and anchors on hover * Update naming to be more clear * Switch back to contentComponent * Apply transformScale to drag and resize * Update connection source and target scaling * Add option to display mini map * Update yarn lock * Revert "Update yarn lock" This reverts commit 3d1dd65d5726fb0fd0813347451884a4034ae5d3. * Set yarn lock to main * Revert "Set yarn lock to main" This reverts commit 64bc50557e75657fae14f81077d1d08b4e9e9029. * Update to Yarn 4 * Add react-zoom-pan-pinch * Update react-zoom-pan checksum * Revert changes to json files * Remove last line of api merged * Remove last lines of all impacted jsons * Update home json * Update coordinate calc function to include scale * Fix types in coordinate calc function * Fix util calculation for transform * Fix arrow anchor shift behavior * Fix scale offset when adding elements during zoom * Fix drag of selected group during zoom * Add feature flag for canvas pan zoom * Revert "Add feature flag for canvas pan zoom" This reverts commit b026e31d8d9ed64b1fe307f852df10292fffadf4. * Regenerate feature flag after merge * Apply feature flag to enable pan zoom wrappers * Add mini map toggle behind feature flag * Simplify minimap behavior * Update feature flag registry * Set minimap to false by default * fix gen-cue * Set toggles gen to main Add blank line to toggle gen csv * Add canvas pan zoom to csv * Remove old comment * Change ref parameter to be more descriptive * Rename visibleFun to be more descriptive * Consolidate transformScale transformRef in util * Remove non-null assertion on connection parentRect * Consolidate parentRect null coalescing into object * Remove minimap and change toggle * Add controls inline help for pan and zoom * Clean up mouse events * Pull scale out of ref and isolate transform * Remove transform ref from scene div * Fix context menu visible behavior * Fix connections and update util functions * Move transform component instance to util * fix backend test * minor updates * Clean up connections / fix minor bug where offset of arrow wasn't being calculated correctly * missed connection code cleanup * cleanup scene code a bit more * actually fix backend test * move eslint disable line closer to actual issue --------- Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
2024-01-03 03:52:21 +08:00
/**
* Enable pan and zoom
*/
panZoom: boolean;
2023-06-17 10:56:23 +08:00
/**
* The root element of canvas (frame), where all canvas elements are nested
* TODO: Figure out how to define a default value for this
*/
root: {
/**
* Name of the root element
*/
name: string;
/**
* Type of root element (frame)
*/
type: 'frame';
/**
* The list of canvas elements attached to the root element
*/
elements: Array<CanvasElementOptions>;
};
/**
* Show all available element types
*/
showAdvancedTypes: boolean;
/**
* Controls tooltip options
*/
tooltip: CanvasTooltip;
Canvas: Pan and zoom improvement (#86879) * fix(canvas): style linter issue * feat(canvas): update infinite viewer root element * fix(canvas): resize element on moving * fix(canvas): global element position * fix(canvas): connection anchor position * fix(canvas): connection position * fix(canvas): connection coordinates calculation * cleaning * fix(canvas): calculation connection coordinates * fix(canvas): initial connections svg position * fix(canvas): align connection with new coordinates system * fix(canvas): temporary element position fix * comment * Canvas: Fix canvas selecto (#104621) * fix(canvas): get context back * fix(canvas): selecto containers * clean up * Canvas: Fix jumpy elements behaviour on select and drag (#104641) fix(canvas): jumpy elements behaviour on select and drag * fix(canvas): connection regression (#104682) * Canvas pan + zoom: Updated mouse interactions (#104648) * feat: canvas panel pan + zoom key binds * feat: panning when right click + ctrl * chore: some cleanup * chore: adjust mouse move delta by canvas scale * Canvas: Zoom to content (#104950) feat(canvas): zoom to content * Canvas pan + zoom: Unique key for canvas panel elements (#104947) fix: unique keys * Canvas: Placement adjustment (#105117) * feat(canvas): top/left placement migration * feat(canvas): adjust constraint system for pan and zoom usage * feat(canvas): support other constraints * Canvas: Align connection anchors and element rotation (#106002) * feat(canvas): align connection anchors and element rotation * clean up * clean-up math * Canvas: Disable pan when pan+zoom toggle is false (#106224) chore: no pan when pan+zoom toggle is disabled * Canvas: Fix desync between scene and InfiniteViewer zoom/position on element addition (#106655) feat(canvas): keep pan and zoom state to re-apply * Canvas: Clicking on metricValue dropdown does not work; right-click triggers context menu instead (#106701) fix(canvas): metricValue left click dropdown * Canvas: Double-click on canvas should reset scale and position (#106709) fix(canvas): dblclick to reset zoom * Canvas: Put new canvas pan and zoom under feature toggle (#107001) * feat(canvas): put pan and zoom under FF * clean-up * clean-up * fix(canvas): clear selection on scene manipulation * fix(canvas): any types * Canvas: Fix canvas apply styles (#107404) * fix(canvas): apply styles * remove deps * Canvas: E2E test coverage (#107474) * betterer * feat(canvas): sceneAbleManagement tests * feat(canvas): playwright tests * chore(canvas): add draft e2e tests * chore(canvas): clean draft e2e tests * chore(canvas): fix draft e2e tests * chore(canvas): todo comments * chore(canvas): update e2e tests * chore(canvas): delete scene unit tests * chore(canvas): delete sceneAbleManagement unit tests * chore(canvas): delete sceneAbleManagement unit tests * chore(canvas): linter * chore(canvas): locales * chore(canvas): remove flag checking * Fix canvas connection point z-indexing bug (#107223) fix(canvas): hoist connect points one level higher in DOM to fix z-index * Revert "Fix canvas connection point z-indexing bug" (#108146) Revert "Fix canvas connection point z-indexing bug (#107223)" This reverts commit e419cb164a6a9a7468a0b35d620dcf55719c37cd. * Canvas: Set canvas zoom range (#108318) * chore(canvas): set zoom range * chore(canvas): naming * Canvas: Fix infinite-viewer connections viewport values (#108315) chore(canvas): infinite-viewer connections viewport values * Canvas: Fix z-indices order and explicit pointer events (#108284) * fix(canvas-connection-points): z-indices order, explicit pointer events * chore(canvas): remove user select * chore(canvas): naming * chore(canvas): create ConnectionAnchor2 component --------- Co-authored-by: Ihor Yeromin <yeryomin.igor@gmail.com> * Canvas: Hide anchors on panel resize (#108588) chore(canvas): hide anchors on panel resize * Canvas: Center & scale select, resize, zoom bugs (#108749) * Canvas: Fix center and scale constraint with zoom * Remove unused resize flag * Consolidate and clean up * fix(canvas): re-size scale and center elements --------- Co-authored-by: Ihor Yeromin <yeryomin.igor@gmail.com> * Canvas: Fix on constraint change during zoom (#108947) * Canvas: Ensure correct panel size during edit (#108953) * chore(canvas): re-gen cue --------- Co-authored-by: drew08t <drew08@gmail.com> Co-authored-by: Sven Grossmann <svennergr@gmail.com> Co-authored-by: Alex Spencer <52186778+alexjonspencer1@users.noreply.github.com> Co-authored-by: Jesse David Peterson <jesdavpet@users.noreply.github.com> Co-authored-by: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com>
2025-08-01 01:34:48 +08:00
/**
* Zoom to content
*/
zoomToContent: boolean;
2023-06-17 10:56:23 +08:00
}
export const defaultOptions: Partial<Options> = {
inlineEditing: true,
Canvas: Add Pan and Zoom (#76705) * Canvas: Add Zoom * Scale selecto components based on zoom state * Fix pan by reverting to 3.1.0 for zoom-pan * Update to latest library that fixes pan regression * Add mini map to canvas pan zoom * Fix selecto and anchors on hover * Update naming to be more clear * Switch back to contentComponent * Apply transformScale to drag and resize * Update connection source and target scaling * Add option to display mini map * Update yarn lock * Revert "Update yarn lock" This reverts commit 3d1dd65d5726fb0fd0813347451884a4034ae5d3. * Set yarn lock to main * Revert "Set yarn lock to main" This reverts commit 64bc50557e75657fae14f81077d1d08b4e9e9029. * Update to Yarn 4 * Add react-zoom-pan-pinch * Update react-zoom-pan checksum * Revert changes to json files * Remove last line of api merged * Remove last lines of all impacted jsons * Update home json * Update coordinate calc function to include scale * Fix types in coordinate calc function * Fix util calculation for transform * Fix arrow anchor shift behavior * Fix scale offset when adding elements during zoom * Fix drag of selected group during zoom * Add feature flag for canvas pan zoom * Revert "Add feature flag for canvas pan zoom" This reverts commit b026e31d8d9ed64b1fe307f852df10292fffadf4. * Regenerate feature flag after merge * Apply feature flag to enable pan zoom wrappers * Add mini map toggle behind feature flag * Simplify minimap behavior * Update feature flag registry * Set minimap to false by default * fix gen-cue * Set toggles gen to main Add blank line to toggle gen csv * Add canvas pan zoom to csv * Remove old comment * Change ref parameter to be more descriptive * Rename visibleFun to be more descriptive * Consolidate transformScale transformRef in util * Remove non-null assertion on connection parentRect * Consolidate parentRect null coalescing into object * Remove minimap and change toggle * Add controls inline help for pan and zoom * Clean up mouse events * Pull scale out of ref and isolate transform * Remove transform ref from scene div * Fix context menu visible behavior * Fix connections and update util functions * Move transform component instance to util * fix backend test * minor updates * Clean up connections / fix minor bug where offset of arrow wasn't being calculated correctly * missed connection code cleanup * cleanup scene code a bit more * actually fix backend test * move eslint disable line closer to actual issue --------- Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
2024-01-03 03:52:21 +08:00
panZoom: true,
2023-06-17 10:56:23 +08:00
showAdvancedTypes: true,
Canvas: Pan and zoom improvement (#86879) * fix(canvas): style linter issue * feat(canvas): update infinite viewer root element * fix(canvas): resize element on moving * fix(canvas): global element position * fix(canvas): connection anchor position * fix(canvas): connection position * fix(canvas): connection coordinates calculation * cleaning * fix(canvas): calculation connection coordinates * fix(canvas): initial connections svg position * fix(canvas): align connection with new coordinates system * fix(canvas): temporary element position fix * comment * Canvas: Fix canvas selecto (#104621) * fix(canvas): get context back * fix(canvas): selecto containers * clean up * Canvas: Fix jumpy elements behaviour on select and drag (#104641) fix(canvas): jumpy elements behaviour on select and drag * fix(canvas): connection regression (#104682) * Canvas pan + zoom: Updated mouse interactions (#104648) * feat: canvas panel pan + zoom key binds * feat: panning when right click + ctrl * chore: some cleanup * chore: adjust mouse move delta by canvas scale * Canvas: Zoom to content (#104950) feat(canvas): zoom to content * Canvas pan + zoom: Unique key for canvas panel elements (#104947) fix: unique keys * Canvas: Placement adjustment (#105117) * feat(canvas): top/left placement migration * feat(canvas): adjust constraint system for pan and zoom usage * feat(canvas): support other constraints * Canvas: Align connection anchors and element rotation (#106002) * feat(canvas): align connection anchors and element rotation * clean up * clean-up math * Canvas: Disable pan when pan+zoom toggle is false (#106224) chore: no pan when pan+zoom toggle is disabled * Canvas: Fix desync between scene and InfiniteViewer zoom/position on element addition (#106655) feat(canvas): keep pan and zoom state to re-apply * Canvas: Clicking on metricValue dropdown does not work; right-click triggers context menu instead (#106701) fix(canvas): metricValue left click dropdown * Canvas: Double-click on canvas should reset scale and position (#106709) fix(canvas): dblclick to reset zoom * Canvas: Put new canvas pan and zoom under feature toggle (#107001) * feat(canvas): put pan and zoom under FF * clean-up * clean-up * fix(canvas): clear selection on scene manipulation * fix(canvas): any types * Canvas: Fix canvas apply styles (#107404) * fix(canvas): apply styles * remove deps * Canvas: E2E test coverage (#107474) * betterer * feat(canvas): sceneAbleManagement tests * feat(canvas): playwright tests * chore(canvas): add draft e2e tests * chore(canvas): clean draft e2e tests * chore(canvas): fix draft e2e tests * chore(canvas): todo comments * chore(canvas): update e2e tests * chore(canvas): delete scene unit tests * chore(canvas): delete sceneAbleManagement unit tests * chore(canvas): delete sceneAbleManagement unit tests * chore(canvas): linter * chore(canvas): locales * chore(canvas): remove flag checking * Fix canvas connection point z-indexing bug (#107223) fix(canvas): hoist connect points one level higher in DOM to fix z-index * Revert "Fix canvas connection point z-indexing bug" (#108146) Revert "Fix canvas connection point z-indexing bug (#107223)" This reverts commit e419cb164a6a9a7468a0b35d620dcf55719c37cd. * Canvas: Set canvas zoom range (#108318) * chore(canvas): set zoom range * chore(canvas): naming * Canvas: Fix infinite-viewer connections viewport values (#108315) chore(canvas): infinite-viewer connections viewport values * Canvas: Fix z-indices order and explicit pointer events (#108284) * fix(canvas-connection-points): z-indices order, explicit pointer events * chore(canvas): remove user select * chore(canvas): naming * chore(canvas): create ConnectionAnchor2 component --------- Co-authored-by: Ihor Yeromin <yeryomin.igor@gmail.com> * Canvas: Hide anchors on panel resize (#108588) chore(canvas): hide anchors on panel resize * Canvas: Center & scale select, resize, zoom bugs (#108749) * Canvas: Fix center and scale constraint with zoom * Remove unused resize flag * Consolidate and clean up * fix(canvas): re-size scale and center elements --------- Co-authored-by: Ihor Yeromin <yeryomin.igor@gmail.com> * Canvas: Fix on constraint change during zoom (#108947) * Canvas: Ensure correct panel size during edit (#108953) * chore(canvas): re-gen cue --------- Co-authored-by: drew08t <drew08@gmail.com> Co-authored-by: Sven Grossmann <svennergr@gmail.com> Co-authored-by: Alex Spencer <52186778+alexjonspencer1@users.noreply.github.com> Co-authored-by: Jesse David Peterson <jesdavpet@users.noreply.github.com> Co-authored-by: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com>
2025-08-01 01:34:48 +08:00
zoomToContent: true,
2023-06-17 10:56:23 +08:00
};