feat(gpu-service): allow re-typing stopped instances on edit
- Add instance-type column to edit drawer for stopped instances - Extract saveInstanceDataInDescription into shared util - Floor sliced unit resources; keep CPU >= 1 core - Expose applyInstanceType for both create and edit flows
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import _ from 'lodash';
|
||||
import { InstanceTypeItem } from '../config/types';
|
||||
|
||||
// Serialize the chosen instance type into the instance's `description` field —
|
||||
// a persisted spec snapshot the form reads back to render the type card and
|
||||
// derive unit resources. Shared by the create/recreate flow (card selection)
|
||||
// and the edit flow (change-type overlay).
|
||||
export const saveInstanceDataInDescription = (
|
||||
instanceType: InstanceTypeItem
|
||||
): string => {
|
||||
return JSON.stringify({
|
||||
name: instanceType.name,
|
||||
spec: {
|
||||
..._.omit(instanceType.spec, ['cache', 'cpu']),
|
||||
cpu: _.pick(instanceType.spec?.cpu, ['manufacturer', 'product', 'family'])
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user