Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PXP-4535 Fix/get access button #625

Merged
merged 10 commits into from
Dec 4, 2019
3 changes: 3 additions & 0 deletions src/GuppyDataExplorer/ExplorerFilter/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class ExplorerFilter extends React.Component {
<TierAccessSelector
onSelectorChange={this.handleAccessSelectorChange}
getAccessButtonLink={this.props.getAccessButtonLink}
hideGetAccessButton={this.props.hideGetAccessButton}
/>
) : (<React.Fragment />)
}
Expand All @@ -182,6 +183,7 @@ ExplorerFilter.propTypes = {
adminAppliedPreFilters: PropTypes.object, // inherit from GuppyWrapper
accessibleFieldCheckList: PropTypes.arrayOf(PropTypes.string), // inherit from GuppyWrapper
getAccessButtonLink: PropTypes.string,
hideGetAccessButton: PropTypes.bool,
};

ExplorerFilter.defaultProps = {
Expand All @@ -198,6 +200,7 @@ ExplorerFilter.defaultProps = {
adminAppliedPreFilters: {},
accessibleFieldCheckList: [],
getAccessButtonLink: undefined,
hideGetAccessButton: false,
};

export default ExplorerFilter;
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
.top-message-banner {
margin-top: 10px;
margin-bottom: 10px;
align-content: flex-end;
background-color: transparent;
padding-bottom: 10px;
display: flex;
border-bottom: 2px solid var(--g3-color__silver);
}

.top-message-banner__button-wrapper {
.top-message-banner__space-column {
width: 20%;
display: flex;
justify-content: flex-end;
}

.top-message-banner__text-column {
width: 80%;
padding-left: 20px;
display: flex;
align-items: center;
white-space: pre-wrap;
}

.top-message-banner__button{
margin-right: 20px;
background-color: var(--g3-color__white);
border-top: 1px solid var(--g3-color__silver);
text-align: center;
margin-right: 20px;
display: inline;
}

.top-message-banner__text-wrapper {
flex-flow: row;
flex-wrap: wrap;
}

.top-message-banner__bold-text {
font-size: 14px;
font-weight: var(--g3-font__semi-bold-weight);
Expand Down
47 changes: 31 additions & 16 deletions src/GuppyDataExplorer/ExplorerTopMessageBanner/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,43 @@ import { GuppyConfigType } from '../configTypeDef';

class ExplorerTopMessageBanner extends React.Component {
render() {
const hideGetAccessButton = this.props.hideGetAccessButton;
return (
<div className={this.props.className}>
{
(this.props.tierAccessLevel === 'regular' && checkForNoAccessibleProject(this.props.accessibleFieldObject, this.props.guppyConfig.accessibleValidationField)) ? (
<div className='top-message-banner'>
<div className='top-message-banner__button-wrapper'>
<Button
label='Get Access'
className='top-message-banner__button'
buttonType='default'
onClick={
(this.props.getAccessButtonLink) ? (
() => { window.open(this.props.getAccessButtonLink); }
) : (() => {})
<div className='top-message-banner__space-column' />
<div className='top-message-banner__text-column'>
<div className='top-message-banner__button-wrapper'>
{ (hideGetAccessButton) ? (<React.Fragment />) :
(
<Button
label='Get Access'
className='top-message-banner__button'
buttonType='default'
enabled={!!(this.props.getAccessButtonLink)}
tooltipEnabled={!(this.props.getAccessButtonLink)}
tooltipText='Coming soon'
onClick={
(this.props.getAccessButtonLink) ? (
() => { window.open(this.props.getAccessButtonLink); }
) : (() => {})
}
/>
)
}
/>
</div>
<span className='top-message-banner__normal-text'>Due to lack of access, you are only able to narrow the cohort down to </span>
<span className='top-message-banner__bold-text'>{ this.props.tierAccessLimit } </span>
<span className='top-message-banner__normal-text'>
{this.props.guppyConfig.nodeCountTitle.toLowerCase()
</div>
<div className='top-message-banner__text-wrapper'>
<span className='top-message-banner__normal-text'>Due to lack of access, you are only able to narrow the cohort down to </span>
<span className='top-message-banner__bold-text'>{ this.props.tierAccessLimit } </span>
<span className='top-message-banner__normal-text'>
{this.props.guppyConfig.nodeCountTitle.toLowerCase()
|| this.props.guppyConfig.dataType}.
Please request additional access if necessary.
</span>
</span>
</div>
</div>
</div>
) : (<React.Fragment />)
}
Expand All @@ -42,6 +55,7 @@ class ExplorerTopMessageBanner extends React.Component {
ExplorerTopMessageBanner.propTypes = {
className: PropTypes.string,
getAccessButtonLink: PropTypes.string,
hideGetAccessButton: PropTypes.bool,
tierAccessLevel: PropTypes.string.isRequired,
tierAccessLimit: PropTypes.number,
accessibleFieldObject: PropTypes.object, // inherit from GuppyWrapper
Expand All @@ -53,6 +67,7 @@ ExplorerTopMessageBanner.defaultProps = {
tierAccessLimit: undefined,
accessibleFieldObject: {},
getAccessButtonLink: undefined,
hideGetAccessButton: false,
guppyConfig: {},
};

Expand Down
4 changes: 4 additions & 0 deletions src/GuppyDataExplorer/GuppyDataExplorer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ class GuppyDataExplorer extends React.Component {
tierAccessLimit={this.props.tierAccessLimit}
guppyConfig={this.props.guppyConfig}
getAccessButtonLink={this.props.getAccessButtonLink}
hideGetAccessButton={this.props.hideGetAccessButton}
/>
<ExplorerFilter
className='guppy-data-explorer__filter'
guppyConfig={this.props.guppyConfig}
getAccessButtonLink={this.props.getAccessButtonLink}
hideGetAccessButton={this.props.hideGetAccessButton}
tierAccessLevel={this.props.tierAccessLevel}
tierAccessLimit={this.props.tierAccessLimit}
/>
Expand Down Expand Up @@ -83,13 +85,15 @@ GuppyDataExplorer.propTypes = {
tierAccessLevel: PropTypes.string.isRequired,
tierAccessLimit: PropTypes.number.isRequired,
getAccessButtonLink: PropTypes.string,
hideGetAccessButton: PropTypes.bool,
adminAppliedPreFilters: PropTypes.object,
};

GuppyDataExplorer.defaultProps = {
heatMapConfig: {},
nodeCountTitle: undefined,
getAccessButtonLink: undefined,
hideGetAccessButton: false,
adminAppliedPreFilters: {},
};

Expand Down
13 changes: 10 additions & 3 deletions src/GuppyDataExplorer/TierAccessSelector/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,19 @@ class TierAccessSelector extends React.Component {
</div>
</div>
{
this.state.selected !== 'with-access' && (
this.state.selected !== 'with-access' && !this.props.hideGetAccessButton && (
<div className='tier-access-selector__button-wrapper'>
<Button
label='Get Access'
className='tier-access-selector__button'
buttonType='default'
enabled={!!(this.props.getAccessButtonLink)}
tooltipEnabled={!(this.props.getAccessButtonLink)}
tooltipText='Coming soon'
onClick={
() => { window.open(this.props.getAccessButtonLink); }
(this.props.getAccessButtonLink) ? (
() => { window.open(this.props.getAccessButtonLink); }
) : (() => {})
}
/>
</div>
Expand All @@ -110,11 +115,13 @@ TierAccessSelector.propTypes = {
// paramter will be one of: 'with-access', 'without-access', or 'all-data'
onSelectorChange: PropTypes.func,
getAccessButtonLink: PropTypes.string,
hideGetAccessButton: PropTypes.bool,
};

TierAccessSelector.defaultProps = {
onSelectorChange: () => {},
getAccessButtonLink: 'https://gen3.org/',
getAccessButtonLink: undefined,
hideGetAccessButton: false,
};

export default TierAccessSelector;
1 change: 1 addition & 0 deletions src/GuppyDataExplorer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class Explorer extends React.Component {
tierAccessLevel={tierAccessLevel}
tierAccessLimit={tierAccessLimit}
getAccessButtonLink={config.dataExplorerConfig.getAccessButtonLink}
hideGetAccessButton={config.dataExplorerConfig.hideGetAccessButton}
/>
</div>
</div>
Expand Down