Skip to content

Commit

Permalink
Added action handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
HeDo88TH committed Oct 29, 2021
1 parent 00f82f4 commit b29f125
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions webapp/js/components/ViewDataset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
@selectionChanged="handleFileSelectionChanged"
@currentUriChanged="handleCurrentUriChanged"
@openProperties="handleFileBrowserOpenProperties"
@deleteSelecteditems="openDeleteItemsDialogFromFileBrowser"
@moveSelectedItems="openRenameItemsDialogFromFileBrowser"
@error="handleError" />
</div>

Expand All @@ -23,6 +25,8 @@
@selectionChanged="handleFileSelectionChanged"
@currentUriChanged="handleCurrentUriChanged"
@openProperties="handleFileBrowserOpenProperties"
@deleteSelecteditems="openDeleteItemsDialogFromFileBrowser"
@moveSelectedItems="openRenameItemsDialogFromFileBrowser"
@error="handleError" />
</template>
<template v-slot:map>
Expand All @@ -37,8 +41,9 @@
:tools="explorerTools"
:currentPath="currentPath"
@openItem="handleOpenItem"
@openProperties="handleExplorerOpenProperties"
@moveItem="handleMoveItem" />
@deleteSelecteditems="openDeleteItemsDialog"
@moveSelectedItems="openRenameItemsDialog"
@openProperties="handleExplorerOpenProperties" />
</template>
</TabSwitcher>

Expand Down Expand Up @@ -304,6 +309,32 @@ export default {
this.deleteDialogOpen = false;
},
openDeleteItemsDialog: function() {
this.deleteDialogOpen = true;
},
openDeleteItemsDialogFromFileBrowser: function() {
this.deleteDialogOpen = true;
this.selectedUsingFileBrowserList = true;
},
openRenameItemsDialog: function() {
if (this.selectedFiles.length != 1) return;
this.selectedUsingFileBrowserList = false;
this.renamePath = this.selectedFiles[0].entry.path;
this.renameDialogOpen = true;
},
openRenameItemsDialogFromFileBrowser: function() {
this.renameDialogOpen = true;
this.renamePath = this.fileBrowserFiles[0].entry.path;
this.selectedUsingFileBrowserList = true;
},
deleteSelectedFiles: async function() {
this.$log.info("ViewDataset.deleteSelectedFiles");
Expand Down Expand Up @@ -332,7 +363,6 @@ export default {
renameFile: async function(file, newPath) {
try {
var oldPath = file.entry.path;
await this.dataset.moveObj(oldPath, newPath);
Expand Down Expand Up @@ -365,11 +395,23 @@ export default {
this.$log.info("ViewDataset.renameSelectedFile(newPath)", newPath);
this.isBusy = true;
var source;
if (this.selectedFiles.length == 0) return;
if (this.selectedUsingFileBrowserList) {
if (this.fileBrowserFiles.length == 0) return;
source = this.fileBrowserFiles[0];
} else {
if (this.selectedFiles.length == 0) return;
source = this.selectedFiles[0];
}
this.isBusy = true;
await this.renameFile(this.selectedFiles[0], newPath);
await this.renameFile(source, newPath);
this.isBusy = false;
},
Expand Down

0 comments on commit b29f125

Please sign in to comment.