Skip to content

Commit 8c699af

Browse files
yubiselmarklogicMarkLogic Builder
authored andcommitted
DHFPROD-8545: Export icon should be hidden in table view, for All Entities
1 parent 3f62629 commit 8c699af

File tree

5 files changed

+73
-7
lines changed

5 files changed

+73
-7
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {Application} from "../../support/application.config";
2+
import {toolbar} from "../../support/components/common";
3+
import browsePage from "../../support/pages/browse";
4+
import LoginPage from "../../support/pages/login";
5+
6+
const entity: string = "Order";
7+
8+
describe("Test table export icon", () => {
9+
before(() => {
10+
cy.visit("/");
11+
cy.contains(Application.title);
12+
13+
cy.log("**Logging into the app as a developer**");
14+
cy.loginAsDeveloper().withRequest();
15+
LoginPage.postLogin();
16+
//Saving Local Storage to preserve session
17+
cy.saveLocalStorage();
18+
});
19+
20+
beforeEach(() => {
21+
//Restoring Local Storage to Preserve Session
22+
Cypress.Cookies.preserveOnce("HubCentralSession");
23+
cy.restoreLocalStorage();
24+
});
25+
26+
it("Validate that the export icon appear only when an entity is selected", () => {
27+
cy.log("**Go to Explore section**");
28+
toolbar.getExploreToolbarIcon().click();
29+
30+
cy.log("**Export button should not exist in snippet, graph and table view**");
31+
browsePage.clickFacetView();
32+
browsePage.getDataExportIcon().should("not.exist");
33+
browsePage.clickTableView();
34+
browsePage.getDataExportIcon().should("not.exist");
35+
browsePage.clickTableView();
36+
browsePage.getDataExportIcon().should("not.exist");
37+
38+
cy.log("**Export button should appear when select an entity**");
39+
browsePage.selectBaseEntity(entity);
40+
browsePage.waitForSpinnerToDisappear();
41+
browsePage.getDataExportIcon().should("be.visible");
42+
43+
cy.log("**Export button should disappear when deselect an entity**");
44+
browsePage.removeBaseEntity(entity);
45+
browsePage.getDataExportIcon().should("not.exist");
46+
});
47+
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ describe("Verify numeric/date facet can be applied", () => {
131131
});
132132
it("Verify clearing date time range facet clears corresponding selected facet", () => {
133133
toolbar.getExploreToolbarIcon().click();
134+
cy.wait(1000);
134135
entitiesSidebar.removeSelectedBaseEntity();
135136
entitiesSidebar.openBaseEntityDropdown();
136137
entitiesSidebar.selectBaseEntityOption("Client");

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ class BrowsePage {
356356
cy.get(`[aria-label='base-option-${entity}']`).scrollIntoView().click();
357357
}
358358

359+
removeBaseEntity(entity: string) {
360+
cy.get(`[aria-label='Remove ${entity}']`).scrollIntoView().click();
361+
}
362+
359363
//table
360364
getColumnTitle(index: number) {
361365
return cy.get(`.table.table-bordered thead th:nth-child(${index}) .resultsTableHeaderColumn`).invoke("text");
@@ -434,7 +438,7 @@ class BrowsePage {
434438
}
435439

436440
getDataExportIcon() {
437-
return cy.get("[data-cy=query-export] > div > svg");
441+
return cy.get("[data-cy=\"query-export\"] > div svg");
438442
}
439443

440444
getColumnSelectorApply() {

marklogic-data-hub-central/ui/src/components/base-entities-facet/base-entities-facet.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, {useContext, useEffect, useState} from "react";
22
import Select from "react-select";
3+
import {components as SelectComponents} from "react-select";
34
import reactSelectThemeConfig from "../../config/react-select-theme.config";
45
import {SearchContext} from "../../util/search-context";
56
import styles from "./base-entities-facet.module.scss";
@@ -121,6 +122,16 @@ const BaseEntitiesFacet: React.FC<Props> = (props) => {
121122
setShowMore(!showMore);
122123
};
123124

125+
const MultiValueRemove = props => {
126+
return (
127+
<SelectComponents.MultiValueRemove {...props}>
128+
<span aria-label={`Remove ${props.data.value}`}>
129+
<svg height="14" width="14" viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"></path></svg>
130+
</span>
131+
</SelectComponents.MultiValueRemove>
132+
);
133+
};
134+
124135
return (
125136
<>
126137
<Select
@@ -130,6 +141,7 @@ const BaseEntitiesFacet: React.FC<Props> = (props) => {
130141
isClearable={false}
131142
value={entityNames ? entityNames.map(d => ({value: d, label: d})) : [{value: "All Entities", label: "All Entities"}]}
132143
onChange={handleChange}
144+
components={{MultiValueRemove}}
133145
isSearchable={false}
134146
aria-label="base-entities-dropdown-list"
135147
options={childrenOptions}

marklogic-data-hub-central/ui/src/components/results-tabular-view/results-tabular-view.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,14 @@ const ResultsTabularView = (props) => {
574574
return (
575575
<>
576576
{!props.groupNodeTableView ? <div className={styles.icon}>
577-
<div className={styles.queryExport} data-cy="query-export">
578-
{canExportQuery && searchOptions.entityTypeIds.length > 0 && <QueryExport hasStructured={props.hasStructured} columns={props.columns} selectedPropertyDefinitions={props.selectedPropertyDefinitions} />}
579-
</div>
580-
{searchOptions.entityTypeIds?.length === 1 ? <div className={styles.columnSelector} data-cy="column-selector">
581-
<ColumnSelector popoverVisibility={popoverVisibility} setPopoverVisibility={setPopoverVisibility} entityPropertyDefinitions={props.entityPropertyDefinitions} selectedPropertyDefinitions={props.selectedPropertyDefinitions} setColumnSelectorTouched={props.setColumnSelectorTouched} columns={props.columns} primaryKey={primaryKey} />
582-
</div> : ""}
577+
{searchOptions.entityTypeIds?.length === 1 ? <>
578+
<div className={styles.queryExport} data-cy="query-export">
579+
{canExportQuery && <QueryExport hasStructured={props.hasStructured} columns={props.columns} selectedPropertyDefinitions={props.selectedPropertyDefinitions} />}
580+
</div>
581+
<div className={styles.columnSelector} data-cy="column-selector">
582+
<ColumnSelector popoverVisibility={popoverVisibility} setPopoverVisibility={setPopoverVisibility} entityPropertyDefinitions={props.entityPropertyDefinitions} selectedPropertyDefinitions={props.selectedPropertyDefinitions} setColumnSelectorTouched={props.setColumnSelectorTouched} columns={props.columns} primaryKey={primaryKey} />
583+
</div>
584+
</> : ""}
583585
</div> : ""}
584586
<div className={styles.tabular}>
585587
{tableHeaders.length > 0 && <HCTable

0 commit comments

Comments
 (0)