Organisation and reworking stuff
parent
191b31e977
commit
8d891f0d51
|
@ -1,9 +0,0 @@
|
|||
<template>
|
||||
<div>Files</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'files'
|
||||
}
|
||||
</script>
|
|
@ -69,8 +69,8 @@
|
|||
<script>
|
||||
import {mapState} from 'vuex'
|
||||
import Item from './ListingItem'
|
||||
import webdav from '../utils/webdav'
|
||||
import page from '../utils/page'
|
||||
import webdav from '@/utils/webdav'
|
||||
import page from '@/utils/page'
|
||||
|
||||
export default {
|
||||
name: 'listing',
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
import { mapMutations, mapGetters, mapState } from 'vuex'
|
||||
import filesize from 'filesize'
|
||||
import moment from 'moment'
|
||||
import webdav from '../utils/webdav.js'
|
||||
import page from '../utils/page.js'
|
||||
import webdav from '@/utils/webdav.js'
|
||||
import page from '@/utils/page.js'
|
||||
|
||||
export default {
|
||||
name: 'item',
|
||||
|
@ -107,7 +107,7 @@ export default {
|
|||
return false
|
||||
},
|
||||
open: function (event) {
|
||||
page.open(this.url)
|
||||
this.$router.push({path: this.url})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,20 +77,20 @@ import Help from './Help'
|
|||
import Preview from './Preview'
|
||||
import Listing from './Listing'
|
||||
import Editor from './Editor'
|
||||
import InfoButton from './InfoButton'
|
||||
import InfoPrompt from './InfoPrompt'
|
||||
import DeleteButton from './DeleteButton'
|
||||
import DeletePrompt from './DeletePrompt'
|
||||
import RenameButton from './RenameButton'
|
||||
import RenamePrompt from './RenamePrompt'
|
||||
import UploadButton from './UploadButton'
|
||||
import DownloadButton from './DownloadButton'
|
||||
import DownloadPrompt from './DownloadPrompt'
|
||||
import SwitchButton from './SwitchViewButton'
|
||||
import MoveButton from './MoveButton'
|
||||
import MovePrompt from './MovePrompt'
|
||||
import NewFilePrompt from './NewFilePrompt'
|
||||
import NewDirPrompt from './NewDirPrompt'
|
||||
import InfoButton from './buttons/InfoButton'
|
||||
import InfoPrompt from './prompts/InfoPrompt'
|
||||
import DeleteButton from './buttons/DeleteButton'
|
||||
import DeletePrompt from './prompts/DeletePrompt'
|
||||
import RenameButton from './buttons/RenameButton'
|
||||
import RenamePrompt from './prompts/RenamePrompt'
|
||||
import UploadButton from './buttons/UploadButton'
|
||||
import DownloadButton from './buttons/DownloadButton'
|
||||
import DownloadPrompt from './prompts/DownloadPrompt'
|
||||
import SwitchButton from './buttons/SwitchViewButton'
|
||||
import MoveButton from './buttons/MoveButton'
|
||||
import MovePrompt from './prompts/MovePrompt'
|
||||
import NewFilePrompt from './prompts/NewFilePrompt'
|
||||
import NewDirPrompt from './prompts/NewDirPrompt'
|
||||
import css from '@/utils/css'
|
||||
import auth from '@/utils/auth'
|
||||
import api from '@/utils/api'
|
||||
|
@ -162,7 +162,18 @@ export default {
|
|||
})
|
||||
},
|
||||
beforeRouteUpdate (to, from, next) {
|
||||
console.log('hey')
|
||||
this.$store.commit('resetSelected')
|
||||
this.$store.commit('multiple', false)
|
||||
|
||||
api.fetch(to.params[0])
|
||||
.then(() => {
|
||||
next()
|
||||
})
|
||||
.catch(error => {
|
||||
// TODO: 404, 403 and 500!
|
||||
console.log(error)
|
||||
window.alert('Something went wrong. Please reload.')
|
||||
})
|
||||
},
|
||||
mounted () {
|
||||
updateColumnSizes()
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import page from '../utils/page'
|
||||
import InfoButton from './InfoButton'
|
||||
import DeleteButton from './DeleteButton'
|
||||
import RenameButton from './RenameButton'
|
||||
import DownloadButton from './DownloadButton'
|
||||
import InfoButton from './buttons/InfoButton'
|
||||
import DeleteButton from './buttons/DeleteButton'
|
||||
import RenameButton from './buttons/RenameButton'
|
||||
import DownloadButton from './buttons/DownloadButton'
|
||||
|
||||
export default {
|
||||
name: 'preview',
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
<script>
|
||||
import {mapGetters, mapMutations, mapState} from 'vuex'
|
||||
import webdav from '../utils/webdav'
|
||||
import page from '../utils/page'
|
||||
import webdav from '@/utils/webdav'
|
||||
import page from '@/utils/page'
|
||||
|
||||
export default {
|
||||
name: 'delete-prompt',
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import page from '../utils/page'
|
||||
import webdav from '../utils/webdav'
|
||||
import page from '@/utils/page'
|
||||
import webdav from '@/utils/webdav'
|
||||
|
||||
export default {
|
||||
name: 'move-prompt',
|
|
@ -11,8 +11,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import page from '../utils/page'
|
||||
import webdav from '../utils/webdav'
|
||||
import page from '@/utils/page'
|
||||
import webdav from '@/utils/webdav'
|
||||
|
||||
export default {
|
||||
name: 'new-dir-prompt',
|
|
@ -11,8 +11,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import page from '../utils/page'
|
||||
import webdav from '../utils/webdav'
|
||||
import page from '@/utils/page'
|
||||
import webdav from '@/utils/webdav'
|
||||
|
||||
export default {
|
||||
name: 'new-file-prompt',
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import page from '../utils/page'
|
||||
import webdav from '../utils/webdav'
|
||||
import page from '@/utils/page'
|
||||
import webdav from '@/utils/webdav'
|
||||
|
||||
export default {
|
||||
name: 'rename-prompt',
|
|
@ -1,7 +1,6 @@
|
|||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import Login from '@/components/Login'
|
||||
import Files from '@/components/Files'
|
||||
import Main from '@/components/Main'
|
||||
import auth from '@/utils/auth.js'
|
||||
|
||||
|
@ -35,8 +34,7 @@ const router = new Router({
|
|||
children: [
|
||||
{
|
||||
path: '/files*',
|
||||
name: 'Files',
|
||||
component: Files
|
||||
name: 'Files'
|
||||
},
|
||||
{
|
||||
path: '/*',
|
||||
|
|
|
@ -10,7 +10,6 @@ function fetch (url) {
|
|||
if (request.status === 200) {
|
||||
let req = JSON.parse(request.responseText)
|
||||
store.commit('updateRequest', req)
|
||||
console.log(req)
|
||||
document.title = req.name
|
||||
resolve()
|
||||
} else {
|
||||
|
|
|
@ -1,36 +1,3 @@
|
|||
import store from '../store/store'
|
||||
|
||||
function open (url, history) {
|
||||
// Reset info
|
||||
store.commit('resetSelected')
|
||||
store.commit('multiple', false)
|
||||
|
||||
let request = new window.XMLHttpRequest()
|
||||
request.open('GET', url, true)
|
||||
request.setRequestHeader('Accept', 'application/json')
|
||||
|
||||
request.onload = () => {
|
||||
if (request.status === 200) {
|
||||
let req = JSON.parse(request.responseText)
|
||||
store.commit('updateRequest', req)
|
||||
|
||||
if (history) {
|
||||
window.history.pushState({
|
||||
name: req.data.name,
|
||||
url: url
|
||||
}, req.data.name, url)
|
||||
|
||||
document.title = req.data.name
|
||||
}
|
||||
} else {
|
||||
console.log(request.responseText)
|
||||
}
|
||||
}
|
||||
|
||||
request.onerror = (error) => { console.log(error) }
|
||||
request.send()
|
||||
}
|
||||
|
||||
function removeLastDir (url) {
|
||||
var arr = url.split('/')
|
||||
if (arr.pop() === '') {
|
||||
|
@ -41,11 +8,5 @@ function removeLastDir (url) {
|
|||
}
|
||||
|
||||
export default {
|
||||
reload: () => {
|
||||
open(window.location.pathname, false)
|
||||
},
|
||||
open: (url) => {
|
||||
open(url, true)
|
||||
},
|
||||
removeLastDir: removeLastDir
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue