Skip to content

Commit

Permalink
Allow to skip bucket policy when registering new bucket (#3800)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodichenko committed Dec 2, 2024
1 parent 2dd384f commit 0101fb2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/src/components/pipelines/browser/Folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ export default class Folder extends localization.LocalizedReactComponent {
}
};
createStorage = async (storage) => {
const request = new CreateDataStorage(this.state.createNewStorageFlag);
const request = new CreateDataStorage(this.state.createNewStorageFlag, storage.skipPolicy);
const hide = message.loading('Creating storage...', 0);
let path = storage.path;
let name = storage.name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export class DataStorageEditDialog extends React.Component {
sensitive: false,
restrictedAccess: true,
restrictedAccessCheckInProgress: false,
omicsType: undefined
omicsType: undefined,
skipPolicy: false
};

formItemLayout = {
Expand Down Expand Up @@ -154,6 +155,9 @@ export class DataStorageEditDialog extends React.Component {
if (!this.isNfsMount) {
values.sensitive = this.state.sensitive;
}
if (!this.isNfsMount && !this.omicsStore) {
values.skipPolicy = this.state.skipPolicy;
}
values.shared = !this.isNfsMount && this.state.sharingEnabled;
values.regionId = +values.regionId;
const path = values.path;
Expand Down Expand Up @@ -436,6 +440,7 @@ export class DataStorageEditDialog extends React.Component {
resetFields();
this.setState({activeTab: 'info'});
};
const skipPolicyFlagVisible = !this.props.dataStorage;
return (
<Modal
maskClosable={!this.props.pending && !this.state.restrictedAccessCheckInProgress}
Expand Down Expand Up @@ -625,6 +630,22 @@ export class DataStorageEditDialog extends React.Component {
</Col>
</Row>
}
{
(!this.omicsStore && !this.isNfsMount && skipPolicyFlagVisible) &&
<Row>
<Col xs={24} sm={6} />
<Col xs={24} sm={18}>
<Form.Item className={styles.dataStorageFormItem}>
<Checkbox
disabled={this.props.pending || isReadOnly || !!this.props.dataStorage}
onChange={(e) => this.setState({skipPolicy: e.target.checked})}
checked={this.state.skipPolicy}>
Skip policy
</Checkbox>
</Form.Item>
</Col>
</Row>
}
{!this.omicsStore &&
!this.isNfsMount &&
this.props.policySupported &&
Expand All @@ -635,7 +656,7 @@ export class DataStorageEditDialog extends React.Component {
<Col xs={24} sm={18}>
<Form.Item className={styles.dataStorageFormItem}>
<Checkbox
disabled={this.props.pending || isReadOnly}
disabled={this.props.pending || isReadOnly || this.state.skipPolicy}
onChange={(e) => this.setState({versioningEnabled: e.target.checked})}
checked={this.state.versioningEnabled}>
Enable versioning
Expand All @@ -660,7 +681,7 @@ export class DataStorageEditDialog extends React.Component {
})(
<InputNumber
style={{width: '100%'}}
disabled={this.props.pending || isReadOnly} />
disabled={this.props.pending || isReadOnly || this.state.skipPolicy} />
)}
</Form.Item>
)}
Expand Down Expand Up @@ -764,7 +785,7 @@ export class DataStorageEditDialog extends React.Component {
const sharingEnabled = !this.isNfsMount && this.props.dataStorage
? this.props.dataStorage.shared
: false;
this.setState({mountDisabled, versioningEnabled, sharingEnabled, sensitive});
this.setState({mountDisabled, versioningEnabled, sharingEnabled, sensitive, skipPolicy: false});
}
};

Expand All @@ -774,7 +795,7 @@ export class DataStorageEditDialog extends React.Component {
const versioningEnabled = false;
const sensitive = false;
const sharingEnabled = false;
this.setState({mountDisabled, versioningEnabled, sharingEnabled, sensitive});
this.setState({mountDisabled, versioningEnabled, sharingEnabled, sensitive, skipPolicy: false});
}
}

Expand Down

0 comments on commit 0101fb2

Please sign in to comment.