]> git.proxmox.com Git - proxmox-backup.git/commit
fix #4977: ui: tape: restore: rework snapshot selection logic
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 29 Sep 2023 13:39:24 +0000 (15:39 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 10 Nov 2023 12:00:08 +0000 (13:00 +0100)
commit34293047334ed45c66c65356ec533c2353fc8e7c
tree0ae4043934593f87adba21f461bf30fcb2a91c5f
parent4206d6fadb7df9d200d69692b76a621a744dc79b
fix #4977: ui: tape: restore: rework snapshot selection logic

previously, the snapshot grid returned one of three possible types of
values:
* a list of snapshots
* a list of datastores (if only whole datastores were selected)
* the string 'all' (when all snapshots were selected)

this led to some confusing and wrong code, especially the part:
```
  if (source === 'all') {
      source = values.store;
  }
```

which basically set the selected *target* store as a source.  (meaning
it tried restoring a datastore with the selected target name,
regardless if it existed or not)

This fell through in testing, since we most often only restored to the
same datastore anyway were the target and source name were the same.

Rework the return value to return the empty array in case all
snapshots are selected, since selecting none is not a valid anyway.

This means we always get an array back, which makes the code a bit
cleaner overall.

At the same time, we now differentiate correctly the 'all selected'
case, by setting the selected target as a default target.

So instead of previously having `target=target` as datastore
parameter, we now have `target` which is the correct behavior when we
want to restore the whole media set anyway.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
www/tape/window/TapeRestore.js