Implemented reset settings and added missing options

Tags selection not added yet
This commit is contained in:
RemixDev 2020-05-03 16:21:37 +02:00
parent d69a4f022c
commit 24146b37b3
2 changed files with 50 additions and 7 deletions

View File

@ -421,7 +421,7 @@ <h2 id="settings_heading">Settings</h2>
</div> </div>
<div class="settings_group"> <div class="settings_group">
<h3>ARL</h3> <h3>Login</h3>
<div class="inline-flex"> <div class="inline-flex">
<input autocomplete="off" type="password" id="login_input_arl" ref="loginInput" placeholder="ARL" /> <input autocomplete="off" type="password" id="login_input_arl" ref="loginInput" placeholder="ARL" />
<button id="settings_btn_copyArl" @click="copyARLtoClipboard"> <button id="settings_btn_copyArl" @click="copyARLtoClipboard">
@ -586,10 +586,42 @@ <h3>Folders</h3>
<p>Save playlists as compilation</p> <p>Save playlists as compilation</p>
<input type="checkbox" v-model="settings.tags.savePlaylistAsCompilation"> <input type="checkbox" v-model="settings.tags.savePlaylistAsCompilation">
</div> </div>
<div class="input_group">
<p>Use null separator</p>
<input type="checkbox" v-model="settings.tags.useNullSeparator">
</div>
<div class="input_group">
<p>Save ID3v1 as well</p>
<input type="checkbox" v-model="settings.tags.saveID3v1">
</div>
<div class="input_group">
<p>How would you like to separate your artists?</p>
<select v-model="settings.tags.multitagSeparator">
<option value="default">Using standard specification</option>
<option value="andFeat">Using & and feat.</option>
<option value=" & ">Using " & "</option>
<option value=",">Using ","</option>
<option value=", ">Using ", "</option>
<option value="/">Using "/"</option>
<option value=" / ">Using "/ "</option>
<option value=";">Using ";"</option>
<option value="; ">Using "; "</option>
</select>
</div>
<div class="input_group"> <div class="input_group">
<p>Remove album version from track title</p> <p>Remove album version from track title</p>
<input type="checkbox" v-model="settings.removeAlbumVersion"> <input type="checkbox" v-model="settings.removeAlbumVersion">
</div> </div>
<div class="input_group">
<p>Date format for FLAC files</p>
<select v-model="settings.dateFormat">
<option value="Y-M-D">YYYY-MM-DD</option>
<option value="Y-D-M">YYYY-DD-MM</option>
<option value="D-M-Y">DD-MM-YYYY</option>
<option value="M-D-Y">MM-DD-YYYY</option>
<option value="Y">YYYY</option>
</select>
</div>
<div class="input_group"> <div class="input_group">
<p>What should I do with featured artists</p> <p>What should I do with featured artists</p>
<select v-model="settings.featuredToTitle"> <select v-model="settings.featuredToTitle">
@ -618,6 +650,11 @@ <h3>Folders</h3>
<option value="sentence">Like a sentence</option> <option value="sentence">Like a sentence</option>
</select> </select>
</div> </div>
<div class="input_group">
<p>Command to execute after download</p>
<p class="secondary-text">Leave blank for no action</p>
<input type="text" v-model="settings.executeCommand">
</div>
</div> </div>
<div id="settings_spotify_tab"> <div id="settings_spotify_tab">
<div class="input_group"> <div class="input_group">
@ -630,7 +667,8 @@ <h3>Folders</h3>
</div> </div>
</div> </div>
<footer> <footer>
<button id="settings_btn_save" @click="saveSettings">Save</button> <button @click="resetSettings">Reset to Default</button>
<button @click="saveSettings">Save</button>
</footer> </footer>
</div> </div>

View File

@ -7,7 +7,8 @@ const SettingsTab = new Vue({
settings: { tags: {} }, settings: { tags: {} },
lastSettings: {}, lastSettings: {},
lastCredentials: {}, lastCredentials: {},
spotifyFeatures: {} spotifyFeatures: {},
defaultSettings: {}
} }
}, },
methods: { methods: {
@ -27,7 +28,8 @@ const SettingsTab = new Vue({
this.lastCredentials = { ...SettingsTab.spotifyFeatures } this.lastCredentials = { ...SettingsTab.spotifyFeatures }
socket.emit('saveSettings', this.lastSettings, this.lastCredentials) socket.emit('saveSettings', this.lastSettings, this.lastCredentials)
}, },
loadSettings(settings, spotifyCredentials) { loadSettings(settings, spotifyCredentials, defaults=null) {
if (defaults) this.defaultSettings = { ...defaults }
this.lastSettings = { ...settings } this.lastSettings = { ...settings }
this.lastCredentials = { ...spotifyCredentials } this.lastCredentials = { ...spotifyCredentials }
this.settings = settings this.settings = settings
@ -42,14 +44,17 @@ const SettingsTab = new Vue({
logout() { logout() {
socket.emit('logout') socket.emit('logout')
}, },
initSettings(settings, credentials) { initSettings(settings, credentials, defaults) {
this.loadSettings(settings, credentials) this.loadSettings(settings, credentials, defaults)
toast('Settings loaded!', 'settings') toast('Settings loaded!', 'settings')
}, },
updateSettings(settings, credentials) { updateSettings(settings, credentials) {
this.loadSettings(settings, credentials) this.loadSettings(settings, credentials)
toast('Settings updated!', 'settings') toast('Settings updated!', 'settings')
} },
resetSettings(){
this.settings = { ...this.defaultSettings }
}
}, },
mounted() { mounted() {
socket.on('init_settings', this.initSettings) socket.on('init_settings', this.initSettings)