aboutsummaryrefslogtreecommitdiff
path: root/src/site/pages/dashboard/admin/settings.vue
blob: bac96839fa5ec520b08d8fb1b3606a9045bc5f23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<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>

					<JoiObject :keys="settingsSchema.keys" :values="{}" />
				</div>
			</div>
		</div>
	</section>
</template>

<script>
import { mapState } from 'vuex';
import Sidebar from '~/components/sidebar/Sidebar.vue';
import JoiObject from '~/components/settings/JoiObject.vue';

export default {
	components: {
		Sidebar,
		JoiObject
	},
	middleware: ['auth', 'admin', ({ store }) => {
		try {
			store.dispatch('admin/fetchSettings');
			store.dispatch('admin/getSettingsSchema');
		} catch (e) {
			// eslint-disable-next-line no-console
			console.error(e);
		}
	}],
	computed: mapState({
		settings: state => state.admin.settings,
		settingsSchema: state => state.admin.settingsSchema
	}),
	methods: {
		promptRestartService() {
			this.$buefy.dialog.confirm({
				message: 'Keep in mind that restarting only works if you have PM2 or something similar set up. Continue?',
				onConfirm: () => this.restartService()
			});
		},
		restartService() {
			this.$handler.executeAction('admin/restartService');
		}
	},
	head() {
		return {
			title: 'Service settings'
		};
	}
};
</script>