mirror of
https://github.com/filegator/filegator.git
synced 2025-08-06 21:16:28 +02:00
js fixes & lint
This commit is contained in:
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
frontend/main.js
|
||||||
|
frontend/registerServiceWorker.js
|
@@ -69,7 +69,6 @@ const data = {
|
|||||||
'Admin': 'Admin',
|
'Admin': 'Admin',
|
||||||
'Save': 'Save',
|
'Save': 'Save',
|
||||||
'Read': 'Read',
|
'Read': 'Read',
|
||||||
'Name': 'Name',
|
|
||||||
'Write': 'Write',
|
'Write': 'Write',
|
||||||
'Upload': 'Upload',
|
'Upload': 'Upload',
|
||||||
'Permissions': 'Permissions',
|
'Permissions': 'Permissions',
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
@@ -43,7 +45,7 @@ new Vue({
|
|||||||
this.$store.commit('setUser', user)
|
this.$store.commit('setUser', user)
|
||||||
this.$router.push('/')
|
this.$router.push('/')
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(() => {
|
||||||
this.$notification.open({
|
this.$notification.open({
|
||||||
message: this.lang('Something went wrong'),
|
message: this.lang('Something went wrong'),
|
||||||
type: 'is-danger',
|
type: 'is-danger',
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import store from '../store.js'
|
import store from '../store.js'
|
||||||
import router from '../router.js'
|
|
||||||
import api from '../api/api'
|
import api from '../api/api'
|
||||||
|
|
||||||
import english from '../translations/english'
|
import english from '../translations/english'
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import axios from 'axios'
|
|
||||||
import shared from './mixins/shared'
|
import shared from './mixins/shared'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
@@ -37,13 +36,13 @@ export default new Vuex.Store({
|
|||||||
this.commit('resetTree')
|
this.commit('resetTree')
|
||||||
this.commit('destroyUser')
|
this.commit('destroyUser')
|
||||||
},
|
},
|
||||||
resetCwd(state, data) {
|
resetCwd(state) {
|
||||||
state.cwd = {
|
state.cwd = {
|
||||||
location: '/',
|
location: '/',
|
||||||
content: [],
|
content: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resetTree(state, data) {
|
resetTree(state) {
|
||||||
state.tree = {
|
state.tree = {
|
||||||
path: '/',
|
path: '/',
|
||||||
name: shared.methods.lang('Home'),
|
name: shared.methods.lang('Home'),
|
||||||
@@ -86,12 +85,12 @@ export default new Vuex.Store({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (typeof object[property] === 'object') {
|
if (typeof object[property] === 'object') {
|
||||||
traverse(object[property]);
|
traverse(object[property])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
traverse(state.tree);
|
traverse(state.tree)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@@ -51,7 +51,6 @@ const data = {
|
|||||||
'Admin': 'Admin',
|
'Admin': 'Admin',
|
||||||
'Save': 'Save',
|
'Save': 'Save',
|
||||||
'Read': 'Read',
|
'Read': 'Read',
|
||||||
'Name': 'Name',
|
|
||||||
'Write': 'Write',
|
'Write': 'Write',
|
||||||
'Upload': 'Upload',
|
'Upload': 'Upload',
|
||||||
'Permissions': 'Permissions',
|
'Permissions': 'Permissions',
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<div v-if="can('read')" class="is-flex is-justify-between">
|
<div v-if="can('read')" class="is-flex is-justify-between">
|
||||||
<div class="breadcrumb" aria-label="breadcrumbs">
|
<div class="breadcrumb" aria-label="breadcrumbs">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="(item, key) in breadcrumbs" v-if="item.name">
|
<li v-for="(item, index) in breadcrumbs" :key="index">
|
||||||
<a @click="goTo(item.path)">{{ item.name }}</a>
|
<a @click="goTo(item.path)">{{ item.name }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -40,7 +40,6 @@
|
|||||||
<a v-if="! checked.length" class="is-inline-block">
|
<a v-if="! checked.length" class="is-inline-block">
|
||||||
<b-icon icon="upload" size="is-small"></b-icon> {{ lang('Add files') }}
|
<b-icon icon="upload" size="is-small"></b-icon> {{ lang('Add files') }}
|
||||||
</a>
|
</a>
|
||||||
</a>
|
|
||||||
</b-upload>
|
</b-upload>
|
||||||
</b-field>
|
</b-field>
|
||||||
<a v-if="can(['read', 'write']) && ! checked.length" class="is-inline-block">
|
<a v-if="can(['read', 'write']) && ! checked.length" class="is-inline-block">
|
||||||
@@ -218,7 +217,7 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return breadcrumbs
|
return _.filter(breadcrumbs, o => o.name)
|
||||||
},
|
},
|
||||||
content() {
|
content() {
|
||||||
return this.$store.state.cwd.content
|
return this.$store.state.cwd.content
|
||||||
@@ -246,7 +245,7 @@ export default {
|
|||||||
this.$router.push({ name: 'browser', query: { 'cd': path }})
|
this.$router.push({ name: 'browser', query: { 'cd': path }})
|
||||||
},
|
},
|
||||||
getSelected() {
|
getSelected() {
|
||||||
return _.reduce(this.checked, function(result, value, key) {
|
return _.reduce(this.checked, function(result, value) {
|
||||||
result.push(value)
|
result.push(value)
|
||||||
return result
|
return result
|
||||||
}, [])
|
}, [])
|
||||||
|
@@ -59,6 +59,7 @@ import UserEdit from './partials/UserEdit'
|
|||||||
import Menu from './partials/Menu'
|
import Menu from './partials/Menu'
|
||||||
import Pagination from './partials/Pagination'
|
import Pagination from './partials/Pagination'
|
||||||
import api from '../api/api'
|
import api from '../api/api'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Users',
|
name: 'Users',
|
||||||
@@ -90,7 +91,7 @@ export default {
|
|||||||
api.deleteUser({
|
api.deleteUser({
|
||||||
username: user.username
|
username: user.username
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(() => {
|
||||||
this.users = _.reject(this.users, u => u.username == user.username)
|
this.users = _.reject(this.users, u => u.username == user.username)
|
||||||
this.$toast.open({
|
this.$toast.open({
|
||||||
message: this.lang('Deleted'),
|
message: this.lang('Deleted'),
|
||||||
|
@@ -41,7 +41,6 @@ import api from '../../api/api'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Menu',
|
name: 'Menu',
|
||||||
components: { Profile },
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
navbarActive: false,
|
navbarActive: false,
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import api from '../../api/api'
|
import api from '../../api/api'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Profile',
|
name: 'Profile',
|
||||||
@@ -39,7 +40,7 @@ export default {
|
|||||||
oldpassword: this.oldpassword,
|
oldpassword: this.oldpassword,
|
||||||
newpassword: this.newpassword,
|
newpassword: this.newpassword,
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(() => {
|
||||||
this.$toast.open({
|
this.$toast.open({
|
||||||
message: this.lang('Updated'),
|
message: this.lang('Updated'),
|
||||||
type: 'is-success',
|
type: 'is-success',
|
||||||
|
@@ -6,13 +6,14 @@
|
|||||||
<a @click="$emit('selected', node)">{{ node.name }}</a>
|
<a @click="$emit('selected', node)">{{ node.name }}</a>
|
||||||
|
|
||||||
<ul v-if="node.children && node.children.length">
|
<ul v-if="node.children && node.children.length">
|
||||||
<TreeNode v-for="child in node.children" :node="child" @selected="$emit('selected', $event)"></TreeNode>
|
<TreeNode v-for="(child, index) in node.children" :node="child" :key="index" @selected="$emit('selected', $event)"></TreeNode>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import api from '../../api/api'
|
import api from '../../api/api'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TreeNode",
|
name: "TreeNode",
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="progressVisible" class="progress-items">
|
<div v-if="progressVisible" class="progress-items">
|
||||||
<div v-for="file in resumable.files.slice().reverse()">
|
<div v-for="(file, index) in resumable.files.slice().reverse()" :key="index">
|
||||||
<div>
|
<div>
|
||||||
<div>{{ file.relativePath != '/' ? file.relativePath : '' }}/{{ file.fileName }}</div>
|
<div>{{ file.relativePath != '/' ? file.relativePath : '' }}/{{ file.fileName }}</div>
|
||||||
<div class="is-flex is-justify-between">
|
<div class="is-flex is-justify-between">
|
||||||
@@ -55,6 +55,7 @@ import Resumable from 'resumablejs'
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import api from '../../api/api'
|
import api from '../../api/api'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Upload',
|
name: 'Upload',
|
||||||
@@ -88,7 +89,7 @@ export default {
|
|||||||
simultaneousUploads: this.$store.state.config.upload_simultaneous,
|
simultaneousUploads: this.$store.state.config.upload_simultaneous,
|
||||||
chunkSize: this.$store.state.config.upload_chunk_size,
|
chunkSize: this.$store.state.config.upload_chunk_size,
|
||||||
maxFileSize: this.$store.state.config.upload_max_size,
|
maxFileSize: this.$store.state.config.upload_max_size,
|
||||||
maxFileSizeErrorCallback: (file, errorCount) => {
|
maxFileSizeErrorCallback: (file) => {
|
||||||
this.$notification.open({
|
this.$notification.open({
|
||||||
message: this.lang('File size error', file.name, this.formatBytes(this.$store.state.config.upload_max_size)),
|
message: this.lang('File size error', file.name, this.formatBytes(this.$store.state.config.upload_max_size)),
|
||||||
type: 'is-danger',
|
type: 'is-danger',
|
||||||
@@ -106,7 +107,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resumable.on('fileAdded', (file) => {
|
this.resumable.on('fileAdded', () => {
|
||||||
if (! this.paused) {
|
if (! this.paused) {
|
||||||
this.resumable.upload()
|
this.resumable.upload()
|
||||||
}
|
}
|
||||||
|
@@ -68,10 +68,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import Tree from './Tree'
|
import Tree from './Tree'
|
||||||
import api from '../../api/api'
|
import api from '../../api/api'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UserEdit',
|
name: 'UserEdit',
|
||||||
components: { Tree },
|
|
||||||
props: [ 'user', 'action' ],
|
props: [ 'user', 'action' ],
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user