Add initial support for tracking current FM directory for creating a folder (and other stuff eventually)

This commit is contained in:
Dane Everitt 2019-02-16 17:54:15 -08:00
parent 767e466fd8
commit be7f7d8da8
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 80 additions and 6 deletions

View file

@ -42,12 +42,13 @@
<div class="flex mt-6" v-if="!loading && !errorMessage">
<div class="flex-1"></div>
<div class="mr-4">
<a href="#" class="block btn btn-secondary btn-sm">New Folder</a>
<a href="#" class="block btn btn-secondary btn-sm" v-on:click.prevent="openNewFolderModal">New Folder</a>
</div>
<div>
<a href="#" class="block btn btn-primary btn-sm">New File</a>
</div>
</div>
<CreateFolderModal/>
</div>
</template>
@ -58,6 +59,7 @@
import getDirectoryContents from "@/api/server/getDirectoryContents";
import FileRow from "@/components/server/components/filemanager/FileRow.vue";
import FolderRow from "@/components/server/components/filemanager/FolderRow.vue";
import CreateFolderModal from '../components/filemanager/modals/CreateFolderModal.vue';
type DataStructure = {
loading: boolean,
@ -70,7 +72,7 @@
export default Vue.extend({
name: 'FileManager',
components: {FileRow, FolderRow},
components: {CreateFolderModal, FileRow, FolderRow},
computed: {
...mapState('server', ['server', 'credentials']),
...mapState('socket', ['connected']),
@ -110,6 +112,8 @@
* Watch the current directory setting and when it changes update the file listing.
*/
currentDirectory: function () {
this.$store.dispatch('server/updateCurrentDirectory', this.currentDirectory);
this.listDirectory();
},
@ -167,6 +171,10 @@
this.loading = false;
});
},
openNewFolderModal: function () {
window.events.$emit('server:files:open-directory-modal');
}
},
});
</script>