gancio-upstream/components/admin/Federation.vue

75 lines
2.5 KiB
Vue
Raw Normal View History

<template lang="pug">
2020-02-21 17:33:20 +01:00
el-main
el-switch.d-block(v-model='enable_federation' :active-text="$t('admin.enable_federation')")
small.text-secondary {{$t('admin.enable_federation_help')}}
2019-11-03 00:54:23 +01:00
2020-02-21 17:33:20 +01:00
template(v-if='enable_federation')
2019-11-03 00:54:23 +01:00
2020-02-21 17:33:20 +01:00
el-switch.d-block.mt-4(v-model='enable_resources' :active-text="$t('admin.enable_resources')")
small.text-secondary {{$t('admin.enable_resources_help')}}
2019-11-03 00:54:23 +01:00
2020-02-21 17:33:20 +01:00
el-switch.d-block.mt-4(v-model='hide_boosts' :active-text="$t('admin.hide_boost_bookmark')")
small.text-secondary {{$t('admin.hide_boost_bookmark_help')}}
div.mt-4 {{$t('admin.instance_name')}}
2020-03-14 18:45:20 +01:00
el-input(v-model='instance_name' placeholder='Instance name')
2020-02-21 17:33:20 +01:00
small.d-block.text-secondary {{$t('admin.instance_name_help')}} (<u>@{{instance_name}}@{{settings.baseurl|url2host}}</u>)
2019-10-30 15:01:15 +01:00
2020-03-14 18:45:20 +01:00
div.mt-4 {{$t('admin.trusted_instances')}}
el-input(v-model='instance_url')
el-button(slot='append' @click='createTrustedInstance') {{$t('common.send')}}
el-table(:data='settings.trusted_instances')
el-table-column(:label="$t('common.name')")
template(slot-scope='data')
span {{data.row.name}}
el-table-column(:label="$t('common.url')")
template(slot-scope='data')
span {{data.row.url}}
el-table-column(:label="$t('common.action')")
template(slot-scope='data')
el-button(size='mini'
type='danger'
@click='delete_instance(data.row)') {{$t('admin.delete_user')}}
</template>
<script>
2020-02-05 00:41:23 +01:00
import { mapActions, mapState } from 'vuex'
2019-12-04 01:20:31 +01:00
export default {
name: 'Federation',
2020-03-14 18:45:20 +01:00
data () {
return {
instance_url: ''
}
},
computed: {
...mapState(['settings']),
2019-12-04 01:20:31 +01:00
instance_name: {
get () { return this.settings.instance_name },
2020-01-15 23:38:03 +01:00
set (value) { this.setSetting({ key: 'instance_name', value }) }
2019-12-04 01:20:31 +01:00
},
enable_federation: {
get () { return this.settings.enable_federation },
set (value) { this.setSetting({ key: 'enable_federation', value }) }
},
2019-12-04 01:20:31 +01:00
enable_resources: {
get () { return this.settings.enable_resources },
set (value) { this.setSetting({ key: 'enable_resources', value }) }
},
2019-12-04 01:20:31 +01:00
hide_boosts: {
get () { return this.settings.hide_boosts },
set (value) { this.setSetting({ key: 'hide_boosts', value }) }
2019-10-28 17:33:20 +01:00
}
2020-02-05 00:41:23 +01:00
},
2020-02-21 17:33:20 +01:00
methods: {
...mapActions(['setSetting']),
save (key, value) {
if (this.settings[key] !== value) {
this.setSetting({ key, value })
}
2020-03-02 15:36:11 +01:00
}
2020-02-21 17:33:20 +01:00
}
}
2019-10-28 17:33:20 +01:00
</script>