This commit is contained in:
2019-03-06 21:35:50 +00:00
parent 60717ac8e0
commit d6a82f902e
3 changed files with 33 additions and 60 deletions

View File

@@ -11,7 +11,9 @@ export default {
} }
return store.state.localeText[key]; return store.state.localeText[key];
}, },
isFetching: false,
fetch(keys) { fetch(keys) {
this.isFetching = true;
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
//step 1: build an array of keys that we don't have already //step 1: build an array of keys that we don't have already
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen //Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
@@ -23,6 +25,7 @@ export default {
} }
if (needIt.length == 0) { if (needIt.length == 0) {
resolve(); resolve();
this.isFetching = false;
return; return;
} }
//step 2: get it //step 2: get it
@@ -34,9 +37,11 @@ export default {
store.commit("addLocaleText", item); store.commit("addLocaleText", item);
}); });
resolve(); resolve();
this.isFetching = false;
}) })
.catch(function(error) { .catch(function(error) {
reject(error); reject(error);
this.isFetching = false;
}); });
}); });
}, },

View File

@@ -27,13 +27,6 @@
</v-container> </v-container>
</v-flex> </v-flex>
</v-layout> </v-layout>
<!-- <v-layout align-center justify-center row fill-height>
<WidgetTop/>
<PartTop/>
<PartAssemblyTop/>
<WarehouseTop/>
<POTop/>
</v-layout>-->
</template> </template>
<script> <script>
@@ -43,22 +36,13 @@ import WarehouseTop from "../components/inventorywarehousetop";
import POTop from "../components/inventorypotop"; import POTop from "../components/inventorypotop";
import PartTop from "../components/inventoryparttop"; import PartTop from "../components/inventoryparttop";
import PartAssemblyTop from "../components/inventorypartassemblytop"; import PartAssemblyTop from "../components/inventorypartassemblytop";
/*
HMMM?? - Maybe top level category is "part" and inventory is a sub item like the rest since they all revolve around parts but are not all inventory
*/
// - PART REQUESTS OVERVIEW ETC....
// - PART ASSEMBLIES
// - PART CATEGORIES
// - PART WAREHOUSES
// - PARTS
// - Part inventory
// - Part inventory adjustments
//import store from "../store";
import lt from "../api/locale";
//import _ from "../utils/libs/lodash.js";
export default { export default {
beforeCreate() {
//Cache all required lt keys
var ltKeysRequired = ["Inventory"].concat(WidgetList.ltKeysRequired);
this.$gzlocale.fetch(ltKeysRequired);
},
components: { components: {
WidgetList, WidgetList,
WarehouseTop, WarehouseTop,
@@ -68,22 +52,6 @@ export default {
}, },
data() { data() {
return {}; return {};
},
beforeRouteEnter(to, from, next) {
//Cache all required lt keys
var ltKeysRequired = ["Inventory"].concat(WidgetList.ltKeysRequired);
lt.fetch(ltKeysRequired).then(() => {
next();
});
},
mounted() {},
methods: {
lt: function(key) {
return lt.get(key);
}
} }
}; };
</script> </script>
<style>
</style>

View File

@@ -1,42 +1,42 @@
<template> <template>
<v-layout row> <v-layout row v-if="this.ready">
<v-flex> <v-flex >
<h1>{{ lt("Log")}}</h1> <h1>{{ this.$gzlocale.get("Log")}}</h1>
<v-textarea v-model="logText" full-width readonly auto-grow></v-textarea> <v-textarea v-model="logText" full-width readonly auto-grow></v-textarea>
</v-flex> </v-flex>
</v-layout> </v-layout>
</template> </template>
<script> <script>
/* xeslint-disable */ /* eslint-disable */
//import lt from "../api/locale";
import store from "../store";
import lt from "../api/locale";
import _ from "../utils/libs/lodash.js"; import _ from "../utils/libs/lodash.js";
export default { export default {
data() { created() {
return { logText: "", blah: 2 }; var that = this;
// debugger;
this.$gzlocale
.fetch(["Log"])
.then(function() {
// Trigger the fetchEnd event
// document.dispatchEvent(fetchEnd);
console.log("FETCHED OK");
that.ready = true;
})
.catch(function(thing) {
// Trigger the fetchEnd event
//document.dispatchEvent(fetchEnd);
console.log("FETCHED FAILED!" + thing);
});
}, },
beforeRouteEnter(to, from, next) { data() {
lt.fetch(["Log"]).then(() => { return { logText: "", ready: false };
next();
});
}, },
mounted() { mounted() {
var outText = ""; var outText = "";
_.forEach(store.state.logArray, function(value) { _.forEach(this.$store.state.logArray, function(value) {
outText += value + "\n"; outText += value + "\n";
}); });
this.logText = outText; this.logText = outText;
},
methods: {
lt: function(key) {
return lt.get(key);
}
} }
}; };
</script> </script>
<style>
</style>