Show notification when adding charts
This commit is contained in:
@@ -2,7 +2,7 @@ import { Action, ActionTypes, ChartParameters } from '../reducers/Charts'
|
|||||||
import { AppState } from '../reducers'
|
import { AppState } from '../reducers'
|
||||||
import { default as persistentStorage, StorageIdentifier } from '../utils/PersistentStorage'
|
import { default as persistentStorage, StorageIdentifier } from '../utils/PersistentStorage'
|
||||||
import { Dispatch } from 'redux'
|
import { Dispatch } from 'redux'
|
||||||
import { showError } from './Global'
|
import { showError, showNotification } from './Global'
|
||||||
|
|
||||||
interface ConnectionViewState {
|
interface ConnectionViewState {
|
||||||
charts: Array<ChartParameters>
|
charts: Array<ChartParameters>
|
||||||
@@ -72,6 +72,7 @@ export const addChart = (chartParameters: ChartParameters) => async (
|
|||||||
.find(chart => chart.topic === chartParameters.topic && chart.dotPath === chartParameters.dotPath)
|
.find(chart => chart.topic === chartParameters.topic && chart.dotPath === chartParameters.dotPath)
|
||||||
)
|
)
|
||||||
if (chartExists) {
|
if (chartExists) {
|
||||||
|
dispatch(showNotification('Already added'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +81,7 @@ export const addChart = (chartParameters: ChartParameters) => async (
|
|||||||
chart: chartParameters,
|
chart: chartParameters,
|
||||||
})
|
})
|
||||||
dispatch(saveCharts())
|
dispatch(saveCharts())
|
||||||
|
dispatch(showNotification('Added to chart panel'))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const updateChart = (chartParameters: ChartParameters) => async (
|
export const updateChart = (chartParameters: ChartParameters) => async (
|
||||||
|
|||||||
Reference in New Issue
Block a user