Completed
Push — master ( 862cae...854c71 )
by Raimund
13s
created

src/main.js (14 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
/**
2
 * Nextcloud - Tasks
3
 *
4
 * @author Raimund Schlüßler
5
 * @copyright 2018 Raimund Schlüßler <[email protected]>
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
9
 * License as published by the Free Software Foundation; either
10
 * version 3 of the License, or any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public
18
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 */
21
'use strict'
22
23
import Vue from 'vue'
0 ignored issues
show
'import' is only available in ES6 (use 'esversion: 6').

Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.

Further Reading:

Loading history...
24
25
import App from './app'
0 ignored issues
show
'import' is only available in ES6 (use 'esversion: 6').

Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.

Further Reading:

Loading history...
26
27
import router from './components/TheRouter'
0 ignored issues
show
'import' is only available in ES6 (use 'esversion: 6').

Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.

Further Reading:

Loading history...
28
import store from './store/store'
0 ignored issues
show
'import' is only available in ES6 (use 'esversion: 6').

Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.

Further Reading:

Loading history...
29
import { sync } from 'vuex-router-sync'
0 ignored issues
show
'import' is only available in ES6 (use 'esversion: 6').

Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.

Further Reading:

Loading history...
30
import VTooltip from 'v-tooltip'
0 ignored issues
show
'import' is only available in ES6 (use 'esversion: 6').

Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.

Further Reading:

Loading history...
31
import VueClipboard from 'vue-clipboard2'
0 ignored issues
show
'import' is only available in ES6 (use 'esversion: 6').

Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.

Further Reading:

Loading history...
32
33
// Disable on production
34
Vue.config.devtools = true
35
Vue.config.performance = true
36
37
// CSP config for webpack dynamic chunk loading
38
// eslint-disable-next-line
39
__webpack_nonce__ = btoa(OC.requestToken)
40
41
// Correct the root of the app for chunk loading
42
// OC.linkTo matches the apps folders
43
// OC.generateUrl ensure the index.php (or not)
44
// We do not want the index.php since we're loading files
45
// eslint-disable-next-line
46
__webpack_public_path__ = OC.linkTo('tasks', 'js/')
0 ignored issues
show
There were too many errors found in this file; checking aborted after 43%.

If JSHint finds too many errors in a file, it aborts checking altogether because it suspects a configuration issue.

Further Reading:

Loading history...
47
48
sync(store, router)
49
50
Vue.use(VTooltip)
51
Vue.use(VueClipboard)
52
53
if (!OCA.Tasks) {
54
	/**
55
	 * @namespace OCA.Tasks
56
	 */
57
	OCA.Tasks = {}
58
}
59
60
Vue.prototype.t = t
61
Vue.prototype.n = n
62
Vue.prototype.OC = OC
63
Vue.prototype.OCA = OCA
64
65
OCA.Tasks.App = new Vue({
66
	el: '.app-tasks',
67
	router,
0 ignored issues
show
Backwards Compatibility introduced by
'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
68
	store,
0 ignored issues
show
Backwards Compatibility introduced by
'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
69
	data: function() {
70
		return {
71
			searchString: ''
72
		}
73
	},
74
	mounted: function() {
75
		var version = OC.config.version.split('.')
76
77
		if (version[0] >= 14) {
78
			OC.Search = new OCA.Search(this.filter, this.cleanSearch)
79
		} else {
80
			OCA.Tasks.Search = {
81
				attach: function(search) {
82
					search.setFilter('tasks', this.filter)
83
				}
84
			}
85
86
			OC.Plugins.register('OCA.Search', OCA.Tasks.Search)
87
		}
88
	},
89
	beforeMount() {
0 ignored issues
show
Backwards Compatibility introduced by
'concise methods' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
90
		// Configure the locale of moment.js
91
		moment.locale(OC.getLocale().replace('_', '-').toLowerCase())
92
		this.$store.dispatch('loadCollections')
93
		this.$store.dispatch('loadSettings')
94
	},
95
	methods: {
96
		filter(query) {
0 ignored issues
show
Backwards Compatibility introduced by
'concise methods' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
97
			this.$store.commit('setSearchQuery', query)
98
		},
99
		cleanSearch() {
0 ignored issues
show
Backwards Compatibility introduced by
'concise methods' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
100
			this.$store.commit('setSearchQuery', '')
101
		}
102
	},
103
	render: h => h(App)
0 ignored issues
show
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code.

Further Reading:

Loading history...
104
})
105