This commit is contained in:
2020-12-22 16:09:35 +00:00
parent 1ad5246fba
commit 048fd308c7
4 changed files with 52 additions and 31 deletions

View File

@@ -70,7 +70,10 @@ currently doing: Review
Make sure can review from all edit forms
test it out full from front to back start to finish, lots of edges on this one
todo: make new review from a review for the same object (new menu option in review)
todo: make a new review from review list
todo: not able to make a new review from review list when it's just a direct viewing of list
or should I add an object selector? NO
EACH OBJECT DEV CYCLE:

View File

@@ -710,6 +710,22 @@ export default {
}
}
}
},
///////////////////////////////////
// FETCH BIZ OBJECT NAME
//
//
async fetchBizObjectName(ayaType, objectId) {
//todo: this is a good candidate for a light weight cache
//maybe one hour or something to invalidate and volatile on refresh
let res = await this.get(`name/${ayaType}/${objectId}`);
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);
} else {
return res.data;
}
}
//---------------

View File

@@ -229,11 +229,20 @@ export default {
throw "ObjectType and ObjectId are required to set a reminder";
}
vm.name = vm.$route.params.name;
window.$gz.form.setFormState({
vm: vm,
loading: false
});
}
if (!vm.name) {
vm.name = await window.$gz.api.fetchBizObjectName(
vm.obj.objectType,
vm.obj.objectId
);
}
window.$gz.form.setFormState({
vm: vm,
dirty: false,
@@ -681,9 +690,15 @@ async function clickHandler(menuItem) {
case "new":
m.vm.$router.push({
name: "review-edit",
params: { recordid: 0, new: true }
params: {
recordid: 0,
objectType: m.vm.obj.objectType,
objectId: m.vm.obj.objectId,
name: m.vm.name
}
});
break;
case "duplicate":
m.vm.duplicate();
break;

View File

@@ -1,6 +1,6 @@
<template>
<div>
<div v-if="objectType" class="mb-6">
<div v-if="objectType && objectId" class="mb-6">
<v-icon @click="navToTarget()" large>{{ iconForType() }}</v-icon
><span @click="navToTarget()" class="text-h5"> {{ name }}</span>
</div>
@@ -40,12 +40,8 @@ export default {
vm.$route.params.objectType
);
console.log("route params ingested as: ", {
id: vm.objectId,
type: vm.objectType
});
if (vm.objectId && vm.objectType) {
if (vm.objectId && vm.objectId != 0 && vm.objectType) {
console.log("reviews created:", { type: vm.objectType, id: vm.objectId });
//pre-filter
vm.metaView = JSON.stringify([
{
@@ -61,7 +57,10 @@ export default {
}
}
]);
await fetchObjectName(vm);
vm.name = await window.$gz.api.fetchBizObjectName(
vm.objectType,
vm.objectId
);
}
generateMenu(vm);
@@ -190,13 +189,15 @@ function generateMenu(vm) {
};
if (vm.rights.change) {
menuOptions.menuItems.push({
title: "New",
icon: "$ayiPlus",
surface: true,
key: FORM_KEY + ":new",
vm: vm
});
if (vm.objectId && vm.objectType) {
menuOptions.menuItems.push({
title: "New",
icon: "$ayiPlus",
surface: true,
key: FORM_KEY + ":new",
vm: vm
});
}
}
//REPORTS
@@ -227,18 +228,4 @@ function generateMenu(vm) {
});
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
///////////////////////////////////////////////////////////
//
//
async function fetchObjectName(vm) {
let res = await window.$gz.api.get(`name/${vm.objectType}/${vm.objectId}`);
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);
} else {
vm.name = res.data;
}
}
</script>