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

Update bootstrap: Fix collection sharing modal #2217

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions app/packs/src/components/managingActions/ManagingModalSharing.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,13 @@ export default class ManagingModalSharing extends React.Component {
}

selectUsers() {
let style = this.props.selectUsers ? {} : { display: 'none' };
const { selectUsers } = this.props;
if (!selectUsers) return null;

let { selectedUsers } = this.state;

return (
<Form.Group className="mb-3" style={style}>
<Form.Group className="mb-3">
<Form.Label>Select Users to share with</Form.Label>
<AsyncSelect
id="share-users-select"
Expand All @@ -325,10 +327,11 @@ export default class ManagingModalSharing extends React.Component {
}

render() {
const displayWarning = (this.state.permissionLevel || '') === '5' ? 'inline-block' : 'none';
const { selectUsers } = this.props;
const { selectedUsers, permissionLevel = '' } = this.state;
const displayWarning = permissionLevel === '5';

const { selectedUsers } = this.state;
const hasSelectedUsers = selectedUsers != null && selectedUsers.length > 0
const canSubmit = !selectUsers || selectedUsers != null && selectedUsers.length > 0

return (
<Form>
Expand Down Expand Up @@ -358,12 +361,12 @@ export default class ManagingModalSharing extends React.Component {
<option value='4'>Import Elements</option>
<option value='5'>Pass ownership</option>
</Form.Select>
<div style={{
color: '#d9534f', fontSize: '12px', paddingLeft: '8px', paddingTop: '4px', display: displayWarning
}}
>
<i className="fa fa-exclamation-circle" aria-hidden="true" />&nbsp;Transfering ownership applies for all sub collections.
</div>
{displayWarning && (
<Form.Text>
<i className="fa fa-exclamation-circle me-1" aria-hidden="true" />
Transfering ownership applies for all sub collections.
</Form.Text>
)}
</Form.Group>
<Form.Group className="mb-3" controlId="sampleDetailLevelSelect">
<Form.Label>Sample detail level</Form.Label>
Expand Down Expand Up @@ -417,7 +420,7 @@ export default class ManagingModalSharing extends React.Component {
<Button
id="create-sync-shared-col-btn"
variant="warning"
disabled={!hasSelectedUsers}
disabled={!canSubmit}
onClick={this.handleSharing}
>
{this.props.collAction} Shared Collection
Expand Down
Loading