3
0

Remove the primary flag from page layouts

This commit is contained in:
Tomaž Jerman
2023-04-03 16:46:42 +02:00
committed by Jože Fortun
parent e18049f933
commit fce2ae90e3
12 changed files with 1 additions and 134 deletions
-2
View File
@@ -616,7 +616,6 @@ func (e YamlEncoder) encodePageLayout(ctx context.Context, p envoyx.EncodeParams
if err != nil {
return
}
auxUpdatedAt, err := e.encodeTimestampNil(p, res.UpdatedAt)
if err != nil {
return
@@ -634,7 +633,6 @@ func (e YamlEncoder) encodePageLayout(ctx context.Context, p envoyx.EncodeParams
"ownedBy", auxOwnedBy,
"pageID", auxPageID,
"parentID", auxParentID,
"primary", res.Primary,
"updatedAt", auxUpdatedAt,
"weight", res.Weight,
)
-8
View File
@@ -831,14 +831,6 @@ var PageLayout = &dal.Model{
Store: &dal.CodecAlias{Ident: "meta"},
},
&dal.Attribute{
Ident: "Primary",
Type: &dal.TypeBoolean{HasDefault: true,
DefaultValue: false,
},
Store: &dal.CodecAlias{Ident: "primary"},
},
&dal.Attribute{
Ident: "Config",
Type: &dal.TypeJSON{
-5
View File
@@ -61,11 +61,6 @@ pageLayout: {
omitGetter: true
}
primary: {
goType: "bool"
dal: { type: "Boolean", default: false }
}
config: {
goType: "types.PageLayoutConfig"
dal: { type: "JSON", defaultEmptyObject: true }
-16
View File
@@ -596,10 +596,6 @@ endpoints:
name: parentID
required: false
title: Parent ID
- type: bool
name: primary
required: false
title: Default layouts
- type: string
name: query
required: false
@@ -640,10 +636,6 @@ endpoints:
name: parentID
required: false
title: Parent ID
- type: bool
name: primary
required: false
title: Default layouts
- type: string
name: query
required: false
@@ -692,10 +684,6 @@ endpoints:
name: handle
required: false
title: Handle
- type: bool
name: primary
required: false
title: Primary
- type: "types.PageLayoutMeta"
name: meta
required: false
@@ -763,10 +751,6 @@ endpoints:
name: handle
required: false
title: Handle
- type: bool
name: primary
required: false
title: Primary
- type: "types.PageLayoutMeta"
name: meta
required: false
-2
View File
@@ -116,7 +116,6 @@ func (ctrl *PageLayout) Create(ctx context.Context, r *request.PageLayoutCreate)
Weight: r.Weight,
NamespaceID: r.NamespaceID,
Handle: r.Handle,
Primary: r.Primary,
Meta: r.Meta,
Labels: r.Labels,
OwnedBy: r.OwnedBy,
@@ -168,7 +167,6 @@ func (ctrl *PageLayout) Update(ctx context.Context, r *request.PageLayoutUpdate)
ParentID: r.ParentID,
NamespaceID: r.NamespaceID,
Handle: r.Handle,
Primary: r.Primary,
Meta: r.Meta,
Labels: r.Labels,
OwnedBy: r.OwnedBy,
-84
View File
@@ -58,11 +58,6 @@ type (
// Parent ID
ParentID uint64 `json:",string"`
// Primary GET parameter
//
// Default layouts
Primary bool
// Query GET parameter
//
// Search query
@@ -115,11 +110,6 @@ type (
// Parent ID
ParentID uint64 `json:",string"`
// Primary GET parameter
//
// Default layouts
Primary bool
// Query GET parameter
//
// Search query
@@ -182,11 +172,6 @@ type (
// Handle
Handle string
// Primary POST parameter
//
// Primary
Primary bool
// Meta POST parameter
//
// Meta
@@ -266,11 +251,6 @@ type (
// Handle
Handle string
// Primary POST parameter
//
// Primary
Primary bool
// Meta POST parameter
//
// Meta
@@ -405,7 +385,6 @@ func (r PageLayoutListNamespace) Auditable() map[string]interface{} {
"pageID": r.PageID,
"moduleID": r.ModuleID,
"parentID": r.ParentID,
"primary": r.Primary,
"query": r.Query,
"handle": r.Handle,
"labels": r.Labels,
@@ -435,11 +414,6 @@ func (r PageLayoutListNamespace) GetParentID() uint64 {
return r.ParentID
}
// Auditable returns all auditable/loggable parameters
func (r PageLayoutListNamespace) GetPrimary() bool {
return r.Primary
}
// Auditable returns all auditable/loggable parameters
func (r PageLayoutListNamespace) GetQuery() string {
return r.Query
@@ -495,12 +469,6 @@ func (r *PageLayoutListNamespace) Fill(req *http.Request) (err error) {
return err
}
}
if val, ok := tmp["primary"]; ok && len(val) > 0 {
r.Primary, err = payload.ParseBool(val[0]), nil
if err != nil {
return err
}
}
if val, ok := tmp["query"]; ok && len(val) > 0 {
r.Query, err = val[0], nil
if err != nil {
@@ -571,7 +539,6 @@ func (r PageLayoutList) Auditable() map[string]interface{} {
"pageID": r.PageID,
"moduleID": r.ModuleID,
"parentID": r.ParentID,
"primary": r.Primary,
"query": r.Query,
"handle": r.Handle,
"labels": r.Labels,
@@ -601,11 +568,6 @@ func (r PageLayoutList) GetParentID() uint64 {
return r.ParentID
}
// Auditable returns all auditable/loggable parameters
func (r PageLayoutList) GetPrimary() bool {
return r.Primary
}
// Auditable returns all auditable/loggable parameters
func (r PageLayoutList) GetQuery() string {
return r.Query
@@ -655,12 +617,6 @@ func (r *PageLayoutList) Fill(req *http.Request) (err error) {
return err
}
}
if val, ok := tmp["primary"]; ok && len(val) > 0 {
r.Primary, err = payload.ParseBool(val[0]), nil
if err != nil {
return err
}
}
if val, ok := tmp["query"]; ok && len(val) > 0 {
r.Query, err = val[0], nil
if err != nil {
@@ -739,7 +695,6 @@ func (r PageLayoutCreate) Auditable() map[string]interface{} {
"weight": r.Weight,
"moduleID": r.ModuleID,
"handle": r.Handle,
"primary": r.Primary,
"meta": r.Meta,
"config": r.Config,
"blocks": r.Blocks,
@@ -778,11 +733,6 @@ func (r PageLayoutCreate) GetHandle() string {
return r.Handle
}
// Auditable returns all auditable/loggable parameters
func (r PageLayoutCreate) GetPrimary() bool {
return r.Primary
}
// Auditable returns all auditable/loggable parameters
func (r PageLayoutCreate) GetMeta() types.PageLayoutMeta {
return r.Meta
@@ -857,13 +807,6 @@ func (r *PageLayoutCreate) Fill(req *http.Request) (err error) {
}
}
if val, ok := req.MultipartForm.Value["primary"]; ok && len(val) > 0 {
r.Primary, err = payload.ParseBool(val[0]), nil
if err != nil {
return err
}
}
if val, ok := req.MultipartForm.Value["meta[]"]; ok {
r.Meta, err = types.ParsePageLayoutMeta(val)
if err != nil {
@@ -946,13 +889,6 @@ func (r *PageLayoutCreate) Fill(req *http.Request) (err error) {
}
}
if val, ok := req.Form["primary"]; ok && len(val) > 0 {
r.Primary, err = payload.ParseBool(val[0]), nil
if err != nil {
return err
}
}
if val, ok := req.Form["meta[]"]; ok {
r.Meta, err = types.ParsePageLayoutMeta(val)
if err != nil {
@@ -1094,7 +1030,6 @@ func (r PageLayoutUpdate) Auditable() map[string]interface{} {
"weight": r.Weight,
"moduleID": r.ModuleID,
"handle": r.Handle,
"primary": r.Primary,
"meta": r.Meta,
"config": r.Config,
"blocks": r.Blocks,
@@ -1138,11 +1073,6 @@ func (r PageLayoutUpdate) GetHandle() string {
return r.Handle
}
// Auditable returns all auditable/loggable parameters
func (r PageLayoutUpdate) GetPrimary() bool {
return r.Primary
}
// Auditable returns all auditable/loggable parameters
func (r PageLayoutUpdate) GetMeta() types.PageLayoutMeta {
return r.Meta
@@ -1217,13 +1147,6 @@ func (r *PageLayoutUpdate) Fill(req *http.Request) (err error) {
}
}
if val, ok := req.MultipartForm.Value["primary"]; ok && len(val) > 0 {
r.Primary, err = payload.ParseBool(val[0]), nil
if err != nil {
return err
}
}
if val, ok := req.MultipartForm.Value["meta[]"]; ok {
r.Meta, err = types.ParsePageLayoutMeta(val)
if err != nil {
@@ -1306,13 +1229,6 @@ func (r *PageLayoutUpdate) Fill(req *http.Request) (err error) {
}
}
if val, ok := req.Form["primary"]; ok && len(val) > 0 {
r.Primary, err = payload.ParseBool(val[0]), nil
if err != nil {
return err
}
}
if val, ok := req.Form["meta[]"]; ok {
r.Meta, err = types.ParsePageLayoutMeta(val)
if err != nil {
-3
View File
@@ -111,7 +111,6 @@ func (p pageLayoutActionProps) Serialize() actionlog.Meta {
if p.filter != nil {
m.Set("filter.query", p.filter.Query, true)
m.Set("filter.handle", p.filter.Handle, true)
m.Set("filter.primary", p.filter.Primary, true)
m.Set("filter.namespaceID", p.filter.NamespaceID, true)
m.Set("filter.sort", p.filter.Sort, true)
m.Set("filter.limit", p.filter.Limit, true)
@@ -191,7 +190,6 @@ func (p pageLayoutActionProps) Format(in string, err error) string {
fns(
p.filter.Query,
p.filter.Handle,
p.filter.Primary,
p.filter.NamespaceID,
p.filter.Sort,
p.filter.Limit,
@@ -199,7 +197,6 @@ func (p pageLayoutActionProps) Format(in string, err error) string {
)
pairs = append(pairs, "{{filter.query}}", fns(p.filter.Query))
pairs = append(pairs, "{{filter.handle}}", fns(p.filter.Handle))
pairs = append(pairs, "{{filter.primary}}", fns(p.filter.Primary))
pairs = append(pairs, "{{filter.namespaceID}}", fns(p.filter.NamespaceID))
pairs = append(pairs, "{{filter.sort}}", fns(p.filter.Sort))
pairs = append(pairs, "{{filter.limit}}", fns(p.filter.Limit))
@@ -21,7 +21,7 @@ props:
fields: [ handle, ID, namespaceID, blocks ]
- name: filter
type: "*types.PageLayoutFilter"
fields: [ query, handle, primary, namespaceID, sort, limit ]
fields: [ query, handle, namespaceID, sort, limit ]
- name: namespace
type: "*types.Namespace"
fields: [ slug, ID ]
-4
View File
@@ -351,8 +351,6 @@ func (r *PageLayout) GetValue(name string, pos uint) (any, error) {
return r.PageID, nil
case "parentID", "ParentID":
return r.ParentID, nil
case "primary", "Primary":
return r.Primary, nil
case "updatedAt", "UpdatedAt":
return r.UpdatedAt, nil
case "weight", "Weight":
@@ -380,8 +378,6 @@ func (r *PageLayout) SetValue(name string, pos uint, value any) (err error) {
return cast2.Uint64(value, &r.PageID)
case "parentID", "ParentID":
return cast2.Uint64(value, &r.ParentID)
case "primary", "Primary":
return cast2.Bool(value, &r.Primary)
case "updatedAt", "UpdatedAt":
return cast2.TimePtr(value, &r.UpdatedAt)
case "weight", "Weight":
-1
View File
@@ -114,7 +114,6 @@ type (
NamespaceID uint64 `json:"namespaceID,string"`
PageID uint64 `json:"pageID,string,omitempty"`
ParentID uint64 `json:"ParentID,string,omitempty"`
Primary bool `json:"primary,omitempty"`
Handle string `json:"handle"`
Name string `json:"name"`
Query string `json:"query"`
-4
View File
@@ -313,7 +313,6 @@ type (
NamespaceID uint64 `db:"namespace_id"`
Weight int `db:"weight"`
Meta composeType.PageLayoutMeta `db:"meta"`
Primary bool `db:"primary"`
Config composeType.PageLayoutConfig `db:"config"`
Blocks composeType.PageLayoutBlocks `db:"blocks"`
OwnedBy uint64 `db:"owned_by"`
@@ -1689,7 +1688,6 @@ func (aux *auxComposePageLayout) encode(res *composeType.PageLayout) (_ error) {
aux.NamespaceID = res.NamespaceID
aux.Weight = res.Weight
aux.Meta = res.Meta
aux.Primary = res.Primary
aux.Config = res.Config
aux.Blocks = res.Blocks
aux.OwnedBy = res.OwnedBy
@@ -1711,7 +1709,6 @@ func (aux auxComposePageLayout) decode() (res *composeType.PageLayout, _ error)
res.NamespaceID = aux.NamespaceID
res.Weight = aux.Weight
res.Meta = aux.Meta
res.Primary = aux.Primary
res.Config = aux.Config
res.Blocks = aux.Blocks
res.OwnedBy = aux.OwnedBy
@@ -1733,7 +1730,6 @@ func (aux *auxComposePageLayout) scan(row scanner) error {
&aux.NamespaceID,
&aux.Weight,
&aux.Meta,
&aux.Primary,
&aux.Config,
&aux.Blocks,
&aux.OwnedBy,
-4
View File
@@ -2100,7 +2100,6 @@ var (
"rel_namespace",
"weight",
"meta",
"primary",
"config",
"blocks",
"owned_by",
@@ -2123,7 +2122,6 @@ var (
"rel_namespace": res.NamespaceID,
"weight": res.Weight,
"meta": res.Meta,
"primary": res.Primary,
"config": res.Config,
"blocks": res.Blocks,
"owned_by": res.OwnedBy,
@@ -2149,7 +2147,6 @@ var (
"rel_namespace": res.NamespaceID,
"weight": res.Weight,
"meta": res.Meta,
"primary": res.Primary,
"config": res.Config,
"blocks": res.Blocks,
"owned_by": res.OwnedBy,
@@ -2173,7 +2170,6 @@ var (
"rel_namespace": res.NamespaceID,
"weight": res.Weight,
"meta": res.Meta,
"primary": res.Primary,
"config": res.Config,
"blocks": res.Blocks,
"owned_by": res.OwnedBy,