named anonymous functions
This commit is contained in:
@@ -47,7 +47,7 @@ All platforms and browsers
|
||||
- DONE Surface property that will force an item to be surfaced to the left of the menu in the app-bar
|
||||
- Keep the original in the menu though for people that are used to it?
|
||||
- DONE reorganize SAVE, DELETE ETC, put a divider between main form actions and then all the myriad of secondary things
|
||||
#### HERE -> LOCALIZE - check all new menu items, some might be not localized (look for ALL CAPS)
|
||||
- DONE LOCALIZE check all new menu items, some might be not localized (look for ALL CAPS)
|
||||
- WIRE UP logout link to go to login form and logout properly
|
||||
- WIRE up save menu item and add code to disable save on broken rules (and make red, disabled etc)
|
||||
- Wire up delete menu item
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-app id="AYANOVA">
|
||||
<v-app>
|
||||
<v-navigation-drawer v-if="isAuthenticated" fixed v-model="drawer" app>
|
||||
<v-list dense>
|
||||
<v-list-tile v-for="item in navItems" :key="item.route" :to="item.route">
|
||||
@@ -19,17 +19,17 @@
|
||||
<span>{{ appBar.title}}</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<v-toolbar-items>
|
||||
<template v-for="(item) in appBar.menuItems">
|
||||
<v-btn
|
||||
class="hidden-xs-only"
|
||||
class="hidden-xs-only"
|
||||
icon
|
||||
v-if="item.surface"
|
||||
:key="item.key"
|
||||
:disabled="item.disabled"
|
||||
@click="$gzevent.$emit('menu-click',item)"
|
||||
>
|
||||
<v-icon :color="item.color ? item.color : ''">{{ "fa-" + item.icon }}</v-icon>
|
||||
<v-icon :color="item.color ? item.color : ''">{{ "fa-" + item.icon }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-spacer></v-spacer>
|
||||
@@ -91,7 +91,6 @@ import aboutInfo from "./api/aboutinfo";
|
||||
import gzmenu from "./api/gzmenu";
|
||||
|
||||
export default {
|
||||
//name: "App",
|
||||
data() {
|
||||
return {
|
||||
drawer: null,
|
||||
@@ -101,8 +100,7 @@ export default {
|
||||
title: "",
|
||||
helpUrl: "index.html",
|
||||
menuItems: []
|
||||
},
|
||||
testcolor: "pink"
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -111,15 +109,17 @@ export default {
|
||||
//
|
||||
//
|
||||
var that = this;
|
||||
this.$gzevent.$on("menu-change", function(ctx) {
|
||||
this.$gzevent.$on("menu-change", function handleMenuChange(ctx) {
|
||||
gzmenu.handleMenuChange(that, ctx);
|
||||
});
|
||||
|
||||
this.$gzevent.$on("menu-replace-item", function(newItem) {
|
||||
this.$gzevent.$on("menu-replace-item", function handleReplaceMenuItem(
|
||||
newItem
|
||||
) {
|
||||
gzmenu.handleReplaceMenuItem(that, newItem);
|
||||
});
|
||||
|
||||
this.$gzevent.$on("menu-click", function(menuitem) {
|
||||
this.$gzevent.$on("menu-click", function handleMenuClick(menuitem) {
|
||||
gzmenu.handleClick(that, menuitem);
|
||||
});
|
||||
},
|
||||
@@ -132,14 +132,14 @@ export default {
|
||||
this.$router.replace({ name: "login" });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setAuthenticated(status) {
|
||||
this.$store.state.authenticated = status;
|
||||
},
|
||||
logout() {
|
||||
this.$store.state.authenticated = false;
|
||||
}
|
||||
},
|
||||
// methods: {
|
||||
// setAuthenticated(status) {
|
||||
// this.$store.state.authenticated = status;
|
||||
// },
|
||||
// logout() {
|
||||
// this.$store.state.authenticated = false;
|
||||
// }
|
||||
// },
|
||||
computed: {
|
||||
isAuthenticated() {
|
||||
return this.$store.state.authenticated === true;
|
||||
|
||||
@@ -17,7 +17,7 @@ export default {
|
||||
.then(() => {
|
||||
return Promise.resolve(true);
|
||||
}) //succeeded, nothing to return
|
||||
.catch(function(error) {
|
||||
.catch(function handleAuthError(error) {
|
||||
processLogout();
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
@@ -233,14 +233,14 @@ export default {
|
||||
//
|
||||
get(route) {
|
||||
var that = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise(function getDataFromServer(resolve, reject) {
|
||||
fetch(that.APIUrl(route), that.fetchGetOptions())
|
||||
.then(that.status)
|
||||
.then(that.json)
|
||||
.then(response => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function handleGetError(error) {
|
||||
//fundamental error, can't proceed with this call
|
||||
handleError("GET", error, route, reject);
|
||||
});
|
||||
@@ -251,7 +251,7 @@ export default {
|
||||
//
|
||||
upsert(route, data) {
|
||||
var that = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise(function upsertDataToServer(resolve, reject) {
|
||||
//determine if this is a new or existing record
|
||||
var fetchOptions = undefined;
|
||||
if (data.concurrencyToken) {
|
||||
@@ -268,7 +268,7 @@ export default {
|
||||
//and let the caller deal with it appropriately
|
||||
resolve(response);
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function handleUpsertError(error) {
|
||||
handleError("UPSERT", error, route, reject);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -84,6 +84,10 @@ export default {
|
||||
} else {
|
||||
alert("STUB gzmenu::handleClick - menu item clicked: " + menuitem.key);
|
||||
}
|
||||
|
||||
//Logout
|
||||
// auth.logout();
|
||||
// this.$router.replace({ name: "login" });
|
||||
}
|
||||
}
|
||||
//new functions above here
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function initialize() {
|
||||
//Fetch the core localized text keys that will always be required by user
|
||||
locale
|
||||
.fetch(locale.coreKeys)
|
||||
.then(function() {
|
||||
.then(function putFetchedNavItemsInStore() {
|
||||
//put nav items into store
|
||||
//Everyone has a home
|
||||
addNavItem(locale.get("Home"), "home", "/");
|
||||
@@ -74,7 +74,7 @@ export default function initialize() {
|
||||
addNavItem(locale.get("HelpAboutAyaNova"), "info-circle", "/about");
|
||||
addNavItem(locale.get("Logout"), "sign-out-alt", "/login");
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function handleIntializeError(error) {
|
||||
store.commit("logItem", "Initialize::() ltfetch -> error" + error);
|
||||
throw error;
|
||||
});
|
||||
@@ -110,7 +110,7 @@ export default function initialize() {
|
||||
locale.timeZoneOffset = res.data.timeZoneOffset;
|
||||
}
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function handleFetchUserOptionsError(error) {
|
||||
store.commit(
|
||||
"logItem",
|
||||
"Initialize::() fetch useroptions -> error" + error
|
||||
|
||||
@@ -12,7 +12,7 @@ export default {
|
||||
return store.state.localeText[key];
|
||||
},
|
||||
fetch(keys) {
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(function fetchLocaleKeysFromServer(resolve) {
|
||||
//, reject
|
||||
//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
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
.then(apiUtil.status)
|
||||
.then(apiUtil.json)
|
||||
.then(response => {
|
||||
_.forEach(response.data, function(item) {
|
||||
_.forEach(response.data, function commitFetchedLTItemToStore(item) {
|
||||
store.commit("addLocaleText", item);
|
||||
});
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ export default {
|
||||
"RowsPerPage"
|
||||
])
|
||||
.then(() => {
|
||||
that.$_.forEach(that.headers, function(header) {
|
||||
that.$_.forEach(that.headers, function setHeaderLocalizedText(header) {
|
||||
header.text = that.$gzlocale.get(header.text);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -114,24 +114,24 @@ document.addEventListener("fetchEnd", function() {
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// FILTERS
|
||||
//
|
||||
Vue.filter("capitalize", function(value) {
|
||||
Vue.filter("capitalize", function vueFilterCapitalize(value) {
|
||||
if (!value) return "";
|
||||
value = value.toString();
|
||||
return value.charAt(0).toUpperCase() + value.slice(1);
|
||||
});
|
||||
|
||||
Vue.filter("shortdate", function(value) {
|
||||
Vue.filter("shortdate", function vueFilterShortDate(value) {
|
||||
if (!value) return "";
|
||||
var dj = dayjs(value);
|
||||
return dj.format("YYYY-MM-DD hh:mm:ss A");
|
||||
});
|
||||
|
||||
Vue.filter("currency", function(value) {
|
||||
Vue.filter("currency", function vueFilterCurrency(value) {
|
||||
if (!value) return "";
|
||||
return "$" + value;
|
||||
});
|
||||
|
||||
Vue.filter("boolastext", function(value) {
|
||||
Vue.filter("boolastext", function vueFilterBoolAsText(value) {
|
||||
if (!value) return "";
|
||||
return value ? "Yes" : "Nope";
|
||||
});
|
||||
|
||||
@@ -139,7 +139,7 @@ export default {
|
||||
.then(response => {
|
||||
this.serverInfo = response.data;
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function handleGetServerInfoError(error) {
|
||||
throw error;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -235,7 +235,7 @@ export default {
|
||||
that.obj = res.data;
|
||||
}
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function handleGetDataFromAPIError(error) {
|
||||
that.$gzHandleFormError(error, that);
|
||||
});
|
||||
},
|
||||
@@ -265,7 +265,7 @@ export default {
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function handleSubmitError(error) {
|
||||
that.$gzHandleFormError(error, that);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
export default {
|
||||
created() {
|
||||
var outText = "";
|
||||
this.$_.forEach(this.$store.state.logArray, function(value) {
|
||||
this.$_.forEach(this.$store.state.logArray, function appendLogItem(value) {
|
||||
outText += value + "\n";
|
||||
});
|
||||
this.logText = outText;
|
||||
|
||||
@@ -81,7 +81,7 @@ export default {
|
||||
.then(() => {
|
||||
this.$router.replace({ name: "home" });
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function handleCaughtLoginError(error) {
|
||||
/* xeslint-disable-next-line */
|
||||
if (
|
||||
error.message &&
|
||||
|
||||
Reference in New Issue
Block a user