This commit is contained in:
Daniel 2025-07-25 12:05:33 +08:00
parent 0d5320f08b
commit cbddce4d25
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 32 additions and 2 deletions

View file

@ -44,6 +44,34 @@ import (
"github.com/xrash/smetrics"
)
func (tx *Transaction) doRemoveAttrViewGroup(operation *Operation) (ret *TxErr) {
if err := removeAttributeViewGroup(operation.AvID, operation.BlockID); nil != err {
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}
func removeAttributeViewGroup(avID, blockID string) (err error) {
attrView, err := av.ParseAttributeView(avID)
if err != nil {
return err
}
view, err := getAttrViewViewByBlockID(attrView, blockID)
if err != nil {
return err
}
view.Group, view.Groups = nil, nil
err = av.SaveAttributeView(attrView)
if err != nil {
logging.LogErrorf("save attribute view [%s] failed: %s", avID, err)
return err
}
return nil
}
func (tx *Transaction) doSyncAttrViewTableColWidth(operation *Operation) (ret *TxErr) {
err := syncAttrViewTableColWidth(operation)
if err != nil {
@ -94,13 +122,13 @@ func syncAttrViewTableColWidth(operation *Operation) (err error) {
}
func (tx *Transaction) doHideAttrViewGroup(operation *Operation) (ret *TxErr) {
if err := HideAttributeViewGroup(operation.AvID, operation.BlockID, operation.ID, operation.Data.(bool)); nil != err {
if err := hideAttributeViewGroup(operation.AvID, operation.BlockID, operation.ID, operation.Data.(bool)); nil != err {
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}
func HideAttributeViewGroup(avID, blockID, groupID string, hidden bool) (err error) {
func hideAttributeViewGroup(avID, blockID, groupID string, hidden bool) (err error) {
attrView, err := av.ParseAttributeView(avID)
if err != nil {
return err

View file

@ -303,6 +303,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doHideAttrViewGroup(op)
case "syncAttrViewTableColWidth":
ret = tx.doSyncAttrViewTableColWidth(op)
case "removeAttrViewGroup":
ret = tx.doRemoveAttrViewGroup(op)
}
if nil != ret {