From 02ea05f520f8abade6640b7ff2c6a8d15fc572e4 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Mon, 24 Apr 2017 18:16:26 -0700 Subject: [PATCH] Update stubbed data --- ui/src/dashboards/actions/index.js | 37 ++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/ui/src/dashboards/actions/index.js b/ui/src/dashboards/actions/index.js index c2b308a67..222263b55 100644 --- a/ui/src/dashboards/actions/index.js +++ b/ui/src/dashboards/actions/index.js @@ -143,12 +143,45 @@ export const runTemplateVariableQuerySuccess = (templateVariable, values) => ({ }, }) +const templates = [ + { + id: '1', + type: 'tagKeys', + label: 'test query', + tempVar: '$HOSTS', + query: { + db: 'db1', + measurement: 'm1', + influxql: 'SHOW TAGS WHERE HUNTER = "coo"', + }, + values: [ + {value: 'h1', type: 'tagKeys', selected: false}, + {value: 'h2', type: 'tagKeys', selected: false}, + {value: 'h3', type: 'tagKeys', selected: false}, + {value: 'h4', type: 'tagKeys', selected: false}, + ], + }, + { + id: '2', + type: 'csv', + label: 'test csv', + tempVar: '$INFLX', + values: [ + {value: 'A', type: 'csv', selected: false}, + {value: 'B', type: 'csv', selected: false}, + {value: 'C', type: 'csv', selected: false}, + ], + }, +] + // Async Action Creators export const getDashboardsAsync = () => async dispatch => { try { const {data: {dashboards}} = await getDashboardsAJAX() - dispatch(loadDashboards(dashboards)) + const stubbedDashboards = dashboards.map(d => ({...d, templates})) + + dispatch(loadDashboards(stubbedDashboards)) } catch (error) { console.error(error) throw error @@ -157,7 +190,7 @@ export const getDashboardsAsync = () => async dispatch => { export const putDashboard = dashboard => dispatch => { updateDashboardAJAX(dashboard).then(({data}) => { - dispatch(updateDashboard(data)) + dispatch(updateDashboard({...data, templates})) }) }