This commit is contained in:
2020-10-08 17:41:35 +00:00
parent 2beec7ebde
commit dc20540e91
4 changed files with 42 additions and 23 deletions

View File

@@ -438,7 +438,7 @@ export default {
return ( return (
!!obj && !!obj &&
(keyParts.length > 1 (keyParts.length > 1
? has(obj[key.split(".")[0]], keyParts.slice(1).join(".")) ? this.has(obj[key.split(".")[0]], keyParts.slice(1).join("."))
: hasOwnProperty.call(obj, key)) : hasOwnProperty.call(obj, key))
); );
}, },

View File

@@ -12,33 +12,52 @@ export default {
if (editedTranslation) { if (editedTranslation) {
//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(
cacheval, //de-lodash
cachekey // window.$gz._.forOwn(window.$gz.store.state.translationText, function(
) { // cacheval,
//find match // cachekey
//de-lodash // ) {
// let display = window.$gz. _.find(editedTranslation.translationItems, { // //find match
// key: cachekey // //de-lodash
// }).display; // // let display = window.$gz. _.find(editedTranslation.translationItems, {
let display = editedTranslation.translationItems.find( // // key: cachekey
z => z.key == cachekey // // }).display;
).display; // let display = editedTranslation.translationItems.find(
// z => z.key == cachekey
// ).display;
// window.$gz.store.commit("setTranslationText", {
// key: cachekey,
// value: display
// });
// });
for (const [key, value] of Object.entries(window.$gz.type)) {
let display = editedTranslation.translationItems.find(z => z.key == key)
.display;
window.$gz.store.commit("setTranslationText", { window.$gz.store.commit("setTranslationText", {
key: cachekey, key: key,
value: display value: value
}); });
}); }
} 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
let needIt = []; let needIt = [];
window.$gz._.forOwn(window.$gz.store.state.translationText, function(
cacheval, //de-lodash
cachekey // window.$gz._.forOwn(window.$gz.store.state.translationText, function(
) { // cacheval,
needIt.push(cachekey); // cachekey
// ) {
// needIt.push(cachekey);
// });
Object.keys(window.$gz.store.state.translationText).forEach(z => {
needIt.push(z);
}); });
//fetch these keys //fetch these keys
let transData = await window.$gz.api.upsert("translation/subset", needIt); let transData = await window.$gz.api.upsert("translation/subset", needIt);
transData.data.forEach(function commitFetchedTranslationItemToStore( transData.data.forEach(function commitFetchedTranslationItemToStore(

View File

@@ -514,7 +514,7 @@ export default {
//this example does remove from the array and does update a plain mustache rendition of it on the page but doesn't update the select itself //this example does remove from the array and does update a plain mustache rendition of it on the page but doesn't update the select itself
//whereas using the native javascript array splice function *does* update the select because vue wraps splice and other native methods specifically //whereas using the native javascript array splice function *does* update the select because vue wraps splice and other native methods specifically
//so it can properly update the dom //so it can properly update the dom
// window.$gz._.remove(vm.selectLists.listViews, function(n) { // window.$gz. _.remove(vm.selectLists.listViews, function(n) {
// return n.id == -1; // return n.id == -1;
// }); // });

View File

@@ -62,7 +62,7 @@ import chartBarHorizontalControl from "./components/chart-bar-horizontal-control
//DEVELOPMENT MODE //DEVELOPMENT MODE
//THIS SHOULD BE FALSE IN RELEASE //THIS SHOULD BE FALSE IN RELEASE
//************************************************************ //************************************************************
const DEV_MODE = false; const DEV_MODE = true;
//************************************************************ //************************************************************
//************************************************************** //**************************************************************
//************************************************************** //**************************************************************