#1579 closed enhancement (fixed)

Patch to Add "Move" Functionality to Web Interface

Reported by: marcusw Owned by: amiller
Priority: normal Milestone: 1.10.0
Component: code-frontend-web Version: 1.9.1
Keywords: move webapi Cc:
Launchpad Bug:

Description (last modified by marcusw)

I made a patch to add a move button to the directory listing of the web interface. It's used to move a file/dir inside a dir to a different dir contained in that dir. I have not written unit tests yet but they should be ready in a few days. This patch applies cleanly to both the 1.9.0 release (use patch -p1) and to the latest git (5fc99788269c350479b6ac51009d2725035ce0c5).

I have tested it in practical usage and found it to work quite well and handle errors gracefully.

Possible future improvements include the ability to move to a dircap URI outside of the current directory, but I will have to figure out how to convert a URI into a working DirectoryNode in a deferrer-friendly way before I can do this.

EDIT: Looks like I can't get the upload file thing to work. Here's a pastebin of the patch.

Attachments (1)

movebutton.diff (20.1 KB) - added by marcusw at 2011-11-17T02:06:55Z.
"Final" complete patch including tests, docs, and the actual code.

Download all attachments as: .zip

Change History (18)

comment:1 Changed at 2011-11-10T08:22:32Z by marcusw

  • Description modified (diff)

comment:2 Changed at 2011-11-11T01:43:04Z by marcusw

Added unit tests. Updated patch is here. Currently working on arbitrary URI targets and copy-only (an option to skip deleting the original link).

comment:3 Changed at 2011-11-11T05:02:04Z by marcusw

Finished arbitrary URI targets and unit tests for that feature. Updated patch. Decided to nix copy-only due to code complexity and lack of usefulness. Thanks for #tahoe-lafs for helping me out when I got suck! I'm done for now.

comment:4 Changed at 2011-11-12T07:46:27Z by marcusw

Wrote documentation for the new webapi function and stuck it in docs/frontends/webapi.rst. Patch

Changed at 2011-11-17T02:06:55Z by marcusw

"Final" complete patch including tests, docs, and the actual code.

comment:5 Changed at 2011-11-17T02:08:08Z by marcusw

The latest version of this patch should be looked for at the git branch.

comment:6 Changed at 2012-02-09T17:28:21Z by zooko

  • Owner set to ChosenOne

Assigning to ChosenOne for review.

comment:7 Changed at 2012-03-07T18:38:02Z by zooko

  • Owner changed from ChosenOne to nobody

comment:8 Changed at 2012-03-13T06:45:32Z by nejucomo

  • Owner changed from nobody to nejucomo

I am now reviewing this ticket.

comment:9 Changed at 2012-03-30T20:48:28Z by zooko

  • Owner changed from nejucomo to zancas

comment:10 Changed at 2012-04-01T04:29:38Z by davidsarah

  • Milestone changed from soon to 1.10.0
  • Priority changed from minor to normal
  • Version changed from n/a to 1.9.1

comment:11 Changed at 2012-05-05T05:46:21Z by socrates1024

  • Owner changed from zancas to socrates1024
  • Status changed from new to assigned

comment:12 Changed at 2012-05-05T06:37:04Z by amiller

  • Owner changed from socrates1024 to amiller
  • Status changed from assigned to new

comment:13 Changed at 2012-05-05T07:12:12Z by amiller

  • Keywords review-needed removed

I have reviewed this patch. It adds a 'move' operation to the Directory web view.

  • Both directories and files can be moved (from a mutable directory to a mutable directory).
  • By default, the semantic is similar to 'mv -f' in that a the destination name will be overwritten if it exists, although a '?replace=false' option is provided.
  • Attempts to move an object to a nonexistent or not-writeable directory will return 410 Gone.
  • Destination directories can be indicated by URI or by pathname
  • Slashes in the destination name aren't permitted, though they're accepted for source

The move operation (dirnode.py) is a symlink followed a copy followed (on success) by an unlink, so the only possible race condition would result in two instances of the file. This behavior seems safe and isn't at all specific to the web interface anyway.

Straightforward tests are provided for all of the failure cases (except the interrupted-move described above, which is OK).

Minor note: a meme was applied incorrectly for the name of a nonexistent directory - 'notchucktesta' should be 'nopechecktesta'

comment:14 Changed at 2012-05-09T23:33:22Z by Brian Warner <warner@…>

  • Resolution set to fixed
  • Status changed from new to closed

In b29d0920d380c066:

Adding 'move' button to web UI, closes #1579

This adds "move file" capability to the web UI's directory display. The
support and test framework is heavily based on the similar "rename file"
feature. Unit tests and documentation are included. Multiple in-progress
versions of this patch may be found in ticket 1579. This version
includes arbitrary URI target support and is compatible with the change
from tahoe_css to tahoe.css.

comment:15 Changed at 2012-05-09T23:36:19Z by warner

I just landed this in 841757, along with a few improvements. The only user-visible one was to merge the "move" page with the existing "rename" page, putting both forms next to each other, and changing the wording/layout to make it more clear what's getting moved where.

comment:16 Changed at 2012-05-09T23:57:21Z by warner

We might want to change the API before releasing this feature.. I've opened #1732 about it.

comment:17 Changed at 2012-05-10T00:35:31Z by davidsarah

  • Keywords move webapi added
Note: See TracTickets for help on using tickets.