2018-05-17 21:40:41 +00:00
|
|
|
<template>
|
2018-07-01 19:50:50 +00:00
|
|
|
<div class="main pusher" v-title="labels.settings">
|
2018-05-17 21:40:41 +00:00
|
|
|
<div class="ui vertical stripe segment">
|
|
|
|
<div class="ui text container">
|
|
|
|
<div :class="['ui', {'loading': isLoading}, 'form']"></div>
|
|
|
|
<div id="settings-grid" v-if="settingsData" class="ui grid">
|
|
|
|
<div class="twelve wide stretched column">
|
|
|
|
<settings-group
|
|
|
|
:settings-data="settingsData"
|
|
|
|
:group="group"
|
|
|
|
:key="group.title"
|
|
|
|
v-for="group in groups" />
|
|
|
|
</div>
|
|
|
|
<div class="four wide column">
|
|
|
|
<div class="ui sticky vertical secondary menu">
|
2018-07-01 13:31:34 +00:00
|
|
|
<div class="header item"><translate>Sections</translate></div>
|
2018-05-17 21:40:41 +00:00
|
|
|
<a :class="['menu', {active: group.id === current}, 'item']"
|
|
|
|
@click.prevent="scrollTo(group.id)"
|
|
|
|
:href="'#' + group.id"
|
|
|
|
v-for="group in groups">{{ group.label }}</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
|
|
|
import $ from 'jquery'
|
|
|
|
|
|
|
|
import SettingsGroup from '@/components/admin/SettingsGroup'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
SettingsGroup
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
isLoading: false,
|
|
|
|
settingsData: null,
|
|
|
|
current: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created () {
|
|
|
|
let self = this
|
|
|
|
this.fetchSettings().then(r => {
|
|
|
|
self.$nextTick(() => {
|
|
|
|
if (self.$store.state.route.hash) {
|
|
|
|
self.scrollTo(self.$store.state.route.hash.substr(1))
|
|
|
|
}
|
2018-05-26 10:46:28 +00:00
|
|
|
$('select.dropdown').dropdown()
|
2018-05-17 21:40:41 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
scrollTo (id) {
|
|
|
|
this.current = id
|
|
|
|
document.getElementById(id).scrollIntoView()
|
|
|
|
},
|
|
|
|
fetchSettings () {
|
|
|
|
let self = this
|
|
|
|
self.isLoading = true
|
|
|
|
return axios.get('instance/admin/settings/').then((response) => {
|
|
|
|
self.settingsData = response.data
|
|
|
|
self.isLoading = false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2018-07-01 19:50:50 +00:00
|
|
|
labels () {
|
|
|
|
return {
|
|
|
|
settings: this.$gettext('Instance settings')
|
|
|
|
}
|
|
|
|
},
|
2018-05-17 21:40:41 +00:00
|
|
|
groups () {
|
2018-06-30 18:32:05 +00:00
|
|
|
// somehow, extraction fails if in the return block directly
|
|
|
|
let instanceLabel = this.$gettext('Instance information')
|
|
|
|
let usersLabel = this.$gettext('Users')
|
|
|
|
let playlistsLabel = this.$gettext('Playlists')
|
|
|
|
let federationLabel = this.$gettext('Federation')
|
|
|
|
let subsonicLabel = this.$gettext('Subsonic')
|
|
|
|
let statisticsLabel = this.$gettext('Statistics')
|
|
|
|
let errorLabel = this.$gettext('Error reporting')
|
2018-05-17 21:40:41 +00:00
|
|
|
return [
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: instanceLabel,
|
2018-05-17 21:40:41 +00:00
|
|
|
id: 'instance',
|
|
|
|
settings: [
|
|
|
|
'instance__name',
|
|
|
|
'instance__short_description',
|
|
|
|
'instance__long_description'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: usersLabel,
|
2018-05-17 21:40:41 +00:00
|
|
|
id: 'users',
|
|
|
|
settings: [
|
|
|
|
'users__registration_enabled',
|
2018-05-26 10:46:28 +00:00
|
|
|
'common__api_authentication_required',
|
2018-09-06 18:35:02 +00:00
|
|
|
'users__default_permissions',
|
|
|
|
'users__upload_quota'
|
2018-05-17 21:40:41 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: playlistsLabel,
|
2018-05-17 21:40:41 +00:00
|
|
|
id: 'playlists',
|
|
|
|
settings: [
|
|
|
|
'playlists__max_tracks'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: federationLabel,
|
2018-05-17 21:40:41 +00:00
|
|
|
id: 'federation',
|
|
|
|
settings: [
|
|
|
|
'federation__enabled',
|
|
|
|
'federation__music_needs_approval',
|
|
|
|
'federation__collection_page_size',
|
|
|
|
'federation__music_cache_duration',
|
|
|
|
'federation__actor_fetch_delay'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: subsonicLabel,
|
2018-05-17 21:40:41 +00:00
|
|
|
id: 'subsonic',
|
|
|
|
settings: [
|
|
|
|
'subsonic__enabled'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: statisticsLabel,
|
2018-05-17 21:40:41 +00:00
|
|
|
id: 'statistics',
|
|
|
|
settings: [
|
|
|
|
'instance__nodeinfo_enabled',
|
|
|
|
'instance__nodeinfo_stats_enabled',
|
|
|
|
'instance__nodeinfo_private'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: errorLabel,
|
2018-05-17 21:40:41 +00:00
|
|
|
id: 'reporting',
|
|
|
|
settings: [
|
|
|
|
'raven__front_enabled',
|
|
|
|
'raven__front_dsn'
|
|
|
|
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
settingsData () {
|
|
|
|
let self = this
|
|
|
|
this.$nextTick(() => {
|
|
|
|
$(self.$el).find('.sticky').sticky({context: '#settings-grid'})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|