Skip to content

Commit 9e0d227

Browse files
briantangMarkLogic Builder
authored andcommitted
DHFPROD-9658: Matching two URI's after a wrong match is unresponsive
1 parent fa16b5b commit 9e0d227

File tree

11 files changed

+82
-20
lines changed

11 files changed

+82
-20
lines changed

marklogic-data-hub-central/ui/e2e/cypress/integration/curation/curate/matching.spec.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,37 @@ describe("Matching", () => {
395395
// cy.findByTestId("ruleSet-slider-ticks").find(`div[style*="left: 19.1919%;"]`).trigger("mousemove", {force: true});
396396
// multiSlider.getHandleName("testMultipleProperty").trigger("mouseup", {force: true});
397397

398+
cy.log("**Test when user clicks on test button after adding/deleting URI's in 'Test Uris'**");
399+
matchingStepDetail.getUriOnlyRadio().click();
400+
for (let i = 0; i < 2; i++) {
401+
cy.waitUntil(() => matchingStepDetail.getUriOnlyInputField().clear().type(uris[i]));
402+
matchingStepDetail.getAddUriOnlyIcon().click();
403+
}
404+
//test two truthy URI matches
405+
matchingStepDetail.getTestMatchUriButton();
406+
cy.findByLabelText("noMatchedDataView").should("have.length.lt", 1);
407+
cy.get(`[id="testMatchedPanel"]`).contains(uriMatchedResults[0].ruleName).should("have.length.gt", 0);
408+
cy.findByText("(Threshold: " + uriMatchedResults[0].threshold + ")").should("have.length.gt", 0);
409+
410+
//delete one and test two faulty URI matches
411+
matchingStepDetail.getUriDeleteIcon().last().click();
412+
cy.waitUntil(() => matchingStepDetail.getUriOnlyInputField().clear().type("/json/persons/faulty-metaphone.json"));
413+
matchingStepDetail.getAddUriOnlyIcon().click();
414+
matchingStepDetail.getTestMatchUriButton();
415+
cy.findByLabelText("noMatchedDataView").should("have.length.gt", 0);
416+
417+
//test two truthy URI matches again
418+
matchingStepDetail.getUriDeleteIcon().last().click();
419+
cy.waitUntil(() => matchingStepDetail.getUriOnlyInputField().clear().type("/json/persons/first-name-double-metaphone2.json"));
420+
matchingStepDetail.getAddUriOnlyIcon().click();
421+
matchingStepDetail.getTestMatchUriButton();
422+
cy.findByLabelText("noMatchedDataView").should("have.length.lt", 1);
423+
cy.get(`[id="testMatchedPanel"]`).contains(uriMatchedResults[0].ruleName).should("have.length.gt", 0);
424+
cy.findByText("(Threshold: " + uriMatchedResults[0].threshold + ")").should("have.length.gt", 0);
425+
398426
//To test when users click on test button and no data is returned
399427
cy.log("**To test when users click on test button and no data is returned**");
400-
cy.findByLabelText("inputUriRadio").scrollIntoView({duration: 2000});
428+
cy.findByLabelText("inputUriRadio").scrollIntoView({duration: 2000}).click();
401429
cy.waitUntil(() => matchingStepDetail.getUriInputField().scrollIntoView().type("/json/noDataUri"));
402430
matchingStepDetail.getAddUriIcon().click();
403431
matchingStepDetail.getTestMatchUriButton();

marklogic-data-hub-central/ui/e2e/cypress/integration/explore/exploreGraphFacetConsistentNavigation.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ describe("Test navigation with facets from graph side panel to details twice", (
2929
toolbar.getExploreToolbarIcon().click();
3030

3131
cy.log("**Verify loading indicator in the graph**");
32-
browsePage.getGraphLoader().should("be.visible");
32+
graphExplore.getGraphLoader().should("be.visible");
3333
cy.log("**Select Graph view**");
3434
browsePage.clickGraphView();
3535
graphExplore.getGraphVisCanvas().should("be.visible");
36+
graphExplore.getStabilizationAlert().should("be.visible");
3637
graphExplore.stopStabilization();
3738

3839
cy.log("**Enter text in search field and apply facets**");

marklogic-data-hub-central/ui/e2e/cypress/support/components/matching/matching-step-detail.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ class MatchingStepDetail {
108108
return cy.findByLabelText("inputUriRadio");
109109
}
110110

111+
getUriOnlyRadio() {
112+
return cy.findByLabelText("inputUriOnlyRadio");
113+
}
114+
111115
verifyURIAdded(name: string) {
112116
return cy.findByText(name).scrollIntoView().should("be.visible");
113117
}

marklogic-data-hub-central/ui/e2e/cypress/support/pages/browse.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,10 +744,6 @@ class BrowsePage {
744744
return cy.get(`[data-testid="merge-icon${rowNum}"]`);
745745
}
746746

747-
//loading spinner and message container
748-
getGraphLoader() {
749-
return cy.get(`[aria-label="spinner-message-container"]`);
750-
}
751747
}
752748

753749
const browsePage = new BrowsePage();

marklogic-data-hub-central/ui/e2e/cypress/support/pages/graphExplore.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ class GraphExplore {
111111
getTooltip() {
112112
return cy.get(`div.vis-tooltip`);
113113
}
114+
getStabilizationAlert() {
115+
return cy.get(`[aria-label="graph-stabilization-alert"]`);
116+
}
117+
118+
//loading spinner and message container
119+
getGraphLoader() {
120+
return cy.get(`[aria-label="spinner-message-container"]`);
121+
}
122+
114123
getContextMenu() {
115124
return cy.waitUntil(() => cy.get("#contextMenu"));
116125
}

marklogic-data-hub-central/ui/src/components/entities/matching/matching-step-detail/matching-step-detail.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@
199199
margin-right: 0;
200200
}
201201

202+
.compareTestButton {
203+
width: 100px;
204+
}
205+
202206
.questionCircle {
203207
font-size: 12px;
204208
vertical-align: top;

marklogic-data-hub-central/ui/src/components/entities/matching/matching-step-detail/matching-step-detail.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const MatchingStepDetail: React.FC = () => {
100100
const [singleUriWarning2, setSingleUriWarning2] = useState(false);
101101
const [uriTestMatchClicked, setUriTestMatchClicked] = useState(uriTestStorage);
102102
const [loading, setToggleLoading] = useState(false);
103+
const [compareBtnLoading, setCompareBtnLoading] = useState<any>([]);
103104
const [allDataSelected, setAllDataSelected] = useState(false);
104105
const [testUrisOnlySelected, setTestUrisOnlySelected] = useState(true);
105106
const [testUrisAllDataSelected, setTestUrisAllDataSelected] = useState(false);
@@ -199,8 +200,9 @@ const MatchingStepDetail: React.FC = () => {
199200
setMatchingActivity(matchActivity);
200201
};
201202

202-
const handlePreviewMatchingActivity = async (testMatchData, previewActivity = previewMatchedActivity, thresholds = curationOptions.activeStep.stepArtifact.thresholds, setDataFunction = setPreviewMatchedData, setActivityFunction = setPreviewMatchedActivity, setDataList = setRulesetDataList, localRulesetDataList = rulesetDataList) => {
203+
const handlePreviewMatchingActivity = async (testMatchData, previewActivity = previewMatchedActivity, thresholds = curationOptions.activeStep.stepArtifact.thresholds, setDataFunction = setPreviewMatchedData, setActivityFunction = setPreviewMatchedActivity, setDataList = setRulesetDataList) => {
203204
const test = () => {
205+
let localRulesetDataList:any = [];
204206
for (let i = 0; i < thresholds.length; i++) {
205207
let ruleset = thresholds[i].thresholdName.concat(" - ") + thresholds[i].action;
206208
let score = thresholds[i].score;
@@ -221,21 +223,21 @@ const MatchingStepDetail: React.FC = () => {
221223
localRulesetDataList.push(localData);
222224
}
223225
}
224-
localRulesetDataList.shift();
226+
return localRulesetDataList;
225227
};
226228
previewActivity = await previewMatchingActivity(testMatchData);
227229
if (previewActivity) {
228230
setToggleLoading(false);
231+
let updatedRulesetList = await test();
229232
setDataFunction(previewActivity.actionPreview.length);
230-
await test();
231233
setActivityFunction(previewActivity);
232-
setDataList(localRulesetDataList);
234+
setDataList(updatedRulesetList);
233235
}
234236

235237
};
236238

237239
const handlePreviewNonMatchingActivity = async (testMatchData) => {
238-
await handlePreviewMatchingActivity(Object.assign({nonMatches: true}, testMatchedData), previewNonMatchedActivity, notMatchedThreshold, setPreviewNonMatchedData, setPreviewNonMatchedActivity, setRulesetNonMatchedDataList, rulesetNonMatchedDataList);
240+
await handlePreviewMatchingActivity(Object.assign({nonMatches: true}, testMatchedData), previewNonMatchedActivity, notMatchedThreshold, setPreviewNonMatchedData, setPreviewNonMatchedActivity, setRulesetNonMatchedDataList);
239241
};
240242

241243
const getKeysToExpandFromTable = async () => {
@@ -531,7 +533,8 @@ const MatchingStepDetail: React.FC = () => {
531533
setActiveMatchedUri(tmpActiveMatchedUri);
532534
};
533535

534-
const handleCompareButton = async (arr) => {
536+
const handleCompareButton = async (e, rulesetName, arr) => {
537+
setCompareBtnLoading([e.target.id, rulesetName]);
535538
setEntityProperties(curationOptions.entityDefinitionsArray[0].properties);
536539
const result1 = await getDocFromURI(arr[0]);
537540
const result2 = await getDocFromURI(arr[1]);
@@ -547,6 +550,7 @@ const MatchingStepDetail: React.FC = () => {
547550
let previewInstance = preview.data.value.envelope.instance;
548551
await setUriInfo([{result1Instance}, {result2Instance}, {previewInstance}]);
549552
}
553+
setCompareBtnLoading(["#", "#"]);
550554
setCompareModalVisible(true);
551555
setUrisCompared(uris);
552556
};
@@ -1083,7 +1087,7 @@ const MatchingStepDetail: React.FC = () => {
10831087
</span>
10841088
</Accordion.Button>
10851089
<div className={"p-2"}>
1086-
<HCButton size="sm" variant="primary" onClick={() => { handleCompareButton([actionPreviewData.uris[0], actionPreviewData.uris[1]]); }} aria-label={actionPreviewData.uris[0].substr(0, 41) + " compareButton"}>Compare</HCButton>
1090+
<HCButton size="sm" variant="primary" id={idx} className={styles.compareTestButton} onClick={(e) => { handleCompareButton(e, rulesetDataList.rulesetName, [actionPreviewData.uris[0], actionPreviewData.uris[1]]); }} loading={compareBtnLoading[0]?.toString() === idx.toString() && compareBtnLoading[1] === rulesetDataList.rulesetName ? true : false} aria-label={actionPreviewData.uris[0].substr(0, 41) + " compareButton"}>Compare</HCButton>
10871091
</div>
10881092
</div>
10891093
{curationOptions.activeStep?.stepArtifact?.matchRulesets &&
@@ -1142,7 +1146,7 @@ const MatchingStepDetail: React.FC = () => {
11421146
</span>
11431147
</Accordion.Button>
11441148
<div className={"p-2"}>
1145-
<HCButton size="sm" variant="primary" onClick={() => { handleCompareButton([actionPreviewData.uris[0], actionPreviewData.uris[1]]); }} aria-label={actionPreviewData.uris[0].substr(0, 41) + " compareButton"}>Compare</HCButton>
1149+
<HCButton size="sm" className={styles.compareTestButton} id={idx} variant="primary" onClick={(e) => { handleCompareButton(e, rulesetDataList.rulesetName, [actionPreviewData.uris[0], actionPreviewData.uris[1]]); }} loading={compareBtnLoading[0]?.toString() === idx.toString() && compareBtnLoading[1] === rulesetDataList.rulesetName ? true : false} aria-label={actionPreviewData.uris[0].substr(0, 41) + " compareButton"}>Compare</HCButton>
11461150
</div>
11471151
</div>
11481152
{curationOptions.activeStep?.stepArtifact?.matchRulesets &&

marklogic-data-hub-central/ui/src/components/explore/graph-view-explore/graph-view-explore.module.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
padding: 10px 10px 0px 0px;
33

44
.graphHeader {
5+
display: flex;
6+
flex-direction: column;
7+
}
8+
9+
.graphButtons {
510
display: flex;
611
justify-content: space-between;
712
width: 100%;

marklogic-data-hub-central/ui/src/components/explore/graph-view-explore/graph-view-explore.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {HCCheckbox, HCTooltip} from "@components/common";
1+
import {HCCheckbox, HCTooltip, HCAlert} from "@components/common";
22
import React, {CSSProperties, useEffect, useContext, useState} from "react";
33
import {getViewSettings, setViewSettings} from "@util/user-context";
44

@@ -215,8 +215,15 @@ const GraphViewExplore: React.FC<Props> = (props) => {
215215
? <span></span>
216216
: (<div className={styles.graphViewExploreContainer}>
217217
<div className={styles.graphHeader}>
218-
{graphSwitches}
219-
{headerButtons}
218+
<HCAlert
219+
variant="info"
220+
aria-label="graph-stabilization-alert"
221+
showIcon
222+
>{graphViewTooltips.graphStabilizationMessage}</HCAlert>
223+
<div className={styles.graphButtons}>
224+
{graphSwitches}
225+
{headerButtons}
226+
</div>
220227
</div>
221228
<div className={styles.borderBelowHeader}></div>
222229
<div>

marklogic-data-hub-central/ui/src/components/explore/graph-vis-explore/graph-vis-explore.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ const GraphVisExplore: React.FC<Props> = (props) => {
111111
} catch (err) {
112112
console.error("Error clearing the graph data before reset.");
113113
} finally {
114-
setIsLoading(true);
114+
115+
//**turn this back on to investigate how to show loading while nodes are bouncing/stabilizing**/
116+
// setIsLoading(true);
117+
//****************************** */
118+
115119
updateNodesData(getNodes());
116120
updateEdgesData(getEdges());
117121
setExpandedNodeData({});

0 commit comments

Comments
 (0)