mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 Support hiding database table view title https://github.com/siyuan-note/siyuan/issues/10478
This commit is contained in:
parent
ec46cbfce7
commit
7dcdcfb0d3
3 changed files with 33 additions and 3 deletions
|
|
@ -141,6 +141,7 @@ type View struct {
|
||||||
ID string `json:"id"` // 视图 ID
|
ID string `json:"id"` // 视图 ID
|
||||||
Icon string `json:"icon"` // 视图图标
|
Icon string `json:"icon"` // 视图图标
|
||||||
Name string `json:"name"` // 视图名称
|
Name string `json:"name"` // 视图名称
|
||||||
|
HideAttrViewName bool `json:"hideAttrViewName"` // 是否隐藏属性视图名称
|
||||||
|
|
||||||
LayoutType LayoutType `json:"type"` // 当前布局类型
|
LayoutType LayoutType `json:"type"` // 当前布局类型
|
||||||
Table *LayoutTable `json:"table,omitempty"` // 表格布局
|
Table *LayoutTable `json:"table,omitempty"` // 表格布局
|
||||||
|
|
|
||||||
|
|
@ -1017,6 +1017,33 @@ func getRowBlockValue(keyValues []*av.KeyValues) (ret *av.Value) {
|
||||||
return
|
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) {
|
func (tx *Transaction) doUpdateAttrViewColRollup(operation *Operation) (ret *TxErr) {
|
||||||
err := updateAttributeViewColRollup(operation)
|
err := updateAttributeViewColRollup(operation)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
|
||||||
ret = tx.doUpdateAttrViewColRelation(op)
|
ret = tx.doUpdateAttrViewColRelation(op)
|
||||||
case "updateAttrViewColRollup":
|
case "updateAttrViewColRollup":
|
||||||
ret = tx.doUpdateAttrViewColRollup(op)
|
ret = tx.doUpdateAttrViewColRollup(op)
|
||||||
|
case "hideAttrViewName":
|
||||||
|
ret = tx.doHideAttrViewName(op)
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != ret {
|
if nil != ret {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue