From a0b128676bea38bc426171bf89ccb1376dd901cc Mon Sep 17 00:00:00 2001 From: Kelani Tolulope Date: Fri, 14 Apr 2023 14:44:47 +0100 Subject: [PATCH 1/3] Fix sortlng for admin automation sessions list --- client/web/admin/src/views/Automation/Session/List.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/client/web/admin/src/views/Automation/Session/List.vue b/client/web/admin/src/views/Automation/Session/List.vue index 448276803..b21711d28 100644 --- a/client/web/admin/src/views/Automation/Session/List.vue +++ b/client/web/admin/src/views/Automation/Session/List.vue @@ -93,7 +93,6 @@ export default { filter: { status: undefined, completed: 1, - sort: 'createdAt DESC', }, sorting: { From 7fcfb40d2e888ea7a540876c9f5c7a5d0fa5d775 Mon Sep 17 00:00:00 2001 From: Vivek Patel Date: Wed, 19 Apr 2023 17:56:31 +0530 Subject: [PATCH 2/3] Fix issue with session list It fixes issue of sorting and pagination for the status column due to Its stringify interpretation. --- server/automation/rest/session.go | 8 ++++++++ server/pkg/filter/pagination.go | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/server/automation/rest/session.go b/server/automation/rest/session.go index 6f0e7b252..29982b396 100644 --- a/server/automation/rest/session.go +++ b/server/automation/rest/session.go @@ -67,6 +67,14 @@ func (ctrl Session) List(ctx context.Context, r *request.SessionList) (interface return nil, err } + // fixes issue with sorting of status column and pagination + // need to improve on cursor for this + if f.Paging.PageCursor != nil { + for _, status := range r.Status { + f.Paging.PageCursor.Set("status", status, false) + } + } + f.IncTotal = r.IncTotal if f.Sorting, err = filter.NewSorting(r.Sort); err != nil { diff --git a/server/pkg/filter/pagination.go b/server/pkg/filter/pagination.go index 512b3ef15..473d5b3a8 100644 --- a/server/pkg/filter/pagination.go +++ b/server/pkg/filter/pagination.go @@ -252,7 +252,7 @@ func (p *PagingCursor) UnmarshalJSON(in []byte) error { } } - if err := json.Unmarshal(in, &aux); err != nil { + if err = json.Unmarshal(in, &aux); err != nil { return err } @@ -287,10 +287,10 @@ func (p *PagingCursor) Decode(cursor string) error { } // Sort returns: -// - sort if cursor is nil -// - sort from cursor when sort is empty -// - sort from cursor when sort is compatible with cursor -// - error if sort & cursor are incompatible +// - sort if cursor is nil +// - sort from cursor when sort is empty +// - sort from cursor when sort is compatible with cursor +// - error if sort & cursor are incompatible func (p *PagingCursor) Sort(sort SortExprSet) (SortExprSet, error) { if p == nil { return sort, nil From a386fa420b01026de7ab9ca0ac52749cb4e965f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Tue, 18 Apr 2023 11:51:04 +0200 Subject: [PATCH 3/3] Adjust admin automation sessions UI/UX --- .../admin/src/themes/corteza-base/custom.scss | 7 +- .../src/views/Automation/Scripts/Index.vue | 1 + .../src/views/Automation/Session/List.vue | 86 ++++++++++++++++--- .../src/views/System/Actionlog/Index.vue | 3 +- lib/vue/src/components/input/CInputSearch.vue | 6 +- .../components/resourceList/CResourceList.vue | 11 ++- 6 files changed, 93 insertions(+), 21 deletions(-) diff --git a/client/web/admin/src/themes/corteza-base/custom.scss b/client/web/admin/src/themes/corteza-base/custom.scss index e9110150d..7d563d029 100644 --- a/client/web/admin/src/themes/corteza-base/custom.scss +++ b/client/web/admin/src/themes/corteza-base/custom.scss @@ -59,7 +59,12 @@ th { // custom height for resource lists with buttons .custom-resource-list-height { - height: calc(100vh - 115px); + height: calc(100vh - 120px); +} + +// custom height for resource lists without buttons +.custom-resource-list-height-no-buttons { + height: calc(100vh - 105px); } // to remove the gap on top of the sticky header table diff --git a/client/web/admin/src/views/Automation/Scripts/Index.vue b/client/web/admin/src/views/Automation/Scripts/Index.vue index 920dcce96..6d0f3acbe 100644 --- a/client/web/admin/src/views/Automation/Scripts/Index.vue +++ b/client/web/admin/src/views/Automation/Scripts/Index.vue @@ -1,5 +1,6 @@