3
0

Enable sorting on workflow fields

This commit is contained in:
Denis Arh 2021-03-17 16:10:04 +01:00
parent d2bd39d61e
commit a848c7d0b8
2 changed files with 23 additions and 6 deletions

View File

@ -6,9 +6,9 @@ types:
fields:
- { field: ID }
- { field: Handle, unique: true, lookupFilterPreprocessor: lower }
- { field: Handle, unique: true, lookupFilterPreprocessor: lower, sortable: true }
- { field: Meta, type: "types.WorkflowMeta" }
- { field: Enabled, type: bool }
- { field: Enabled, type: bool, sortable: true }
- { field: Trace, type: bool }
- { field: KeepSessions, type: "time.Duration" }
- { field: Scope, type: "expr.Vars" }
@ -20,9 +20,9 @@ fields:
- { field: CreatedBy }
- { field: UpdatedBy }
- { field: DeletedBy }
- { field: CreatedAt }
- { field: UpdatedAt }
- { field: DeletedAt }
- { field: CreatedAt, sortable: true }
- { field: UpdatedAt, sortable: true }
- { field: DeletedAt, sortable: true }
rdbms:
alias: atmwf

View File

@ -527,7 +527,12 @@ func (Store) automationWorkflowColumns(aa ...string) []string {
// With optional string arg, all columns are returned aliased
func (Store) sortableAutomationWorkflowColumns() map[string]string {
return map[string]string{
"id": "id",
"id": "id", "handle": "handle", "enabled": "enabled", "created_at": "created_at",
"createdat": "created_at",
"updated_at": "updated_at",
"updatedat": "updated_at",
"deleted_at": "deleted_at",
"deletedat": "deleted_at",
}
}
@ -588,6 +593,18 @@ func (s Store) collectAutomationWorkflowCursorValues(res *types.Workflow, cc ...
cursor.Set(c.Column, res.Handle, c.Descending)
hasUnique = true
case "enabled":
cursor.Set(c.Column, res.Enabled, c.Descending)
case "created_at":
cursor.Set(c.Column, res.CreatedAt, c.Descending)
case "updated_at":
cursor.Set(c.Column, res.UpdatedAt, c.Descending)
case "deleted_at":
cursor.Set(c.Column, res.DeletedAt, c.Descending)
}
}
}