feat: add ability to disable cache (#23439)

This commit is contained in:
Ville Brofeldt
2023-03-31 11:41:57 +03:00
committed by GitHub
parent f6b5b658e5
commit 500d90058f
9 changed files with 38 additions and 16 deletions
@@ -944,7 +944,7 @@ class DatasourceEditor extends React.PureComponent {
fieldKey="cache_timeout"
label={t('Cache timeout')}
description={t(
'The duration of time in seconds before the cache is invalidated',
'The duration of time in seconds before the cache is invalidated. Set to -1 to bypass the cache.',
)}
control={<TextControl controlId="cache_timeout" />}
/>
@@ -101,6 +101,10 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
postPayload: {
data: {
...currentDatasource,
cache_timeout:
currentDatasource.cache_timeout === ''
? null
: currentDatasource.cache_timeout,
schema,
metrics: currentDatasource?.metrics?.map(
(metric: Record<string, unknown>) => ({
@@ -399,7 +399,7 @@ function PropertiesModal({
</StyledFormItem>
<StyledHelpBlock className="help-block">
{t(
"Duration (in seconds) of the caching timeout for this chart. Note this defaults to the dataset's timeout if undefined.",
"Duration (in seconds) of the caching timeout for this chart. Set to -1 to bypass the cache. Note this defaults to the dataset's timeout if undefined.",
)}
</StyledHelpBlock>
</FormItem>
@@ -238,7 +238,7 @@ const ExtraOptions = ({
<div className="helper">
{t(
'Duration (in seconds) of the caching timeout for charts of this database.' +
' A timeout of 0 indicates that the cache never expires.' +
' A timeout of 0 indicates that the cache never expires, and -1 bypasses the cache.' +
' Note this defaults to the global timeout if undefined.',
)}
</div>