Skip to content

Commit

Permalink
修复「前端bug:资产管理的资产编辑页面,清除接入网关,确认后不生效」fixed #306
Browse files Browse the repository at this point in the history
  • Loading branch information
dushixiang committed Nov 13, 2022
1 parent 34594d8 commit 6916b64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 7 additions & 5 deletions server/service/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 0 additions & 7 deletions web/src/components/asset/AssetModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,13 @@ 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) {
setStorages(result['data']);
}
}

const handleStepChange = (value) => {
console.log('onChange:', current);
setCurrent(value);
};

useEffect(() => {

const getItem = async () => {
Expand Down

0 comments on commit 6916b64

Please sign in to comment.