fix: use setFieldsValue to explicitly set gatewayType and accessGatewayId

This commit is contained in:
2026-04-23 14:02:20 +08:00
parent ed9a1d57fe
commit f8e2fc4d7d
+6 -2
View File
@@ -72,7 +72,6 @@ const AssetsPost = function ({assetId, groupId, copy, onClose}: AssetsInfoProps)
const get = async () => {
if (assetId) {
let asset = await assetsApi.getById(assetId);
window.alert('accessGatewayId: ' + asset.accessGatewayId + ', gatewayType will be set');
if (strings.hasText(asset.logo)) {
setLogo(asset.logo);
}
@@ -89,7 +88,12 @@ const AssetsPost = function ({assetId, groupId, copy, onClose}: AssetsInfoProps)
}
if (asset.accessGatewayId && asset.accessGatewayId !== '-') {
asset.gatewayType = 'ssh';
window.alert('gatewayType set to: ' + asset.gatewayType);
setTimeout(() => {
formRef.current?.setFieldsValue({
gatewayType: 'ssh',
accessGatewayId: asset.accessGatewayId
});
}, 100);
}
return asset;
}