Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display versions for a file and allow any version to be restored #4805

Closed
wants to merge 9 commits into from
Closed

Display versions for a file and allow any version to be restored #4805

wants to merge 9 commits into from

Commits on Aug 6, 2022

  1. Change ngSelected to a dictionary, add pointers to parent for child n…

    …odes
    
    The functionality should be the exact same after these changes.
    Rather than building a dictionary object from the ngSelected array all the time, use a dictionary from the beginning.
    The dictionary will be updated when the check state of a node changes, which will then trigger the partial map to be updated. The partial map only needs to be updated when the dictionary changes rather than also building it all the time.
    Made a general cleanup pass of the file.
    Remove unused and newly unneeded functions, renamed some variables.
    seantempleton committed Aug 6, 2022
    Copy the full SHA
    ad880af View commit details
    Browse the repository at this point in the history
  2. Fix nodes under root not being deselected properly

    If there are two or more nodes under the root node, select all of the nodes then deselect the root node, one or more of the nodes under the root node remains selected.
    Fixed by removing all selected nodes under the root from the selected dictionary when selecting a node. The check is propogated all the way up to the root node and if all of its children are selected, they can be removed from the dictionary.
    
    Also, prevented the full path of a file from being placed in the partial map as there is nothing beneath a file.
    updateNodesFromMap will now only update the nodes (and their children) that are passed in. Or if none are passed in then the entire tree is updated.
    seantempleton committed Aug 6, 2022
    Copy the full SHA
    6026160 View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2022

  1. Show file versions under each file

    When expanding a file, a request is made to the backend for all the versions of that file. They are then shown in descending order, most recent at the top.
    seantempleton committed Aug 7, 2022
    Copy the full SHA
    61e5cc9 View commit details
    Browse the repository at this point in the history
  2. Change file picker to handle versions properly

    Versions are handled specially. If selected they are always put in ngSelected. Exception to this is if the default version, the latest version, is the only version selected.
    In that case the file itself is put in ngSelected because that version of the file will be restored from the chosen backup.
    
    Added logic changes for the above plus edge cases of e.g.
    1. Check a file, the first version is automatically checked and the file is added to ngSelected.
    2. Check the first version, the file is automatically checked and added to ngSelected.
    3. Check the second version, that version is added to ngSelected and the file is checked.
    4. The file already has been selected, meaning the default version is selected, and then another version is checked. The file is removed from ngSelected, the two versions are added to ngSelected.
    5. Propagation logic when deselecting versions or files.
    seantempleton committed Aug 7, 2022
    Copy the full SHA
    6d3aa80 View commit details
    Browse the repository at this point in the history
  3. Show version in bold if it was backed up in the selected backup

    Change file picker to use the version that is in the selected backup as the default version instead of using the first version as the default.
    seantempleton committed Aug 7, 2022
    Copy the full SHA
    c7ae6c3 View commit details
    Browse the repository at this point in the history
  4. Restore selected versions of a file

    The modified time of the file is appended to the restored filename when multiple versions of a file are being restored
    If the version of a file that is selected to be restored is the version of the file that is in the chosen backup, then no special logic needs to be performed. It is a normal restore.
    If the selected version is not in the chosen backup, the fileId is passed to the backend and used to restore that specific version of the file.
    
    When any version is selected that is not the default version (the version in the chosen backup), then ALL selected versions for that file have the fileId sent to the backend. Additionally, if
    more than one version is selected, and one of those is the default version, all fileIds are sent to the backend and the file from the chosen backup is "ignored".
    The files from the backup are put into a temp table and since specific versions are going to be restored, the file with versions selected must be removed from that table so the specific versions of
    the file can be put in the table and have the modified time be part of the filenames.
    seantempleton committed Aug 7, 2022
    Copy the full SHA
    7ff231b View commit details
    Browse the repository at this point in the history
  5. Use existing renaming logic for restoring versions of a file when the…

    … user specifies to not overwrite existing files
    
    Two scenarios
    1) Restore a versioned file with the regular file name. Append the last modified time to the filename.
    2) A versioned file is already being restored with the last modified time in the filename. Make sure to not append the time again and let the existing logic choose a new name.
    seantempleton committed Aug 7, 2022
    Copy the full SHA
    b81d373 View commit details
    Browse the repository at this point in the history
  6. Show loading spinner when loading versions for a file

    Change x-tree-icon class for a file from x-tree-icon-leaf to x-tree-icon-file.
    Change x-tree-icon-fileversion back to leaf as multiple things depend on leaf and it is hard to track them all down.
    Set a file node to not be expanded when searching.
    seantempleton committed Aug 7, 2022
    Copy the full SHA
    3783211 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2022

  1. Add unit tests for restoring specific versions of files, fix existing…

    … unit tests
    
    Fixed existing unit tests by:
    m_filters was null because the unit tests did not call a constructor on FilterExpression which set it. Create a new List on construction so it is not null.
    If m_filters was empty, OnlyContainsFilterType() would return true. Added a check that there were items in the list first.
    A call to Parameters.Clear() was accidentally removed after ExecuteScalarInt64() was called. ExecuteScalarInt64() clears parameters, adds any if needed, but does not clear its own parameters.
    Use the proper OS directory separator before the &fileid= indicator from the frontend of what file id to restore.
    seantempleton committed Aug 12, 2022
    Copy the full SHA
    69b988d View commit details
    Browse the repository at this point in the history