vue linter

This commit is contained in:
Milos Stojanovic
2019-06-25 18:47:58 +02:00
parent 0af6d13315
commit bc4f8250bb
13 changed files with 243 additions and 225 deletions

View File

@@ -1,12 +1,13 @@
module.exports = { module.exports = {
extends: [ extends: [
// add more generic rulesets here, such as: // add more generic rulesets here, such as:
'eslint:recommended',
'plugin:vue/recommended' 'plugin:vue/recommended'
], ],
rules: { rules: {
// override/add rules settings here, such as: // override/add rules settings here, such as:
'vue/no-unused-vars': 'error', 'no-unused-vars': 'error',
'vue/require-prop-types': 0, 'vue/require-prop-types': 0,
'vue/require-default-prop': 0 'vue/max-attributes-per-line': 10
} }
} }

View File

@@ -9,9 +9,11 @@ before_script:
- cp configuration_sample.php configuration.php - cp configuration_sample.php configuration.php
- composer self-update - composer self-update
- composer install --no-interaction - composer install --no-interaction
- npm install
script: script:
- vendor/bin/phpunit --coverage-clover=coverage.xml - vendor/bin/phpunit --coverage-clover=coverage.xml
- npm run lint
after_success: after_success:
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)

View File

@@ -1,8 +1,8 @@
<template> <template>
<div id="wrapper" v-if="$store.state.initialized"> <div v-if="$store.state.initialized" id="wrapper">
<Login v-if="is('guest') && ! can('write') && ! can('read') && ! can('upload')"/> <Login v-if="is('guest') && ! can('write') && ! can('read') && ! can('upload')" />
<div id="inner" v-else> <div v-else id="inner">
<router-view/> <router-view />
</div> </div>
</div> </div>
</template> </template>

View File

