Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2025-07-30 12:08:30 +08:00
commit c222e0d6f7
7 changed files with 56 additions and 10 deletions

View file

@ -29,6 +29,7 @@ type LayoutGallery struct {
CardAspectRatio CardAspectRatio `json:"cardAspectRatio"` // 卡片宽高比 CardAspectRatio CardAspectRatio `json:"cardAspectRatio"` // 卡片宽高比
CardSize CardSize `json:"cardSize"` // 卡片大小0小卡片1中卡片2大卡片 CardSize CardSize `json:"cardSize"` // 卡片大小0小卡片1中卡片2大卡片
FitImage bool `json:"fitImage"` // 是否适应封面图片大小 FitImage bool `json:"fitImage"` // 是否适应封面图片大小
DisplayFieldName bool `json:"displayFieldName"` // 是否显示字段名称
CardFields []*ViewGalleryCardField `json:"fields"` // 卡片字段 CardFields []*ViewGalleryCardField `json:"fields"` // 卡片字段
@ -94,6 +95,7 @@ type Gallery struct {
CardAspectRatio CardAspectRatio `json:"cardAspectRatio"` // 卡片宽高比 CardAspectRatio CardAspectRatio `json:"cardAspectRatio"` // 卡片宽高比
CardSize CardSize `json:"cardSize"` // 卡片大小 CardSize CardSize `json:"cardSize"` // 卡片大小
FitImage bool `json:"fitImage"` // 是否适应封面图片大小 FitImage bool `json:"fitImage"` // 是否适应封面图片大小
DisplayFieldName bool `json:"displayFieldName"` // 是否显示字段名称
Fields []*GalleryField `json:"fields"` // 卡片字段 Fields []*GalleryField `json:"fields"` // 卡片字段
Cards []*GalleryCard `json:"cards"` // 卡片 Cards []*GalleryCard `json:"cards"` // 卡片
CardCount int `json:"cardCount"` // 总卡片数 CardCount int `json:"cardCount"` // 总卡片数

View file

@ -514,6 +514,36 @@ func setAttrViewFitImage(operation *Operation) (err error) {
return return
} }
func (tx *Transaction) doSetAttrViewDisplayFieldName(operation *Operation) (ret *TxErr) {
err := setAttrViewDisplayFieldName(operation)
if err != nil {
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}
func setAttrViewDisplayFieldName(operation *Operation) (err error) {
attrView, err := av.ParseAttributeView(operation.AvID)
if err != nil {
return
}
view, err := getAttrViewViewByBlockID(attrView, operation.BlockID)
if err != nil {
return
}
switch view.LayoutType {
case av.LayoutTypeTable:
return
case av.LayoutTypeGallery:
view.Gallery.DisplayFieldName = operation.Data.(bool)
}
err = av.SaveAttributeView(attrView)
return
}
func (tx *Transaction) doSetAttrViewCardSize(operation *Operation) (ret *TxErr) { func (tx *Transaction) doSetAttrViewCardSize(operation *Operation) (ret *TxErr) {
err := setAttrViewCardSize(operation) err := setAttrViewCardSize(operation)
if err != nil { if err != nil {
@ -2503,6 +2533,7 @@ func (tx *Transaction) doDuplicateAttrViewView(operation *Operation) (ret *TxErr
view.Gallery.CoverFromAssetKeyID = masterView.Gallery.CoverFromAssetKeyID view.Gallery.CoverFromAssetKeyID = masterView.Gallery.CoverFromAssetKeyID
view.Gallery.CardSize = masterView.Gallery.CardSize view.Gallery.CardSize = masterView.Gallery.CardSize
view.Gallery.FitImage = masterView.Gallery.FitImage view.Gallery.FitImage = masterView.Gallery.FitImage
view.Gallery.DisplayFieldName = masterView.Gallery.DisplayFieldName
view.Gallery.ShowIcon = masterView.Gallery.ShowIcon view.Gallery.ShowIcon = masterView.Gallery.ShowIcon
view.Gallery.WrapField = masterView.Gallery.WrapField view.Gallery.WrapField = masterView.Gallery.WrapField
} }
@ -4651,8 +4682,12 @@ func regenAttrViewViewGroups(attrView *av.AttributeView, keyID string) {
for _, g := range view.Groups { for _, g := range view.Groups {
if view.Group.HideEmpty { if view.Group.HideEmpty {
if 2 != g.GroupHidden && 1 > len(g.GroupItemIDs) { if 1 > len(g.GroupItemIDs) {
g.GroupHidden = 1 if 0 == g.GroupHidden {
g.GroupHidden = 1
}
} else {
g.GroupHidden = 0
} }
} else { } else {
if 2 != g.GroupHidden { if 2 != g.GroupHidden {

View file

@ -677,6 +677,11 @@ func FullReindex() {
} }
func fullReindex() { func fullReindex() {
pushSQLInsertBlocksFTSMsg = true
defer func() {
pushSQLInsertBlocksFTSMsg = false
}()
util.PushEndlessProgress(Conf.language(35)) util.PushEndlessProgress(Conf.language(35))
defer util.PushClearProgress() defer util.PushClearProgress()

View file

@ -359,6 +359,8 @@ func init() {
subscribeSQLEvents() subscribeSQLEvents()
} }
var pushSQLInsertBlocksFTSMsg bool
func subscribeSQLEvents() { func subscribeSQLEvents() {
// 使用下面的 EvtSQLInsertBlocksFTS 就可以了 // 使用下面的 EvtSQLInsertBlocksFTS 就可以了
//eventbus.Subscribe(eventbus.EvtSQLInsertBlocks, func(context map[string]interface{}, current, total, blockCount int, hash string) { //eventbus.Subscribe(eventbus.EvtSQLInsertBlocks, func(context map[string]interface{}, current, total, blockCount int, hash string) {
@ -368,6 +370,12 @@ func subscribeSQLEvents() {
// util.ContextPushMsg(context, msg) // util.ContextPushMsg(context, msg)
//}) //})
eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, blockCount int, hash string) { eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, blockCount int, hash string) {
if !pushSQLInsertBlocksFTSMsg {
// 如果不是全量重建索引,则不显示进度信息
// Improve status bar index creation information prompt https://github.com/siyuan-note/siyuan/issues/15390
return
}
current := context["current"].(int) current := context["current"].(int)
total := context["total"] total := context["total"]
msg := fmt.Sprintf(Conf.Language(90), current, total, blockCount, hash) msg := fmt.Sprintf(Conf.Language(90), current, total, blockCount, hash)

View file

@ -54,7 +54,6 @@ import (
"github.com/siyuan-note/logging" "github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/conf" "github.com/siyuan-note/siyuan/kernel/conf"
"github.com/siyuan-note/siyuan/kernel/filesys" "github.com/siyuan-note/siyuan/kernel/filesys"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/task" "github.com/siyuan-note/siyuan/kernel/task"
"github.com/siyuan-note/siyuan/kernel/treenode" "github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util" "github.com/siyuan-note/siyuan/kernel/util"
@ -772,13 +771,7 @@ func checkoutRepo(id string) {
return return
} }
task.AppendTask(task.DatabaseIndexFull, fullReindex) FullReindex()
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
go func() {
sql.FlushQueue()
ResetVirtualBlockRefCache()
}()
task.AppendTask(task.ReloadUI, util.ReloadUIResetScroll)
if syncEnabled { if syncEnabled {
task.AppendAsyncTaskWithDelay(task.PushMsg, 7*time.Second, util.PushMsg, Conf.Language(134), 0) task.AppendAsyncTaskWithDelay(task.PushMsg, 7*time.Second, util.PushMsg, Conf.Language(134), 0)

View file

@ -289,6 +289,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doSetAttrViewCardSize(op) ret = tx.doSetAttrViewCardSize(op)
case "setAttrViewFitImage": case "setAttrViewFitImage":
ret = tx.doSetAttrViewFitImage(op) ret = tx.doSetAttrViewFitImage(op)
case "setDisplayFieldName":
ret = tx.doSetAttrViewDisplayFieldName(op)
case "setAttrViewShowIcon": case "setAttrViewShowIcon":
ret = tx.doSetAttrViewShowIcon(op) ret = tx.doSetAttrViewShowIcon(op)
case "setAttrViewWrapField": case "setAttrViewWrapField":

View file

@ -26,6 +26,7 @@ func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query
CardAspectRatio: view.Gallery.CardAspectRatio, CardAspectRatio: view.Gallery.CardAspectRatio,
CardSize: view.Gallery.CardSize, CardSize: view.Gallery.CardSize,
FitImage: view.Gallery.FitImage, FitImage: view.Gallery.FitImage,
DisplayFieldName: view.Gallery.DisplayFieldName,
Fields: []*av.GalleryField{}, Fields: []*av.GalleryField{},
Cards: []*av.GalleryCard{}, Cards: []*av.GalleryCard{},
} }