Skip to content

Commit

Permalink
Merge pull request #1046 from sennetconsortium/tjmadonna/1034-metadat…
Browse files Browse the repository at this point in the history
…a-link-to-home-page

Tjmadonna/1034 metadata link to home page
  • Loading branch information
maxsibilla authored Nov 20, 2023
2 parents ed536f1 + 9850460 commit 46d160a
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 43 deletions.
13 changes: 1 addition & 12 deletions src/components/custom/layout/AppNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,7 @@ const AppNavbar = ({hidden, signoutHidden}) => {
</div>
))}
</NavDropdown>
{/*<NavDropdown active={false}*/}
{/* variant={'primary'}*/}
{/* hidden={hidden}*/}
{/* title="Search"*/}
{/* id="nav-dropdown--search">*/}
{/* <NavDropdown.Item key={`dd-search-entity`} href={APP_ROUTES.search}>*/}
{/* <span>Entity</span>*/}
{/* </NavDropdown.Item>*/}
{/* <NavDropdown.Item key={`dd-search-file`} href={`${APP_ROUTES.search}/files`}>*/}
{/* <span>File</span>*/}
{/* </NavDropdown.Item>*/}
{/*</NavDropdown>*/}

<NavDropdown active={false}
variant={'primary'}
title="Documentation"
Expand Down
4 changes: 2 additions & 2 deletions src/components/custom/search/ResultsPerPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ export function ResultsPerPage({resultsPerPage, setResultsPerPage, totalRows}) {
}

return (
<div className={'sui-react-select'}>&nbsp; {getOptions(totalRows).length > 0 && <Select blurInputOnSelect={false} options={getOptions(totalRows)} defaultValue={getDefaultValue()} value={getCurrentValue()} onChange={handleChange} name={'resultsPerPage'} />}</div>
<div className={'sui-react-select'}>{getOptions(totalRows).length > 0 && <Select blurInputOnSelect={false} options={getOptions(totalRows)} defaultValue={getDefaultValue()} value={getCurrentValue()} onChange={handleChange} name={'resultsPerPage'} />}</div>
)
}
}
41 changes: 41 additions & 0 deletions src/components/custom/search/SearchDropdown.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Link from "next/link";
import { APP_ROUTES } from "../../../config/constants";

const SearchDropdown = ({ title }) => {
const dropdownItems = [
{ name: "Entities", url: APP_ROUTES.search },
{ name: "Metadata", url: APP_ROUTES.discover + "/metadata" },
];

const createLinkView = (item) => {
if (item.name === title) {
return null;
}
return (
<Link key={item.name} className="dropdown-item" href={item.url}>
Search {item.name}
</Link>
);
};

return (
<div className="dropdown sui-layout-sidebar-dropdown">
<button
className="btn btn-outline-primary rounded-0 dropdown-toggle w-100"
type="button"
id="searchDropdown"
data-bs-toggle="dropdown"
aria-expanded="false"
>
Search {title}
</button>
<ul className="dropdown-menu" aria-labelledby="searchDropdown">
{dropdownItems.map((item) => {
return createLinkView(item);
})}
</ul>
</div>
);
};

