diff options
author | Joas Schilling <coding@schilljs.com> | 2019-03-04 19:05:36 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-03-08 16:32:18 +0300 |
commit | 646841600c9f3447968c798c00a340adbb331ea6 (patch) | |
tree | 193ac05fcf56b4cb163577996d75ee03c82f061f /vue | |
parent | b695fa6b34a480510019ea050f2d6ba9b695ef2b (diff) |
Use VueJS for admin settings
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'vue')
-rw-r--r-- | vue/src/StunServerSettings.vue | 77 | ||||
-rw-r--r-- | vue/src/components/StunServer.vue | 69 | ||||
-rw-r--r-- | vue/src/stun-server.js | 34 | ||||
-rw-r--r-- | vue/webpack.common.js | 1 |
4 files changed, 181 insertions, 0 deletions
diff --git a/vue/src/StunServerSettings.vue b/vue/src/StunServerSettings.vue new file mode 100644 index 000000000..1073e4cf5 --- /dev/null +++ b/vue/src/StunServerSettings.vue @@ -0,0 +1,77 @@ +<!-- + - @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com> + - + - @author Joas Schilling <coding@schilljs.com> + - + - @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 id="stun_server" class="videocalls section"> + <h2>{{ t('spreed', 'STUN servers') }}</h2> + + <p class="settings-hint">{{ t('spreed', 'A STUN server is used to determine the public IP address of participants behind a router.') }}</p> + + <div class="stun-servers"> + <StunServer v-for="(s, i) in servers" :server="servers[i]" :key="i" + @removeServer="removeServer(i)" @newServer="newServer"></StunServer> + </div> + </div> +</template> + +<script> + import StunServer from './components/StunServer'; + + export default { + name: 'app', + + data () { + return { + servers: [] + } + }, + + components: { + StunServer + }, + + methods: { + removeServer (i) { + console.log(i); + console.log(this.servers); + this.servers.splice(i, 1); + console.log(this.servers); + }, + + newServer () { + this.servers.push(''); + }, + + addDefaultServer () { + this.servers.push('stun.nextcloud.com:443'); + }, + + saveServers () { + + } + }, + + mounted () { + this.servers = OCP.InitialState.loadState('talk', 'stun_servers'); + } + } +</script> diff --git a/vue/src/components/StunServer.vue b/vue/src/components/StunServer.vue new file mode 100644 index 000000000..e639647df --- /dev/null +++ b/vue/src/components/StunServer.vue @@ -0,0 +1,69 @@ +<!-- + - @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com> + - + - @author Joas Schilling <coding@schilljs.com> + - + - @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 class="stun-server"> + <input type="text" name="stun_server" placeholder="stunserver:port" v-model="server" :aria-label="t('spreed', 'STUN server URL')" /> + <a class="icon icon-delete" @click="deleteServer" :title="t('spreed', 'Delete servers')"></a> + <a class="icon icon-add" @click="addServer" :title="t('spreed', 'Add new servers')"></a> + <span class="icon icon-checkmark-color hidden" :title="t('spreed', 'Saved') "></span> + </div> + +</template> + +<script> + export default { + name: 'stun-server', + + // props: [ + // 'server' + // ], + + data () { + return { + server: 's' + } + }, + + methods: { + deleteServer () { + console.log(this.server); + this.$emit('removeServer'); + }, + + addServer () { + this.$emit('newServer'); + }, + + saveServers () { + + } + }, + + // components: { + // Command + // }, + + mounted () { + } + } +</script> diff --git a/vue/src/stun-server.js b/vue/src/stun-server.js new file mode 100644 index 000000000..5eff29f86 --- /dev/null +++ b/vue/src/stun-server.js @@ -0,0 +1,34 @@ +/* + * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com> + * + * @author Joas Schilling <coding@schilljs.com> + * + * @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/>. + * + */ + +import Vue from 'vue'; +import StunServerSettings from './StunServerSettings'; + +Vue.prototype.t = t; +Vue.prototype.n = n; +Vue.prototype.OC = OC; +Vue.prototype.OCA = OCA; + +new Vue({ + el: '#stun_server', + render: h => h(StunServerSettings) +}); diff --git a/vue/webpack.common.js b/vue/webpack.common.js index e9dc838e5..c4f6e40a9 100644 --- a/vue/webpack.common.js +++ b/vue/webpack.common.js @@ -5,6 +5,7 @@ module.exports = { entry: { "admin/commands": path.join(__dirname, 'src', 'commands.js'), "admin/allowed-groups": path.join(__dirname, 'src', 'allowed-groups.js'), + "admin/stun-server": path.join(__dirname, 'src', 'stun-server.js'), }, output: { path: path.resolve(__dirname, '../js'), |