Include status in cell editor overlay
parent
f16e9b5074
commit
2519bb44fd
|
@ -103,6 +103,14 @@ export const deleteDashboardCell = (cell) => ({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export const editCellQueryStatus = (queryID, status) => ({
|
||||||
|
type: 'EDIT_CELL_QUERY_STATUS',
|
||||||
|
payload: {
|
||||||
|
queryID,
|
||||||
|
status,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Async Action Creators
|
// Async Action Creators
|
||||||
|
|
||||||
export const getDashboardsAsync = (dashboardID) => async (dispatch) => {
|
export const getDashboardsAsync = (dashboardID) => async (dispatch) => {
|
||||||
|
|
|
@ -29,6 +29,7 @@ class CellEditorOverlay extends Component {
|
||||||
this.handleEditRawText = ::this.handleEditRawText
|
this.handleEditRawText = ::this.handleEditRawText
|
||||||
|
|
||||||
const {cell: {name, type, queries}} = props
|
const {cell: {name, type, queries}} = props
|
||||||
|
|
||||||
const queriesWorkingDraft = _.cloneDeep(queries.map(({queryConfig}) => ({...queryConfig, id: uuid.v4()})))
|
const queriesWorkingDraft = _.cloneDeep(queries.map(({queryConfig}) => ({...queryConfig, id: uuid.v4()})))
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -39,6 +40,17 @@ class CellEditorOverlay extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const {status, queryID} = this.props.queryStatus
|
||||||
|
const nextStatus = nextProps.queryStatus
|
||||||
|
if (nextStatus.status && nextStatus.queryID) {
|
||||||
|
if (nextStatus.queryID !== queryID || nextStatus.status !== status) {
|
||||||
|
const nextQueries = this.state.queriesWorkingDraft.map((q) => q.id === queryID ? ({...q, status: nextStatus.status}) : q)
|
||||||
|
this.setState({queriesWorkingDraft: nextQueries})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
queryStateReducer(queryModifier) {
|
queryStateReducer(queryModifier) {
|
||||||
return (queryID, payload) => {
|
return (queryID, payload) => {
|
||||||
const {queriesWorkingDraft} = this.state
|
const {queriesWorkingDraft} = this.state
|
||||||
|
@ -111,11 +123,12 @@ class CellEditorOverlay extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
onCancel,
|
|
||||||
autoRefresh,
|
|
||||||
timeRange,
|
|
||||||
source,
|
source,
|
||||||
|
onCancel,
|
||||||
|
timeRange,
|
||||||
|
autoRefresh,
|
||||||
fetchTimeSeries,
|
fetchTimeSeries,
|
||||||
|
editQueryStatus,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -142,6 +155,7 @@ class CellEditorOverlay extends Component {
|
||||||
cellType={cellWorkingType}
|
cellType={cellWorkingType}
|
||||||
cellName={cellWorkingName}
|
cellName={cellWorkingName}
|
||||||
fetchTimeSeries={fetchTimeSeries}
|
fetchTimeSeries={fetchTimeSeries}
|
||||||
|
editQueryStatus={editQueryStatus}
|
||||||
/>
|
/>
|
||||||
<ResizeBottom>
|
<ResizeBottom>
|
||||||
<div style={{display: 'flex', flexDirection: 'column', height: '100%'}}>
|
<div style={{display: 'flex', flexDirection: 'column', height: '100%'}}>
|
||||||
|
@ -191,6 +205,11 @@ CellEditorOverlay.propTypes = {
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
fetchTimeSeries: func.isRequired,
|
fetchTimeSeries: func.isRequired,
|
||||||
|
editQueryStatus: func.isRequired,
|
||||||
|
queryStatus: shape({
|
||||||
|
queryID: string,
|
||||||
|
status: shape({}),
|
||||||
|
}).isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CellEditorOverlay
|
export default CellEditorOverlay
|
||||||
|
|
|
@ -56,6 +56,10 @@ const DashboardPage = React.createClass({
|
||||||
inPresentationMode: bool.isRequired,
|
inPresentationMode: bool.isRequired,
|
||||||
handleClickPresentationButton: func,
|
handleClickPresentationButton: func,
|
||||||
fetchTimeSeries: func,
|
fetchTimeSeries: func,
|
||||||
|
cellQueryStatus: shape({
|
||||||
|
queryID: string,
|
||||||
|
status: shape(),
|
||||||
|
}).isRequired,
|
||||||
},
|
},
|
||||||
|
|
||||||
childContextTypes: {
|
childContextTypes: {
|
||||||
|
@ -160,15 +164,17 @@ const DashboardPage = React.createClass({
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
dashboards,
|
|
||||||
params: {sourceID, dashboardID},
|
|
||||||
inPresentationMode,
|
|
||||||
handleClickPresentationButton,
|
|
||||||
source,
|
source,
|
||||||
handleChooseAutoRefresh,
|
|
||||||
autoRefresh,
|
|
||||||
timeRange,
|
timeRange,
|
||||||
|
dashboards,
|
||||||
|
autoRefresh,
|
||||||
fetchTimeSeries,
|
fetchTimeSeries,
|
||||||
|
cellQueryStatus,
|
||||||
|
dashboardActions,
|
||||||
|
inPresentationMode,
|
||||||
|
handleChooseAutoRefresh,
|
||||||
|
handleClickPresentationButton,
|
||||||
|
params: {sourceID, dashboardID},
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const dashboard = dashboards.find(d => d.id === +dashboardID)
|
const dashboard = dashboards.find(d => d.id === +dashboardID)
|
||||||
|
@ -190,6 +196,8 @@ const DashboardPage = React.createClass({
|
||||||
onCancel={this.handleDismissOverlay}
|
onCancel={this.handleDismissOverlay}
|
||||||
onSave={this.handleSaveEditedCell}
|
onSave={this.handleSaveEditedCell}
|
||||||
fetchTimeSeries={fetchTimeSeries}
|
fetchTimeSeries={fetchTimeSeries}
|
||||||
|
editQueryStatus={dashboardActions.editCellQueryStatus}
|
||||||
|
queryStatus={cellQueryStatus}
|
||||||
/> :
|
/> :
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
@ -260,6 +268,7 @@ const mapStateToProps = (state) => {
|
||||||
dashboardUI: {
|
dashboardUI: {
|
||||||
dashboards,
|
dashboards,
|
||||||
timeRange,
|
timeRange,
|
||||||
|
cellQueryStatus,
|
||||||
},
|
},
|
||||||
} = state
|
} = state
|
||||||
|
|
||||||
|
@ -268,6 +277,7 @@ const mapStateToProps = (state) => {
|
||||||
autoRefresh,
|
autoRefresh,
|
||||||
timeRange,
|
timeRange,
|
||||||
inPresentationMode,
|
inPresentationMode,
|
||||||
|
cellQueryStatus,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ const initialState = {
|
||||||
dashboards: [],
|
dashboards: [],
|
||||||
timeRange: {lower, upper},
|
timeRange: {lower, upper},
|
||||||
isEditMode: false,
|
isEditMode: false,
|
||||||
|
cellQueryStatus: {queryID: null, status: null},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ui(state = initialState, action) {
|
export default function ui(state = initialState, action) {
|
||||||
|
@ -157,6 +158,12 @@ export default function ui(state = initialState, action) {
|
||||||
|
|
||||||
return {...state, ...newState}
|
return {...state, ...newState}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'EDIT_CELL_QUERY_STATUS': {
|
||||||
|
const {queryID, status} = action.payload
|
||||||
|
|
||||||
|
return {...state, cellQueryStatus: {queryID, status}}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return state
|
return state
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {proxy} from 'utils/queryUrlGenerator'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
const NOOP = () => ({
|
const NOOP = () => ({
|
||||||
type: 'I_NEED_TO_EDIT_QUERY_STATUS',
|
type: 'RUNNING_FETCH_TIME_SERIES',
|
||||||
})
|
})
|
||||||
|
|
||||||
export const handleLoading = (query, editQueryStatus, dispatch) => {
|
export const handleLoading = (query, editQueryStatus, dispatch) => {
|
||||||
|
|
Loading…
Reference in New Issue