修复「前端bug:资产管理的资产编辑页面,清除接入网关,确认后不生效」fixed #306
This commit is contained in:
		| @ -267,21 +267,23 @@ func (s assetService) UpdateById(id string, m maps.Map) error { | |||||||
| 		item.Description = "-" | 		item.Description = "-" | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if item.AccessGatewayId == "" { | ||||||
|  | 		item.AccessGatewayId = "-" | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if err := s.Encrypt(&item, config.GlobalCfg.EncryptionPassword); err != nil { | 	if err := s.Encrypt(&item, config.GlobalCfg.EncryptionPassword); err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 	return env.GetDB().Transaction(func(tx *gorm.DB) error { |  | ||||||
| 		c := s.Context(tx) |  | ||||||
|  |  | ||||||
| 		if err := repository.AssetRepository.UpdateById(c, &item, id); err != nil { | 	return s.Transaction(context.Background(), func(ctx context.Context) error { | ||||||
|  | 		if err := repository.AssetRepository.UpdateById(ctx, &item, id); err != nil { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
| 		if err := repository.AssetRepository.UpdateAttributes(c, id, item.Protocol, m); err != nil { | 		if err := repository.AssetRepository.UpdateAttributes(ctx, id, item.Protocol, m); err != nil { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
| 		return nil | 		return nil | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s assetService) FixSshMode() error { | func (s assetService) FixSshMode() error { | ||||||
|  | |||||||
| @ -61,8 +61,6 @@ const AssetModal = function ({ | |||||||
|     let [tags, setTags] = useState([]); |     let [tags, setTags] = useState([]); | ||||||
|     let [credentials, setCredentials] = useState([]); |     let [credentials, setCredentials] = useState([]); | ||||||
|  |  | ||||||
|     const [current, setCurrent] = useState(0); |  | ||||||
|  |  | ||||||
|     const getStorages = async () => { |     const getStorages = async () => { | ||||||
|         const result = await request.get('/storages/shares'); |         const result = await request.get('/storages/shares'); | ||||||
|         if (result.code === 1) { |         if (result.code === 1) { | ||||||
| @ -70,11 +68,6 @@ const AssetModal = function ({ | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const handleStepChange = (value) => { |  | ||||||
|         console.log('onChange:', current); |  | ||||||
|         setCurrent(value); |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     useEffect(() => { |     useEffect(() => { | ||||||
|  |  | ||||||
|         const getItem = async () => { |         const getItem = async () => { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user