@@ -2,22 +2,20 @@
<div id="dropzone" class="container" <div id="dropzone" class="container"
@dragover="dropZone = can('upload') && ! isLoading ? true : false" @dragover="dropZone = can('upload') && ! isLoading ? true : false"
@dragleave="dropZone = false" @dragleave="dropZone = false"
@drop="dropZone = false"> @drop="dropZone = false"
>
<div v-if="isLoading" id="loading" />
<div id="loading" v-if="isLoading"></div> <Upload v-if="can('upload')" v-show="dropZone == false" :files="files" :drop-zone="dropZone" />
<Upload v-if="can('upload')" v-show="dropZone == false" :files="files" :dropZone="dropZone"></Upload> <b-upload v-if="dropZone && ! isLoading" multiple drag-drop @input="files = $event">
<b-upload v-if="dropZone && ! isLoading" @input="files = $event" multiple drag-drop>
<b class="drop-info">{{ lang('Drop files to upload') }}</b> <b class="drop-info">{{ lang('Drop files to upload') }}</b>
</b-upload> </b-upload>
<div class="container" v-if="!dropZone"> <div v-if="!dropZone" class="container">
<Menu />
<Menu></Menu>
<div id="browser"> <div id="browser">
<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>
@@ -28,7 +26,7 @@
</div> </div>
<div> <div>
<a class="is-paddingless" @click="selectDir"> <a class="is-paddingless" @click="selectDir">
<b-icon icon="sitemap" class="is-marginless" size="is-small"></b-icon> <b-icon icon="sitemap" class="is-marginless" size="is-small" />
</a> </a>
</div> </div>
</div> </div>
@@ -36,45 +34,45 @@
<section class="actions is-flex is-justify-between"> <section class="actions is-flex is-justify-between">
<div> <div>
<b-field v-if="can('upload') && ! checked.length" class="file is-inline-block"> <b-field v-if="can('upload') && ! checked.length" class="file is-inline-block">
<b-upload @input="files = $event" multiple native> <b-upload multiple native @input="files = $event">
<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" /> {{ lang('Add files') }}
</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">
<b-dropdown aria-role="list" :disabled="checked.length > 0"> <b-dropdown aria-role="list" :disabled="checked.length > 0">
<span slot="trigger"> <span slot="trigger">
<b-icon icon="plus" size="is-small"></b-icon> {{ lang('New') }} <b-icon icon="plus" size="is-small" /> {{ lang('New') }}
</span> </span>
<b-dropdown-item @click="create('dir')" aria-role="listitem"> <b-dropdown-item aria-role="listitem" @click="create('dir')">
<b-icon icon="folder" size="is-small"></b-icon> {{ lang('Folder') }} <b-icon icon="folder" size="is-small" /> {{ lang('Folder') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item @click="create('file')" aria-role="listitem"> <b-dropdown-item aria-role="listitem" @click="create('file')">
<b-icon icon="file" size="is-small"></b-icon> {{ lang('File') }} <b-icon icon="file" size="is-small" /> {{ lang('File') }}
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
</a> </a>
<a v-if="can('batchdownload') && checked.length" @click="batchDownload" class="is-inline-block"> <a v-if="can('batchdownload') && checked.length" class="is-inline-block" @click="batchDownload">
<b-icon icon="download" size="is-small"></b-icon> {{ lang('Download') }} <b-icon icon="download" size="is-small" /> {{ lang('Download') }}
</a> </a>
<a v-if="can('write') && checked.length" @click="copy" class="is-inline-block"> <a v-if="can('write') && checked.length" class="is-inline-block" @click="copy">
<b-icon icon="copy" size="is-small"></b-icon> {{ lang('Copy') }} <b-icon icon="copy" size="is-small" /> {{ lang('Copy') }}
</a> </a>
<a v-if="can('write') && checked.length" @click="move" class="is-inline-block"> <a v-if="can('write') && checked.length" class="is-inline-block" @click="move">
<b-icon icon="external-link-square-alt" size="is-small"></b-icon> {{ lang('Move') }} <b-icon icon="external-link-square-alt" size="is-small" /> {{ lang('Move') }}
</a> </a>
<a v-if="can(['write', 'zip']) && checked.length" @click="zip" class="is-inline-block"> <a v-if="can(['write', 'zip']) && checked.length" class="is-inline-block" @click="zip">
<b-icon icon="file-archive" size="is-small"></b-icon> {{ lang('Zip') }} <b-icon icon="file-archive" size="is-small" /> {{ lang('Zip') }}
</a> </a>
<a v-if="can('write') && checked.length" @click="remove" class="is-inline-block"> <a v-if="can('write') && checked.length" class="is-inline-block" @click="remove">
<b-icon icon="trash-alt" size="is-small"></b-icon> {{ lang('Delete') }} <b-icon icon="trash-alt" size="is-small" /> {{ lang('Delete') }}
</a> </a>
</div> </div>
<div v-if="can('read')"> <div v-if="can('read')">
<Pagination :perpage="perPage" @selected="perPage = $event"></Pagination> <Pagination :perpage="perPage" @selected="perPage = $event" />
</div> </div>
</section> </section>
@@ -89,11 +87,11 @@
:row-class="(row) => 'file-row type-'+row.type" :row-class="(row) => 'file-row type-'+row.type"
:checked-rows.sync="checked" :checked-rows.sync="checked"
:loading="isLoading" :loading="isLoading"
checkable> checkable
>
<template slot-scope="props"> <template slot-scope="props">
<b-table-column field="data.name" :label="lang('Name')" :custom-sort="sortByName" sortable> <b-table-column field="data.name" :label="lang('Name')" :custom-sort="sortByName" sortable>
<a @click="itemClick(props.row)" class="is-block name"> <a class="is-block name" @click="itemClick(props.row)">
{{ props.row.name }} {{ props.row.name }}
</a> </a>
</b-table-column> </b-table-column>
@@ -108,46 +106,42 @@
<b-table-column class="action-padding" width="51"> <b-table-column class="action-padding" width="51">
<b-dropdown v-if="props.row.type != 'back'" aria-role="list" position="is-bottom-left" :disabled="checked.length > 0"> <b-dropdown v-if="props.row.type != 'back'" aria-role="list" position="is-bottom-left" :disabled="checked.length > 0">
<button class="button is-small" slot="trigger"> <button slot="trigger" class="button is-small">
<b-icon icon="ellipsis-h" size="is-small"></b-icon> <b-icon icon="ellipsis-h" size="is-small" />
</button> </button>
<b-dropdown-item v-if="props.row.type == 'file' && can('download')" @click="download(props.row)" aria-role="listitem"> <b-dropdown-item v-if="props.row.type == 'file' && can('download')" aria-role="listitem" @click="download(props.row)">
<b-icon icon="download" size="is-small"></b-icon> {{ lang('Download') }} <b-icon icon="download" size="is-small" /> {{ lang('Download') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item v-if="can('write')" @click="copy($event, props.row)" aria-role="listitem"> <b-dropdown-item v-if="can('write')" aria-role="listitem" @click="copy($event, props.row)">
<b-icon icon="copy" size="is-small"></b-icon> {{ lang('Copy') }} <b-icon icon="copy" size="is-small" /> {{ lang('Copy') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item v-if="can('write')" @click="move($event, props.row)" aria-role="listitem"> <b-dropdown-item v-if="can('write')" aria-role="listitem" @click="move($event, props.row)">
<b-icon icon="external-link-square-alt" size="is-small"></b-icon> {{ lang('Move') }} <b-icon icon="external-link-square-alt" size="is-small" /> {{ lang('Move') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item v-if="can('write')" @click="rename($event, props.row)" aria-role="listitem"> <b-dropdown-item v-if="can('write')" aria-role="listitem" @click="rename($event, props.row)">
<b-icon icon="file-signature" size="is-small"></b-icon> {{ lang('Rename') }} <b-icon icon="file-signature" size="is-small" /> {{ lang('Rename') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item v-if="can(['write', 'zip']) && isArchive(props.row)" @click="unzip($event, props.row)" aria-role="listitem"> <b-dropdown-item v-if="can(['write', 'zip']) && isArchive(props.row)" aria-role="listitem" @click="unzip($event, props.row)">
<b-icon icon="file-archive" size="is-small"></b-icon> {{ lang('Unzip') }} <b-icon icon="file-archive" size="is-small" /> {{ lang('Unzip') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item v-if="can(['write', 'zip']) && ! isArchive(props.row)" @click="zip($event, props.row)" aria-role="listitem"> <b-dropdown-item v-if="can(['write', 'zip']) && ! isArchive(props.row)" aria-role="listitem" @click="zip($event, props.row)">
<b-icon icon="file-archive" size="is-small"></b-icon> {{ lang('Zip') }} <b-icon icon="file-archive" size="is-small" /> {{ lang('Zip') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item v-if="can('write')" @click="remove($event, props.row)" aria-role="listitem"> <b-dropdown-item v-if="can('write')" aria-role="listitem" @click="remove($event, props.row)">
<b-icon icon="trash-alt" size="is-small"></b-icon> {{ lang('Delete') }} <b-icon icon="trash-alt" size="is-small" /> {{ lang('Delete') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item v-if="props.row.type == 'file' && can('download')" v-clipboard:copy="getDownloadLink(props.row)" aria-role="listitem"> <b-dropdown-item v-if="props.row.type == 'file' && can('download')" v-clipboard:copy="getDownloadLink(props.row)" aria-role="listitem">
<b-icon icon="clipboard" size="is-small"></b-icon> {{ lang('Copy link') }} <b-icon icon="clipboard" size="is-small" /> {{ lang('Copy link') }}
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
</b-table-column> </b-table-column>
</template> </template>
<template slot="bottom-left"> <template slot="bottom-left">
<span>{{ lang('Selected', checked.length, totalCount) }}</span> <span>{{ lang('Selected', checked.length, totalCount) }}</span>
</template> </template>
</b-table> </b-table>
</div> </div>
</div> </div>
</div> </div>
@@ -161,6 +155,7 @@ import Pagination from './partials/Pagination'
import Upload from './partials/Upload' import Upload from './partials/Upload'
import api from '../api/api' import api from '../api/api'
import VueClipboard from 'vue-clipboard2' import VueClipboard from 'vue-clipboard2'
import _ from 'lodash'
Vue.use(VueClipboard) Vue.use(VueClipboard)
@@ -178,32 +173,6 @@ export default {
files: [], files: [],
} }
}, },
mounted() {
if (this.can('read')) {
this.loadFiles()
}
},
watch: {
'$route' (to, from) {
this.isLoading = true
this.checked = []
this.currentPage = 1
api.changeDir({
to: to.query.cd
})
.then(ret => {
this.$store.commit('setCwd', {
content: ret.files,
location: ret.location,
})
this.isLoading = false
})
.catch(error => {
this.isLoading = false
this.handleError(error)
})
},
},
computed: { computed: {
breadcrumbs() { breadcrumbs() {
let path = '' let path = ''
@@ -228,6 +197,32 @@ export default {
}) || 0 }) || 0
}, },
}, },
watch: {
'$route' (to) {
this.isLoading = true
this.checked = []
this.currentPage = 1
api.changeDir({
to: to.query.cd
})
.then(ret => {
this.$store.commit('setCwd', {
content: ret.files,
location: ret.location,
})
this.isLoading = false
})
.catch(error => {
this.isLoading = false
this.handleError(error)
})
},
},
mounted() {
if (this.can('read')) {
this.loadFiles()
}
},
methods: { methods: {
loadFiles() { loadFiles() {
api.getDir({ api.getDir({
@@ -281,7 +276,7 @@ export default {
destination: dir.path, destination: dir.path,
items: item ? [item] : this.getSelected(), items: item ? [item] : this.getSelected(),
}) })
.then(res => { .then(() => {
this.isLoading = false this.isLoading = false
}) })
.catch(error => { .catch(error => {
@@ -305,7 +300,7 @@ export default {
destination: dir.path, destination: dir.path,
items: item ? [item] : this.getSelected(), items: item ? [item] : this.getSelected(),
}) })
.then(res => { .then(() => {
this.isLoading = false this.isLoading = false
}) })
.catch(error => { .catch(error => {
@@ -366,7 +361,7 @@ export default {
item: item.path, item: item.path,
destination: this.$store.state.cwd.location, destination: this.$store.state.cwd.location,
}) })
.then(res => { .then(() => {
this.isLoading = false this.isLoading = false
this.loadFiles() this.loadFiles()
}) })
@@ -399,7 +394,7 @@ export default {
items: item ? [item] : this.getSelected(), items: item ? [item] : this.getSelected(),
destination: this.$store.state.cwd.location, destination: this.$store.state.cwd.location,
}) })
.then(ret => { .then(() => {
this.isLoading = false this.isLoading = false
this.loadFiles() this.loadFiles()
}) })
@@ -428,7 +423,7 @@ export default {
to: value, to: value,
destination: this.$store.state.cwd.location, destination: this.$store.state.cwd.location,
}) })
.then(res => { .then(() => {
this.isLoading = false this.isLoading = false
this.loadFiles() this.loadFiles()
}) })
@@ -457,7 +452,7 @@ export default {
destination: this.$store.state.cwd.location, destination: this.$store.state.cwd.location,
}) })
// TODO: cors is triggering this too early? // TODO: cors is triggering this too early?
.then(ret => { .then(() => {
this.isLoading = false this.isLoading = false
this.loadFiles() this.loadFiles()
}) })
@@ -480,7 +475,7 @@ export default {
api.removeItems({ api.removeItems({
items: item ? [item] : this.getSelected(), items: item ? [item] : this.getSelected(),
}) })
.then(ret => { .then(() => {
this.isLoading = false this.isLoading = false
this.loadFiles() this.loadFiles()
}) })

View File

@@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<a v-if="can('read')" @click="$router.push('/')" id="back-arrow"> <a v-if="can('read')" id="back-arrow" @click="$router.push('/')">
<b-icon icon="times"></b-icon> <b-icon icon="times" />
</a> </a>
<div id="login" class="columns is-centered"> <div id="login" class="columns is-centered">
@@ -13,10 +13,10 @@
</div> </div>
<br> <br>
<b-field :label="lang('Username')"> <b-field :label="lang('Username')">
<b-input name="username" v-model="username" @input="error = ''" required></b-input> <b-input v-model="username" name="username" required @input="error = ''" />
</b-field> </b-field>
<b-field :label="lang('Password')"> <b-field :label="lang('Password')">
<b-input type="password" name="password" v-model="password" @input="error = ''" required></b-input> <b-input v-model="password" type="password" name="password" required @input="error = ''" />
</b-field> </b-field>
<div class="is-flex is-justify-end"> <div class="is-flex is-justify-end">
@@ -28,12 +28,10 @@
<div v-if="error"> <div v-if="error">
<code>{{ error }}</code> <code>{{ error }}</code>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -1,15 +1,15 @@
<template> <template>
<div class="container"> <div class="container">
<Menu></Menu> <Menu />
<section class="actions is-flex is-justify-between"> <section class="actions is-flex is-justify-between">
<div> <div>
<a @click="addUser"> <a @click="addUser">
<b-icon icon="plus" size="is-small"></b-icon> {{ lang('New') }} <b-icon icon="plus" size="is-small" /> {{ lang('New') }}
</a> </a>
</div> </div>
<div> <div>
<Pagination :perpage="perPage" @selected="perPage = $event"></Pagination> <Pagination :perpage="perPage" @selected="perPage = $event" />
</div> </div>
</section> </section>
@@ -20,9 +20,9 @@
:per-page="perPage" :per-page="perPage"
:current-page.sync="currentPage" :current-page.sync="currentPage"
:hoverable="true" :hoverable="true"
:loading="isLoading"> :loading="isLoading"
>
<template slot-scope="props"> <template slot-scope="props">
<b-table-column field="name" :label="lang('Name')" sortable> <b-table-column field="name" :label="lang('Name')" sortable>
<a @click="editUser(props.row)"> <a @click="editUser(props.row)">
{{ props.row.name }} {{ props.row.name }}
@@ -45,10 +45,9 @@
<b-table-column> <b-table-column>
<a v-if="props.row.role != 'guest'" @click="remove(props.row)"> <a v-if="props.row.role != 'guest'" @click="remove(props.row)">
<b-icon icon="trash-alt" size="is-small"></b-icon> <b-icon icon="trash-alt" size="is-small" />
</a> </a>
</b-table-column> </b-table-column>
</template> </template>
</b-table> </b-table>
</div> </div>

View File

@@ -5,33 +5,32 @@
<img :src="this.$store.state.config.logo"> <img :src="this.$store.state.config.logo">
</a> </a>
<a @click="navbarActive = !navbarActive" role="button" :class="[navbarActive ? 'is-active' : '', 'navbar-burger burger']" aria-label="menu" aria-expanded="false"> <a role="button" :class="[navbarActive ? 'is-active' : '', 'navbar-burger burger']" aria-label="menu" aria-expanded="false" @click="navbarActive = !navbarActive">
<span aria-hidden="true"></span> <span aria-hidden="true" />
<span aria-hidden="true"></span> <span aria-hidden="true" />
<span aria-hidden="true"></span> <span aria-hidden="true" />
</a> </a>
</div> </div>
<div :class="[navbarActive ? 'is-active' : '', 'navbar-menu']"> <div :class="[navbarActive ? 'is-active' : '', 'navbar-menu']">
<div class="navbar-end"> <div class="navbar-end">
<a @click="$router.push('/')" v-if="is('admin')" class="navbar-item"> <a v-if="is('admin')" class="navbar-item" @click="$router.push('/')">
{{ lang('Files') }} {{ lang('Files') }}
</a> </a>
<a @click="$router.push('/users')" v-if="is('admin')" class="navbar-item"> <a v-if="is('admin')" class="navbar-item" @click="$router.push('/users')">
{{ lang('Users') }} {{ lang('Users') }}
</a> </a>
<a @click="login" v-if="is('guest')" class="navbar-item"> <a v-if="is('guest')" class="navbar-item" @click="login">
{{ lang('Login') }} {{ lang('Login') }}
</a> </a>
<a @click="profile" v-if="!is('guest')" class="navbar-item"> <a v-if="!is('guest')" class="navbar-item" @click="profile">
{{ lang('Profile') }} {{ lang('Profile') }}
</a> </a>
<a @click="logout" v-if="!is('guest')" class="navbar-item"> <a v-if="!is('guest')" class="navbar-item" @click="logout">
{{ lang('Logout') }} {{ lang('Logout') }}
</a> </a>
</div> </div>
</div> </div>
</nav> </nav>
</template> </template>

View File

@@ -1,10 +1,18 @@
<template> <template>
<div> <div>
<b-select :value="perpage" @input="$emit('selected', $event)" size="is-small"> <b-select :value="perpage" size="is-small" @input="$emit('selected', $event)">
<option value="">{{ lang('No pagination') }}</option> <option value="">
<option value="5">{{ lang('Per page', 5) }}</option> {{ lang('No pagination') }}
<option value="10">{{ lang('Per page', 10) }}</option> </option>
<option value="15">{{ lang('Per page', 15) }}</option> <option value="5">
{{ lang('Per page', 5) }}
</option>
<option value="10">
{{ lang('Per page', 10) }}
</option>
<option value="15">
{{ lang('Per page', 15) }}
</option>
</b-select> </b-select>
</div> </div>
</template> </template>

View File

@@ -1,22 +1,28 @@
<template> <template>
<div class="modal-card"> <div class="modal-card">
<header class="modal-card-head"> <header class="modal-card-head">
<p class="modal-card-title">{{ $store.state.user.name }}</p> <p class="modal-card-title">
{{ $store.state.user.name }}
</p>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<form @submit="save"> <form @submit="save">
<b-field :label="lang('Old password')" :type="formErrors.oldpassword ? 'is-danger' : ''" :message="formErrors.oldpassword"> <b-field :label="lang('Old password')" :type="formErrors.oldpassword ? 'is-danger' : ''" :message="formErrors.oldpassword">
<b-input v-model="oldpassword" @keydown.native="formErrors.oldpassword = ''" password-reveal required></b-input> <b-input v-model="oldpassword" password-reveal required @keydown.native="formErrors.oldpassword = ''" />
</b-field> </b-field>
<b-field :label="lang('New password')" :type="formErrors.newpassword ? 'is-danger' : ''" :message="formErrors.newpassword"> <b-field :label="lang('New password')" :type="formErrors.newpassword ? 'is-danger' : ''" :message="formErrors.newpassword">
<b-input v-model="newpassword" @keydown.native="formErrors.newpassword = ''" password-reveal required></b-input> <b-input v-model="newpassword" password-reveal required @keydown.native="formErrors.newpassword = ''" />
</b-field> </b-field>
</form> </form>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<button class="button" type="button" @click="$parent.close()">{{ lang('Close') }}</button> <button class="button" type="button" @click="$parent.close()">
<button class="button is-primary" type="button" @click="save">{{ lang('Save') }}</button> {{ lang('Close') }}
</button>
<button class="button is-primary" type="button" @click="save">
{{ lang('Save') }}
</button>
</footer> </footer>
</div> </div>
</template> </template>

View File

@@ -1,17 +1,21 @@
<template> <template>
<div class="modal-card"> <div class="modal-card">
<header class="modal-card-head"> <header class="modal-card-head">
<p class="modal-card-title">{{ lang('Select Folder') }}</p> <p class="modal-card-title">
{{ lang('Select Folder') }}
</p>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<div class="tree"> <div class="tree">
<ul class="tree-list"> <ul class="tree-list">
<TreeNode @selected="$emit('selected', $event) && $parent.close()" :node="$store.state.tree"></TreeNode> <TreeNode :node="$store.state.tree" @selected="$emit('selected', $event) && $parent.close()" />
</ul> </ul>
</div> </div>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<button class="button" type="button" @click="$parent.close()">{{ lang('Close') }}</button> <button class="button" type="button" @click="$parent.close()">
{{ lang('Close') }}
</button>
</footer> </footer>
</div> </div>
</template> </template>

View File

@@ -6,7 +6,7 @@
&nbsp; <a @click="$emit('selected', node)">{{ node.name }}</a> &nbsp; <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, index) in node.children" :node="child" :key="index" @selected="$emit('selected', $event)"></TreeNode> <TreeNode v-for="(child, index) in node.children" :key="index" :node="child" @selected="$emit('selected', $event)" />
</ul> </ul>
</li> </li>
</template> </template>
@@ -26,12 +26,6 @@ export default {
button_type: 'is-primary' button_type: 'is-primary'
} }
}, },
mounted() {
if (this.node.path == '/') {
this.$store.commit('resetTree')
this.toggleButton(this.node)
}
},
computed: { computed: {
icon() { icon() {
return { return {
@@ -42,6 +36,12 @@ export default {
} }
}, },
}, },
mounted() {
if (this.node.path == '/') {
this.$store.commit('resetTree')
this.toggleButton(this.node)
}
},
methods: { methods: {
toggleButton(node) { toggleButton(node) {
if (! this.active) { if (! this.active) {

View File

@@ -6,7 +6,7 @@
<div class="is-flex is-justify-between"> <div class="is-flex is-justify-between">
<div class="is-flex"> <div class="is-flex">
<a @click="toggleWindow"> <a @click="toggleWindow">
<b-icon :icon="progressVisible ? 'angle-down' : 'angle-up'"></b-icon> <b-icon :icon="progressVisible ? 'angle-down' : 'angle-up'" />
</a> </a>
<span v-if="activeUploads"> <span v-if="activeUploads">
{{ lang('Uploading files', Math.round(resumable.progress()*100), formatBytes(resumable.getSize())) }} {{ lang('Uploading files', Math.round(resumable.progress()*100), formatBytes(resumable.getSize())) }}
@@ -20,10 +20,10 @@
</div> </div>
<div class="is-flex"> <div class="is-flex">
<a v-if="activeUploads" @click="togglePause()"> <a v-if="activeUploads" @click="togglePause()">
<b-icon :icon="paused ? 'play-circle' : 'pause-circle'"></b-icon> <b-icon :icon="paused ? 'play-circle' : 'pause-circle'" />
</a> </a>
<a @click="closeWindow()" class="progress-icon"> <a class="progress-icon" @click="closeWindow()">
<b-icon icon="times"></b-icon> <b-icon icon="times" />
</a> </a>
</div> </div>
</div> </div>
@@ -34,12 +34,12 @@
<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">
<progress :class="[file.file.uploadingError ? 'is-danger' : 'is-primary', 'progress is-large']" :value="file.progress()*100" max="100"></progress> <progress :class="[file.file.uploadingError ? 'is-danger' : 'is-primary', 'progress is-large']" :value="file.progress()*100" max="100" />
<a v-if="! file.isUploading() && file.file.uploadingError" @click="file.retry()" class="progress-icon"> <a v-if="! file.isUploading() && file.file.uploadingError" class="progress-icon" @click="file.retry()">
<b-icon icon="redo" type="is-danger"></b-icon> <b-icon icon="redo" type="is-danger" />
</a> </a>
<a v-else @click="file.cancel()" class="progress-icon"> <a v-else class="progress-icon" @click="file.cancel()">
<b-icon :icon="file.isComplete() ? 'check' : 'times'"></b-icon> <b-icon :icon="file.isComplete() ? 'check' : 'times'" />
</a> </a>
</div> </div>
</div> </div>
@@ -69,6 +69,11 @@ export default {
progress: 0, progress: 0,
} }
}, },
computed: {
activeUploads() {
return this.resumable.files.length && this.resumable.progress() < 1
},
},
watch: { watch: {
'files' (files) { 'files' (files) {
this.visible = true this.visible = true
@@ -132,11 +137,6 @@ export default {
file.file.uploadingError = true file.file.uploadingError = true
}) })
}, },
computed: {
activeUploads() {
return this.resumable.files.length && this.resumable.progress() < 1
},
},
methods: { methods: {
closeWindow() { closeWindow() {
if (this.activeUploads) { if (this.activeUploads) {

View File

@@ -1,36 +1,39 @@
<template> <template>
<div class="modal-card"> <div class="modal-card">
<header class="modal-card-head"> <header class="modal-card-head">
<p class="modal-card-title">{{ user.name }}</p> <p class="modal-card-title">
{{ user.name }}
</p>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<form @submit.prevent="save"> <form @submit.prevent="save">
<div v-if="user.role == 'user' || user.role == 'admin'" class="field"> <div v-if="user.role == 'user' || user.role == 'admin'" class="field">
<b-field :label="lang('Role')"> <b-field :label="lang('Role')">
<b-select v-model="formFields.role" :placeholder="lang('Role')" expanded required> <b-select v-model="formFields.role" :placeholder="lang('Role')" expanded required>
<option value="user" key="user">{{ lang('User') }}</option> <option key="user" value="user">
<option value="admin" key="admin">{{ lang('Admin') }}</option> {{ lang('User') }}
</option>
<option key="admin" value="admin">
{{ lang('Admin') }}
</option>
</b-select> </b-select>
</b-field> </b-field>
<b-field :label="lang('Username')" :type="formErrors.username ? 'is-danger' : ''" :message="formErrors.username"> <b-field :label="lang('Username')" :type="formErrors.username ? 'is-danger' : ''" :message="formErrors.username">
<b-input v-model="formFields.username" @keydown.native="formErrors.username = ''"></b-input> <b-input v-model="formFields.username" @keydown.native="formErrors.username = ''" />
</b-field> </b-field>
<b-field :label="lang('Name')" :type="formErrors.name ? 'is-danger' : ''" :message="formErrors.name"> <b-field :label="lang('Name')" :type="formErrors.name ? 'is-danger' : ''" :message="formErrors.name">
<b-input v-model="formFields.name" @keydown.native="formErrors.name = ''"></b-input> <b-input v-model="formFields.name" @keydown.native="formErrors.name = ''" />
</b-field> </b-field>
<b-field :label="lang('Password')" :type="formErrors.password ? 'is-danger' : ''" :message="formErrors.password"> <b-field :label="lang('Password')" :type="formErrors.password ? 'is-danger' : ''" :message="formErrors.password">
<b-input v-model="formFields.password" @keydown.native="formErrors.password = ''" :placeholder="action == 'edit' ? lang('Leave blank for no change') : ''" password-reveal></b-input> <b-input v-model="formFields.password" :placeholder="action == 'edit' ? lang('Leave blank for no change') : ''" password-reveal @keydown.native="formErrors.password = ''" />
</b-field> </b-field>
</div> </div>
<b-field :label="lang('Homedir')" :type="formErrors.homedir ? 'is-danger' : ''" :message="formErrors.homedir"> <b-field :label="lang('Homedir')" :type="formErrors.homedir ? 'is-danger' : ''" :message="formErrors.homedir">
<b-input v-model="formFields.homedir" @focus="selectDir"></b-input> <b-input v-model="formFields.homedir" @focus="selectDir" />
</b-field> </b-field>
<b-field :label="lang('Permissions')"> <b-field :label="lang('Permissions')">
@@ -55,12 +58,15 @@
</b-checkbox> </b-checkbox>
</div> </div>
</b-field> </b-field>
</form> </form>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<button class="button" type="button" @click="$parent.close()">{{ lang('Close') }}</button> <button class="button" type="button" @click="$parent.close()">
<button class="button is-primary" type="button" @click="confirmSave">{{ lang('Save') }}</button> {{ lang('Close') }}
</button>
<button class="button is-primary" type="button" @click="confirmSave">
{{ lang('Save') }}
</button>
</footer> </footer>
</div> </div>
</template> </template>
@@ -73,8 +79,6 @@ import _ from 'lodash'
export default { export default {
name: 'UserEdit', name: 'UserEdit',
props: [ 'user', 'action' ], props: [ 'user', 'action' ],
computed: {
},
data() { data() {
return { return {
formFields: { formFields: {
@@ -95,6 +99,8 @@ export default {
} }
} }
}, },
computed: {
},
watch: { watch: {
'permissions.read' (val) { 'permissions.read' (val) {
if (!val) { if (!val) {