TT#63409 SoundSets: As PBXAdmin I want to unset a SoundSet as contract default

Change-Id: I7c164c80757bfd5b63d01fa80fd1a6f58ff1ece2
changes/84/31884/2
Hans-Peter Herzog 6 years ago
parent 83771d7d56
commit 4800776290

@ -91,6 +91,10 @@ export function setAsDefault(soundSetId) {
return setSoundSetProperty(soundSetId, 'contract_default', true); return setSoundSetProperty(soundSetId, 'contract_default', true);
} }
export function unsetAsDefault(soundSetId) {
return setSoundSetProperty(soundSetId, 'contract_default', false);
}
export function setSoundSetName(soundSetId, name) { export function setSoundSetName(soundSetId, name) {
return setSoundSetProperty(soundSetId, 'name', name); return setSoundSetProperty(soundSetId, 'name', name);
} }

@ -209,9 +209,10 @@
}, },
methods: { methods: {
saveAsDefault() { saveAsDefault() {
if(!this.soundSet.contract_default) { this.$emit('save-as-default', {
this.$emit('save-as-default'); soundSetId: this.soundSet.id,
} contractDefault: !this.soundSet.contract_default
});
}, },
remove() { remove() {
if(this.$refs.listItem) { if(this.$refs.listItem) {

@ -61,7 +61,7 @@
:sound-file-update-state="soundFileUpdateState" :sound-file-update-state="soundFileUpdateState"
@require-sound-handles="loadSoundSetResources(soundSet.id)" @require-sound-handles="loadSoundSetResources(soundSet.id)"
@remove="openSoundSetRemovalDialog(soundSet.id)" @remove="openSoundSetRemovalDialog(soundSet.id)"
@save-as-default="setAsDefaultSoundSet(soundSet.id)" @save-as-default="setAsDefaultSoundSet"
@save-name="setSoundSetName" @save-name="setSoundSetName"
@save-description="setSoundSetDescription" @save-description="setSoundSetDescription"
@expand="expandSoundSet(soundSet.id)" @expand="expandSoundSet(soundSet.id)"

@ -16,7 +16,7 @@ import {
getAllSoundFilesBySoundSetId, getAllSoundFilesBySoundSetId,
getSoundFile, getSoundFile,
uploadSoundFile, uploadSoundFile,
setLoopPlay setLoopPlay, unsetAsDefault
} from "../api/pbx-soundsets"; } from "../api/pbx-soundsets";
import _ from "lodash"; import _ from "lodash";
import { import {
@ -324,9 +324,13 @@ export default {
context.commit('soundSetRemovalFailed', err.message); context.commit('soundSetRemovalFailed', err.message);
}); });
}, },
setAsDefaultSoundSet(context, soundSetId) { setAsDefaultSoundSet(context, options) {
context.commit('soundSetUpdateRequesting', soundSetId); context.commit('soundSetUpdateRequesting', options.soundSetId);
setAsDefault(soundSetId).then(()=>{ let func = setAsDefault;
if(options.contractDefault !== true) {
func = unsetAsDefault;
}
func(options.soundSetId).then(()=>{
return context.dispatch('loadSoundSetList', { return context.dispatch('loadSoundSetList', {
listVisible: true, listVisible: true,
page: context.state.soundSetListCurrentPage page: context.state.soundSetListCurrentPage

Loading…
Cancel
Save