-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfb3aa8
commit aabc060
Showing
9 changed files
with
201 additions
and
7 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
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
102 changes: 102 additions & 0 deletions
102
frontend/src/pages/clusterSettings/ModelServingPlatformSettings.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,102 @@ | ||
import * as React from 'react'; | ||
import { | ||
Alert, | ||
AlertActionCloseButton, | ||
AlertVariant, | ||
Checkbox, | ||
Stack, | ||
StackItem, | ||
} from '@patternfly/react-core'; | ||
import SettingSection from '~/components/SettingSection'; | ||
import { ModelServingPlatformEnabled } from '~/types'; | ||
|
||
type ModelServingPlatformSettingsProps = { | ||
initialValue: ModelServingPlatformEnabled; | ||
enabledPlatforms: ModelServingPlatformEnabled; | ||
setEnabledPlatforms: (platforms: ModelServingPlatformEnabled) => void; | ||
}; | ||
|
||
const ModelServingPlatformSettings: React.FC<ModelServingPlatformSettingsProps> = ({ | ||
initialValue, | ||
enabledPlatforms, | ||
setEnabledPlatforms, | ||
}) => { | ||
const [alert, setAlert] = React.useState<{ variant: AlertVariant; message: string }>(); | ||
|
||
React.useEffect(() => { | ||
if (!enabledPlatforms.kServe && !enabledPlatforms.modelMesh) { | ||
setAlert({ | ||
variant: AlertVariant.warning, | ||
message: | ||
'Disabling both model serving platforms prevents new projects from deploying models. Models can still be deployed from existing projects that already have a serving platform.', | ||
}); | ||
} else { | ||
if (initialValue.modelMesh && !enabledPlatforms.modelMesh) { | ||
setAlert({ | ||
variant: AlertVariant.info, | ||
message: | ||
'Disabling the multi-model serving platform prevents models deployed in new projects and in existing projects with no deployed models from sharing model servers. Existing projects with deployed models will continue to use multi-model serving.', | ||
}); | ||
} else { | ||
setAlert(undefined); | ||
} | ||
} | ||
}, [enabledPlatforms, initialValue]); | ||
|
||
return ( | ||
<SettingSection | ||
title="Model serving platforms" | ||
description="Select the serving platforms that projects on this cluster can use for deploying models." | ||
> | ||
<Stack hasGutter> | ||
<StackItem> | ||
<Checkbox | ||
label="Single model serving platform" | ||
isChecked={enabledPlatforms.kServe} | ||
onChange={(enabled) => { | ||
const newEnabledPlatforms: ModelServingPlatformEnabled = { | ||
...enabledPlatforms, | ||
kServe: enabled, | ||
}; | ||
setEnabledPlatforms(newEnabledPlatforms); | ||
}} | ||
aria-label="Single model serving platform enabled checkbox" | ||
id="single-model-serving-platform-enabled-checkbox" | ||
data-id="single-model-serving-platform-enabled-checkbox" | ||
name="singleModelServingPlatformEnabledCheckbox" | ||
/> | ||
</StackItem> | ||
<StackItem> | ||
<Checkbox | ||
label="Multi-model serving platform" | ||
isChecked={enabledPlatforms.modelMesh} | ||
onChange={(enabled) => { | ||
const newEnabledPlatforms: ModelServingPlatformEnabled = { | ||
...enabledPlatforms, | ||
modelMesh: enabled, | ||
}; | ||
setEnabledPlatforms(newEnabledPlatforms); | ||
}} | ||
aria-label="Multi-model serving platform enabled checkbox" | ||
id="multi-model-serving-platform-enabled-checkbox" | ||
data-id="multi-model-serving-platform-enabled-checkbox" | ||
name="multiModelServingPlatformEnabledCheckbox" | ||
/> | ||
</StackItem> | ||
{alert && ( | ||
<StackItem> | ||
<Alert | ||
data-id="serving-platform-warning-alert" | ||
variant={alert.variant} | ||
title={alert.message} | ||
isInline | ||
actionClose={<AlertActionCloseButton onClose={() => setAlert(undefined)} />} | ||
/> | ||
</StackItem> | ||
)} | ||
</Stack> | ||
</SettingSection> | ||
); | ||
}; | ||
|
||
export default ModelServingPlatformSettings; |
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