export default SearchDropdown;
1 change: 1 addition & 0 deletions src/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
export const APP_ROUTES = {
"home": "/",
"search": "/search",
"discover": "/discover",
"login": "/login",
"logout": "/logout",
"notFound": "/404"
Expand Down
33 changes: 17 additions & 16 deletions src/config/search/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ export const SEARCH_METADATA = {
uiType: 'numrange',
uiRange: [0, 100],
},
"metadata.weight_value_unit": {
"metadata.weight_unit": {
label: 'Weight Unit',
type: 'value',
field: 'metadata.weight_value_unit.keyword',
field: 'metadata.weight_unit.keyword',
isExpanded: false,
filterType: 'any',
isFilterable: false,
Expand All @@ -159,12 +159,13 @@ export const SEARCH_METADATA = {
filterType: 'any',
isFilterable: false,
uiType: 'numrange',
uiRange: [0, 100],
uiRange: [0, 100000],
uiInterval: 5000,
},
"metadata.volume_value_unit": {
"metadata.volume_unit": {
label: 'Volume Unit',
type: 'value',
field: 'metadata.volume_value_unit.keyword',
field: 'metadata.volume_unit.keyword',
isExpanded: false,
filterType: 'any',
isFilterable: false,
Expand All @@ -179,10 +180,10 @@ export const SEARCH_METADATA = {
uiType: 'numrange',
uiRange: [0, 100],
},
"metadata.pathology_distance_value_unit": {
"metadata.pathology_distance_unit": {
label: 'Pathology Distance Unit',
type: 'value',
field: 'metadata.pathology_distance_value_unit.keyword',
field: 'metadata.pathology_distance_unit.keyword',
isExpanded: false,
filterType: 'any',
isFilterable: false,
Expand Down Expand Up @@ -332,11 +333,11 @@ export const SEARCH_METADATA = {

// Sample Block
"metadata.weight_value": FilterIsSelected('sample_category', 'Block'),
"metadata.weight_value_unit": FilterIsSelected('sample_category', 'Block'),
"metadata.weight_unit": FilterIsSelected('sample_category', 'Block'),
"metadata.volume_value": FilterIsSelected('sample_category', 'Block'),
"metadata.volume_value_unit": FilterIsSelected('sample_category', 'Block'),
"metadata.volume_unit": FilterIsSelected('sample_category', 'Block'),
"metadata.pathology_distance_value": FilterIsSelected('sample_category', 'Block'),
"metadata.pathology_distance_value_unit": FilterIsSelected('sample_category', 'Block'),
"metadata.pathology_distance_unit": FilterIsSelected('sample_category', 'Block'),

// Sample Section
"metadata.section_thickness_value": FilterIsSelected('sample_category', 'Section'),
Expand Down Expand Up @@ -437,10 +438,10 @@ export const SEARCH_METADATA = {
queryString: 'size=n_10000_n&filters%5B0%5D%5Bfield%5D=entity_type&filters%5B0%5D%5Bvalues%5D%5B0%5D=Source&filters%5B0%5D%5Btype%5D=any&filters%5B1%5D%5Bfield%5D=source_type&filters%5B1%5D%5Bvalues%5D%5B0%5D=Human&filters%5B1%5D%5Btype%5D=any&sort%5B0%5D%5Bfield%5D=last_modified_timestamp&sort%5B0%5D%5Bdirection%5D=desc'
},
{
title: 'C57BL/6J-Kit<W-39J> Mouse Sources',
description: 'Mouse sources from the C57BL/6J-Kit<W-39J> strain',
title: 'C57BL/6 Mouse Sources',
description: 'Mouse sources from the C57BL/6 strain',
entityType: 'source',
queryString: 'size=n_10000_n&filters%5B0%5D%5Bfield%5D=entity_type&filters%5B0%5D%5Bvalues%5D%5B0%5D=Source&filters%5B0%5D%5Btype%5D=any&filters%5B1%5D%5Bfield%5D=source_type&filters%5B1%5D%5Bvalues%5D%5B0%5D=Mouse&filters%5B1%5D%5Btype%5D=any&filters%5B2%5D%5Bfield%5D=metadata.strain&filters%5B2%5D%5Bvalues%5D%5B0%5D=C57BL%2F6J-Kit<W-39J>&filters%5B2%5D%5Btype%5D=any&sort%5B0%5D%5Bfield%5D=last_modified_timestamp&sort%5B0%5D%5Bdirection%5D=desc'
queryString: 'size=n_10000_n&filters[0][field]=entity_type&filters[0][values][0]=Source&filters[0][type]=any&filters[1][field]=source_type&filters[1][values][0]=Mouse&filters[1][type]=any&filters[2][field]=metadata.strain&filters[2][values][0]=C57BL%2F6&filters[2][type]=any&sort[0][field]=last_modified_timestamp&sort[0][direction]=desc'
},
{
title: 'All Mouse Sources',
Expand Down Expand Up @@ -479,10 +480,10 @@ export const SEARCH_METADATA = {
queryString: 'size=n_10000_n&filters%5B0%5D%5Bfield%5D=entity_type&filters%5B0%5D%5Bvalues%5D%5B0%5D=Dataset&filters%5B0%5D%5Btype%5D=any&filters%5B1%5D%5Bfield%5D=metadata.metadata.analyte_class&filters%5B1%5D%5Bvalues%5D%5B0%5D=RNA&filters%5B1%5D%5Btype%5D=any&sort%5B0%5D%5Bfield%5D=last_modified_timestamp&sort%5B0%5D%5Bdirection%5D=desc'
},
{
title: 'All Protein Datasets',
description: 'Datasets with the Protein analyte class.',
title: 'All Sequence Datasets',
description: 'Datasets with the sequence assay category.',
entityType: 'dataset',
queryString: 'size=n_10000_n&filters%5B0%5D%5Bfield%5D=entity_type&filters%5B0%5D%5Bvalues%5D%5B0%5D=Dataset&filters%5B0%5D%5Btype%5D=any&filters%5B1%5D%5Bfield%5D=metadata.metadata.analyte_class&filters%5B1%5D%5Bvalues%5D%5B0%5D=protein&filters%5B1%5D%5Btype%5D=any&sort%5B0%5D%5Bfield%5D=last_modified_timestamp&sort%5B0%5D%5Bdirection%5D=desc'
queryString: 'size=n_10000_n&filters%5B0%5D%5Bfield%5D=entity_type&filters%5B0%5D%5Bvalues%5D%5B0%5D=Dataset&filters%5B0%5D%5Btype%5D=any&filters%5B1%5D%5Bfield%5D=metadata.metadata.assay_category&filters%5B1%5D%5Bvalues%5D%5B0%5D=sequence&filters%5B1%5D%5Btype%5D=any&sort%5B0%5D%5Bfield%5D=last_modified_timestamp&sort%5B0%5D%5Bdirection%5D=desc'
},
],
}
4 changes: 2 additions & 2 deletions src/pages/discover/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function Metadata() {
<div className="bd-highlight">
<button className="btn btn-outline-primary rounded-0 clear-filter-button"
onClick={handleBrowseAllMetadataClicked}>
Browse All Metadata
Search all metadata
</button>
</div>
</div>
Expand All @@ -69,7 +69,7 @@ function Metadata() {
<Card.Text className="mb-2">{item.description}</Card.Text>
</div>
<Link href={{ pathname: METADATA_SEARCH, query: item.queryString }}>
<Button variant="primary rounded-0">Browse</Button>
<Button variant="primary rounded-0">Search</Button>
</Link>
</Card.Body>
</Card>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/search/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import SelectedFacets from "../../components/custom/search/SelectedFacets";
import SearchUIContainer from "search-ui/components/core/SearchUIContainer";
import FacetsContent from "../../components/custom/search/FacetsContent";
import BodyContent from "../../components/custom/search/BodyContent";
import SearchDropdown from "../../components/custom/search/SearchDropdown";
import {TableResultsEntities} from "../../components/custom/TableResultsEntities";
import InvalidToken from "../../components/custom/layout/InvalidToken";
import AppTutorial from "../../components/custom/layout/AppTutorial";
Expand Down Expand Up @@ -110,6 +111,8 @@ function SearchEntities() {
}
sideContent={
<div data-js-ada='facets'>
<SearchDropdown title='Entities' />

<CustomClearSearchBox />

<SelectedFilters />
Expand All @@ -130,4 +133,4 @@ function SearchEntities() {
}
}

export default SearchEntities
export default SearchEntities
5 changes: 4 additions & 1 deletion src/pages/search/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import SelectedFacets from "../../components/custom/search/SelectedFacets";
import SearchUIContainer from "search-ui/components/core/SearchUIContainer";
import FacetsContent from "../../components/custom/search/FacetsContent";
import BodyContent from "../../components/custom/search/BodyContent";
import SearchDropdown from "../../components/custom/search/SearchDropdown";

function SearchFiles() {
const {
Expand Down Expand Up @@ -81,6 +82,8 @@ function SearchFiles() {
}
sideContent={
<div data-js-ada='facets'>
<SearchDropdown title='Files' />

<CustomClearSearchBox />

<SelectedFilters />
Expand All @@ -101,4 +104,4 @@ function SearchFiles() {
}
}

export default SearchFiles
export default SearchFiles
3 changes: 3 additions & 0 deletions src/pages/search/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import SelectedFacets from "../../components/custom/search/SelectedFacets";
import SearchUIContainer from "search-ui/components/core/SearchUIContainer";
import FacetsContent from "../../components/custom/search/FacetsContent";
import BodyContent from "../../components/custom/search/BodyContent";
import SearchDropdown from "../../components/custom/search/SearchDropdown";
import {TableResultsEntities} from "../../components/custom/TableResultsEntities";

function SearchMetadata() {
Expand Down Expand Up @@ -92,6 +93,8 @@ function SearchMetadata() {
}
sideContent={
<div data-js-ada='facets'>
<SearchDropdown title='Metadata' />

<CustomClearSearchBox />

<SelectedFilters/>
Expand Down
20 changes: 20 additions & 0 deletions src/sass/components/header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.c-SelectedFacets {
display: flex;
flex-flow: row wrap;
align-items: center;
padding: 10px 0;
gap: 10px;
min-height: 85px;
}

@include md-mx {
.c-SelectedFacets {
min-height: 0px;
padding: 20px 0 0;
}

.c-SelectedFacets:empty {
min-height: 0px;
padding: 0px 0;
}
}
23 changes: 15 additions & 8 deletions src/sass/components/sui.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
.sui-layout-sidebar-toggle {
display: block !important;
width: 100%;
margin-top: 20px;
margin-bottom: 20px;
padding: 10px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.5;
Expand Down Expand Up @@ -85,7 +85,6 @@

// Facets
.clear-filter-div {
padding-bottom: 32px;
}

.clear-filter-button {
Expand All @@ -103,7 +102,7 @@
.sui-layout-sidebar {
-ms-flex: 0 0 300px;
flex: 0 0 300px;
padding: 32px 32px 0 0;
padding: 0 32px 0 0;
}

.sui-layout-sidebar--toggled {
Expand All @@ -113,12 +112,17 @@

.sui-layout-main {
width: 100%;
padding: 32px 0 32px 32px;
padding: 0 0 32px 32px;
}

.sui-facet__title--FileType + .sui-facet {
text-transform: uppercase;
}

.sui-layout-sidebar-dropdown {
margin-bottom: 1.5rem;
}

// Handle sidebar on smaller screens
@include md-mx {
.sui-layout-main {
Expand Down Expand Up @@ -148,10 +152,15 @@
overflow: auto;
}

.sui-layout-sidebar-dropdown {
margin-bottom: 20px;
}

.sui-layout-sidebar-toggle {
display: block !important;
width: 100%;
margin-top: 20px;
margin-bottom: 20px;
padding: 10px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.5;
Expand Down Expand Up @@ -193,7 +202,7 @@
.modal-content .sui-layout-sidebar-toggle {
display: block !important;
width: 100%;
margin-top: 20px;
margin-bottom: 20px;
padding: 10px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.5;
Expand Down Expand Up @@ -254,8 +263,6 @@
background: $col-entity-grey;
padding: 0 24px;
.MuiChip-root {
margin-top: 10px;
margin-right: 5px;
color: #4f4f4f;
}
.chip-title {
Expand Down Expand Up @@ -287,4 +294,4 @@
overflow: hidden;
}
}
}
}
3 changes: 2 additions & 1 deletion src/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@import 'components/entity';
@import 'components/footer';
@import 'components/form';
@import 'components/header';
@import 'components/metadaUpload';
@import 'components/modal';
@import 'components/mui';
Expand All @@ -28,4 +29,4 @@
@import 'vendor/primereact';

@import 'pages/edit';
@import 'pages/discover';
@import 'pages/discover';

0 comments on commit 46d160a

Please sign in to comment.