Merge pull request #11120 from influxdata/fix/save-view-properties

Ensure view retains cellID, and use cellID or id in updateVeiw
pull/11161/head
Deniz Kusefoglu 2019-01-16 12:36:59 -08:00 committed by GitHub
commit ef7d5a1928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -45,14 +45,16 @@ export const readView = (dashboardID: string, cellID: string) => async (
export const updateView = (dashboardID: string, view: View) => async (
dispatch: Dispatch<Action>
): Promise<View> => {
dispatch(setView(view.cellID, null, RemoteDataState.Loading))
const viewID = view.cellID
dispatch(setView(viewID, null, RemoteDataState.Loading))
try {
const newView = await updateViewAJAX(dashboardID, view.cellID, view)
const newView = await updateViewAJAX(dashboardID, viewID, view)
dispatch(setView(view.cellID, newView, RemoteDataState.Done))
dispatch(setView(viewID, newView, RemoteDataState.Done))
return newView
} catch {
dispatch(setView(view.cellID, null, RemoteDataState.Error))
dispatch(setView(viewID, null, RemoteDataState.Error))
}
}

View File

@ -688,6 +688,8 @@ const convertView = (
newView.properties.queries = cloneDeep(view.properties.queries)
newView.name = view.name
newView.cellID = view.cellID
newView.dashboardID = view.dashboardID
newView.id = (view as any).id
newView.links = (view as any).links

View File

@ -102,7 +102,7 @@ type Omit<K, V> = Pick<K, Exclude<keyof K, V>>
export type NewView<T extends ViewProperties = ViewProperties> = Omit<
View<T>,
'id' | 'links' | 'cellID' | 'dashboardID'
'id' | 'links'
>
export interface ViewLinks {