Skip to content

Commit

Permalink
S3 objects lifecycle GUI (#2759) - refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rodichenko committed Sep 8, 2022
1 parent 1d8b4a0 commit 28a40a9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ export class DataStorageEditDialog extends React.Component {
: this.props.isNfsMount;
}

@computed
get transitionRulesAvailable () {
const {
dataStorage
} = this.props;
return dataStorage &&
dataStorage.id &&
/^s3$/i.test(dataStorage.storageType || dataStorage.type);
}

@computed
get awsRegions () {
return this.props.awsRegions.loaded ? (this.props.awsRegions.value || []).map(r => r) : [];
Expand Down Expand Up @@ -222,7 +232,7 @@ export class DataStorageEditDialog extends React.Component {
<Button
id="edit-storage-dialog-delete-button"
type="danger"
onClick={this.openDeleteDialog}>Delete</Button>
onClick={this.openDeleteDialog}>DELETE</Button>
)
}
</Row>
Expand All @@ -231,12 +241,12 @@ export class DataStorageEditDialog extends React.Component {
<Row type="flex" justify="end">
<Button
id="edit-storage-dialog-cancel-button"
onClick={this.props.onCancel}>Cancel</Button>
onClick={this.props.onCancel}>CANCEL</Button>
<Button
id="edit-storage-dialog-save-button"
type="primary"
htmlType="submit"
onClick={this.handleSubmit}>Save</Button>
onClick={this.handleSubmit}>SAVE</Button>
</Row>
</Col>
</Row>
Expand Down Expand Up @@ -575,9 +585,7 @@ export class DataStorageEditDialog extends React.Component {
objectType="DATA_STORAGE" />
</Tabs.TabPane>
}
{this.props.dataStorage &&
this.props.dataStorage.id &&
/^s3$/i.test(this.props.dataStorage.type) && (
{this.transitionRulesAvailable && (
<Tabs.TabPane key="transitionRules" tab="Transition rules">
<LifeCycleRules
storageId={this.props.dataStorage.id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class LifeCycleRules extends React.Component {
</Tooltip>
) : null}
</td>
<td style={{padding: '0 5px'}}>
<td style={{padding: '0 5px', textAlign: 'right'}}>
{controls}
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,14 @@ class LifeCycleEditModal extends React.Component {
footer={
<Row type="flex" justify="end">
<Button onClick={this.onCancel}>
Cancel
CANCEL
</Button>
<Button
type="primary"
onClick={this.handleSubmit}
disabled={pending || !this.modified}
>
Save
SAVE
</Button>
</Row>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class LifeCycleHistoryModal extends React.Component {
onClick={onOk}
type="primary"
>
Ok
OK
</Button>
</Row>
)}
Expand Down

0 comments on commit 28a40a9

Please sign in to comment.