diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts index 9f2738bbd48..49f4632f0eb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts @@ -167,7 +167,7 @@ describe('IscsiTargetFormComponent', () => { httpTesting.expectOne('ui-api/iscsi/settings').flush(SETTINGS); httpTesting.expectOne('ui-api/iscsi/portals').flush(PORTALS); httpTesting.expectOne('ui-api/iscsi/version').flush(VERSION); - httpTesting.expectOne('api/block/image?offset=0&limit=-1').flush(RBD_LIST); + httpTesting.expectOne('api/block/image?offset=0&limit=-1&search=&sort=%3Ename').flush(RBD_LIST); httpTesting.expectOne('api/iscsi/target').flush(LIST_TARGET); httpTesting.verify(); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index 734118632ae..f43bd0a1ff1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -658,7 +658,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O context.search = this.userConfig.search; if (this.userConfig.sorts?.length) { const sort = this.userConfig.sorts[0]; - context.sort = `${sort.dir == 'desc' ? '<' : '>'}${sort.prop}`; + context.sort = `${sort.dir === 'desc' ? '<' : '>'}${sort.prop}`; } this.fetchData.emit(context); this.updating = true; diff --git a/src/pybind/mgr/dashboard/openapi.yaml b/src/pybind/mgr/dashboard/openapi.yaml index 8d07d74f09c..83bd98c2ed1 100644 --- a/src/pybind/mgr/dashboard/openapi.yaml +++ b/src/pybind/mgr/dashboard/openapi.yaml @@ -171,6 +171,11 @@ paths: name: search schema: type: string + - default: '' + in: query + name: sort + schema: + type: string responses: '200': content: diff --git a/src/pybind/mgr/dashboard/services/rbd.py b/src/pybind/mgr/dashboard/services/rbd.py index 21ecd34f157..4071943a304 100644 --- a/src/pybind/mgr/dashboard/services/rbd.py +++ b/src/pybind/mgr/dashboard/services/rbd.py @@ -430,7 +430,8 @@ class RbdService(object): return joint_refs @classmethod - def rbd_pool_list(cls, pool_names: List[str], namespace=None, offset=0, limit=0, search='', sort=''): + def rbd_pool_list(cls, pool_names: List[str], namespace=None, offset=0, limit=0, + search='', sort=''): offset = int(offset) limit = int(limit) # let's use -1 to denotate we want ALL images for now. Iscsi currently gathers @@ -451,6 +452,8 @@ class RbdService(object): result = [] end = offset + limit + if len(sort) < 2: + sort = '>name' descending = sort[0] == '<' sort_by = sort[1:] if sort_by == 'pool_name':