@@ -48,9 +48,9 @@ export class EditResourceContainerItem extends React.Component<ContainerItemProp
48
48
{ workloadEdit, addons } = subRoot ,
49
49
{ containers, canAddContainer, volumes, isCanUseGpu } = workloadEdit ;
50
50
51
- let container = containers . find ( item => item . id === cKey ) ;
51
+ const container = containers . find ( item => item . id === cKey ) ;
52
52
// 选择镜像所需的一些信息
53
- let selectRegistry = {
53
+ const selectRegistry = {
54
54
id : uuid ( ) ,
55
55
cKey : cKey
56
56
} ;
@@ -62,13 +62,14 @@ export class EditResourceContainerItem extends React.Component<ContainerItemProp
62
62
canAdd = isEmpty ( editingContainer ) || validateWorkloadActions . _canAddContainer ( editingContainer , volumes ) ;
63
63
64
64
// 判断是否能够删除容器
65
- let canDelete = containers . length > 1 ;
65
+ const canDelete = containers . length > 1 ;
66
66
67
67
// 判断是否能够使用gpu
68
- let k8sVersion = clusterVersion . split ( '.' ) ;
69
- let isK8sOk = + k8sVersion [ 0 ] >= 1 && + k8sVersion [ 1 ] >= 8 ;
70
- let canUseGpu = isK8sOk && isCanUseGpu ,
71
- canUseGpuManager = + k8sVersion [ 0 ] >= 1 && + k8sVersion [ 1 ] >= 10 && addons [ 'GPUManager' ] !== undefined ;
68
+ const hasGPUManager = ! ! cluster ?. selection ?. spec ?. features ?. gpuType ;
69
+ const k8sVersion = clusterVersion . split ( '.' ) ;
70
+ const isK8sOk = + k8sVersion [ 0 ] >= 1 && + k8sVersion [ 1 ] >= 8 ;
71
+ const canUseGpu = isK8sOk && isCanUseGpu ,
72
+ canUseGpuManager = + k8sVersion [ 0 ] >= 1 && + k8sVersion [ 1 ] >= 10 && hasGPUManager ;
72
73
73
74
return (
74
75
container && (
@@ -231,11 +232,11 @@ export class EditResourceContainerItem extends React.Component<ContainerItemProp
231
232
232
233
/** 选择保存按钮 */
233
234
private _handleSaveContainer ( cKey : string ) {
234
- let { actions, subRoot } = this . props ,
235
+ const { actions, subRoot } = this . props ,
235
236
{ workloadEdit } = subRoot ,
236
237
{ containers, volumes } = workloadEdit ;
237
238
238
- let container = containers . find ( c => c . id === cKey ) ;
239
+ const container = containers . find ( c => c . id === cKey ) ;
239
240
// 校验container的所有选项
240
241
actions . validate . workload . validateContainer ( container ) ;
241
242
0 commit comments