From 124ff68f06bcfee7494e4b8117d87dd206c6ecbe Mon Sep 17 00:00:00 2001 From: Pitu Date: Sun, 10 May 2020 21:22:48 +0900 Subject: Feat: implement lazy loading for waterfall view --- src/site/components/grid/Grid.vue | 441 ++++++++++++++++++++++--------------- src/site/pages/dashboard/index.vue | 55 +---- 2 files changed, 259 insertions(+), 237 deletions(-) (limited to 'src') diff --git a/src/site/components/grid/Grid.vue b/src/site/components/grid/Grid.vue index ca3d0f9..3b65011 100644 --- a/src/site/components/grid/Grid.vue +++ b/src/site/components/grid/Grid.vue @@ -1,110 +1,3 @@ - - - - @@ -55,10 +32,7 @@ export default { middleware: 'auth', data() { return { - files: [], - albums: [], - isAlbumsModalActive: false, - showingModalForFile: null + files: [] }; }, metaInfo() { @@ -66,39 +40,12 @@ export default { }, mounted() { this.getFiles(); - this.getAlbums(); }, methods: { - isAlbumSelected(id) { - if (!this.showingModalForFile) return; - const found = this.showingModalForFile.albums.find(el => el.id === id); - return found ? found.id ? true : false : false; - }, - openAlbumModal(file) { - this.showingModalForFile = file; - this.isAlbumsModalActive = true; - }, - async albumCheckboxClicked(value, id) { - const response = await this.$axios.$post(`file/album/${value ? 'add' : 'del'}`, { - albumId: id, - fileId: this.showingModalForFile.id - }); - this.$buefy.toast.open(response.message); - - // Not the prettiest solution to refetch on each click but it'll do for now - this.getFiles(); - }, async getFiles() { const response = await this.$axios.$get(`files`); this.files = response.files; - }, - async getAlbums() { - const response = await this.$axios.$get(`albums/dropdown`); - this.albums = response.albums; } } }; - -- cgit v1.2.3