Merge pull request #842 from nextcloud/depsAndConfig

Dependency and config tidy
This commit is contained in:
René Gieling 2020-03-02 18:11:18 +01:00 коммит произвёл GitHub
Родитель ea324cea96 00cacdf8d8
Коммит ec225a604a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 67 добавлений и 242 удалений

Просмотреть файл

@ -1,9 +1,10 @@
module.exports = {
plugins: ['@babel/plugin-syntax-dynamic-import'],
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
targets: {
browsers: ['last 2 versions', 'ie >= 11']
}
@ -11,4 +12,3 @@ module.exports = {
]
]
}

Просмотреть файл

@ -3,9 +3,8 @@ module.exports = {
env: {
browser: true,
es6: true,
'nextcloud/nextcloud': true,
node: true,
jest: true
jest: true,
},
globals: {
t: true,
@ -14,32 +13,32 @@ module.exports = {
OCA: true,
Vue: true,
VueRouter: true,
moment:true
moment:true,
},
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 6
ecmaVersion: 6,
},
extends: [
'plugin:@nextcloud/recommended',
'eslint:recommended',
'plugin:nextcloud/recommended',
'plugin:node/recommended',
'plugin:vue/essential',
'plugin:vue/recommended',
'standard'
'standard',
],
plugins: [
'vue',
'node',
'nextcloud'
],
rules: {
"@nextcloud/no-deprecations": "warn",
"@nextcloud/no-removed-apis": "error",
'node/no-missing-import': ['error', {
'allowModules': [],
'tryExtensions': ['.js', '.vue']
}],
'nextcloud/no-deprecations': 'warn',
'nextcloud/no-removed-apis': 'error',
// 'comma-dangle': ['error', 'always-multiline'],
// space before function ()
'space-before-function-paren': ['error', 'never'],
// curly braces always space

Просмотреть файл

@ -388,26 +388,6 @@ class Acl implements JsonSerializable {
return $this;
}
/**
* @NoAdminRequired
* @return string
*/
public function getAccessLevel(): string {
if ($this->getIsOwner()) {
return 'owner';
} elseif ($this->poll->getAccess() === 'public') {
return 'public';
} elseif ($this->poll->getAccess() === 'registered' && \OC::$server->getUserSession()->getUser()->getUID() === $this->userId) {
return 'registered';
} elseif ($this->poll->getAccess() === 'hidden' && $this->getisOwner()) {
return 'hidden';
} elseif ($this->getIsAdmin()) {
return 'admin';
} else {
return 'none';
}
}
/**
* @return array
*/
@ -430,8 +410,7 @@ class Acl implements JsonSerializable {
'groupShare' => $this->getGroupShare(),
'personalShare' => $this->getPersonalShare(),
'publicShare' => $this->getPublicShare(),
'foundByToken' => $this->getFoundByToken(),
'accessLevel' => $this->getAccessLevel()
'foundByToken' => $this->getFoundByToken()
];
}
}

Просмотреть файл

@ -35,23 +35,14 @@
"stylelint:fix": "stylelint src --fix"
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"@nextcloud/axios": "^1.3.1",
"@nextcloud/router": "^1.0.0",
"@nextcloud/vue": "^1.3.0",
"acorn": "^7.1.0",
"acorn-jsx": "^5.1.0",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-latest": "^6.24.1",
"fibers": "^4.0.2",
"core-js": "^3.6.4",
"lodash": "^4.17.15",
"moment": "^2.23.0",
"v-click-outside": "^3.0.0",
"v-tooltip": "^3.0.0-alpha.11",
"vue": "^2.6.11",
"vue-click-outside": "^1.0.7",
"vue-clipboard2": "^0.3.1",
"vue-router": "^3.1.5",
"vuedraggable": "^2.23.2",
@ -66,37 +57,33 @@
"node": ">=10.0.0"
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/core": "^7.8.6",
"@babel/preset-env": "^7.8.6",
"@nextcloud/eslint-plugin": "^1.1.0",
"babel-eslint": "^10.0.2",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"babel-preset-env": "^1.7.0",
"cross-env": "^7.0.0",
"css-loader": "^3.4.2",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-nextcloud": "^0.3.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^6.1.2",
"file-loader": "^5.0.2",
"node-sass": "^4.13.1",
"prettier-eslint": "^9.0.1",
"raw-loader": "^4.0.0",
"sass-loader": "^8.0.2",
"stylelint": "^13.2.0",
"stylelint-config-recommended-scss": "^4.2.0",
"stylelint-scss": "^3.14.2",
"vue-loader": "^15.7.2",
"vue-style-loader": "^4.1.1",
"vue-template-compiler": "^2.6.10",
"terser-webpack-plugin": "^2.3.5",
"vue-loader": "^15.9.0",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-cli": "^3.3.11",
"webpack-merge": "^4.1.5"
}
}

Просмотреть файл

