修复「前端bug:资产管理的资产编辑页面,清除接入网关,确认后不生效」fixed #306

This commit is contained in:
dushixiang 2022-11-13 22:46:37 +08:00
parent 76baf3e41e
commit 3f31d4919a
2 changed files with 7 additions and 12 deletions

View File

@ -267,21 +267,23 @@ func (s assetService) UpdateById(id string, m maps.Map) error {
item.Description = "-"
}
if item.AccessGatewayId == "" {
item.AccessGatewayId = "-"
}
if err := s.Encrypt(&item, config.GlobalCfg.EncryptionPassword); err != nil {
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
}
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 nil
})
}
func (s assetService) FixSshMode() error {

View File

@ -61,8 +61,6 @@ const AssetModal = function ({
let [tags, setTags] = useState([]);
let [credentials, setCredentials] = useState([]);
const [current, setCurrent] = useState(0);
const getStorages = async () => {
const result = await request.get('/storages/shares');
if (result.code === 1) {
@ -70,11 +68,6 @@ const AssetModal = function ({
}
}
const handleStepChange = (value) => {
console.log('onChange:', current);
setCurrent(value);
};
useEffect(() => {
const getItem = async () => {