v3.0.0/src/site/pages/dashboard/admin/settings.vue

134 lines
3.4 KiB
Vue
Raw Normal View History

2018-09-16 06:09:02 +02:00
<template>
<section class="section is-fullheight dashboard">
<div class="container">
<div class="columns">
<div class="column is-narrow">
<Sidebar />
</div>
<div class="column">
<h2 class="subtitle">Service settings</h2>
<hr>
2018-09-16 06:09:02 +02:00
<b-field label="Service name"
message="Please enter the name which this service is gonna be identified as"
horizontal>
<b-input v-model="options.serviceName"
expanded />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Upload folder"
message="Where to store the files relative to the working directory"
horizontal>
<b-input v-model="options.uploadFolder"
expanded />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Links per album"
message="Maximum links allowed per album"
horizontal>
<b-input v-model="options.linksPerAlbum"
type="number"
expanded />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Max upload size"
message="Maximum allowed file size in MB"
horizontal>
<b-input v-model="options.maxUploadSize"
expanded />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Filename length"
message="How many characters long should the generated filenames be"
horizontal>
<b-input v-model="options.filenameLength"
expanded />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Album link length"
message="How many characters a link for an album should have"
horizontal>
<b-input v-model="options.albumLinkLength"
expanded />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Generate thumbnails"
message="Generate thumbnails when uploading a file if possible"
horizontal>
<b-switch v-model="options.generateThumbnails"
:true-value="true"
:false-value="false" />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Generate zips"
message="Allow generating zips to download entire albums"
horizontal>
<b-switch v-model="options.generateZips"
:true-value="true"
:false-value="false" />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Public mode"
message="Enable anonymous uploades"
horizontal>
<b-switch v-model="options.publicMode"
:true-value="true"
:false-value="false" />
</b-field>
2019-02-26 14:26:03 +01:00
<b-field label="Enable creating account"
message="Enable creating new accounts in the platform"
horizontal>
<b-switch v-model="options.enableAccounts"
:true-value="true"
:false-value="false" />
</b-field>
2019-02-26 14:26:03 +01:00
<div class="mb2 mt2 text-center">
<button class="button is-primary"
@click="promptRestartService">Save and restart service</button>
2018-09-16 06:09:02 +02:00
</div>
</div>
</div>
</div>
</section>
</template>
<script>
2018-09-19 09:45:50 +02:00
import Sidebar from '~/components/sidebar/Sidebar.vue';
2018-09-16 06:09:02 +02:00
export default {
components: {
2018-09-19 09:45:50 +02:00
Sidebar
2018-09-16 06:09:02 +02:00
},
middleware: ['auth', 'admin'],
2018-09-16 06:09:02 +02:00
data() {
return {
2019-02-26 14:26:03 +01:00
options: {}
2018-09-16 06:09:02 +02:00
};
},
metaInfo() {
return { title: 'Settings' };
},
mounted() {
2019-02-28 15:26:44 +01:00
this.getSettings();
2018-09-16 06:09:02 +02:00
},
methods: {
2019-02-28 15:26:44 +01:00
async getSettings() {
const response = await this.$axios.$get(`service/config`);
this.options = response.config;
2019-02-28 15:26:44 +01:00
},
promptRestartService() {
2019-10-12 08:47:25 +02:00
this.$buefy.dialog.confirm({
2019-02-28 15:26:44 +01:00
message: 'Keep in mind that restarting only works if you have PM2 or something similar set up. Continue?',
onConfirm: () => this.restartService()
});
},
2019-02-26 14:26:03 +01:00
async restartService() {
const response = await this.$axios.$post(`service/restart`);
2019-10-12 08:47:25 +02:00
this.$buefy.toast.open(response.message);
2019-02-26 14:26:03 +01:00
}
2018-09-16 06:09:02 +02:00
}
};
</script>