Skip to content

Commit

Permalink
Update bootstrap: Fix collection sharing modal (#2217)
Browse files Browse the repository at this point in the history
  • Loading branch information
maiwald authored Oct 15, 2024
1 parent bb3d98c commit 0a87479
Showing 1 changed file with 15 additions and 12 deletions.
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

0 comments on commit 0a87479

Please sign in to comment.