koel/resources/assets/js/components/main-wrapper/main-content/settings.vue

77 lines
1.7 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
2016-06-25 16:05:24 +00:00
<section id="settingsWrapper">
<h1 class="heading">
<span>Settings</span>
</h1>
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
<form @submit.prevent="save" class="main-scroll-wrap">
<div class="form-row">
<label for="inputSettingsPath">Media Path</label>
<p class="help">
The <em>absolute</em> path to the server directory containing your media.
Koel will scan this directory for songs and extract any available information.<br>
Scanning may take a while, especially if you have a lot of songs, so be patient.
</p>
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
<input type="text" v-model="state.settings.media_path" id="inputSettingsPath">
</div>
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
<div class="form-row">
<button type="submit">Scan</button>
</div>
</form>
</section>
2015-12-13 04:42:28 +00:00
</template>
<script>
2016-06-25 16:05:24 +00:00
import { settingStore } from '../../../stores';
import { parseValidationError, forceReloadWindow, event, showOverlay, hideOverlay } from '../../../utils';
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
export default {
data() {
return {
state: settingStore.state,
};
},
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
methods: {
/**
* Save the settings.
*/
save() {
showOverlay();
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
settingStore.update(() => {
forceReloadWindow();
}, error => {
let msg = 'Unknown error.';
2016-01-01 07:47:03 +00:00
2016-06-25 16:05:24 +00:00
if (error.status === 422) {
msg = parseValidationError(error.data)[0];
}
2016-06-25 16:05:24 +00:00
showOverlay(`Error: ${msg}`, 'error', true);
});
},
},
};
2015-12-13 04:42:28 +00:00
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
#settingsWrapper {
input[type="text"] {
width: 384px;
margin-top: 12px;
}
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
@media only screen and (max-width : 667px) {
input[type="text"] {
width: 100%;
2015-12-13 04:42:28 +00:00
}
2016-06-25 16:05:24 +00:00
}
}
2015-12-13 04:42:28 +00:00
</style>