This commit is contained in:
2020-06-24 21:42:52 +00:00
parent 77621a4c9c
commit 272b620f61
3 changed files with 11 additions and 6 deletions

View File

@@ -11,7 +11,6 @@ export default {
//or they just edited a translation and saved it in translation editor and it's also their own local translation //or they just edited a translation and saved it in translation editor and it's also their own local translation
if (editedTranslation) { if (editedTranslation) {
console.log("Updating local translation");
//iterate the keys that are cached and set them from whatever is in editedTranslation for that key //iterate the keys that are cached and set them from whatever is in editedTranslation for that key
window.$gz._.forOwn(window.$gz.store.state.translationText, function( window.$gz._.forOwn(window.$gz.store.state.translationText, function(
cacheval, cacheval,
@@ -28,6 +27,7 @@ export default {
}); });
} else { } else {
//gather up the keys that are cached and fetch the latest and then replace them //gather up the keys that are cached and fetch the latest and then replace them
console.log("STUB:translation:updateCache");
} }
//if editedTranslation is empty that means just fetch the existing ones freshly again //if editedTranslation is empty that means just fetch the existing ones freshly again

View File

@@ -336,10 +336,6 @@ export default {
vm.obj.concurrency = res.data.concurrency; vm.obj.concurrency = res.data.concurrency;
//Update local copy of translations if that's the same one in use //Update local copy of translations if that's the same one in use
console.log(
"Editing active translation=",
vm.editingActiveTranslation
);
if (vm.editingActiveTranslation) { if (vm.editingActiveTranslation) {
await window.$gz.translation.updateCache(vm.obj); await window.$gz.translation.updateCache(vm.obj);
} }
@@ -592,7 +588,6 @@ async function fetchTranslatedText(vm) {
async function setEditingActiveTranslation(vm) { async function setEditingActiveTranslation(vm) {
if (vm.$route.params.recordid != 0) { if (vm.$route.params.recordid != 0) {
let res = await window.$gz.api.get("user-option/" + vm.$store.state.userId); let res = await window.$gz.api.get("user-option/" + vm.$store.state.userId);
vm.editingActiveTranslation = vm.editingActiveTranslation =
res.data.translationId == vm.$route.params.recordid; res.data.translationId == vm.$route.params.recordid;
} }

View File

@@ -164,6 +164,7 @@ export default {
selectLists: { selectLists: {
translations: [] translations: []
}, },
activeTranslationId: null,
darkMode: this.$store.state.darkMode, darkMode: this.$store.state.darkMode,
obj: { obj: {
/*concurrency": 7490431, /*concurrency": 7490431,
@@ -265,6 +266,7 @@ export default {
window.$gz.form.setErrorBoxErrors(vm); window.$gz.form.setErrorBoxErrors(vm);
} else { } else {
vm.obj = res.data; vm.obj = res.data;
vm.activeTranslationId = res.data.translationId;
//Update the form status //Update the form status
window.$gz.form.setFormState({ window.$gz.form.setFormState({
@@ -332,6 +334,14 @@ export default {
} }
window.$gz.store.commit("setLocale", l); window.$gz.store.commit("setLocale", l);
if (
vm.activeTranslationId &&
vm.activeTranslationId != vm.obj.translationId
) {
await window.$gz.translation.updateCache();
vm.activeTranslationId = vm.obj.translationId;
}
} }
} catch (error) { } catch (error) {
vm.formState.loading = false; vm.formState.loading = false;