Skip to content

Commit f5f95a6

Browse files
Ryan DewMarkLogic Builder
authored andcommitted
DHFPROD-9767: Replace all value generated key refs with expression
1 parent c3eede0 commit f5f95a6

File tree

15 files changed

+380
-345
lines changed

15 files changed

+380
-345
lines changed

marklogic-data-hub-central/ui/e2e/cypress/e2e/explore/graphEntitiesSettings.cy.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ describe("Entity Type Settings Modal", () => {
210210

211211
cy.log("**Save the changes**");
212212
dataModelDisplaySettingsModal.getModalSaveButton().click();
213+
cy.waitForAsyncRequest();
213214
dataModelDisplaySettingsModal.getModalBody().should("not.exist");
214215

215216
cy.log("**Reopen the settings modal and check the new values**");
@@ -236,8 +237,9 @@ describe("Entity Type Settings Modal", () => {
236237
});
237238

238239
cy.log("**Click on customer node and verify that label in side bar**");
239-
cy.wait(2000);
240+
cy.wait(5000);
240241
graphExplore.stopStabilization();
242+
cy.waitForAsyncRequest();
241243
graphExplore.focusNode(ExploreGraphNodes.CUSTOMER_102);
242244
graphExplore.getPositionsOfNodes(ExploreGraphNodes.CUSTOMER_102).then((nodePositions: any) => {
243245
let customer_102_nodePosition: any = nodePositions[ExploreGraphNodes.CUSTOMER_102];
@@ -347,6 +349,7 @@ describe("Entity Type Settings Modal", () => {
347349
cy.log("**Click on customer node and verify that label in side bar**");
348350
cy.wait(1000);
349351
graphExplore.stopStabilization();
352+
cy.waitForAsyncRequest();
350353
graphExplore.focusNode(ExploreGraphNodes.CUSTOMER_102);
351354
graphExplore.getPositionsOfNodes(ExploreGraphNodes.CUSTOMER_102).then((nodePositions: any) => {
352355
let customer_102_nodePosition: any = nodePositions[ExploreGraphNodes.CUSTOMER_102];

marklogic-data-hub-central/ui/e2e/cypress/e2e/explore/graphLeafNodes.cy.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ describe("Leaf Nodes", () => {
1414
cy.log("**Logging into the app as a developer**");
1515
cy.loginAsDeveloper().withRequest();
1616
LoginPage.postLogin();
17-
});
18-
before(() => {
1917
cy.log("**Navigate to Explore**");
2018
toolbar.getExploreToolbarIcon().click();
2119
browsePage.waitForSpinnerToDisappear();
20+
cy.waitForAsyncRequest();
2221
});
2322
afterEach(() => {
2423
cy.clearAllSessionStorage();
@@ -49,7 +48,7 @@ describe("Leaf Nodes", () => {
4948
canvas.click(orderCoordinates.x, orderCoordinates.y, {force: true});
5049
//Hover to bring focus
5150
canvas.trigger("mouseover", orderCoordinates.x, orderCoordinates.y, {force: true});
52-
51+
cy.waitForAsyncRequest();
5352
graphExplore.stopStabilization();
5453
graphView.physicsAnimationToggle();
5554
});
@@ -62,6 +61,7 @@ describe("Leaf Nodes", () => {
6261

6362
canvas.rightclick(orderCoordinates.x, orderCoordinates.y, {force: true});
6463
graphExplore.clickShowRelated();
64+
cy.waitForAsyncRequest();
6565
graphExplore.stopStabilization();
6666
graphView.physicsAnimationToggle();
6767
});
@@ -112,12 +112,14 @@ describe("Leaf Nodes", () => {
112112
cy.log("**Coordinates should not exist because it was collapsed**");
113113
expect(orderCoordinates).to.be.undefined;
114114
});
115+
browsePage.removeBaseEntity("Customer");
116+
cy.waitForAsyncRequest();
117+
cy.wait(5000);
115118
});
116119
it("Verify if concepts leaf can be expanded properly. Select 'Product' entity", () => {
117-
browsePage.removeBaseEntity("Customer");
118120
entitiesSidebar.selectBaseEntityOption("Product");
119-
cy.wait(2000);
120121
cy.waitForAsyncRequest();
122+
cy.wait(2000);
121123

122124
graphExplore.fit();
123125
graphExplore.stopStabilization();
@@ -136,6 +138,7 @@ describe("Leaf Nodes", () => {
136138
graphView.physicsAnimationToggle();
137139

138140
graphExplore.clickShowRelated();
141+
cy.waitForAsyncRequest();
139142
graphExplore.stopStabilization();
140143
graphView.physicsAnimationToggle();
141144
});
@@ -148,6 +151,7 @@ describe("Leaf Nodes", () => {
148151

149152
//Click on node to open side panel
150153
canvas.click(officeCoordinates.x, officeCoordinates.y, {force: true});
154+
cy.waitForAsyncRequest();
151155
cy.wait(2000);
152156
graphView.physicsAnimationToggle();
153157
graphExploreSidePanel.getSidePanel().should("exist");
@@ -164,6 +168,7 @@ describe("Leaf Nodes", () => {
164168

165169
// Right click and expand the remaining records of the node
166170
canvas.rightclick(jeansCoordinates.x, jeansCoordinates.y, {force: true});
171+
cy.waitForAsyncRequest();
167172
graphExplore.stopStabilization();
168173
});
169174
});

marklogic-data-hub/src/main/resources/ml-modules/root/data-hub/5/data-services/graph/entitiesWithConceptsTypes.sjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ result.map(item => {
7171
}
7272
})
7373

74-
const supportsGraphConceptsSearch = graphUtils.supportsGraphConceptsSearch();
74+
const supportsGraphConceptsSearch = true;
7575

7676
hashmapEntityType.forEach (function(relatedConcepts, entityType) {
7777
let entityNode = {};
7878
entityNode.entityType = entityType;
79-
entityNode.relatedConcepts = supportsGraphConceptsSearch ? relatedConcepts: [];
79+
entityNode.relatedConcepts = relatedConcepts;
8080
nodes.push(entityNode);
8181
})
8282

marklogic-data-hub/src/main/resources/ml-modules/root/data-hub/5/data-services/graph/searchNodes.sjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ if (relatedEntityTypeIRIs.length) {
135135
let totalRelated = fn.head(totalRelatedEntities).total;
136136
totalCount += totalRelated;
137137
}
138-
if (graphUtils.supportsGraphConceptsSearch() && predicateConceptList.length) {
138+
if (predicateConceptList.length) {
139139
//get total Concepts
140140
let totalConcepts = graphUtils.getConceptCounting(entityTypeIRIs, predicateConceptList, ctsQuery);
141141
let totalConcept = fn.head(totalConcepts).total;
@@ -145,7 +145,7 @@ if (graphUtils.supportsGraphConceptsSearch() && predicateConceptList.length) {
145145
const totalEstimate = totalCount;
146146
const {nodes, edges} = graphUtils.graphResultsToNodesAndEdges(result, queryObj.entityTypeIds);
147147

148-
const supportsGraphConceptsSearch = graphUtils.supportsGraphConceptsSearch();
148+
const supportsGraphConceptsSearch = true;
149149
const response = {
150150
supportsGraphConceptsSearch,
151151
'total': (start === 0 && (!pageLength || totalEstimate < pageLength)) ? nodes.length: totalEstimate,

marklogic-data-hub/src/main/resources/ml-modules/root/data-hub/5/impl/entity-lib.sjs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -715,23 +715,30 @@ function getLabelFromHubConfigByEntityType(entityType, hubCentralConfig) {
715715
return "";
716716
}
717717

718-
function getValueFromProperty(propertyName, docUri,entityType) {
719-
const doc = cts.doc(docUri);
720-
if(fn.exists(doc.xpath(".//*:envelope/*:instance/*:"+entityType+"/*:"+propertyName))){
721-
return fn.data(doc.xpath(".//*:envelope/*:instance/*:"+entityType+"/*:"+propertyName));
718+
function getValueFromProperty(propertyName, doc, entityType) {
719+
const propertyNode = doc.xpath(".//*:envelope/*:instance/*:"+entityType+"/*:"+propertyName);
720+
if (fn.exists(propertyNode)) {
721+
return fn.data(propertyNode);
722722
}
723723
return "";
724724
}
725725

726+
const labelsByEntityType = new Map();
727+
726728
function getPropertiesOnHoverFromHubConfigByEntityType(entityType, hubCentralConfig) {
727-
if(hubCentralConfig != null && fn.exists(hubCentralConfig.xpath("/modeling/entities/" + entityType+"/propertiesOnHover"))){
728-
const obj = JSON.parse(hubCentralConfig);
729-
return obj.modeling.entities[entityType].propertiesOnHover;
729+
if (entityType && !labelsByEntityType.has(entityType)) {
730+
const propertiesOnHoverNode = fn.exists(hubCentralConfig) ? hubCentralConfig.xpath("/modeling/entities/" + entityType + "/propertiesOnHover"): null;
731+
if (fn.exists(propertiesOnHoverNode)) {
732+
const obj = JSON.parse(hubCentralConfig);
733+
labelsByEntityType.set(entityType, obj.modeling.entities[entityType].propertiesOnHover);
734+
} else {
735+
labelsByEntityType.set(entityType, "");
736+
}
730737
}
731-
return "";
738+
return labelsByEntityType.get(entityType);
732739
}
733740

734-
function getValuesPropertiesOnHover(docUri,entityType, hubCentralConfig) {
741+
function getValuesPropertiesOnHover(doc,entityType, hubCentralConfig) {
735742
let resultPropertiesOnHover = [];
736743
let configPropertiesOnHover = getPropertiesOnHoverFromHubConfigByEntityType(entityType, hubCentralConfig);
737744
if(configPropertiesOnHover.toString().length > 0){
@@ -741,7 +748,7 @@ function getValuesPropertiesOnHover(docUri,entityType, hubCentralConfig) {
741748
if(!entityPropertyName.includes(".")){
742749
//create an Property on hover object
743750
let objPropertyOnHover = new Object();
744-
objPropertyOnHover[entityPropertyName] = getValueFromProperty(entityPropertyName,docUri,entityType);
751+
objPropertyOnHover[entityPropertyName] = getValueFromProperty(entityPropertyName,doc,entityType);
745752
resultPropertiesOnHover.push(objPropertyOnHover);
746753
}else{
747754

@@ -757,18 +764,18 @@ function getValuesPropertiesOnHover(docUri,entityType, hubCentralConfig) {
757764
}
758765

759766
}
760-
objPropertyOnHover[entityPropertyName] = getValueFromPropertyPath(entityPropertyName,docUri,entityType, newPath);
767+
objPropertyOnHover[entityPropertyName] = getValueFromPropertyPath(entityPropertyName,doc,entityType, newPath);
761768
resultPropertiesOnHover.push(objPropertyOnHover);
762769
}
763770
}
764771
}
765772
return resultPropertiesOnHover;
766773
}
767774

768-
function getValueFromPropertyPath(path, docUri,entityType,propertyPath) {
769-
const doc = cts.doc(docUri);
770-
if(fn.exists(doc.xpath(".//*:envelope/*:instance/*:"+entityType+propertyPath))){
771-
return fn.data(doc.xpath(".//*:envelope/*:instance/*:"+entityType+propertyPath));
775+
function getValueFromPropertyPath(path, doc,entityType,propertyPath) {
776+
const propertyNode = doc.xpath(".//*:envelope/*:instance/*:"+entityType+propertyPath);
777+
if(fn.exists(propertyNode)){
778+
return fn.data(propertyNode);
772779
}
773780
return "";
774781
}

0 commit comments

Comments
 (0)