aboutsummaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/js-src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/updatenotification/js-src')
-rw-r--r--apps/updatenotification/js-src/app.js54
-rw-r--r--apps/updatenotification/js-src/components/root.vue37
-rw-r--r--apps/updatenotification/js-src/init.js23
-rw-r--r--apps/updatenotification/js-src/webpack.common.js28
-rw-r--r--apps/updatenotification/js-src/webpack.config.js56
-rw-r--r--apps/updatenotification/js-src/webpack.dev.js12
-rw-r--r--apps/updatenotification/js-src/webpack.prod.js7
7 files changed, 89 insertions, 128 deletions
diff --git a/apps/updatenotification/js-src/app.js b/apps/updatenotification/js-src/app.js
deleted file mode 100644
index 0b28cabd6ac..00000000000
--- a/apps/updatenotification/js-src/app.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @copyright (c) 2018 Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- */
-
-/* global $, define */
-
-define(function (require) {
- "use strict";
-
- return {
-
- /** @type {Vue|null} */
- vm: null,
-
- /**
- * Initialise the app
- */
- initialise: function() {
- var data = JSON.parse($('#updatenotification').attr('data-json'));
- var Vue = require('vue');
- var vSelect = require('vue-select');
- Vue.component('v-select', vSelect.VueSelect);
- Vue.mixin({
- methods: {
- t: function(app, text, vars, count, options) {
- return OC.L10N.translate(app, text, vars, count, options);
- },
- n: function(app, textSingular, textPlural, count, vars, options) {
- return OC.L10N.translatePlural(app, textSingular, textPlural, count, vars, options);
- }
- }
- });
- this.vm = new Vue(require('./components/root.vue'));
-
- this.vm.newVersionString = data.newVersionString;
- this.vm.lastCheckedDate = data.lastChecked;
- this.vm.isUpdateChecked = data.isUpdateChecked;
- this.vm.updaterEnabled = data.updaterEnabled;
- this.vm.downloadLink = data.downloadLink;
- this.vm.isNewVersionAvailable = data.isNewVersionAvailable;
- this.vm.updateServerURL = data.updateServerURL;
- this.vm.currentChannel = data.currentChannel;
- this.vm.channels = data.channels;
- this.vm.notifyGroups = data.notifyGroups;
- this.vm.isDefaultUpdateServerURL = data.isDefaultUpdateServerURL;
- this.vm.versionIsEol = data.versionIsEol;
- }
- };
-});
diff --git a/apps/updatenotification/js-src/components/root.vue b/apps/updatenotification/js-src/components/root.vue
index a52e1b12bd4..7902d80c951 100644
--- a/apps/updatenotification/js-src/components/root.vue
+++ b/apps/updatenotification/js-src/components/root.vue
@@ -79,11 +79,13 @@
</template>
<script>
- export default {
- name: "root",
-
- el: '#updatenotification',
+ import vSelect from 'vue-select';
+ export default {
+ name: 'root',
+ components: {
+ vSelect,
+ },
data: function () {
return {
newVersionString: '',
@@ -261,7 +263,23 @@
this.hideAvailableUpdates = !this.hideAvailableUpdates;
}
},
-
+ beforeMount: function() {
+ // Parse server data
+ var data = JSON.parse($('#updatenotification').attr('data-json'));
+
+ this.newVersionString = data.newVersionString;
+ this.lastCheckedDate = data.lastChecked;
+ this.isUpdateChecked = data.isUpdateChecked;
+ this.updaterEnabled = data.updaterEnabled;
+ this.downloadLink = data.downloadLink;
+ this.isNewVersionAvailable = data.isNewVersionAvailable;
+ this.updateServerURL = data.updateServerURL;
+ this.currentChannel = data.currentChannel;
+ this.channels = data.channels;
+ this.notifyGroups = data.notifyGroups;
+ this.isDefaultUpdateServerURL = data.isDefaultUpdateServerURL;
+ this.versionIsEol = data.versionIsEol;
+ },
mounted: function () {
this._$el = $(this.$el);
this._$releaseChannel = this._$el.find('#release-channel');
@@ -271,15 +289,12 @@
}.bind(this));
$.ajax({
- url: OC.generateUrl('/settings/users/groups'),
+ url: OC.linkToOCS('cloud', 2)+ '/groups',
dataType: 'json',
success: function(data) {
var results = [];
- $.each(data.data.adminGroups, function(i, group) {
- results.push({value: group.id, label: group.name});
- });
- $.each(data.data.groups, function(i, group) {
- results.push({value: group.id, label: group.name});
+ $.each(data.ocs.data.groups, function(i, group) {
+ results.push({value: group, label: group});
});
this.availableGroups = results;
diff --git a/apps/updatenotification/js-src/init.js b/apps/updatenotification/js-src/init.js
index 7730affb527..d874cb67f33 100644
--- a/apps/updatenotification/js-src/init.js
+++ b/apps/updatenotification/js-src/init.js
@@ -19,13 +19,22 @@
*/
/* global define, $ */
+import Vue from 'vue';
+import Root from './components/root'
-define(function(require) {
- 'use strict';
+Vue.mixin({
+ methods: {
+ t: function(app, text, vars, count, options) {
+ return OC.L10N.translate(app, text, vars, count, options);
+ },
+ n: function(app, textSingular, textPlural, count, vars, options) {
+ return OC.L10N.translatePlural(app, textSingular, textPlural, count, vars, options);
+ }
+ }
+});
+
+const vm = new Vue({
+ render: h => h(Root)
+}).$mount('#updatenotification');
- var App = require('./app');
- $(function() {
- App.initialise();
- });
-});
diff --git a/apps/updatenotification/js-src/webpack.common.js b/apps/updatenotification/js-src/webpack.common.js
new file mode 100644
index 00000000000..0cd451893ed
--- /dev/null
+++ b/apps/updatenotification/js-src/webpack.common.js
@@ -0,0 +1,28 @@
+const path = require('path')
+const { VueLoaderPlugin } = require('vue-loader');
+
+module.exports = {
+ entry: './js-src/init.js',
+ output: {
+ path: path.resolve(__dirname, '../js'),
+ publicPath: '/',
+ filename: 'merged.js'
+ },
+ module: {
+ rules: [
+ {
+ test: /\.vue$/,
+ loader: 'vue-loader',
+ }
+ ]
+ },
+ plugins: [
+ new VueLoaderPlugin()
+ ],
+ resolve: {
+ alias: {
+ 'vue$': 'vue/dist/vue.esm.js'
+ },
+ extensions: ['*', '.js', '.vue', '.json']
+ }
+}
diff --git a/apps/updatenotification/js-src/webpack.config.js b/apps/updatenotification/js-src/webpack.config.js
deleted file mode 100644
index 1e62a3de9c9..00000000000
--- a/apps/updatenotification/js-src/webpack.config.js
+++ /dev/null
@@ -1,56 +0,0 @@
-var path = require('path');
-var webpack = require('webpack');
-
-module.exports = {
- entry: './js-src/init.js',
- output: {
- path: path.resolve(__dirname, '../js'),
- publicPath: '/',
- filename: 'merged.js'
- },
- module: {
- rules: [
- {
- test: /\.vue$/,
- loader: 'vue-loader',
- options: {
- loaders: {
- },
- esModule: false
- // other vue-loader options go here
- }
- }
- ]
- },
- resolve: {
- alias: {
- 'vue-select': 'vue-select/dist/vue-select.js',
- 'vue': process.env.NODE_ENV === 'production' ? 'vue/dist/vue.min.js' : 'vue/dist/vue.js'
- }
- },
- performance: {
- hints: false
- },
- devtool: '#eval-source-map'
-};
-
-if (process.env.NODE_ENV === 'production') {
- module.exports.devtool = '#source-map';
- // http://vue-loader.vuejs.org/en/workflow/production.html
- module.exports.plugins = (module.exports.plugins || []).concat([
- new webpack.DefinePlugin({
- 'process.env': {
- NODE_ENV: '"production"'
- }
- }),
- new webpack.optimize.UglifyJsPlugin({
- sourceMap: true,
- compress: {
- warnings: false
- }
- }),
- new webpack.LoaderOptionsPlugin({
- minimize: true
- })
- ]);
-}
diff --git a/apps/updatenotification/js-src/webpack.dev.js b/apps/updatenotification/js-src/webpack.dev.js
new file mode 100644
index 00000000000..88409bbb1d8
--- /dev/null
+++ b/apps/updatenotification/js-src/webpack.dev.js
@@ -0,0 +1,12 @@
+const merge = require('webpack-merge');
+const common = require('./webpack.common.js');
+
+module.exports = merge(common, {
+ mode: 'development',
+ devServer: {
+ historyApiFallback: true,
+ noInfo: true,
+ overlay: true
+ },
+ devtool: '#eval-source-map',
+})
diff --git a/apps/updatenotification/js-src/webpack.prod.js b/apps/updatenotification/js-src/webpack.prod.js
new file mode 100644
index 00000000000..f081567bd63
--- /dev/null
+++ b/apps/updatenotification/js-src/webpack.prod.js
@@ -0,0 +1,7 @@
+const merge = require('webpack-merge')
+const common = require('./webpack.common.js')
+
+module.exports = merge(common, {
+ mode: 'production',
+ devtool: '#source-map'
+})