mirror of
https://github.com/zoriya/flood.git
synced 2025-12-19 21:55:15 +00:00
Add move torrents option to context menu
This commit is contained in:
@@ -54,11 +54,23 @@ class TorrentStoreClass extends BaseStore {
|
||||
return this.selectedTorrents;
|
||||
}
|
||||
|
||||
handleAddTorrentError(error) {
|
||||
getSelectedTorrentsDownloadLocations() {
|
||||
return this.selectedTorrents.map((hash) => {
|
||||
return this.torrents[hash].basePath;
|
||||
});
|
||||
}
|
||||
|
||||
getSelectedTorrentsFilename() {
|
||||
return this.selectedTorrents.map((hash) => {
|
||||
return this.torrents[hash].filename;
|
||||
});
|
||||
}
|
||||
|
||||
handleAddTorrentError() {
|
||||
this.emit(EventTypes.CLIENT_ADD_TORRENT_ERROR);
|
||||
}
|
||||
|
||||
handleAddTorrentSuccess(data) {
|
||||
handleAddTorrentSuccess() {
|
||||
this.emit(EventTypes.CLIENT_ADD_TORRENT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -88,6 +100,14 @@ class TorrentStoreClass extends BaseStore {
|
||||
return this.sortedTorrents;
|
||||
}
|
||||
|
||||
handleMoveTorrentsSuccess(data) {
|
||||
this.emit(EventTypes.CLIENT_MOVE_TORRENTS_SUCCESS);
|
||||
}
|
||||
|
||||
handleMoveTorrentsError(error) {
|
||||
this.emit(EventTypes.CLIENT_MOVE_TORRENTS_REQUEST_ERROR);
|
||||
}
|
||||
|
||||
setTorrents(torrents) {
|
||||
let torrentsSort = TorrentFilterStore.getTorrentsSort();
|
||||
|
||||
@@ -155,9 +175,9 @@ class TorrentStoreClass extends BaseStore {
|
||||
}
|
||||
}
|
||||
|
||||
const TorrentStore = new TorrentStoreClass();
|
||||
let TorrentStore = new TorrentStoreClass();
|
||||
|
||||
AppDispatcher.register((payload) => {
|
||||
TorrentStore.dispatcherID = AppDispatcher.register((payload) => {
|
||||
const {action, source} = payload;
|
||||
|
||||
switch (action.type) {
|
||||
@@ -173,6 +193,12 @@ AppDispatcher.register((payload) => {
|
||||
case ActionTypes.CLIENT_FETCH_TORRENTS_SUCCESS:
|
||||
TorrentStore.setTorrents(action.data.torrents);
|
||||
break;
|
||||
case ActionTypes.CLIENT_MOVE_TORRENTS_SUCCESS:
|
||||
TorrentStore.handleMoveTorrentsSuccess(action.data);
|
||||
break;
|
||||
case ActionTypes.CLIENT_MOVE_TORRENTS_ERROR:
|
||||
TorrentStore.handleMoveTorrentsError(action.error);
|
||||
break;
|
||||
case ActionTypes.CLIENT_FETCH_TORRENTS_ERROR:
|
||||
console.log(action);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user