This commit is contained in:
2018-11-16 18:52:48 +00:00
parent 869322032e
commit 7f8dca456a
7 changed files with 55 additions and 8 deletions

View File

@@ -48,6 +48,7 @@
<script> <script>
import aboutInfo from "./utils/aboutinfo"; import aboutInfo from "./utils/aboutinfo";
export default { export default {
name: "App", name: "App",
data() { data() {
@@ -55,6 +56,9 @@ export default {
drawer: null drawer: null
}; };
}, },
// beforeCreate() {
// },
mounted() { mounted() {
if (!this.$store.state.authenticated) { if (!this.$store.state.authenticated) {
this.$router.replace({ name: "login" }); this.$router.replace({ name: "login" });

View File

@@ -5,9 +5,13 @@ import App from "./App.vue";
import router from "./router"; import router from "./router";
import store from "./store"; import store from "./store";
import "./registerServiceWorker"; import "./registerServiceWorker";
import errorHandler from "./utils/errorhandler";
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.config.errorHandler = errorHandler.handleVueError;
window.onerror = errorHandler.handleGeneralError;
new Vue({ new Vue({
router, router,
store, store,

View File

@@ -1,6 +1,7 @@
import Vue from "vue"; import Vue from "vue";
import Vuex from "vuex"; import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate"; import createPersistedState from "vuex-persistedstate";
import _ from "./utils/libs/core.min.js";
Vue.use(Vuex); Vue.use(Vuex);
@@ -14,7 +15,7 @@ export default new Vuex.Store({
roles: 0, roles: 0,
localeText: {}, localeText: {},
navItems: [], navItems: [],
logBuffer: [] logArray: []
}, },
mutations: { mutations: {
login(state, data) { login(state, data) {
@@ -42,8 +43,12 @@ export default new Vuex.Store({
setAPIURL(state, data) { setAPIURL(state, data) {
state.apiUrl = data; state.apiUrl = data;
}, },
setLog(state, data) { logItem(state, msg) {
state.logBuffer = data; msg = Date.now() + "|" + msg;
state.logArray.push(msg);
if (state.logArray.length > 100) {
_.drop(state.logArray);
}
} }
}, },
actions: {} actions: {}

View File

@@ -0,0 +1,34 @@
/* xeslint-disable */
//import store from "../store";
function dealWithError(msg) {
alert(msg);
}
export default {
handleGeneralError(message, source, lineno, colno, error) {
var msg = "GeneralError: \n" + message;
if (source) {
msg += "\nsource: " + source;
}
if (lineno) {
msg += "\nlineno: " + lineno;
}
if (colno) {
msg += "\ncolno: " + colno;
}
if (error) {
msg += "\nerror: " + error;
}
dealWithError(msg);
},
handleVueError(err, vm, info) {
var msg = "VueError: \n" + err;
if (vm) {
msg += "\nvm present ";
}
if (info) {
msg += "\ninfo: " + info;
}
dealWithError(msg);
}
};

View File

@@ -1,4 +1,4 @@
/* eslint-disable */ /* xeslint-disable */
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
//in-memory log, keeps up to 100 of the past log items //in-memory log, keeps up to 100 of the past log items
// //
@@ -15,7 +15,7 @@ export default {
buffer.push(msg); buffer.push(msg);
store.commit("setLog", buffer.toArray()); store.commit("setLog", buffer.toArray());
}, },
getLogText(){ getLogText() {
//TODO: iterate the array from store, convert timestamps to local date and time and arrange as a block of multiline text to display in the UI //TODO: iterate the array from store, convert timestamps to local date and time and arrange as a block of multiline text to display in the UI
} }
}; };

View File

@@ -39,6 +39,7 @@
</template> </template>
<script> <script>
/* xeslint-disable */
import auth from "../api/auth"; import auth from "../api/auth";
export default { export default {
name: "Login", name: "Login",
@@ -52,9 +53,6 @@ export default {
}, },
methods: { methods: {
login() { login() {
// xeslint-disable-next-line
// debugger;
//console.log("Login.vue::page url is:" + this.$route.query.page);
if (this.input.username != "" && this.input.password != "") { if (this.input.username != "" && this.input.password != "") {
auth auth
.authenticate(this.input.username, this.input.password) .authenticate(this.input.username, this.input.password)

View File

@@ -62,6 +62,8 @@ NEXT UP / CURRENTLY WORKING ON:
- Widget: List, search, edit, localized WIDGET UI components - Widget: List, search, edit, localized WIDGET UI components
- Post up another build with the entry form and re-round of testing - Post up another build with the entry form and re-round of testing
- Stage 2.5 TESTING
- Enable some end to end testing and use it going forward all over.
- Stage 3: - Stage 3:
- At the end of this phase re-assess and see what needs to be the focus going forward and if anything is amiss - At the end of this phase re-assess and see what needs to be the focus going forward and if anything is amiss