From dbafe19b7fa7e27f43bddda44482a359efabc131 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 3 Jun 2024 17:35:59 +0200 Subject: [PATCH] chore: declare ttl property in schema --- umap/static/umap/js/modules/schema.js | 13 ++++++++++++- umap/static/umap/js/umap.forms.js | 9 --------- umap/static/umap/js/umap.layer.js | 5 +---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/umap/static/umap/js/modules/schema.js b/umap/static/umap/js/modules/schema.js index 93ab6ae3..8661e541 100644 --- a/umap/static/umap/js/modules/schema.js +++ b/umap/static/umap/js/modules/schema.js @@ -478,8 +478,19 @@ export const SCHEMA = { label: translate('To zoom'), 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: 'String', + type: String, impacts: ['data'], }, weight: { diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index 92c1cdfa..a822cd9d 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -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({ getOptions: function () { const layer_classes = [ diff --git a/umap/static/umap/js/umap.layer.js b/umap/static/umap/js/umap.layer.js index faf2d5d4..653e4990 100644 --- a/umap/static/umap/js/umap.layer.js +++ b/umap/static/umap/js/umap.layer.js @@ -1407,10 +1407,7 @@ U.DataLayer = L.Evented.extend({ helpEntries: 'proxyRemoteData', }, ]) - remoteDataFields.push([ - 'options.remoteData.ttl', - { handler: 'ProxyTTLSelect', label: L._('Cache proxied request') }, - ]) + remoteDataFields.push('options.remoteData.ttl') } const remoteDataContainer = L.DomUtil.createFieldset(container, L._('Remote data'))