@ -1,172 +0,0 @@
<!--
- @copyright Copyright (c) 2018 René Gieling <github@dartcafe.de>
-
- @author René Gieling <github@dartcafe.de>
-
- @license GNU AGPL version 3 or any later version
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-->
<template>
<div>
<h2> {{ t('polls', 'Share with') }}</h2>
<Multiselect id="ajax"
v-model="shares"
:options="users"
:multiple="true"
:user-select="true"
:tag-width="80"
:clear-on-select="false"
:preserve-search="true"
:options-limit="20"
:loading="isLoading"
:internal-search="false"
:searchable="true"
:preselect-first="true"
:placeholder="placeholder"
label="displayName"
track-by="user"
@search-change="loadUsersAsync"
@close="updateShares">
<template slot="selection" slot-scope="{ values, search, isOpen }">
<span v-if="values.length &amp;&amp; !isOpen" class="multiselect__single">
{{ values.length }} users selected
</span>
</template>
</Multiselect>
<TransitionGroup :css="false" tag="ul" class="shared-list">
<li v-for="(item, index) in sortedShares" :key="item.displayName" :data-index="index">
<UserDiv :user-id="item.user" :display-name="item.displayName" :type="item.type"
:hide-names="hideNames" />
<div class="options">
<a class="icon icon-delete svg delete-poll" @click="removeShare(index, item)" />
</div>
</li>
</TransitionGroup>
</div>
</template>
<script>
import { Multiselect } from '@nextcloud/vue'
export default {
name: 'ShareDiv',
components: {
Multiselect
},
props: {
placeholder: {
type: String,
default: ''
},
activeShares: {
type: Array,
default: function() {
return []
}
},
hideNames: {
type: Boolean,
default: false
}
},
data() {
return {
shares: [],
users: [],
isLoading: false,
siteUsersListOptions: {
getUsers: true,
getGroups: true,
query: ''
}
}
},
computed: {
sortedShares() {
return this.shares.slice(0).sort(this.sortByDisplayname)
}
},
watch: {
activeShares(value) {
this.shares = value.slice(0)
}
},
methods: {
removeShare(index, item) {
this.$emit('remove-share', item)
},
updateShares() {
this.$emit('update-shares', this.shares)
},
loadUsersAsync(query) {
this.isLoading = false
this.siteUsersListOptions.query = query
this.$http.post(OC.generateUrl('apps/polls/siteusers/get/'), this.siteUsersListOptions)
.then((response) => {
this.users = response.data.siteusers
this.isLoading = false
}, (error) => {
console.error(error.response)
})
},
sortByDisplayname(a, b) {
if (a.displayName.toLowerCase() < b.displayName.toLowerCase()) return -1
if (a.displayName.toLowerCase() > b.displayName.toLowerCase()) return 1
return 0
}
}
}
</script>
<style lang="scss">
.shared-list {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
padding-top: 8px;
> li {
display: flex;
}
}
.options {
display: flex;
position: relative;
top: -12px;
left: -13px;
}
.multiselect {
width: 100% !important;
max-width: 100% !important;
}
</style>

Просмотреть файл

@ -36,7 +36,6 @@ import { Tooltip } from '@nextcloud/vue'
import UserDiv from './components/Base/UserDiv'
import ButtonDiv from './components/Base/ButtonDiv'
import LoadingOverlay from './components/Base/LoadingOverlay'
/* eslint-disable-next-line camelcase, no-undef */
__webpack_nonce__ = btoa(OC.requestToken)
@ -57,7 +56,6 @@ Vue.prototype.OCA = OCA
Vue.component('UserDiv', UserDiv)
Vue.component('ButtonDiv', ButtonDiv)
Vue.component('LoadingOverlay', LoadingOverlay)
Vue.directive('tooltip', Tooltip)
Vue.use(ClickOutside)

Просмотреть файл

@ -67,13 +67,13 @@ const getters = {
return (state.expire > 0 && moment.unix(state.expire).diff() < 0)
},
accessType: (state, getters, rootState) => {
if (rootState.acl.accessLevel === 'public') {
accessType: (state) => {
if (state.access === 'public') {
return t('polls', 'Public access')
} else if (rootState.acl.accessLevel === 'hidden') {
} else if (state.access === 'hidden') {
return t('polls', 'Hidden poll')
} else {
return rootState.acl.accessLevel
return state.access
}
},

Просмотреть файл

@ -51,12 +51,14 @@ import { AppContent } from '@nextcloud/vue'
import PollListItem from '../components/PollList/PollListItem'
import { mapGetters } from 'vuex'
import sortBy from 'lodash/sortBy'
import LoadingOverlay from '../components/Base/LoadingOverlay'
export default {
name: 'PollList',
components: {
AppContent,
LoadingOverlay,
PollListItem
},

Просмотреть файл

@ -11,12 +11,15 @@ module.exports = {
},
module: {
rules: [
// {
// enforce: 'pre',
// test: /\.(js|vue)$/,
// loader: 'eslint-loader',
// exclude: /node_modules/
// },
{
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /node_modules/,
options: {
quiet: true
}
},
{
test: /\.css$/,
use: [
@ -34,7 +37,12 @@ module.exports = {
},
{
test: /\.vue$/,
loader: 'vue-loader'
loader: 'vue-loader',
options: {
compilerOptions: {
whitespace: 'condense'
}
}
},
{
test: /\.js$/,

Просмотреть файл

@ -1,12 +1,25 @@
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = merge(common, {
mode: 'development',
devtool: 'source-map',
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
devtool: 'source-map'
optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
cache: true,
extractComments: false,
terserOptions: {
ecma: 6
}
})
]
}
})

Просмотреть файл

@ -1,7 +1,18 @@
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map'
optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
cache: true,
terserOptions: {
ecma: 6
}
})
]
}
})