import React from 'react'; import { Field, Switch, Input, Button, HorizontalGroup, Tooltip, Icon, Label } from '@grafana/ui'; import { CacheSettingsDisable } from './CacheSettingsDisable'; import { Props } from './DataSourceCache'; interface CacheSettingsProps { loading: boolean; setUseDefaultTTL: (useDefaultTTL: boolean) => void; setTtlQueriesMs: (ttl: number) => void; setTtlResourcesMs: (ttl: number) => void; } export const CacheSettingsForm = (props: Props & CacheSettingsProps) => { const { updateDataSourceCache, pageId, useDefaultTTL, setUseDefaultTTL, defaultTTLMs, ttlQueriesMs, setTtlQueriesMs, ttlResourcesMs, setTtlResourcesMs, loading, enabled, dataSourceID, dataSourceUID, } = props; return (
{ setUseDefaultTTL(!useDefaultTTL); }} /> { setTtlQueriesMs(el.currentTarget.valueAsNumber); }} /> Resource TTL Resources are dynamic values that Grafana data source plugins retrieve from data sources for use in the query editor. Examples are Splunk namespaces, Prometheus labels, and CloudWatch metric names. Since these values update less frequently, you might prefer a longer cache TTL for Resources than queries. See the docs{' '} for more info.
} > } disabled={loading || useDefaultTTL} > { setTtlResourcesMs(el.currentTarget.valueAsNumber); }} /> ); };