Skip to content

Commit 3b39dfb

Browse files
MSBrignoniMarkLogic Builder
authored andcommitted
DHFPROD-8804-RunFlowAfterDeletingStep_5.7
1 parent b0dae7a commit 3b39dfb

File tree

10 files changed

+331
-60
lines changed

10 files changed

+331
-60
lines changed

marklogic-data-hub-central/ui/e2e/cypress/integration/curation/run/runFlow.spec.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,16 @@ describe("Run Tile tests", () => {
7474
runPage.openStepsSelectDropdown(flowName);
7575

7676
cy.log("**Unclick All Steps**");
77+
cy.get("#ingest-orders").click();
7778
cy.get("#ingest-orders").should("be.disabled");
7879
cy.get("#loadPersonXML").click();
7980
cy.get("#mapPersonXML").click();
8081
cy.get("#match-xml-person").click();
8182
cy.get("#merge-xml-person").click();
8283
cy.get("#master-person").click();
8384
cy.get("#generate-dictionary").click();
85+
cy.get("#checkAll").click();
8486
cy.get("#errorMessageEmptySteps").contains("Select at least one step to run a flow.");
85-
cy.get("#ingest-orders").click();
86-
cy.get("#loadPersonXML").should("be.disabled");
87-
cy.get("#ingest-orders").click();
88-
cy.get("#errorMessageEmptySteps").contains("Select at least one step to run a flow.");
89-
runPage.verifyDisabledRunButton(flowName);
9087

9188
cy.log("**Click Necessary Steps and Run**");
9289
cy.get("#loadPersonXML").click();

marklogic-data-hub-central/ui/src/components/entities/mapping/mapping-card.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ describe("Mapping Card component", () => {
310310

311311
// Dialog appears, click 'Yes'
312312
expect(getByLabelText("step-in-flow")).toBeInTheDocument();
313-
fireEvent.click(getByTestId("Mapping1-to-testFlow-Confirm"));
313+
fireEvent.click(getByTestId("Mapping1-to-testFlow-Exists-Confirm"));
314314

315315
//Check if the /tiles/run/add route has been called
316316
wait(() => { expect(mockHistoryPush).toHaveBeenCalledWith("/tiles/run/add"); });
@@ -464,8 +464,8 @@ describe("Mapping Card component", () => {
464464
expect(getByTestId(`${mappingStepName}-toExistingFlow`)).toBeInTheDocument();
465465
fireEvent.keyDown(getByLabelText(`${mappingStepName}-flowsList`), {key: "ArrowDown"});
466466
fireEvent.click(getByText(data.flows.data[0].name));
467-
fireEvent.click(getByText("Yes"));
468-
expect(mockAddStepToFlow).toBeCalledTimes(1);
467+
fireEvent.click(getByText("OK"));
468+
expect(mockAddStepToFlow).toBeCalledTimes(0);
469469

470470
// adding to new flow
471471
const mappingStep = getAllByText(mappingStepName);

marklogic-data-hub-central/ui/src/components/entities/mapping/mapping-card.tsx

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const MappingCard: React.FC<Props> = (props) => {
3838
const [mapData, setMapData] = useState({});
3939
const [dialogVisible, setDialogVisible] = useState(false);
4040
const [addDialogVisible, setAddDialogVisible] = useState(false);
41+
const [addExistingStepDialogVisible, setAddExistingStepDialogVisible] = useState(false);
4142
const [runNoFlowsDialogVisible, setRunNoFlowsDialogVisible] = useState(false);
4243
const [runOneFlowDialogVisible, setRunOneFlowDialogVisible] = useState(false);
4344
const [runMultFlowsDialogVisible, setRunMultFlowsDialogVisible] = useState(false);
@@ -97,6 +98,7 @@ const MappingCard: React.FC<Props> = (props) => {
9798
const onCancel = () => {
9899
setDialogVisible(false);
99100
setAddDialogVisible(false);
101+
setAddExistingStepDialogVisible(false);
100102
setRunNoFlowsDialogVisible(false);
101103
setRunOneFlowDialogVisible(false);
102104
setRunMultFlowsDialogVisible(false);
@@ -196,7 +198,11 @@ const MappingCard: React.FC<Props> = (props) => {
196198
const handleStepAdd = (mappingName, flowName) => {
197199
setMappingArtifactName(mappingName);
198200
setFlowName(flowName);
199-
setAddDialogVisible(true);
201+
if (isStepInFlow(mappingName, flowName)) {
202+
setAddExistingStepDialogVisible(true);
203+
} else {
204+
setAddDialogVisible(true);
205+
}
200206
};
201207

202208
const handleStepRun = (mappingName) => {
@@ -243,6 +249,9 @@ const MappingCard: React.FC<Props> = (props) => {
243249
});
244250
};
245251

252+
const onConfirmOk = () => {
253+
setAddExistingStepDialogVisible(false);
254+
};
246255

247256
const onAddOk = async (lName, fName) => {
248257
await props.addStepToFlow(lName, fName, "mapping");
@@ -266,10 +275,9 @@ const MappingCard: React.FC<Props> = (props) => {
266275
<Modal.Header className={"bb-none"}>
267276
<button type="button" className="btn-close" aria-label="Close" onClick={onCancel}></button>
268277
</Modal.Header>
269-
<Modal.Body className={"pt-0 pb-4"}>
278+
<Modal.Body className={"pt-0 pb-4 text-center"}>
270279
<div aria-label="add-step-confirmation" style={{fontSize: "16px"}}>
271-
{isStepInFlow(mappingArtifactName, flowName) ?
272-
<p aria-label="step-in-flow">The step <strong>{mappingArtifactName}</strong> is already in the flow <strong>{flowName}</strong>. Would you like to add another instance of the step?</p> :
280+
{
273281
<p aria-label="step-not-in-flow">Are you sure you want to add the step <strong>{mappingArtifactName}</strong> to the flow <strong>{flowName}</strong>?</p>
274282
}
275283
</div>
@@ -285,6 +293,29 @@ const MappingCard: React.FC<Props> = (props) => {
285293
</Modal>
286294
);
287295

296+
const addExistingStepConfirmation = (
297+
<Modal
298+
show={addExistingStepDialogVisible}
299+
>
300+
<Modal.Header className={"bb-none"}>
301+
<button type="button" className="btn-close" aria-label="Close" onClick={onCancel}></button>
302+
</Modal.Header>
303+
<Modal.Body className={"text-center pt-0 pb-4"}>
304+
<div className={`mb-4`} style={{fontSize: "16px"}}>
305+
{
306+
<p aria-label="step-in-flow">The step <strong>{mappingArtifactName}</strong> is already in the flow <strong>{flowName}</strong>.</p>
307+
}
308+
</div>
309+
<div>
310+
<HCButton variant="primary" data-testid={`${mappingArtifactName}-to-${flowName}-Exists-Confirm`} aria-label={"Ok"} type="submit" className={"me-2"} onClick={onConfirmOk}>
311+
OK
312+
</HCButton>
313+
</div>
314+
</Modal.Body>
315+
</Modal>
316+
);
317+
318+
288319
const runNoFlowsConfirmation = (
289320
<Modal
290321
show={runNoFlowsDialogVisible}
@@ -499,6 +530,7 @@ const MappingCard: React.FC<Props> = (props) => {
499530
</Row>
500531
{deleteConfirmation}
501532
{addConfirmation}
533+
{addExistingStepConfirmation}
502534
{runNoFlowsConfirmation}
503535
{runOneFlowConfirmation}
504536
{runMultFlowsConfirmation}

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const MatchingCard: React.FC<Props> = (props) => {
4444

4545
const [editStepArtifact, setEditStepArtifact] = useState({});
4646
const [addToFlowVisible, setAddToFlowVisible] = useState(false);
47+
const [addExistingStepDialogVisible, setAddExistingStepDialogVisible] = useState(false);
4748
const [matchingArtifactName, setMatchingArtifactName] = useState("");
4849
const [flowName, setFlowName] = useState("");
4950

@@ -126,7 +127,11 @@ const MatchingCard: React.FC<Props> = (props) => {
126127
const handleStepAdd = (matchingName, flowName) => {
127128
setMatchingArtifactName(matchingName);
128129
setFlowName(flowName);
129-
setAddToFlowVisible(true);
130+
if (isStepInFlow(matchingName, flowName)) {
131+
setAddExistingStepDialogVisible(true);
132+
} else {
133+
setAddToFlowVisible(true);
134+
}
130135
};
131136

132137
const handleStepRun = (matchingName) => {
@@ -186,6 +191,10 @@ const MatchingCard: React.FC<Props> = (props) => {
186191
});
187192
};
188193

194+
const onConfirmOk = () => {
195+
setAddExistingStepDialogVisible(false);
196+
};
197+
189198
const onAddCancel = () => {
190199
setAddToFlowVisible(false);
191200
setRunNoFlowsDialogVisible(false);
@@ -234,7 +243,7 @@ const MatchingCard: React.FC<Props> = (props) => {
234243
<Modal.Header className={"bb-none"}>
235244
<button type="button" className="btn-close" aria-label="Close" onClick={onAddCancel}></button>
236245
</Modal.Header>
237-
<Modal.Body className={"pt-0 pb-4 px-4"}>
246+
<Modal.Body className={"pt-0 pb-4 text-center"}>
238247
<div aria-label="add-step-confirmation" style={{fontSize: "16px"}}>
239248
{ isStepInFlow(matchingArtifactName, flowName) ?
240249
<p aria-label="step-in-flow">The step <strong>{matchingArtifactName}</strong> is already in the flow <strong>{flowName}</strong>. Would you like to add another instance of the step?</p> :
@@ -253,6 +262,28 @@ const MatchingCard: React.FC<Props> = (props) => {
253262
</Modal>
254263
);
255264

265+
const addExistingStepConfirmation = (
266+
<Modal
267+
show={addExistingStepDialogVisible}
268+
>
269+
<Modal.Header className={"bb-none"}>
270+
<button type="button" className="btn-close" aria-label="Close" onClick={onAddCancel}></button>
271+
</Modal.Header>
272+
<Modal.Body className={"text-center pt-0 pb-4"}>
273+
<div className={`mb-4`} style={{fontSize: "16px"}}>
274+
{
275+
<p aria-label="step-in-flow">The step <strong>{matchingArtifactName}</strong> is already in the flow <strong>{flowName}</strong>.</p>
276+
}
277+
</div>
278+
<div>
279+
<HCButton variant="primary" aria-label={"Ok"} type="submit" className={"me-2"} onClick={onConfirmOk}>
280+
OK
281+
</HCButton>
282+
</div>
283+
</Modal.Body>
284+
</Modal>
285+
);
286+
256287
const runNoFlowsConfirmation = (
257288
<Modal
258289
show={runNoFlowsDialogVisible}
@@ -517,6 +548,7 @@ const MatchingCard: React.FC<Props> = (props) => {
517548
targetEntityName={props.entityModel.entityName}
518549
/>
519550
{renderAddConfirmation}
551+
{addExistingStepConfirmation}
520552
{runNoFlowsConfirmation}
521553
{runOneFlowConfirmation}
522554
{runMultFlowsConfirmation}

marklogic-data-hub-central/ui/src/components/entities/merging/merging-card.tsx

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const MergingCard: React.FC<Props> = (props) => {
4848
const [tooltipVisible, setTooltipVisible] = useState(false);
4949

5050
const [addToFlowVisible, setAddToFlowVisible] = useState(false);
51+
const [addExistingStepDialogVisible, setAddExistingStepDialogVisible] = useState(false);
5152
const [mergingArtifactName, setMergingArtifactName] = useState("");
5253
const [flowName, setFlowName] = useState("");
5354

@@ -142,7 +143,11 @@ const MergingCard: React.FC<Props> = (props) => {
142143
const handleStepAdd = (mergingName, flowName) => {
143144
setMergingArtifactName(mergingName);
144145
setFlowName(flowName);
145-
setAddToFlowVisible(true);
146+
if (isStepInFlow(mergingName, flowName)) {
147+
setAddExistingStepDialogVisible(true);
148+
} else {
149+
setAddToFlowVisible(true);
150+
}
146151
};
147152

148153
const handleStepRun = (mergingName) => {
@@ -188,6 +193,10 @@ const MergingCard: React.FC<Props> = (props) => {
188193
});
189194
};
190195

196+
const onConfirmOk = () => {
197+
setAddExistingStepDialogVisible(false);
198+
};
199+
191200
const onAddOk = async (lName, fName) => {
192201
await props.addStepToFlow(lName, fName, "merging");
193202
setAddToFlowVisible(false);
@@ -204,6 +213,7 @@ const MergingCard: React.FC<Props> = (props) => {
204213

205214
const onAddCancel = () => {
206215
setAddToFlowVisible(false);
216+
setAddExistingStepDialogVisible(false);
207217
setRunNoFlowsDialogVisible(false);
208218
setRunOneFlowDialogVisible(false);
209219
setRunMultFlowsDialogVisible(false);
@@ -233,7 +243,7 @@ const MergingCard: React.FC<Props> = (props) => {
233243
<Modal.Header className={"bb-none"}>
234244
<button type="button" className="btn-close" aria-label="Close" onClick={onAddCancel}></button>
235245
</Modal.Header>
236-
<Modal.Body className={"pt-0 pb-4 px-4"}>
246+
<Modal.Body className={"pt-0 pb-4 px-4 text-center"}>
237247
<div aria-label="add-step-confirmation" style={{fontSize: "16px"}}>
238248
{ isStepInFlow(mergingArtifactName, flowName) ?
239249
<p aria-label="step-in-flow">The step <strong>{mergingArtifactName}</strong> is already in the flow <strong>{flowName}</strong>. Would you like to add another instance of the step?</p> :
@@ -252,6 +262,30 @@ const MergingCard: React.FC<Props> = (props) => {
252262
</Modal>
253263
);
254264

265+
266+
const addExistingStepConfirmation = (
267+
<Modal
268+
show={addExistingStepDialogVisible}
269+
>
270+
<Modal.Header className={"bb-none"}>
271+
<button type="button" className="btn-close" aria-label="Close" onClick={onAddCancel}></button>
272+
</Modal.Header>
273+
<Modal.Body className={"text-center pt-0 pb-4"}>
274+
<div className={`mb-4`} style={{fontSize: "16px"}}>
275+
{
276+
<p aria-label="step-in-flow">The step <strong>{mergingArtifactName}</strong> is already in the flow <strong>{flowName}</strong>.</p>
277+
}
278+
</div>
279+
<div>
280+
<HCButton variant="primary" aria-label={"Ok"} type="submit" className={"me-2"} onClick={onConfirmOk}>
281+
OK
282+
</HCButton>
283+
</div>
284+
</Modal.Body>
285+
</Modal>
286+
);
287+
288+
255289
const runNoFlowsConfirmation = (
256290
<Modal
257291
show={runNoFlowsDialogVisible}
@@ -516,6 +550,7 @@ const MergingCard: React.FC<Props> = (props) => {
516550
targetEntityName={props.entityModel.entityName}
517551
/>
518552
{renderAddConfirmation}
553+
{addExistingStepConfirmation}
519554
{runNoFlowsConfirmation}
520555
{runOneFlowConfirmation}
521556
{runMultFlowsConfirmation}

0 commit comments

Comments
 (0)