Select default telegraf database
parent
fd52a65263
commit
5de1cc4cb7
|
@ -427,16 +427,25 @@ export const setTimeRangeAsync = (timeRange: TimeRange) => async (
|
||||||
dispatch(setTableQueryConfigAsync())
|
dispatch(setTableQueryConfigAsync())
|
||||||
}
|
}
|
||||||
|
|
||||||
export const populateNamespacesAsync = (proxyLink: string) => async (
|
export const populateNamespacesAsync = (
|
||||||
dispatch
|
proxyLink: string,
|
||||||
): Promise<void> => {
|
source: Source = null
|
||||||
|
) => async (dispatch): Promise<void> => {
|
||||||
const namespaces = await getDatabasesWithRetentionPolicies(proxyLink)
|
const namespaces = await getDatabasesWithRetentionPolicies(proxyLink)
|
||||||
|
|
||||||
if (namespaces && namespaces.length > 0) {
|
if (namespaces && namespaces.length > 0) {
|
||||||
dispatch(setNamespaces(namespaces))
|
dispatch(setNamespaces(namespaces))
|
||||||
|
if (source) {
|
||||||
|
const defaultNamespace = namespaces.find(
|
||||||
|
namespace => namespace.database === source.telegraf
|
||||||
|
)
|
||||||
|
|
||||||
|
dispatch(setNamespaceAsync(defaultNamespace))
|
||||||
|
} else {
|
||||||
dispatch(setNamespaceAsync(namespaces[0]))
|
dispatch(setNamespaceAsync(namespaces[0]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const getSourceAndPopulateNamespacesAsync = (sourceID: string) => async (
|
export const getSourceAndPopulateNamespacesAsync = (sourceID: string) => async (
|
||||||
dispatch
|
dispatch
|
||||||
|
@ -448,7 +457,7 @@ export const getSourceAndPopulateNamespacesAsync = (sourceID: string) => async (
|
||||||
|
|
||||||
if (proxyLink) {
|
if (proxyLink) {
|
||||||
dispatch(setSource(source))
|
dispatch(setSource(source))
|
||||||
dispatch(populateNamespacesAsync(proxyLink))
|
dispatch(populateNamespacesAsync(proxyLink, source))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue