This commit is contained in:
2020-01-15 00:42:35 +00:00
parent e6c7bd3a13
commit d01434c833
3 changed files with 38 additions and 41 deletions

View File

@@ -2,11 +2,12 @@ DISPLAY FORMAT TEMPLATE SYSTEM SPECS
OVERVIEW OVERVIEW
RAVEN uses a user customizable template to determine what fields in which order get sent to the client when they display a list or select from a drop down RAVEN uses a user customizable template to determine what fields in which order get sent to the client when they display a list or select from a drop down
- FILTER / SORT: The templating is ENTIRELY separate from the filtering and sorting code which is already coded sufficiently and is a separate thing
- Users with BIZ rights can set the template - Users with BIZ rights can set the template
- There is one template per list (not user based but global in nature) - There is one template per list (not user based but global in nature)
- Template affects both "MINI" single column display of list for small devices and large format wide mode with multiple columns for larger devices - Template affects both "MINI" single column display of list for small devices and "FULL" format wide mode with multiple columns for larger devices
- In MINI list format displays they choose which columns go into the one single column for display that is returned - In MINI list format displays they choose which columns go into the one single column for display that is returned
- In regular list format display they choose which columns are returned and which order separately from MINI format display - In FULL list format display they choose which columns are returned and which order separately from MINI format display
Narrow grids on small screens as well as picklists need to show a single field of information as required by that shop for selection, recognition etc so templated to format multiple return fields into one Narrow grids on small screens as well as picklists need to show a single field of information as required by that shop for selection, recognition etc so templated to format multiple return fields into one
Grids need a way to ensure you can see what you need on small devices as well they need to show the columns desired on larger devices Grids need a way to ensure you can see what you need on small devices as well they need to show the columns desired on larger devices
@@ -64,10 +65,10 @@ Back AND front end
MOCK TEMPLATE MOCK TEMPLATE
{ {
columns:[ full:[
ltKey,ltKey2,ltkey3
], ],
mini:[ mini:[
ltKey, ltkey2, ltkey3
] ]
} }

View File

@@ -20,7 +20,7 @@ REALLY MAKING MORE PROGRESS WHEN CLIENT DEV DRIVES BACKEND DEV, STICK TO THAT!!
----------------------- -----------------------
GRID LISTS TODO NOW: GRID LISTS TODO NOW:
- RECODE GETLIST in WidgetBiz
- Return JSON and internally work with JSON so the list can return dynamic object - Return JSON and internally work with JSON so the list can return dynamic object
- https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ - https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/
- https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#fast-built-in-json-support - https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#fast-built-in-json-support

View File

