Skip to content

Commit

Permalink
🎨 Support hiding database table view title #10478
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Mar 1, 2024
1 parent ec46cbf commit 7dcdcfb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kernel/av/av.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ type SelectOption struct {

// View 描述了视图的结构。
type View struct {
ID string `json:"id"` // 视图 ID
Icon string `json:"icon"` // 视图图标
Name string `json:"name"` // 视图名称
ID string `json:"id"` // 视图 ID
Icon string `json:"icon"` // 视图图标
Name string `json:"name"` // 视图名称
HideAttrViewName bool `json:"hideAttrViewName"` // 是否隐藏属性视图名称

LayoutType LayoutType `json:"type"` // 当前布局类型
Table *LayoutTable `json:"table,omitempty"` // 表格布局
Expand Down
27 changes: 27 additions & 0 deletions kernel/model/attribute_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,33 @@ func getRowBlockValue(keyValues []*av.KeyValues) (ret *av.Value) {
return
}

func (tx *Transaction) doHideAttrViewName(operation *Operation) (ret *TxErr) {
err := hideAttrViewName(operation)
if nil != err {
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}

func hideAttrViewName(operation *Operation) (err error) {
attrView, err := av.ParseAttributeView(operation.AvID)
if nil != err {
logging.LogErrorf("parse attribute view [%s] failed: %s", operation.AvID, err)
return
}

viewID := operation.ID
view := attrView.GetView(viewID)
if nil == view {
logging.LogErrorf("get view [%s] failed: %s", viewID, err)
return
}

view.HideAttrViewName = operation.Data.(bool)
err = av.SaveAttributeView(attrView)
return
}

func (tx *Transaction) doUpdateAttrViewColRollup(operation *Operation) (ret *TxErr) {
err := updateAttributeViewColRollup(operation)
if nil != err {
Expand Down
2 changes: 2 additions & 0 deletions kernel/model/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doUpdateAttrViewColRelation(op)
case "updateAttrViewColRollup":
ret = tx.doUpdateAttrViewColRollup(op)
case "hideAttrViewName":
ret = tx.doHideAttrViewName(op)
}

if nil != ret {
Expand Down

0 comments on commit 7dcdcfb

Please sign in to comment.