mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 08:01:25 +00:00
feat(frontend): set default app refesh interval (#5380)
This commit is contained in:
@@ -21,7 +21,8 @@
|
||||
export let render: boolean
|
||||
export let horizontalAlignment: 'left' | 'center' | 'right' | undefined = undefined
|
||||
|
||||
const { app, worldStore, policy } = getContext<AppViewerContext>('AppViewerContext')
|
||||
const { app, worldStore, policy, recomputeAllContext } =
|
||||
getContext<AppViewerContext>('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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{#each Object.keys(components['recomputeallcomponent'].initialData.configuration) as key (key)}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user