-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1384 from jonner/mtv-1504
MTV-1504 | Add UI for setting inventory memory limits
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 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
50 changes: 50 additions & 0 deletions
50
...ages/forklift-console-plugin/src/modules/Overview/modal/EditInventoryMemoryLimitModal.tsx
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,50 @@ | ||
import React from 'react'; | ||
import { EditModal, ModalInputComponentType } from 'src/modules/Providers/modals'; | ||
import { useForkliftTranslation } from 'src/utils/i18n'; | ||
|
||
import { ForkliftControllerModel } from '@kubev2v/types'; | ||
import { ModalVariant } from '@patternfly/react-core'; | ||
|
||
import { EditSettingsModalProps } from './EditSettingsModalProps'; | ||
import SettingsSelectInput from './SettingsSelectInput'; | ||
|
||
// Define the options | ||
const options = [ | ||
{ key: '400Mi', name: '400Mi', description: 'Low memory limit' }, | ||
{ key: '1000Mi', name: '1000Mi', description: 'Moderate memory limit' }, | ||
{ key: '2000Mi', name: '2000Mi', description: 'High memory limit' }, | ||
{ key: '8000Mi', name: '8000Mi', description: 'Very high memory limit' }, | ||
]; | ||
|
||
/** | ||
* InventoryMemoryLimitSelect component. | ||
* Wraps the SettingsSelectInput component with pre-defined options. | ||
* | ||
* @param {ModalInputComponentProps} props - Properties passed to the component | ||
* @returns {JSX.Element} | ||
*/ | ||
const InventoryMemoryLimitSelect: ModalInputComponentType = (props) => { | ||
return <SettingsSelectInput {...props} options={options} />; | ||
}; | ||
|
||
export const EditInventoryMemoryLimitModal: React.FC<EditSettingsModalProps> = (props) => { | ||
const { t } = useForkliftTranslation(); | ||
|
||
return ( | ||
<EditModal | ||
{...props} | ||
jsonPath={'spec.inventory_container_limits_memory'} | ||
title={props?.title || t('Edit Inventory Container Memory limit')} | ||
label={props?.label || t('Inventory Container Memory limit')} | ||
model={ForkliftControllerModel} | ||
variant={ModalVariant.small} | ||
body={t( | ||
'The limit for memory usage by the inventory container, specified in Megabytes (Mi). Default value is 1000Mi.', | ||
)} | ||
helperText={t( | ||
'Please enter the limit for memory usage by the inventory container in Mi, if empty default value will be used.', | ||
)} | ||
InputComponent={InventoryMemoryLimitSelect} | ||
/> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/forklift-console-plugin/src/modules/Overview/modal/index.ts
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