@@ -266,46 +266,26 @@ namespace AyaNova.Biz
// LISTS // LISTS
// //
// public static FilterOptions FilterOptions(long localizeToLocaleId = 0)
// {
// //NOTE: All column names are lowercase to conform with Postgres AyaNova DB which uses lowercase for all identifiers
// //Also all list keys are lower case for consistency
// FilterOptions f = new FilterOptions("widget");
// f.
// AddField("id", "ID", AyDataType.Integer).
// AddField("name", "WidgetName", AyDataType.Text).
// AddField("serial", "WidgetSerial", AyDataType.Integer).
// AddField("notes", "WidgetNotes", AyDataType.Text).
// AddField("dollaramount", "WidgetDollarAmount", AyDataType.Decimal).
// AddField("active", "Active", AyDataType.Bool).
// AddField("startdate", "WidgetStartDate", AyDataType.Date).
// AddField("count", "WidgetCount", AyDataType.Integer).
// AddField("tags", "Tags", AyDataType.Tags).
// AddField("enddate", "WidgetEndDate", AyDataType.Date);
// if (localizeToLocaleId != 0)
// f.Localize(localizeToLocaleId);
// return f;
// }
//get many (paged) //get many (paged)
internal async Task<JObject> GetList(IUrlHelper Url, string routeName, ListOptions pagingOptions) internal async Task<JObject> GetList(IUrlHelper Url, string routeName, ListOptions listOptions)
{ {
pagingOptions.Offset = pagingOptions.Offset ?? ListOptions.DefaultOffset; listOptions.Offset = listOptions.Offset ?? ListOptions.DefaultOffset;
pagingOptions.Limit = pagingOptions.Limit ?? ListOptions.DefaultLimit; listOptions.Limit = listOptions.Limit ?? ListOptions.DefaultLimit;
//BUILD THE QUERY //BUILD THE QUERY
//base query //base query
var q = "SELECT *, xmin FROM AWIDGET "; var q = "SELECT *, xmin FROM AWIDGET ";
//GET THE FILTER / SORT //GET THE FILTER / SORT
if (pagingOptions.DataFilterId > 0) if (listOptions.DataFilterId > 0)
{ {
var TheFilter = await ct.DataFilter.FirstOrDefaultAsync(x => x.Id == pagingOptions.DataFilterId); var TheFilter = await ct.DataFilter.FirstOrDefaultAsync(x => x.Id == listOptions.DataFilterId);
//BUILD WHERE AND APPEND IT //BUILD WHERE AND APPEND IT
q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, ObjectFields.ObjectFieldsList(ObjectFields.WIDGET_KEY), UserId); q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, ObjectFields.ObjectFieldsList(ObjectFields.WIDGET_KEY), UserId);
//BUILD ORDER BY AND APPEND IT //BUILD ORDER BY AND APPEND IT
q = q + FilterSqlOrderByBuilder.DataFilterToSQLOrderBy(TheFilter); q = q + FilterSqlOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
@@ -319,35 +299,51 @@ namespace AyaNova.Biz
#pragma warning disable EF1000 #pragma warning disable EF1000
//GET THE FULL LIST OF ITEMS //GET THE FULL LIST OF ITEMS
var items = await ct.Widget var items = await ct.Widget
.FromSqlRaw(q) .FromSqlRaw(q)
.AsNoTracking() .AsNoTracking()
.Skip(pagingOptions.Offset.Value) .Skip(listOptions.Offset.Value)
.Take(pagingOptions.Limit.Value) .Take(listOptions.Limit.Value)
.ToArrayAsync(); .ToArrayAsync();
//GET THE RECORD COUNT //GET THE RECORD COUNT
var totalRecordCount = await ct.Widget var totalRecordCount = await ct.Widget
.FromSqlRaw(q) .FromSqlRaw(q)
.AsNoTracking() .AsNoTracking()
.CountAsync(); .CountAsync();
#pragma warning restore EF1000 #pragma warning restore EF1000
//BUILD THE PAGING LINKS PORTION //BUILD THE PAGING LINKS PORTION
var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, totalRecordCount).PagingLinksObject(); var pageLinks = new PaginationLinkBuilder(Url, routeName, null, listOptions, totalRecordCount).PagingLinksObject();
//BUILD THE RETURN BASED ON TEMPLATE and MINI CONDITIONAL FORMAT //BUILD THE RETURN BASED ON TEMPLATE and MINI CONDITIONAL FORMAT
//TODO: Get template (MOCKED FOR NOW UNTIL PROOF OF CONCEPT) //TODO: Get template (MOCKED FOR NOW UNTIL PROOF OF CONCEPT)
/*{ "MyStringArray" : ["somestring1", "somestring2"] }
{
columns:[
ltKey,ltKey2,ltkey3
],
mini:[
ltKey, ltkey2, ltkey3
]
}
*/
var MOCK_DISPLAY_TEMPLATE = @"
{
""full"":[""WidgetName"",""WidgetSerial"",""WidgetDollarAmount"",""WidgetRoles"",""WidgetStartDate"",""Active""],
""mini"":[""WidgetName"",""WidgetSerial""]
}
";
//TODO: BUILD THE RETURN LIST OF FIELDS / TYPES AND ORDER FROM TEMPLATE AND MINI CONDITIONAL //TODO: BUILD THE RETURN LIST OF FIELDS / TYPES AND ORDER FROM TEMPLATE AND MINI CONDITIONAL
//TODO: BUILD THE RETURN LIST OF DATA ITEMS //TODO: BUILD THE RETURN LIST OF DATA ITEMS
//If mini format all desired columns in order into the single mini return display (and set the only other return field which is ID) //If mini format all desired columns in order into the single mini return display (and set the only other return field which is ID)
//If wide then format the fields in oder chosen (grid sort and filter template has already done that part above) //If wide then format the fields in oder chosen (grid sort and filter template has already done that part above)
//TODO: Genericize the above block of building return when it's working as this code needs to be central and optimized as much as possible //TODO: Genericize the above block of building return when it's working as this code needs to be central and optimized as much as possible
//New return code //New return code
dynamic ret = new JObject(); dynamic ret = new JObject();