⬆️ Upgrade database table view

This commit is contained in:
Daniel 2023-12-14 11:51:31 +08:00
parent c3918a2a71
commit 8f9ce6e3f0
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
8 changed files with 29 additions and 3 deletions

View file

@ -564,7 +564,7 @@ const (
func NewTableView() (ret *View) {
ret = &View{
ID: ast.NewNodeID(),
Name: "Table",
Name: getI18nName("table"),
LayoutType: LayoutTypeTable,
Table: &LayoutTable{
Spec: 0,
@ -578,7 +578,7 @@ func NewTableView() (ret *View) {
}
func NewTableViewWithBlockKey(blockKeyID string) (view *View, blockKey *Key) {
name := "Table"
name := getI18nName("table")
view = &View{
ID: ast.NewNodeID(),
Name: name,
@ -591,7 +591,7 @@ func NewTableViewWithBlockKey(blockKeyID string) (view *View, blockKey *Key) {
PageSize: 50,
},
}
blockKey = NewKey(blockKeyID, "Block", "", KeyTypeBlock)
blockKey = NewKey(blockKeyID, getI18nName("key"), "", KeyTypeBlock)
view.Table.Columns = []*ViewTableColumn{{ID: blockKeyID}}
return
}
@ -781,6 +781,10 @@ func GetAttributeViewDataPath(avID string) (ret string) {
return
}
func getI18nName(name string) string {
return util.AttrViewLangs[util.Lang][name].(string)
}
var (
ErrViewNotFound = errors.New("view not found")
ErrKeyNotFound = errors.New("key not found")