This commit is contained in:
2020-04-09 19:34:10 +00:00
parent dafa4ad3c5
commit edcf0cdec6
2 changed files with 16 additions and 28 deletions

View File

@@ -50,9 +50,7 @@ CURRENT TODOs
@@@@@@@@@@@ ROADMAP STAGE 2:
todo: excerpt, add as part of item object and conditionally show
todo: search controller at server needs an excerpt route so client can request an excerpt for a record
todo: add integration test for search controller get excerpt route
todo: session cache search results and scroll position if possible to support "back and forthing"
todo: search what order should the results be retruned in, right now is by id but looks weird in list
todo: look at using finally block in all fetch form calls to do the things that are repeated in catch and then above it see search form for example

View File

@@ -83,31 +83,6 @@
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
/**
* NOTE: In router.js I've made the ayatype parameter OPTIONAL, so make sure to deal with that, it may be undefined, not just zero
* NOTE: going to default max results for simplicity, picklists are 100 but this should be higher so maybe 200 by default
* - PUT SEARCH into main menu, it's constantly there like help with the source as part of the data sent with the click
- I.E. source could be widget from list or widget entry form and so user is searching widgets or source could be a main page where there is no source
so it's empty and search everything
- User clicks on search, it opens a main search form view which is also accessible under HOME section normally so two ways to get there
- PUT SEARCH into HOME section as a main form (make sure it has no search button on *it's* menu)
- Search page allows to select types of objects in an array (maybe, did I code the server that way or single at a time object type)
- Also tags can be selected
- Object type and tag sb clearable with easy single clicks to speed up searching.
- Results are in standard grid list which is sortable or printable or openable to records etc
USE-CASE: No snippet (excerpts) just name and type.
- Excerpt available on demand (user clicks on excerpt button)
This search will return both widgets and users:
{
"phrase": "e*",
"nameOnly": false,
"typeOnly": 0,
"maxResults": 100
}
*
*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////
const FORM_KEY = "home-search";
@@ -116,6 +91,16 @@ const FORM_CUSTOM_TEMPLATE_KEY = "home-search";
const MAX_RESULTS = 200;
export default {
beforeRouteLeave(to, from, next) {
let vm = this;
//save last search in session cache if there is something to save
window.$gz.form.setFormSettings(FORM_KEY, {
temp: { page: vm.dataTablePagingOptions.page, cachedListView: cachedlv }
});
next();
},
created() {
let vm = this;
initForm(vm)
@@ -123,6 +108,11 @@ export default {
vm.formState.ready = true;
window.$gz.eventBus.$on("menu-click", clickHandler);
generateMenu(vm);
//get form settings from session cache, if same type as in route then re-use teh last search stuff
//however if different than need to clear it (or not rehydrate it)
let formSettings = window.$gz.form.getFormSettings(FORM_KEY);
if (vm.$route.params.ayatype) {
vm.searchObjectType = vm.$route.params.ayatype;
}