From 46f77a7c9e91f9f849b98e20b106af3d22be0f4c Mon Sep 17 00:00:00 2001 From: Terry Date: Thu, 22 Apr 2021 16:04:10 +0200 Subject: [PATCH] webpack added file_versions.js --- apps/files_versions/src/views/VersionTab.vue | 56 +++++++++++--------- apps/files_versions/webpack.js | 4 +- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/apps/files_versions/src/views/VersionTab.vue b/apps/files_versions/src/views/VersionTab.vue index fe902bebbd..73c0065c2f 100644 --- a/apps/files_versions/src/views/VersionTab.vue +++ b/apps/files_versions/src/views/VersionTab.vue @@ -31,13 +31,19 @@ @@ -47,17 +53,18 @@ import Avatar from '@nextcloud/vue/dist/Components/Avatar' import axios from '@nextcloud/axios' -import { generateRemoteUrl} from "@nextcloud/router"; +import { generateRemoteUrl } from '@nextcloud/router' import { ListItemIcon } from '@nextcloud/vue' +import { getCurrentUser } from '@nextcloud/auth' +import { sendHeartbeat } from '../../../user_status/src/services/heartbeatService' export default { name: 'VersionTab', components: { - Avatar, ListItemIcon, - VersionEntry + VersionEntry, }, data() { @@ -76,35 +83,34 @@ export default { // version object versionsList: [], - } + } }, - methods: { - setFileInfo (fileInfo) { + setFileInfo(fileInfo) { this._fileInfo = fileInfo }, - getFileInfo () { + getFileInfo() { return this._fileInfo }, - setCurrentUser (user) { + setCurrentUser(user) { this._currentUser = user }, - getCurrentUser () { - return this._currentUser || OC.getCurrentUser().uid + getCurrentUser() { + return this._currentUser || getCurrentUser().uid }, - setClient (client) { + setClient(client) { this._client = client }, /** * Update current fileInfo and fetch new data * @param {Object} fileInfo the current file FileInfo */ - async update (fileInfo) { + async update(fileInfo) { fileInfo = this.fileInfo name = this._fileInfo.get('name') }, @@ -116,19 +122,19 @@ export default { /** * Get the existing shares infos */ - async getVersions () { + async getVersions() { try { this.loading = true - // init params const shareUrl = generateRemoteUrl('dav') + this.getCurrentUser() + '/versions/' + this._fileInfo.get('id') const format = 'json' - console.log('Shareurl:', shareUrl); + console.log('Shareurl:', shareUrl) // TODO: replace with proper getFUllpath implementation of our own FileInfo model const path = (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/') - console.log(path); + console.log(path) // fetch version + const fetchVersion = await axios.get(shareUrl, { params: { format, @@ -139,7 +145,7 @@ export default { this.loading = false // process results this.versionList = fetchVersion.data - console.log(versionList); + console.log(versionList) this.version.fullPath = fullPath this.version.fileId = fileId this.version.name = name @@ -155,9 +161,9 @@ export default { console.error('Error loading the version list', error) } }, - mounted(){ - this.getVersions(); - } - } + mounted() { + this.getVersions() + }, + }, } diff --git a/apps/files_versions/webpack.js b/apps/files_versions/webpack.js index bc735a0362..f33a9bb861 100644 --- a/apps/files_versions/webpack.js +++ b/apps/files_versions/webpack.js @@ -26,8 +26,8 @@ const path = require('path') module.exports = { entry: { - // files_versions : path.join(__dirname, 'src', 'files_versions.js'), - files_versions_tab : path.join(__dirname, 'src', 'files_versions_tab.js'), + files_versions: path.join(__dirname, 'src', 'files_versions.js'), + files_versions_tab: path.join(__dirname, 'src', 'files_versions_tab.js'), }, output: { path: path.resolve(__dirname, './js'),