Skip to content

Commit

Permalink
Merge pull request #5843 from chalice-1831/v3.9.x_import_check_assoca…
Browse files Browse the repository at this point in the history
…tion

bugfix 修复导入主机判断excel表格数量问题以及导入关联关系返回错误不正确问题
  • Loading branch information
breezelxp authored Dec 21, 2021
2 parents f9f91cc + 0744f5c commit 93ee211
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ import (
"configcenter/src/common/util"
)

func (assoc *association) ImportInstAssociation(ctx context.Context, kit *rest.Kit, objID string, importData map[int]metadata.ExcelAssociation, languageIf language.CCLanguageIf) (resp metadata.ResponeImportAssociationData, err error) {
ia := NewImportAssociation(ctx, assoc, kit, objID, importData, assoc.authManager, languageIf.CreateDefaultCCLanguageIf(util.GetLanguage(kit.Header)))
err = ia.ParsePrimaryKey()
if err != nil {
// ImportInstAssociation import inst association
func (assoc *association) ImportInstAssociation(ctx context.Context, kit *rest.Kit, objID string,
importData map[int]metadata.ExcelAssociation, languageIf language.CCLanguageIf) (
resp metadata.ResponeImportAssociationData, err error) {

ia := NewImportAssociation(ctx, assoc, kit, objID, importData, assoc.authManager,
languageIf.CreateDefaultCCLanguageIf(util.GetLanguage(kit.Header)))
if err = ia.ParsePrimaryKey(); err != nil {
return resp, err
}

Expand Down
2 changes: 1 addition & 1 deletion src/scene_server/topo_server/service/object_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (s *Service) ImportInstanceAssociation(ctx *rest.Contexts) {
})

if txnErr != nil {
ctx.RespAutoError(txnErr)
ctx.RespEntityWithError(ret, txnErr)
return
}
ctx.RespEntity(ret)
Expand Down
4 changes: 2 additions & 2 deletions src/web_server/logics/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ func (lgc *Logics) ImportHosts(ctx context.Context, f *xlsx.File, header http.He
resp = result
}

if len(f.Sheets) < 2 {
if len(f.Sheets) <= 2 {
resp.Result = true
return resp
}

// if len(f.Sheets) >= 2, the second sheet is association data to be import
// if len(f.Sheets) > 2, the second sheet is association data to be import
asstInfoMap, assoErrMsg := GetAssociationExcelData(f.Sheets[1], common.HostAddMethodExcelAssociationIndexOffset,
defLang)

Expand Down

0 comments on commit 93ee211

Please sign in to comment.