2025-04-14 - Frontend LinkPath structure for tableOutput
Jump to navigation
Jump to search
Overview
Structure frontend TableConfig and Output prepare for shared library that creates complexFilter and requestProperties
Example params in tableConfig
let paramFromTableOutput = {
// .. other properties same as params sent to backend
// requiredDataFields not needed in tableConfig as referenced in elements and sortFields
// header/footer filterDataField elements reference valueUserTag
"elements": {
// shared types
"elementId12":{
"elementType": "freetext",
"value": "aa"
}
// headerFooter types
"elementId1":{
"elementType": "valueUserTag",
"valueUserTag": "userTag_9",
"inputType": "text" // || "select" || "checkbox" || "radio" ,
},
"elementId2":{
"elementType": "valueUserTag",
"inputType": "select",
"options": [
{
optionText:"option1",
valueUserTag:{
userTag_1:"valueA", //value not ref valueUserTag
userTag_2:"valueB"
},
{
optionText:"option2",
valueUserTag:{
userTag_9:"valueC"
},
],
},
"elementId21":{
"elementType": "valueUserTag",
"inputType": "checkbox",
"onSetting:{
optionText:"on",
valueUserTag:{
userTag_1:"valueA", //value not ref valueUserTag
userTag_2:"valueB"
},
},
"offSetting":{
optionText:"off",
valueUserTag:{
userTag_9:"valueC"
},
},
},
"elementId3":{
"elementType": "sort",
"display": "downArrow", // || upArrow
"requiredDataLinkStepObjectId": "userTag_LinkStepObjectC",
"dataType": "number", // "number" | "string"
"sortOrder": "ascending" // "ascending"|"descending" (default ascending)
},
"elementId4":{
"elementType": "numberOfRows",
"selection": "input" // || list
},
"elementId6":{
"elementType": "submit",
"display": "submit", // any text to be shown
"sendRequest": "all" // numberOfRows || all || filters
},
"elementId7":{
"elementType": "reset",
"display": "reset rows", // any text to be shown
"sendRequest": "numberOfRows" // numberOfRows || all || filters
},
"elementId9":{
"elementType": "totalDatafield",
"requiredDataLinkStepObjectId": "link1",
"showIfNotAllRowsLoaded": true // || false
},
"elementId11":{
// will need to link to per record check box
"elementType": "bulkAction",
"action": "on" // on | off | switch
"bulkActionUserTag": "tagA", // have normalized list of bulkActionTags, with list of "bulkAction" and "bulkActionCheckBox" elements linked to it
},
"elementId8":{
"elementType": "pageNumbers",
"linksAfter": [
{
"action": "jumpNumberOfPages",
"jumpPages": 7,
"string": ".."
},
{
"action": "jumpNumberOfPages",
"jumpPages": 1,
"string": ">"
},
{
"action": "goToLastPage",
"hideWhenLastPageShown": true,
"string": ">>"
}
],
"linksBefore": [
{
"action": "goToFirstPage",
"hideWhenFirstPageShown": true,
"string": "<<"
},
{
"action": "jumpNumberOfPages",
"jumpPages": 1,
"string": "<"
},
{
"action": "jumpNumberOfPages",
"jumpPages": 7,
"string": ".."
}
],
"showPagesAfter": 3,
"showPagesBefore": 3
},
// records types
"elementId5":{
"elementType": "requiredDataLinkStepObject", // in record
"requiredDataLinkStepObjectId": "link1",
},
"elementIdxx":{
"elementType": "bulkActionCheckBox",
"bulkActionUserTag": "tagA",
},
},
values: {
// values are shared between requestProperties and filter values. This set can be iterated to overwrite values using userTag to identify
userTag_1:{
defaultValue: "xx",
},
userTag_2:{
defaultValue: "xx",
},
userTag_3:{
defaultValue: "xx",
},
userTag_4:{
defaultValue: "xx",
},
userTag_5:{
defaultValue: "xx",
},
userTag_6:{
valueSource: "complexFilterCombination",
complexFilterCombinationId: "hash_complexFilterCombinationA",
},
userTag_7:{
valueSource: "perParentCombination",
perParentCombinationId: "hash_perParentCombinationA",
},
userTag_8: {
valueSource: 'perParentIdentifier',
perParentIdentifierFieldname: 'sellOfferId'
},,
userTag_9:{
defaultValue: "xx",
},
userTag_10:{
defaultValue: "xx",
},
userTag_11:{
defaultValue: "xx",
},
},
bulkActionUserTags: {
tagA:{
bulkActions: [
"elementId11",
// ...
],
bulkActionCheckBoxes: [
"elementIdxx",
// ...
],
},
// ...
},
}
Example params sent to backend
let paramFromTableOutput = {
objType: { //* main objType
serviceTag: "ProductManager",
objectType: "Product"
},
initialLogicalElementId: "uuid_logical_1",
logicalElements: {
uuid_logical_1: {
logicalElementType: "logical",
previousLogicalElementId: null,
nextLogicalElementId: null,
objType: {
serviceTag: "ProductManager",
objectType: "product"
},
fieldName: "productId",
comparison: "equals",
valueUserTag: "userTag_1"
}
},
requiredDataFields: [ //* linkStepObjects to create main sort result's requiredData and sortFields
// not needed at tableConfig level because can be built from table's elements and sortFields before sending to lib that converts to backend structure
"userTag_LinkStepObjectA", // no link, field in main objType (structure same linkPath but only one step)
"userTag_LinkStepObjectB", // has link
],
complexFilterCombinations:{
hash_complexFilterCombinationA: {
objType: {
serviceTag: "Locations",
objectType: "locationNode"
},
initialLogicalElementId: "child_complexFilter_localtionNode",
logicalElements: {
child_complexFilter_localtionNode: {
logicalElementType: "childComplexFilter",
previousLogicalElementId: null,
nextLogicalElementId: null,
childLogicalElementId: "logical_locationNode",
objType: {
serviceTag: "Locations",
objectType: "locationNode"
},
pathLinkType: {
objType: {
serviceTag: "Locations",
objectType: "locationNode"
},
relType: {
serviceTag: "Locations",
relationshipTag: "hasParentLocationNode"
},
direction: "to"
},
},
logical_locationNode: {
logicalElementType: "logical",
previousLogicalElementId: "child_complexFilter_localtionNode",
nextLogicalElementId: null,
objType: {
serviceTag: "Locations",
objectType: "locationNode"
},
fieldName: "locationNodeId",
comparison: "equals",
valueUserTag: "userTag_7"
}
}
},
},
perParentCombinations:{
hash_perParentCombinationA: {
objType: {
serviceTag: "SellOfferPlan",
objectType: "sellOfferPlan"
},
initialLogicalElementId: "child_complexFilter_1",
logicalElements: {
child_complexFilter_1: {
logicalElementType: "childComplexFilter",
previousLogicalElementId: null,
nextLogicalElementId: null,
childLogicalElementId: "logical_sellOffer",
objType: {
serviceTag: "SellOfferPlan",
objectType: "sellOfferPlan"
},
pathLinkType: {
objType: {
serviceTag: "SellOfferManager",
objectType: "sellOffer"
},
relType: {
serviceTag: "SellOfferManager",
relationshipTag: "usesSellOfferPlan"
},
direction: "to"
},
requestProperties: {
tag_orderQuantity: "userTag_9"
}
},
logical_sellOffer: {
logicalElementType: "logical",
previousLogicalElementId: "child_complexFilter_1",
nextLogicalElementId: null,
objType: {
serviceTag: "SellOfferManager",
objectType: "sellOffer"
},
fieldName: "sellOfferId",
comparison: "equals",
valueUserTag: "userTag_8"
}
}
},
},
requiredDataLinkStepObjects: {
userTag_LinkStepObjectA: { //* requiredData no linkPath
initialObjType: { //* main objType
serviceTag: "ProductManager",
objectType: "Product"
},
linkSteps: ["hash_linkStepA_1"],
},
userTag_LinkStepObjectB: { // requiredDataFields for finding max orderTotal
initialObjType: { //* main objType
serviceTag: "ProductManager",
objectType: "Product"
},
linkSteps: ["hash_linkStepB_1", "hash_linkStepB_2", "hash_linkStepB_3"],
}
// userTag_LinkStepObjectC
// userTag_LinkStepObjectD
},
requiredDataLinkSteps: {
hash_linkStepA_1:{
fieldName: "xxx"
},
hash_linkStepB_1:{
pathLinkType: {
objType: {
serviceTag: "SellOfferManager",
objectType: "SellOffer"
},
relType: {
serviceTag: "ProductManager",
relationshipTag: "hasSellOffer"
},
direction: "to",
},
addFilterMain: true, //default: false => need to add filterMain set = true
filterElements: { //* filter in linkPath
objType: {
serviceTag: "SellOfferManager",
objectType: "SellOffer"
},
initialLogicalElementId: "logical_sellOffer_in_link",
logicalElements: {
logical_sellOffer_in_link: {
logicalElementType: "logical",
previousLogicalElementId: null,
nextLogicalElementId: null,
objType: {
serviceTag: "SellOfferManager",
objectType: "SellOffer"
},
fieldName: "userId",
comparison: "equals",
valueUserTag: "userTag_2"
}
}
},
},
hash_linkStepB_2: {
pathLinkType: {
objType: {
serviceTag: "OrderPrice",
objectType: "OrderPrice"
},
relType: {
serviceTag: "sellOfferStandard",
relationshipTag: "hasOrderPrice"
},
direction: "to",
},
requestProperties: {
tag_deliverTo: "userTag_3",
tag_sellOfferPlan: "userTag_4",
// tag_sellOfferPlanDeliveryMethodLink: "userTag_5",
// tag_sellOfferPlanUserPaymentMethodLink: "userTag_6"
}
aggregate: "max",
sortFields: [
{
requiredDataLinkStepObjectId: "userTag_LinkStepObjectC",
dataType: "number"
},
{
requiredDataLinkStepObjectId: "userTag_LinkStepObjectD",
dataType: "string"
},
{
requiredDataLinkStepObjectId: "userTag_LinkStepObjectD",
dataType: "array",
sortByValueUserTags:["userTag_1","userTag_2"]
}
],
comparison: "greaterThan",
comparisonSortField: "upToValue",
comparisonSortDataType: "string",
comparisonValue: "userTag_2",
},
hash_linkStepB_3: {
fieldName: "zzz",
}
},
sortFields: [
{
requiredDataLinkStepObjectId: "userTag_LinkStepObjectB",
dataType: "number",
sortOrder: "descending"
},
{
requiredDataLinkStepObjectId: "userTag_LinkStepObjectA",
dataType: "string"
},
{
requiredDataLinkStepObjectId: "userTag_LinkStepObjectD",
dataType: "array",
sortByValueUserTags:["userTag_1","userTag_2"]
}
],
valueUserTags: {
userTag_1:{
value: "xx",
},
userTag_2:{
value: "yy",
},
userTag_3:{
valueSource: "complexFilterCombination",
complexFilterCombinationId: "hash_complexFilterCombinationA",
},
userTag_4:{
valueSource: "perParentCombination",
perParentCombinationId: "hash_perParentCombinationA",
},
userTag_7: {
value: "zz",
},
userTag_8: {
valueSource: 'perParentIdentifier',
perParentIdentifierFieldname: 'sellOfferId'
},
userTag_9: {
value: 2,
},
}
}