|
| 1 | +<!-- |
| 2 | + - @copyright Copyright (c) 2024 Maksim Sukharev <antreesy.web@gmail.com> |
| 3 | + - |
| 4 | + - @author Maksim Sukharev < [email protected]> |
| 5 | + - |
| 6 | + - @license AGPL-3.0-or-later |
| 7 | + - |
| 8 | + - This program is free software: you can redistribute it and/or modify |
| 9 | + - it under the terms of the GNU Affero General Public License as |
| 10 | + - published by the Free Software Foundation, either version 3 of the |
| 11 | + - License, or (at your option) any later version. |
| 12 | + - |
| 13 | + - This program is distributed in the hope that it will be useful, |
| 14 | + - but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + - GNU Affero General Public License for more details. |
| 17 | + - |
| 18 | + - You should have received a copy of the GNU Affero General Public License |
| 19 | + - along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | + - |
| 21 | + --> |
| 22 | + |
| 23 | +<template> |
| 24 | + <section id="general_settings" class="federation section"> |
| 25 | + <h2> |
| 26 | + {{ t('spreed', 'Federation') }} |
| 27 | + <small>{{ t('spreed', 'Beta') }}</small> |
| 28 | + </h2> |
| 29 | + |
| 30 | + <NcCheckboxRadioSwitch :checked="isFederationEnabled" |
| 31 | + :disabled="loading" |
| 32 | + type="switch" |
| 33 | + @update:checked="saveFederationEnabled"> |
| 34 | + {{ t('spreed', 'Enable Federation in Talk app') }} |
| 35 | + </NcCheckboxRadioSwitch> |
| 36 | + </section> |
| 37 | +</template> |
| 38 | + |
| 39 | +<script> |
| 40 | +import { loadState } from '@nextcloud/initial-state' |
| 41 | + |
| 42 | +import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js' |
| 43 | + |
| 44 | +export default { |
| 45 | + name: 'Federation', |
| 46 | + |
| 47 | + components: { |
| 48 | + NcCheckboxRadioSwitch, |
| 49 | + }, |
| 50 | + |
| 51 | + data() { |
| 52 | + return { |
| 53 | + loading: false, |
| 54 | + isFederationEnabled: loadState('spreed', 'federation_enabled') === 'yes', |
| 55 | + } |
| 56 | + }, |
| 57 | + |
| 58 | + methods: { |
| 59 | + saveFederationEnabled(value) { |
| 60 | + this.loading = true |
| 61 | + |
| 62 | + OCP.AppConfig.setValue('spreed', 'federation_enabled', value ? 'yes' : 'no', { |
| 63 | + success: function() { |
| 64 | + this.loading = false |
| 65 | + this.isFederationEnabled = value |
| 66 | + }.bind(this), |
| 67 | + }) |
| 68 | + }, |
| 69 | + }, |
| 70 | +} |
| 71 | +</script> |
| 72 | + |
| 73 | +<style scoped lang="scss"> |
| 74 | +small { |
| 75 | + color: var(--color-warning); |
| 76 | + border: 1px solid var(--color-warning); |
| 77 | + border-radius: 16px; |
| 78 | + padding: 0 9px; |
| 79 | +} |
| 80 | +</style> |
0 commit comments