Skip to content

Commit

Permalink
NXRIVE-2666: [Direct Transfer] Rethink the "new remote folder" capabi…
Browse files Browse the repository at this point in the history
…lity (#3132)
  • Loading branch information
rom1win authored Oct 15, 2021
1 parent 548719d commit 43627f6
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 92 deletions.
17 changes: 17 additions & 0 deletions docs/changes/5.2.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Release date: `2021-xx-xx`
### Direct Transfer

- [NXDRIVE-2157](https://jira.nuxeo.com/browse/NXDRIVE-2157): Fix bulk add files from the context menu
- [NXDRIVE-2666](https://jira.nuxeo.com/browse/NXDRIVE-2666): Rethink the new remote folder capability

## GUI

Expand All @@ -36,5 +37,21 @@ Release date: `2021-xx-xx`

## Technical Changes

- Added `force_refresh` keyword argument to `ContentLoaderMixin.__init__()`
- Added `ContentLoaderMixin.handle_already_cached()`
- Added `Engine.directTransferNewFolderError`
- Added `Engine.directTransferNewFolderSuccess`
- Added `FolderContentLoader.fill_tree()`
- Added `FolderContentLoader.handle_already_cached()`
- Added `FolderTreeView.expand_current_selected()`
- Added `FolderTreeView.filled`
- Added `FolderTreeView.get_item_from_position()`
- Added `FolderTreeView.is_item_enabled()`
- Added `FolderTreeView.refresh_selected()`
- Added `FolderTreeView.select_item_from_path()`
- Added `FolderTreeView.update`
- Added `FoldersDialog.newCtxTransfer`
- Added `FoldersDialog.open_menu`
- Added `Options.xxx_broken_update`
- Added `force_refresh` keyword argument to `TreeViewMixin.load_children()`
- Added folders_dialog.py::`NewFolderDialog`
8 changes: 8 additions & 0 deletions nxdrive/data/i18n/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"CHANNEL": "Channel",
"CHANNEL_CHANGE_SETTINGS": "Channel update",
"CHANNEL_CONFIRM_DANGEROUS": "Confirm development channel?",
"CLOSE": "Close",
"COMPLETED": "Completed",
"COMPLETED_ON": "Completed on %1",
"CONFIRM_DISCONNECT": "Confirm deletion?",
Expand All @@ -52,6 +53,7 @@
"CONTEXT_MENU_4": "Upload content",
"CONTINUE": "Continue",
"CONTINUE_USING": "Continue using Drive %1",
"CREATE": "Create",
"CREATE_REPORT": "Generate bug report",
"DATETIME_FORMAT": "%x %X",
"DEBUG": "Debug",
Expand Down Expand Up @@ -173,7 +175,9 @@
"FOLDER_DOES_NOT_EXISTS": "This folder does not exist",
"FOLDER_DUPLICATES_DETECTED": "Duplicate folder detected",
"FOLDER_DUPLICATES_MSG": "The following folder(s) already exist under <a href=\"%1\">%2</a>:<ul>%3</ul>Please rename them or process to several transfers within those folders.",
"FOLDER_NAME": "Folder name",
"FOLDER_PERMISSION_ERROR": "No enough rights to use the local folder",
"FOLDER_TYPE": "Folder type",
"FOLDER_USED": "Folder already used by another account",
"FREE_DISK_SPACE": "(Free disk space: %1)",
"GENERATING": "Generating…",
Expand Down Expand Up @@ -253,6 +257,9 @@
"NETWORK_ERROR_UnknownProxyError": "Unknown error",
"NEW_ENGINE": "Add account",
"NEW_REMOTE_FOLDER": "New remote folder",
"NEW_REMOTE_FOLDER_DUPLICATE": "A folder with the same name already exists here. Please use another one.",
"NEW_REMOTE_FOLDER_FAILURE": "Drive was not able to create a folder. Try again later or contact your administrator.",
"NEW_REMOTE_FOLDER_SUCCESS": "The folder has been created.",
"NEW_REMOTE_FOLDER_TOOLTIP": "Create a new target remote folder in the selected path where all files from the session will be uploaded to.",
"NEW_TRANSFER": "New transfer",
"NO": "No",
Expand Down Expand Up @@ -338,6 +345,7 @@
"SHOW_FILE_STATUS": "Show file status",
"SOURCE_FILES": "Source file(s):",
"SOURCE_LINK": "See the source",
"SUCCESS": "Success",
"SSL_CERTIFICATE": "Certificate",
"SSL_HOSTNAME_ERROR": "The host name did not match any of the valid hosts for this certificate.",
"SSL_UNTRUSTED_CERT_TITLE": "Untrusted Certificate",
Expand Down
10 changes: 7 additions & 3 deletions nxdrive/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dataclasses import dataclass
from functools import partial
from logging import getLogger
from pathlib import Path, PurePath
from pathlib import Path
from threading import Thread
from time import sleep
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Type
Expand Down Expand Up @@ -113,6 +113,8 @@ class Engine(QObject):

# Direct Transfer
directTranferError = pyqtSignal(Path)
directTransferNewFolderError = pyqtSignal()
directTransferNewFolderSuccess = pyqtSignal(str)
directTransferSessionFinished = pyqtSignal(str, str, str)

type = "NXDRIVE"
Expand Down Expand Up @@ -475,17 +477,19 @@ def _create_remote_folder(
self, remote_parent_path: str, new_folder: str, session_id: int, /
) -> Dict[str, Any]:
try:
return self.remote.upload_folder(
res = self.remote.upload_folder(
remote_parent_path,
{"title": new_folder},
headers={DT_NEW_FOLDER: 1, DT_SESSION_NUMBER: session_id},
)
self.directTransferNewFolderSuccess.emit(res["path"])
return res
except Exception:
log.warning(
f"Could not create the {new_folder!r} folder in the {remote_parent_path!r} remote folder",
exc_info=True,
)
self.directTranferError.emit(PurePath(remote_parent_path, new_folder))
self.directTransferNewFolderError.emit()
return {}

def _direct_transfer(
Expand Down
Loading

0 comments on commit 43627f6

Please sign in to comment.