named anonymous functions

This commit is contained in:
2019-04-18 19:51:21 +00:00
parent 7770b8bad1
commit 8cdae969fb
13 changed files with 43 additions and 39 deletions

View File

@@ -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 - 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? - 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 - 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 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 save menu item and add code to disable save on broken rules (and make red, disabled etc)
- Wire up delete menu item - Wire up delete menu item

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-app id="AYANOVA"> <v-app>
<v-navigation-drawer v-if="isAuthenticated" fixed v-model="drawer" app> <v-navigation-drawer v-if="isAuthenticated" fixed v-model="drawer" app>
<v-list dense> <v-list dense>
<v-list-tile v-for="item in navItems" :key="item.route" :to="item.route"> <v-list-tile v-for="item in navItems" :key="item.route" :to="item.route">
@@ -19,17 +19,17 @@
<span>{{ appBar.title}}</span> <span>{{ appBar.title}}</span>
</v-toolbar-title> </v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-toolbar-items> <v-toolbar-items>
<template v-for="(item) in appBar.menuItems"> <template v-for="(item) in appBar.menuItems">
<v-btn <v-btn
class="hidden-xs-only" class="hidden-xs-only"
icon icon
v-if="item.surface" v-if="item.surface"
:key="item.key" :key="item.key"
:disabled="item.disabled" :disabled="item.disabled"
@click="$gzevent.$emit('menu-click',item)" @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> </v-btn>
</template> </template>
<v-spacer></v-spacer> <v-spacer></v-spacer>
@@ -91,7 +91,6 @@ import aboutInfo from "./api/aboutinfo";
import gzmenu from "./api/gzmenu"; import gzmenu from "./api/gzmenu";
export default { export default {
//name: "App",
data() { data() {
return { return {
drawer: null, drawer: null,
@@ -101,8 +100,7 @@ export default {
title: "", title: "",
helpUrl: "index.html", helpUrl: "index.html",
menuItems: [] menuItems: []
}, }
testcolor: "pink"
}; };
}, },
created() { created() {
@@ -111,15 +109,17 @@ export default {
// //
// //
var that = this; var that = this;
this.$gzevent.$on("menu-change", function(ctx) { this.$gzevent.$on("menu-change", function handleMenuChange(ctx) {
gzmenu.handleMenuChange(that, 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); gzmenu.handleReplaceMenuItem(that, newItem);
}); });
this.$gzevent.$on("menu-click", function(menuitem) { this.$gzevent.$on("menu-click", function handleMenuClick(menuitem) {
gzmenu.handleClick(that, menuitem); gzmenu.handleClick(that, menuitem);
}); });
}, },
@@ -132,14 +132,14 @@ export default {
this.$router.replace({ name: "login" }); this.$router.replace({ name: "login" });
} }
}, },
methods: { // methods: {
setAuthenticated(status) { // setAuthenticated(status) {
this.$store.state.authenticated = status; // this.$store.state.authenticated = status;
}, // },
logout() { // logout() {
this.$store.state.authenticated = false; // this.$store.state.authenticated = false;
} // }
}, // },
computed: { computed: {
isAuthenticated() { isAuthenticated() {
return this.$store.state.authenticated === true; return this.$store.state.authenticated === true;

View File

@@ -17,7 +17,7 @@ export default {
.then(() => { .then(() => {
return Promise.resolve(true); return Promise.resolve(true);
}) //succeeded, nothing to return }) //succeeded, nothing to return
.catch(function(error) { .catch(function handleAuthError(error) {
processLogout(); processLogout();
return Promise.reject(error); return Promise.reject(error);
}); });

View File

@@ -233,14 +233,14 @@ export default {
// //
get(route) { get(route) {
var that = this; var that = this;
return new Promise(function(resolve, reject) { return new Promise(function getDataFromServer(resolve, reject) {
fetch(that.APIUrl(route), that.fetchGetOptions()) fetch(that.APIUrl(route), that.fetchGetOptions())
.then(that.status) .then(that.status)
.then(that.json) .then(that.json)
.then(response => { .then(response => {
resolve(response); resolve(response);
}) })
.catch(function(error) { .catch(function handleGetError(error) {
//fundamental error, can't proceed with this call //fundamental error, can't proceed with this call
handleError("GET", error, route, reject); handleError("GET", error, route, reject);
}); });
@@ -251,7 +251,7 @@ export default {
// //
upsert(route, data) { upsert(route, data) {
var that = this; 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 //determine if this is a new or existing record
var fetchOptions = undefined; var fetchOptions = undefined;
if (data.concurrencyToken) { if (data.concurrencyToken) {
@@ -268,7 +268,7 @@ export default {
//and let the caller deal with it appropriately //and let the caller deal with it appropriately
resolve(response); resolve(response);
}) })
.catch(function(error) { .catch(function handleUpsertError(error) {
handleError("UPSERT", error, route, reject); handleError("UPSERT", error, route, reject);
}); });
}); });

View File

@@ -84,6 +84,10 @@ export default {
} else { } else {
alert("STUB gzmenu::handleClick - menu item clicked: " + menuitem.key); alert("STUB gzmenu::handleClick - menu item clicked: " + menuitem.key);
} }
//Logout
// auth.logout();
// this.$router.replace({ name: "login" });
} }
} }
//new functions above here //new functions above here

View File

@@ -20,7 +20,7 @@ export default function initialize() {
//Fetch the core localized text keys that will always be required by user //Fetch the core localized text keys that will always be required by user
locale locale
.fetch(locale.coreKeys) .fetch(locale.coreKeys)
.then(function() { .then(function putFetchedNavItemsInStore() {
//put nav items into store //put nav items into store
//Everyone has a home //Everyone has a home
addNavItem(locale.get("Home"), "home", "/"); addNavItem(locale.get("Home"), "home", "/");
@@ -74,7 +74,7 @@ export default function initialize() {
addNavItem(locale.get("HelpAboutAyaNova"), "info-circle", "/about"); addNavItem(locale.get("HelpAboutAyaNova"), "info-circle", "/about");
addNavItem(locale.get("Logout"), "sign-out-alt", "/login"); addNavItem(locale.get("Logout"), "sign-out-alt", "/login");
}) })
.catch(function(error) { .catch(function handleIntializeError(error) {
store.commit("logItem", "Initialize::() ltfetch -> error" + error); store.commit("logItem", "Initialize::() ltfetch -> error" + error);
throw error; throw error;
}); });
@@ -110,7 +110,7 @@ export default function initialize() {
locale.timeZoneOffset = res.data.timeZoneOffset; locale.timeZoneOffset = res.data.timeZoneOffset;
} }
}) })
.catch(function(error) { .catch(function handleFetchUserOptionsError(error) {
store.commit( store.commit(
"logItem", "logItem",
"Initialize::() fetch useroptions -> error" + error "Initialize::() fetch useroptions -> error" + error

View File

@@ -12,7 +12,7 @@ export default {
return store.state.localeText[key]; return store.state.localeText[key];
}, },
fetch(keys) { fetch(keys) {
return new Promise(function(resolve) { return new Promise(function fetchLocaleKeysFromServer(resolve) {
//, reject //, 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
@@ -33,7 +33,7 @@ export default {
.then(apiUtil.status) .then(apiUtil.status)
.then(apiUtil.json) .then(apiUtil.json)
.then(response => { .then(response => {
_.forEach(response.data, function(item) { _.forEach(response.data, function commitFetchedLTItemToStore(item) {
store.commit("addLocaleText", item); store.commit("addLocaleText", item);
}); });

View File

@@ -70,7 +70,7 @@ export default {
"RowsPerPage" "RowsPerPage"
]) ])
.then(() => { .then(() => {
that.$_.forEach(that.headers, function(header) { that.$_.forEach(that.headers, function setHeaderLocalizedText(header) {
header.text = that.$gzlocale.get(header.text); header.text = that.$gzlocale.get(header.text);
}); });
}) })

View File

@@ -114,24 +114,24 @@ document.addEventListener("fetchEnd", function() {
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// FILTERS // FILTERS
// //
Vue.filter("capitalize", function(value) { Vue.filter("capitalize", function vueFilterCapitalize(value) {
if (!value) return ""; if (!value) return "";
value = value.toString(); value = value.toString();
return value.charAt(0).toUpperCase() + value.slice(1); return value.charAt(0).toUpperCase() + value.slice(1);
}); });
Vue.filter("shortdate", function(value) { Vue.filter("shortdate", function vueFilterShortDate(value) {
if (!value) return ""; if (!value) return "";
var dj = dayjs(value); var dj = dayjs(value);
return dj.format("YYYY-MM-DD hh:mm:ss A"); return dj.format("YYYY-MM-DD hh:mm:ss A");
}); });
Vue.filter("currency", function(value) { Vue.filter("currency", function vueFilterCurrency(value) {
if (!value) return ""; if (!value) return "";
return "$" + value; return "$" + value;
}); });
Vue.filter("boolastext", function(value) { Vue.filter("boolastext", function vueFilterBoolAsText(value) {
if (!value) return ""; if (!value) return "";
return value ? "Yes" : "Nope"; return value ? "Yes" : "Nope";
}); });

View File

@@ -139,7 +139,7 @@ export default {
.then(response => { .then(response => {
this.serverInfo = response.data; this.serverInfo = response.data;
}) })
.catch(function(error) { .catch(function handleGetServerInfoError(error) {
throw error; throw error;
}); });
}, },

View File

@@ -235,7 +235,7 @@ export default {
that.obj = res.data; that.obj = res.data;
} }
}) })
.catch(function(error) { .catch(function handleGetDataFromAPIError(error) {
that.$gzHandleFormError(error, that); that.$gzHandleFormError(error, that);
}); });
}, },
@@ -265,7 +265,7 @@ export default {
} }
} }
}) })
.catch(function(error) { .catch(function handleSubmitError(error) {
that.$gzHandleFormError(error, that); that.$gzHandleFormError(error, that);
}); });
} }

View File

@@ -12,7 +12,7 @@
export default { export default {
created() { created() {
var outText = ""; var outText = "";
this.$_.forEach(this.$store.state.logArray, function(value) { this.$_.forEach(this.$store.state.logArray, function appendLogItem(value) {
outText += value + "\n"; outText += value + "\n";
}); });
this.logText = outText; this.logText = outText;

View File

@@ -81,7 +81,7 @@ export default {
.then(() => { .then(() => {
this.$router.replace({ name: "home" }); this.$router.replace({ name: "home" });
}) })
.catch(function(error) { .catch(function handleCaughtLoginError(error) {
/* xeslint-disable-next-line */ /* xeslint-disable-next-line */
if ( if (
error.message && error.message &&