diff --git a/frontend/src/lib/components/apps/components/display/AppRecomputeAll.svelte b/frontend/src/lib/components/apps/components/display/AppRecomputeAll.svelte index ebf89e6b9a..2b41c014e5 100644 --- a/frontend/src/lib/components/apps/components/display/AppRecomputeAll.svelte +++ b/frontend/src/lib/components/apps/components/display/AppRecomputeAll.svelte @@ -21,7 +21,8 @@ export let render: boolean export let horizontalAlignment: 'left' | 'center' | 'right' | undefined = undefined - const { app, worldStore, policy } = getContext('AppViewerContext') + const { app, worldStore, policy, recomputeAllContext } = + getContext('AppViewerContext') let resolvedConfig = initConfig( components['recomputeallcomponent'].initialData.configuration, @@ -35,6 +36,22 @@ initializing = false let css = initCss($app.css?.recomputeallcomponent, customCss) + + $: resolvedConfig.defaultRefreshInterval && handleRefreshInterval() + + function handleRefreshInterval() { + if (resolvedConfig.defaultRefreshInterval !== undefined) { + const newInterval = + typeof resolvedConfig.defaultRefreshInterval === 'number' + ? resolvedConfig.defaultRefreshInterval * 1000 + : parseInt(resolvedConfig.defaultRefreshInterval) * 1000 + + if (newInterval !== $recomputeAllContext.interval) { + $recomputeAllContext.setInter?.(newInterval) + } + } + } + {#each Object.keys(components['recomputeallcomponent'].initialData.configuration) as key (key)} diff --git a/frontend/src/lib/components/apps/editor/component/components.ts b/frontend/src/lib/components/apps/editor/component/components.ts index b1408bf40c..1d7645bfc0 100644 --- a/frontend/src/lib/components/apps/editor/component/components.ts +++ b/frontend/src/lib/components/apps/editor/component/components.ts @@ -4157,7 +4157,22 @@ See date-fns format for more information. By default, it is 'dd.MM.yyyy HH:mm' initialData: { ...defaultAlignement, componentInput: undefined, - configuration: {}, + configuration: { + defaultRefreshInterval: { + fieldType: 'select', + type: 'static', + selectOptions: [ + { value: '0', label: 'Once' }, + { value: '5', label: 'Every 5 seconds' }, + { value: '10', label: 'Every 10 seconds' }, + { value: '15', label: 'Every 15 seconds' }, + { value: '20', label: 'Every 20 seconds' }, + { value: '25', label: 'Every 25 seconds' }, + { value: '30', label: 'Every 30 seconds' } + ], + value: '0' + } + }, menuItems: true } }