|
|
@ -41,82 +41,72 @@ import {WithRouterProps} from 'react-router'
|
|
|
|
import {ManualRefreshProps} from 'src/shared/components/ManualRefresh'
|
|
|
|
import {ManualRefreshProps} from 'src/shared/components/ManualRefresh'
|
|
|
|
import {Location} from 'history'
|
|
|
|
import {Location} from 'history'
|
|
|
|
import {InjectedRouter} from 'react-router'
|
|
|
|
import {InjectedRouter} from 'react-router'
|
|
|
|
import * as SourceData from 'src/types/sources'
|
|
|
|
import * as Types from 'src/types/modules'
|
|
|
|
import * as TempVarData from 'src/types/tempVars'
|
|
|
|
|
|
|
|
import * as DashboardData from 'src/types/dashboards'
|
|
|
|
|
|
|
|
import * as QueryData from 'src/types/query'
|
|
|
|
|
|
|
|
import * as ColorData from 'src/types/colors'
|
|
|
|
|
|
|
|
import * as AnnotationActions from 'src/types/actions/annotations'
|
|
|
|
|
|
|
|
import * as AppActions from 'src/types/actions/app'
|
|
|
|
|
|
|
|
import * as CellEditorOverlayActions from 'src/types/actions/cellEditorOverlay'
|
|
|
|
|
|
|
|
import * as DashboardActions from 'src/types/actions/dashboards'
|
|
|
|
|
|
|
|
import * as ErrorActions from 'src/types/actions/errors'
|
|
|
|
|
|
|
|
import * as NotificationActions from 'src/types/actions/notifications'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface DashboardActions {
|
|
|
|
interface DashboardActions {
|
|
|
|
setDashTimeV1: DashboardActions.SetDashTimeV1ActionCreator
|
|
|
|
setDashTimeV1: Types.Dashboards.Actions.SetDashTimeV1ActionCreator
|
|
|
|
updateDashboard: DashboardActions.UpdateDashboardActionCreator
|
|
|
|
updateDashboard: Types.Dashboards.Actions.UpdateDashboardActionCreator
|
|
|
|
syncURLQueryParamsFromQueryParamsObject: DashboardActions.SyncURLQueryFromQueryParamsObjectDispatcher
|
|
|
|
syncURLQueryParamsFromQueryParamsObject: Types.Dashboards.Actions.SyncURLQueryFromQueryParamsObjectDispatcher
|
|
|
|
putDashboard: DashboardActions.PutDashboardDispatcher
|
|
|
|
putDashboard: Types.Dashboards.Actions.PutDashboardDispatcher
|
|
|
|
putDashboardByID: DashboardActions.PutDashboardByIDDispatcher
|
|
|
|
putDashboardByID: Types.Dashboards.Actions.PutDashboardByIDDispatcher
|
|
|
|
getDashboardsNamesAsync: DashboardActions.GetDashboardsNamesDispatcher
|
|
|
|
getDashboardsNamesAsync: Types.Dashboards.Actions.GetDashboardsNamesDispatcher
|
|
|
|
getDashboardWithHydratedAndSyncedTempVarsAsync: DashboardActions.GetDashboardWithHydratedAndSyncedTempVarsAsyncDispatcher
|
|
|
|
getDashboardWithHydratedAndSyncedTempVarsAsync: Types.Dashboards.Actions.GetDashboardWithHydratedAndSyncedTempVarsAsyncDispatcher
|
|
|
|
setTimeRange: DashboardActions.SetTimeRangeActionCreator
|
|
|
|
setTimeRange: Types.Dashboards.Actions.SetTimeRangeActionCreator
|
|
|
|
addDashboardCellAsync: DashboardActions.AddDashboardCellDispatcher
|
|
|
|
addDashboardCellAsync: Types.Dashboards.Actions.AddDashboardCellDispatcher
|
|
|
|
editCellQueryStatus: DashboardActions.EditCellQueryStatusActionCreator
|
|
|
|
editCellQueryStatus: Types.Dashboards.Actions.EditCellQueryStatusActionCreator
|
|
|
|
updateDashboardCell: DashboardActions.UpdateDashboardCellDispatcher
|
|
|
|
updateDashboardCell: Types.Dashboards.Actions.UpdateDashboardCellDispatcher
|
|
|
|
cloneDashboardCellAsync: DashboardActions.CloneDashboardCellDispatcher
|
|
|
|
cloneDashboardCellAsync: Types.Dashboards.Actions.CloneDashboardCellDispatcher
|
|
|
|
deleteDashboardCellAsync: DashboardActions.DeleteDashboardCellDispatcher
|
|
|
|
deleteDashboardCellAsync: Types.Dashboards.Actions.DeleteDashboardCellDispatcher
|
|
|
|
templateVariableSelected: DashboardActions.TemplateVariableSelectedActionCreator
|
|
|
|
templateVariableSelected: Types.Dashboards.Actions.TemplateVariableSelectedActionCreator
|
|
|
|
syncURLQueryFromTempVars: DashboardActions.SyncURLQueryFromTempVarsDispatcher
|
|
|
|
syncURLQueryFromTempVars: Types.Dashboards.Actions.SyncURLQueryFromTempVarsDispatcher
|
|
|
|
setZoomedTimeRangeAsync: DashboardActions.SetZoomedTimeRangeDispatcher
|
|
|
|
setZoomedTimeRangeAsync: Types.Dashboards.Actions.SetZoomedTimeRangeDispatcher
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface Props extends DashboardActions, ManualRefreshProps, WithRouterProps {
|
|
|
|
interface Props extends DashboardActions, ManualRefreshProps, WithRouterProps {
|
|
|
|
source: SourceData.Source
|
|
|
|
source: Types.Sources.Data.Source
|
|
|
|
sources: SourceData.Source[]
|
|
|
|
sources: Types.Sources.Data.Source[]
|
|
|
|
params: {
|
|
|
|
params: {
|
|
|
|
sourceID: string
|
|
|
|
sourceID: string
|
|
|
|
dashboardID: string
|
|
|
|
dashboardID: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
location: Location
|
|
|
|
location: Location
|
|
|
|
dashboardID: number
|
|
|
|
dashboardID: number
|
|
|
|
dashboard: DashboardData.Dashboard
|
|
|
|
dashboard: Types.Dashboards.Data.Dashboard
|
|
|
|
dashboards: DashboardData.Dashboard[]
|
|
|
|
dashboards: Types.Dashboards.Data.Dashboard[]
|
|
|
|
handleChooseAutoRefresh: AppActions.SetAutoRefreshActionCreator
|
|
|
|
handleChooseAutoRefresh: Types.App.Actions.SetAutoRefreshActionCreator
|
|
|
|
autoRefresh: number
|
|
|
|
autoRefresh: number
|
|
|
|
templateControlBarVisibilityToggled: () => AppActions.TemplateControlBarVisibilityToggledActionCreator
|
|
|
|
templateControlBarVisibilityToggled: () => Types.App.Actions.TemplateControlBarVisibilityToggledActionCreator
|
|
|
|
timeRange: QueryData.TimeRange
|
|
|
|
timeRange: Types.Queries.Data.TimeRange
|
|
|
|
zoomedTimeRange: QueryData.TimeRange
|
|
|
|
zoomedTimeRange: Types.Queries.Data.TimeRange
|
|
|
|
showTemplateControlBar: boolean
|
|
|
|
showTemplateControlBar: boolean
|
|
|
|
inPresentationMode: boolean
|
|
|
|
inPresentationMode: boolean
|
|
|
|
handleClickPresentationButton: AppActions.DelayEnablePresentationModeDispatcher
|
|
|
|
handleClickPresentationButton: Types.App.Actions.DelayEnablePresentationModeDispatcher
|
|
|
|
cellQueryStatus: {
|
|
|
|
cellQueryStatus: {
|
|
|
|
queryID: string
|
|
|
|
queryID: string
|
|
|
|
status: object
|
|
|
|
status: object
|
|
|
|
}
|
|
|
|
}
|
|
|
|
errorThrown: ErrorActions.ErrorThrownActionCreator
|
|
|
|
errorThrown: Types.Errors.Actions.ErrorThrownActionCreator
|
|
|
|
meRole: string
|
|
|
|
meRole: string
|
|
|
|
isUsingAuth: boolean
|
|
|
|
isUsingAuth: boolean
|
|
|
|
router: InjectedRouter
|
|
|
|
router: InjectedRouter
|
|
|
|
notify: NotificationActions.PublishNotificationActionCreator
|
|
|
|
notify: Types.Notifications.Actions.PublishNotificationActionCreator
|
|
|
|
getAnnotationsAsync: AnnotationActions.GetAnnotationsDispatcher
|
|
|
|
getAnnotationsAsync: Types.Annotations.Actions.GetAnnotationsDispatcher
|
|
|
|
handleShowCellEditorOverlay: CellEditorOverlayActions.ShowCellEditorOverlayActionCreator
|
|
|
|
handleShowCellEditorOverlay: Types.CellEditorOverlay.Actions.ShowCellEditorOverlayActionCreator
|
|
|
|
handleHideCellEditorOverlay: CellEditorOverlayActions.HideCellEditorOverlayActionCreator
|
|
|
|
handleHideCellEditorOverlay: Types.CellEditorOverlay.Actions.HideCellEditorOverlayActionCreator
|
|
|
|
handleDismissEditingAnnotation: AnnotationActions.DismissEditingAnnotationActionCreator
|
|
|
|
handleDismissEditingAnnotation: Types.Annotations.Actions.DismissEditingAnnotationActionCreator
|
|
|
|
selectedCell: DashboardData.Cell
|
|
|
|
selectedCell: Types.Dashboards.Data.Cell
|
|
|
|
thresholdsListType: string
|
|
|
|
thresholdsListType: string
|
|
|
|
thresholdsListColors: ColorData.ColorNumber[]
|
|
|
|
thresholdsListColors: Types.Colors.Data.ColorNumber[]
|
|
|
|
gaugeColors: ColorData.ColorNumber[]
|
|
|
|
gaugeColors: Types.Colors.Data.ColorNumber[]
|
|
|
|
lineColors: ColorData.ColorString[]
|
|
|
|
lineColors: Types.Colors.Data.ColorString[]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface State {
|
|
|
|
interface State {
|
|
|
|
isEditMode: boolean
|
|
|
|
isEditMode: boolean
|
|
|
|
selectedCell: DashboardData.Cell | null
|
|
|
|
selectedCell: Types.Dashboards.Data.Cell | null
|
|
|
|
scrollTop: number
|
|
|
|
scrollTop: number
|
|
|
|
windowHeight: number
|
|
|
|
windowHeight: number
|
|
|
|
dashboardsNames: DashboardData.DashboardName[]
|
|
|
|
dashboardsNames: Types.Dashboards.Data.DashboardName[]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ErrorHandling
|
|
|
|
@ErrorHandling
|
|
|
@ -353,7 +343,7 @@ class DashboardPage extends Component<Props, State> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private getDashboard = async (): Promise<
|
|
|
|
private getDashboard = async (): Promise<
|
|
|
|
DashboardActions.GetDashboardWithHydratedAndSyncedTempVarsAsyncThunk
|
|
|
|
Types.Dashboards.Actions.GetDashboardWithHydratedAndSyncedTempVarsAsyncThunk
|
|
|
|
> => {
|
|
|
|
> => {
|
|
|
|
const {dashboardID, source, router, location} = this.props
|
|
|
|
const {dashboardID, source, router, location} = this.props
|
|
|
|
|
|
|
|
|
|
|
@ -378,7 +368,7 @@ class DashboardPage extends Component<Props, State> {
|
|
|
|
this.setState({dashboardsNames})
|
|
|
|
this.setState({dashboardsNames})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private inView = (cell: DashboardData.Cell): boolean => {
|
|
|
|
private inView = (cell: Types.Dashboards.Data.Cell): boolean => {
|
|
|
|
const {scrollTop, windowHeight} = this.state
|
|
|
|
const {scrollTop, windowHeight} = this.state
|
|
|
|
const bufferValue = 600
|
|
|
|
const bufferValue = 600
|
|
|
|
const cellTop = cell.y * DASHBOARD_LAYOUT_ROW_HEIGHT
|
|
|
|
const cellTop = cell.y * DASHBOARD_LAYOUT_ROW_HEIGHT
|
|
|
@ -392,14 +382,16 @@ class DashboardPage extends Component<Props, State> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleSaveEditedCell = async (
|
|
|
|
private handleSaveEditedCell = async (
|
|
|
|
newCell: DashboardData.Cell
|
|
|
|
newCell: Types.Dashboards.Data.Cell
|
|
|
|
): Promise<void> => {
|
|
|
|
): Promise<void> => {
|
|
|
|
const {dashboard, handleHideCellEditorOverlay} = this.props
|
|
|
|
const {dashboard, handleHideCellEditorOverlay} = this.props
|
|
|
|
await this.props.updateDashboardCell(dashboard, newCell)
|
|
|
|
await this.props.updateDashboardCell(dashboard, newCell)
|
|
|
|
handleHideCellEditorOverlay()
|
|
|
|
handleHideCellEditorOverlay()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleChooseTimeRange = (timeRange: QueryData.TimeRange): void => {
|
|
|
|
private handleChooseTimeRange = (
|
|
|
|
|
|
|
|
timeRange: Types.Queries.Data.TimeRange
|
|
|
|
|
|
|
|
): void => {
|
|
|
|
const {
|
|
|
|
const {
|
|
|
|
dashboard,
|
|
|
|
dashboard,
|
|
|
|
|
|
|
|
|
|
|
@ -422,7 +414,9 @@ class DashboardPage extends Component<Props, State> {
|
|
|
|
getAnnotationsAsync(source.links.annotations, annotationRange)
|
|
|
|
getAnnotationsAsync(source.links.annotations, annotationRange)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleUpdatePosition = (cells: DashboardData.Cell[]): void => {
|
|
|
|
private handleUpdatePosition = (
|
|
|
|
|
|
|
|
cells: Types.Dashboards.Data.Cell[]
|
|
|
|
|
|
|
|
): void => {
|
|
|
|
const {dashboard, meRole, isUsingAuth} = this.props
|
|
|
|
const {dashboard, meRole, isUsingAuth} = this.props
|
|
|
|
const newDashboard = {...dashboard, cells}
|
|
|
|
const newDashboard = {...dashboard, cells}
|
|
|
|
|
|
|
|
|
|
|
@ -440,7 +434,7 @@ class DashboardPage extends Component<Props, State> {
|
|
|
|
this.props.addDashboardCellAsync(dashboard)
|
|
|
|
this.props.addDashboardCellAsync(dashboard)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleCloneCell = (cell: DashboardData.Cell): void => {
|
|
|
|
private handleCloneCell = (cell: Types.Dashboards.Data.Cell): void => {
|
|
|
|
const {dashboard} = this.props
|
|
|
|
const {dashboard} = this.props
|
|
|
|
this.props.cloneDashboardCellAsync(dashboard, cell)
|
|
|
|
this.props.cloneDashboardCellAsync(dashboard, cell)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -463,15 +457,17 @@ class DashboardPage extends Component<Props, State> {
|
|
|
|
this.getDashboardsNames()
|
|
|
|
this.getDashboardsNames()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleDeleteDashboardCell = (cell: DashboardData.Cell): void => {
|
|
|
|
private handleDeleteDashboardCell = (
|
|
|
|
|
|
|
|
cell: Types.Dashboards.Data.Cell
|
|
|
|
|
|
|
|
): void => {
|
|
|
|
const {dashboard} = this.props
|
|
|
|
const {dashboard} = this.props
|
|
|
|
this.props.deleteDashboardCellAsync(dashboard, cell)
|
|
|
|
this.props.deleteDashboardCellAsync(dashboard, cell)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleSelectTemplate = (
|
|
|
|
private handleSelectTemplate = (
|
|
|
|
templateID: string
|
|
|
|
templateID: string
|
|
|
|
): ((value: TempVarData.TemplateValue) => void) => (
|
|
|
|
): ((value: Types.TempVars.Data.TemplateValue) => void) => (
|
|
|
|
value: TempVarData.TemplateValue
|
|
|
|
value: Types.TempVars.Data.TemplateValue
|
|
|
|
): void => {
|
|
|
|
): void => {
|
|
|
|
const {dashboard, dashboardID, location} = this.props
|
|
|
|
const {dashboard, dashboardID, location} = this.props
|
|
|
|
|
|
|
|
|
|
|
@ -495,7 +491,7 @@ class DashboardPage extends Component<Props, State> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleSaveTemplateVariables = async (
|
|
|
|
private handleSaveTemplateVariables = async (
|
|
|
|
templates: TempVarData.Template[]
|
|
|
|
templates: Types.TempVars.Data.Template[]
|
|
|
|
): Promise<void> => {
|
|
|
|
): Promise<void> => {
|
|
|
|
const {location, dashboard} = this.props
|
|
|
|
const {location, dashboard} = this.props
|
|
|
|
|
|
|
|
|
|
|
@ -519,7 +515,7 @@ class DashboardPage extends Component<Props, State> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleZoomedTimeRange = (
|
|
|
|
private handleZoomedTimeRange = (
|
|
|
|
zoomedTimeRange: QueryData.TimeRange
|
|
|
|
zoomedTimeRange: Types.Queries.Data.TimeRange
|
|
|
|
): void => {
|
|
|
|
): void => {
|
|
|
|
const {location} = this.props
|
|
|
|
const {location} = this.props
|
|
|
|
this.props.setZoomedTimeRangeAsync(zoomedTimeRange, location)
|
|
|
|
this.props.setZoomedTimeRangeAsync(zoomedTimeRange, location)
|
|
|
|