chore: declare ttl property in schema

This commit is contained in:
Yohan Boniface 2024-06-03 17:35:59 +02:00
parent 16fd5d8ca3
commit dbafe19b7f
3 changed files with 13 additions and 14 deletions

View file

@ -478,8 +478,19 @@ export const SCHEMA = {
label: translate('To zoom'), label: translate('To zoom'),
helpText: translate('Optional.'), helpText: translate('Optional.'),
}, },
ttl: {
type: Number,
label: translate('Cache proxied request'),
choices: [
['', translate('No cache')],
['300', translate('5 min')],
['3600', translate('1 hour')],
['86400', translate('1 day')],
],
default: '300',
},
type: { type: {
type: 'String', type: String,
impacts: ['data'], impacts: ['data'],
}, },
weight: { weight: {

View file

@ -340,15 +340,6 @@ L.FormBuilder.TextColorPicker = L.FormBuilder.ColorPicker.extend({
], ],
}) })
L.FormBuilder.ProxyTTLSelect = L.FormBuilder.Select.extend({
selectOptions: [
[undefined, L._('No cache')],
['300', L._('5 min')],
['3600', L._('1 hour')],
['86400', L._('1 day')],
],
})
L.FormBuilder.LayerTypeChooser = L.FormBuilder.Select.extend({ L.FormBuilder.LayerTypeChooser = L.FormBuilder.Select.extend({
getOptions: function () { getOptions: function () {
const layer_classes = [ const layer_classes = [

View file

@ -1407,10 +1407,7 @@ U.DataLayer = L.Evented.extend({
helpEntries: 'proxyRemoteData', helpEntries: 'proxyRemoteData',
}, },
]) ])
remoteDataFields.push([ remoteDataFields.push('options.remoteData.ttl')
'options.remoteData.ttl',
{ handler: 'ProxyTTLSelect', label: L._('Cache proxied request') },
])
} }
const remoteDataContainer = L.DomUtil.createFieldset(container, L._('Remote data')) const remoteDataContainer = L.DomUtil.createFieldset(container, L._('Remote data'))