copied from pve-manager, with adaptions for modern js
(let, parameter destructuring,...)
and dropped the not needed 'needOTP' method
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
when rstore is not instanciated but only a config,
auto-create it with its type
this allows us to configure an diff/rstore combination completely
declaratively like this:
store: {
type: 'diff',
autoDestroy: true,
autoDestroyRstore: true,
rstore: {
type: 'update',
model: 'some-model',
autoStart: true,
interval: 5000,
},
},
the only thing we have to be careful about is to either
do a manual 'stopUpdate' somewhere, or use the 'autoDestroyRstore' flag
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
when this flag is set, the diffstore will automatically try to destroy
the rstore when it is destroyed itself
for this we have to move the rstore into the object (instead of using a closure)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
in some cases, we provide a config with interval set to 'undefined',
which gets happily applied to the config, but gets interpreted as '0'
when actually starting the task, resulting in constant api requests
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
this allows to drop setting the default values and ensures that when
interval is updated it actually effects the used update frequency.
Anything which was saved in "me" before, for example me.autoStart, is
still there and gets also updated on a me.setIsStopped(), so there
should be no effects on code using internals.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
since all modern browsers can properly handle multiple
xmlhttprequests, we do not need to serialize them ourselves, but
leave it to the browser
this fixes an issue wehre a canceled request of an updatestore
blocks all other updatestores until refresh
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
the store never fires/gets a destroy event, thus it
never stops the load_task and never unqueues itself in case
the store gets destroyed but not explicitely stopped
with overriding the destroy method, this works now as intended
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
the alias is to use it in a declarative syntax,
the autostart parameter automatically starts the update
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>