mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 17:44:59 +09:00
PROD-605 Change default sort
This commit is contained in:
parent
215c5fca58
commit
5e57cec391
1 changed files with 15 additions and 14 deletions
|
@ -301,11 +301,7 @@ func (d *sdataview) CreateView(ctx *session.Context, id string,
|
|||
|
||||
if len(view.Sorts) == 0 {
|
||||
// todo: set depends on the view type
|
||||
view.Sorts = []*model.BlockContentDataviewSort{{
|
||||
Id: bson.NewObjectId().Hex(),
|
||||
RelationKey: bundle.RelationKeyLastModifiedDate.String(),
|
||||
Type: model.BlockContentDataviewSort_Desc,
|
||||
}}
|
||||
view.Sorts = defaultLastModifiedDateSort()
|
||||
}
|
||||
|
||||
sbType, err := d.sbtProvider.Type(d.Id())
|
||||
|
@ -327,6 +323,16 @@ func (d *sdataview) CreateView(ctx *session.Context, id string,
|
|||
return &view, d.Apply(s)
|
||||
}
|
||||
|
||||
func defaultLastModifiedDateSort() []*model.BlockContentDataviewSort {
|
||||
return []*model.BlockContentDataviewSort{
|
||||
{
|
||||
Id: bson.NewObjectId().Hex(),
|
||||
RelationKey: bundle.RelationKeyLastModifiedDate.String(),
|
||||
Type: model.BlockContentDataviewSort_Desc,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (d *sdataview) UpdateViewGroupOrder(ctx *session.Context, blockId string, order *model.BlockContentDataviewGroupOrder) error {
|
||||
st := d.NewStateCtx(ctx)
|
||||
dvBlock, err := getDataviewBlock(st, blockId)
|
||||
|
@ -630,15 +636,10 @@ func DataviewBlockBySource(sbtProvider typeprovider.SmartBlockTypeProvider, stor
|
|||
RelationLinks: relations,
|
||||
Views: []*model.BlockContentDataviewView{
|
||||
{
|
||||
Id: bson.NewObjectId().Hex(),
|
||||
Type: model.BlockContentDataviewView_Table,
|
||||
Name: "All",
|
||||
Sorts: []*model.BlockContentDataviewSort{
|
||||
{
|
||||
RelationKey: "name",
|
||||
Type: model.BlockContentDataviewSort_Asc,
|
||||
},
|
||||
},
|
||||
Id: bson.NewObjectId().Hex(),
|
||||
Type: model.BlockContentDataviewView_Table,
|
||||
Name: "All",
|
||||
Sorts: defaultLastModifiedDateSort(),
|
||||
Filters: nil,
|
||||
Relations: viewRelations,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue