This commit is contained in:
2018-11-13 22:31:57 +00:00
parent d90d6a160e
commit 15daaebab9
7 changed files with 30 additions and 40 deletions

View File

@@ -13512,6 +13512,11 @@
"integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==",
"dev": true
},
"shvl": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/shvl/-/shvl-1.3.1.tgz",
"integrity": "sha512-+rRPP46hloYUAEImJcqprUgXu+05Ikqr4h4V+w5i2zJy37nAqtkQKufs3+3S2fDq6JNRrHMIQhB/Vaex+jgAAw=="
},
"sigmund": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
@@ -15334,6 +15339,22 @@
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.0.1.tgz",
"integrity": "sha512-wLoqz0B7DSZtgbWL1ShIBBCjv22GV5U+vcBFox658g6V0s4wZV9P4YjCNyoHSyIBpj1f29JBoNQIqD82cR4O3w=="
},
"vuex-persistedstate": {
"version": "2.5.4",
"resolved": "https://registry.npmjs.org/vuex-persistedstate/-/vuex-persistedstate-2.5.4.tgz",
"integrity": "sha512-XYJhKIwO+ZVlTaXyxKxnplrJ88Fnvk5aDw753bxzRw5/yMKLQ6lq9CDCBex2fwZaQcLibhtgJOxGCHjy9GLSlQ==",
"requires": {
"deepmerge": "^2.1.0",
"shvl": "^1.3.0"
},
"dependencies": {
"deepmerge": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz",
"integrity": "sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA=="
}
}
},
"w3c-hr-time": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz",

View File

@@ -16,7 +16,8 @@
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuetify": "^1.3.0",
"vuex": "^3.0.1"
"vuex": "^3.0.1",
"vuex-persistedstate": "^2.5.4"
},
"devDependencies": {
"@cypress/webpack-preprocessor": "^3.0.0",

View File

@@ -3,24 +3,8 @@ import config from "../utils/config";
import api from "./apiutil";
import _ from "../utils/libs/core.min.js";
/*
Locale:
Methods
- This module is responsible for handling all localized text operations
- It stores a local in memory cache of the keys and returns them from cache whenever possible
- Method: Get keys one at a time or in an array
- a method that accepts lt keys and returns their text
- If a key is not in the cache here then it returns an obvious error string
- Method: pre-fetch / Cache keys
- Used to pre-fetch a bunch of keys at once if necessary
- A caller will call this with the list of keys it will need in advance, the ones that are not present in the cache will be fetched from the server and the cache populated
- No text is actually returned at this point, it's just a pre-setup kind of thing to ensure better perf later
- Method: Clear cache
- Clear the local cache entirely
*/
//Keep the localized text keys here temporarily
//TODO: rehydrate on page refresh / put in sessionstorage
var lt = {};
export default {

View File

@@ -1,9 +1,11 @@
import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";
Vue.use(Vuex);
export default new Vuex.Store({
plugins: [createPersistedState()],
state: {
authenticated: false,
apiUrl: "http://localhost:7575/api/v8.0/",

View File

@@ -39,10 +39,5 @@ export default {
return false;
}
return role === (store.state.roles & role);
//https://stackoverflow.com/questions/39359740/what-are-enum-flags-in-typescript
//https://stackoverflow.com/questions/15551652/javascript-enum-flag-check
// if ((role & flags.ERROR) == flags.ERROR) {
// alert("ERROR IS SET");
// }
}
};

View File

@@ -31,9 +31,10 @@ WEEK OF 2018-11-12 - RAVEN shell start work. YAY!
NEXT UP / CURRENTLY WORKING ON:
- lookup naming guidelines for javascript functions (capitalized?) and fixup the code and stick to it.
- Look over the (now two) api calls and look for optimization and code shrinkage / de-duplication
- Handle refresh with session storage and how to rehydrate stuff
- Move on to the next thing (build and post?)

View File

@@ -79,23 +79,9 @@ https://vuex.vuejs.org/guide/structure.html
VUEX STATE PERSISTENCE = VUEX-PERSISTEDSTATE
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- https://github.com/robinvdvleuten/vuex-persistedstate
- Some stuff should probably be persisted like auth, maybe other stuff?
- Is this app an online only app?
- Store enough stuff to keep working locally?
- Fill out a workorder offline?
- Create a new one offline?
- enter labour only, no parts or other lengthy lookup stuff??
- If recreating AyaNova 7 essentially, then that app is always online as well so maybe don't even consider offline work?
- Many things need to be persisted and survive a refresh so this is how it will be done
LOCALSTORAGE = Built in
=-=-=-=-=-=-=-=-=-=-=-=
- All modern browsers should support it and less libs the better
- Fallback if find it doesn't work:
- = STORE.JS Very widely used and I don't necessarily need a VUE specific one, this is the one used for pecklist and rockfish
- https://github.com/marcuswestin/store.js/
SERVICEWORKER = WORKBOX
=-=-=-=-=-=-=-=-=-=-=-=
For offsite PWA use, works well and is simple to implement