MCPcopy
hub / github.com/deepops-ai/deepops / getDatasource

Function getDatasource

ui/src/utils/datasource.ts:21–31  ·  view source on GitHub ↗
(k, ds?)

Source from the content-addressed store, hash-verified

19import { $datasources } from "src/views/datasource/store"
20
21export const getDatasource = (k, ds?):Datasource => {
22 const datasources = ds ?? $datasources.get()
23 let currentDatasource
24 if (hasVariableFormat(k?.toString())) {
25 const name = replaceWithVariables(k)
26 currentDatasource = datasources?.find(ds => ds.name == name)
27 } else {
28 currentDatasource = datasources?.find(ds => ds.id == k)
29 }
30 return currentDatasource
31}
32
33export const roundDsTime = timestamp => {
34 return floor(timestamp)

Callers 15

EditVariableFunction · 0.90
queryVariableValuesFunction · 0.90
queryDataFunction · 0.90
EditPanelQueryFunction · 0.90
queryPrometheusLabelsFunction · 0.90
queryDependenciesFunction · 0.90
queryJaegerServicesFunction · 0.90
queryJaegerOperationsFunction · 0.90
queryJaegerTracesFunction · 0.90
queryJaegerTraceFunction · 0.90

Calls 4

hasVariableFormatFunction · 0.90
replaceWithVariablesFunction · 0.90
getMethod · 0.80
findMethod · 0.80

Tested by

no test coverage detected