-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add FreezeFSForSnapshot support * Fix Makefile variable typo * Change wording from overwrite to override * Reword file system to filesystem * Minor improvements based on review Longhorn 2187 Signed-off-by: Eric Weber <eric.weber@suse.com>
- Loading branch information
Showing
15 changed files
with
336 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/routes/volume/UpdateBulkFreezeFilesystemForSnapshotModal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Form, Select, Alert } from 'antd' | ||
import { ModalBlur } from '../../components' | ||
const FormItem = Form.Item | ||
const { Option } = Select | ||
|
||
const formItemLayout = { | ||
labelCol: { | ||
span: 24, | ||
}, | ||
wrapperCol: { | ||
span: 24, | ||
}, | ||
} | ||
|
||
const modal = ({ | ||
items, | ||
option, | ||
visible, | ||
onCancel, | ||
onOk, | ||
form: { | ||
getFieldDecorator, | ||
validateFields, | ||
getFieldsValue, | ||
}, | ||
}) => { | ||
function handleOk() { | ||
validateFields((errors) => { | ||
if (errors) { | ||
return | ||
} | ||
const data = { | ||
...getFieldsValue(), | ||
} | ||
const urls = items.map((item) => item?.actions?.updateFreezeFilesystemForSnapshot) | ||
|
||
onOk(data, urls) | ||
}) | ||
} | ||
|
||
const modalOpts = { | ||
title: 'Update Freeze Filesystem For Snapshot', | ||
visible, | ||
onCancel, | ||
width: 600, | ||
onOk: handleOk, | ||
} | ||
if (!items || items?.length === 0) { | ||
return null | ||
} | ||
return ( | ||
<ModalBlur {...modalOpts}> | ||
<Form layout="horizontal"> | ||
<FormItem label="Option" {...formItemLayout}> | ||
{getFieldDecorator('freezeFilesystemForSnapshot', { | ||
initialValue: 'ignored', | ||
})(<Select> | ||
{ option.map(ele => <Option key={ele.key} value={ele.value}>{ele.key}</Option>) } | ||
</Select>)} | ||
<Alert | ||
style={{ marginTop: 10 }} | ||
message="This action may override the global setting “Freeze Filesystem For Snapshot”" | ||
type="warning" | ||
/> | ||
</FormItem> | ||
</Form> | ||
</ModalBlur> | ||
) | ||
} | ||
|
||
modal.propTypes = { | ||
form: PropTypes.object.isRequired, | ||
visible: PropTypes.bool, | ||
option: PropTypes.array, | ||
onCancel: PropTypes.func, | ||
items: PropTypes.array, | ||
onOk: PropTypes.func, | ||
} | ||
|
||
export default Form.create()(modal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/routes/volume/UpdateFreezeFilesystemForSnapshotModal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Form, Select, Alert } from 'antd' | ||
import { ModalBlur } from '../../components' | ||
const FormItem = Form.Item | ||
const { Option } = Select | ||
|
||
const formItemLayout = { | ||
labelCol: { | ||
span: 24, | ||
}, | ||
wrapperCol: { | ||
span: 24, | ||
}, | ||
} | ||
|
||
const modal = ({ | ||
item, | ||
option, | ||
visible, | ||
onCancel, | ||
onOk, | ||
form: { | ||
getFieldDecorator, | ||
validateFields, | ||
getFieldsValue, | ||
}, | ||
}) => { | ||
function handleOk() { | ||
validateFields((errors) => { | ||
if (errors) { | ||
return | ||
} | ||
const data = { | ||
...getFieldsValue(), | ||
} | ||
let url = item?.actions?.updateFreezeFilesystemForSnapshot | ||
|
||
onOk(data, url) | ||
}) | ||
} | ||
|
||
const modalOpts = { | ||
title: 'Update Freeze Filesystem For Snapshot', | ||
visible, | ||
onCancel, | ||
width: 600, | ||
onOk: handleOk, | ||
} | ||
if (!item) { | ||
return null | ||
} | ||
return ( | ||
<ModalBlur {...modalOpts}> | ||
<Form layout="horizontal"> | ||
<FormItem label="Option" {...formItemLayout}> | ||
{getFieldDecorator('freezeFilesystemForSnapshot', { | ||
initialValue: item?.freezeFilesystemForSnapshot, | ||
})(<Select> | ||
{ option.map(ele => <Option key={ele.key} value={ele.value}>{ele.key}</Option>) } | ||
</Select>)} | ||
<Alert | ||
style={{ marginTop: 10 }} | ||
message="This action may override the global setting “Freeze Filesystem For Snapshot”" | ||
type="warning" | ||
/> | ||
</FormItem> | ||
</Form> | ||
</ModalBlur> | ||
) | ||
} | ||
|
||
modal.propTypes = { | ||
form: PropTypes.object.isRequired, | ||
visible: PropTypes.bool, | ||
option: PropTypes.array, | ||
onCancel: PropTypes.func, | ||
item: PropTypes.object, | ||
onOk: PropTypes.func, | ||
} | ||
|
||
export default Form.create()(modal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.