The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/dashboard/state/utils.ts

29 lines
735 B

import { REPEAT_DIR_HORIZONTAL } from '../../../core/constants';
import { PanelModel } from './PanelModel';
export function isOnTheSameGridRow(sourcePanel: PanelModel, otherPanel: PanelModel): boolean {
if (sourcePanel.repeatDirection === REPEAT_DIR_HORIZONTAL) {
return false;
}
if (
otherPanel.gridPos.x >= sourcePanel.gridPos.x + sourcePanel.gridPos.w &&
otherPanel.gridPos.y === sourcePanel.gridPos.y
) {
return true;
}
return false;
}
export function deleteScopeVars(panels: PanelModel[]) {
for (const panel of panels) {
delete panel.scopedVars;
if (panel.panels?.length) {
for (const collapsedPanel of panel.panels) {
delete collapsedPanel.scopedVars;
}
}
}
}