Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): Fix negative values shown on the replicas slider when an env…
… is selected during model deployment (#549) # Description When deploying a model, selecting an environment where that model has already been deployed in would cause the initial min replica value to appear as -1, which is an invalid value: https://github.com/caraml-dev/merlin/assets/36802364/465d433a-1e4d-4eb7-ab2d-27f082575241 Besides being invalid, the initial min replica value should also have been set as the value found in the previous deployment. The same should be expected for the max replica value, which from the video above, is set as 0 initially, instead of the value found in the previous deployment. If an environment in which the model has not yet been deployed is selected instead, we also notice incorrect initial min and max replica values - they are set as 0 even though their default values are configured as non-zero (these values can usually be configured in the `default_deployment_config` schema of the `environments` config file, just as how it has been done [here](https://github.com/caraml-dev/merlin/blob/0a79211db6ed60b266ee75cf03088b4f22eb037d/environment.yaml#L19)). https://github.com/caraml-dev/merlin/assets/36802364/6fcd03f8-9a54-4a8a-a56c-c6a1748de658 This PR thus addresses this bug whereby the min/max replica values are unexpectedly set to -1/0 or 0/0, instead of the using those values from a previous deployment or from the default values configured in the environments file. # Fix The fix mainly involves triggering the effects and `onChange` handlers for the `resourcesConfig` object **_only when an environment has been selected_** (this means that the `environment` or `maxAllowedReplica` variables are non-null and non-undefined). This ensures that the `resourcesConfig` object does not get modified unexpectedly when an environment is not selected. New behaviour after the fix has been implemented: https://github.com/caraml-dev/merlin/assets/36802364/28c513ba-c684-40fe-a6d0-b9a33e672832 # Modifications - `ui/src/pages/version/components/forms/DeployModelVersionForm.js` - Change the default value of `maxAllowedReplica` from `0` to `undefined` when an environment is not selected - `ui/src/pages/version/components/forms/components/ResourcesPanel.js` - Add additional checks to effects, onChange handlers, and values to display when an environment is not selected # Checklist - [x] Added PR label - [ ] Added unit test, integration, and/or e2e tests - [x] Tested locally - [ ] Updated documentation - [ ] Update Swagger spec if the PR introduce API changes - [ ] Regenerated Golang and Python client if the PR introduces API changes # Release Notes ```release-note NONE ```
- Loading branch information