From b216e446a38e9d1a47518964be826ec373c91afc Mon Sep 17 00:00:00 2001 From: suyash-naithani <66817941+suyash-naithani@users.noreply.github.com> Date: Tue, 29 Jun 2021 17:00:44 +0530 Subject: [PATCH 1/3] fix(api-mock): Add sorting for consumer groups by group id (#99) --- packages/api-mock/src/handlers/kafka-admin.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/api-mock/src/handlers/kafka-admin.js b/packages/api-mock/src/handlers/kafka-admin.js index 64fe1e48..24e2c22b 100644 --- a/packages/api-mock/src/handlers/kafka-admin.js +++ b/packages/api-mock/src/handlers/kafka-admin.js @@ -5,6 +5,13 @@ module.exports = { getConsumerGroups: async (c, req, res) => { let consumerGroupList = consumerGroups; let count = consumerGroups !== undefined ? consumerGroups.length : 0; + + let order = req.query.order || 'asc'; + let orderKey = req.query.orderKey; + + if(orderKey=='name') { + order === 'asc' ? consumerGroups.sort(compareGroupId) : consumerGroups.sort((a, b) => compareGroupId(b, a)); + } const filteredConsumerGroups = () => { let regexp = new RegExp(`${req.query['group-id-filter'].trim()}`,`i`); @@ -14,7 +21,7 @@ module.exports = { consumerGroupList = filteredConsumerGroups(); count = consumerGroupList.length; } - + const filterConsumerGroups = (topicName) => { return consumerGroupList.filter((consumerGroup) => { return consumerGroup.consumers.some( @@ -269,6 +276,12 @@ function compareName(a, b) { return 0; } +function compareGroupId(a, b) { + if (a.groupId < b.groupId) return -1; + if (a.groupId > b.groupId) return 1; + return 0; +} + function comparePartitions(a, b) { if (a.partitions.length < b.partitions.length) return -1; if (a.partitions.length > b.partitions.length) return 1; From dc81f2ae1ebe0b038fbc7cb48b666e523a2306d7 Mon Sep 17 00:00:00 2001 From: Red Hat Application Services CI <84090353+app-services-ci@users.noreply.github.com> Date: Tue, 29 Jun 2021 12:01:22 -0400 Subject: [PATCH 2/3] feat(openapi): srs-mgmt/v1 owner field support (#100) --- .openapi/srs-fleet-manager.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.openapi/srs-fleet-manager.json b/.openapi/srs-fleet-manager.json index d3acf15f..cafb32e2 100644 --- a/.openapi/srs-fleet-manager.json +++ b/.openapi/srs-fleet-manager.json @@ -495,6 +495,10 @@ "registryDeploymentId": { "description": "Identifier of a multi-tenant deployment, where this Service Registry instance resides.", "type": "integer" + }, + "owner": { + "description": "Registry instance owner", + "type": "string" } }, "example": { @@ -505,7 +509,8 @@ "status": "PROVISIONING", "lastUpdated": "2021-05-04T12:34:56Z" }, - "registryDeploymentId": 1 + "registryDeploymentId": 1, + "owner": "ownername" } } ] From c38e4a8fa30d31b0467533bb89bc7b2b42152a99 Mon Sep 17 00:00:00 2001 From: Red Hat Application Services CI <84090353+app-services-ci@users.noreply.github.com> Date: Tue, 29 Jun 2021 12:04:19 -0400 Subject: [PATCH 3/3] chore(registry-mgmt): new owner field for registry (#101) --- .../src/generated/model/root-type-for-registry.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/registry-management-sdk/src/generated/model/root-type-for-registry.ts b/packages/registry-management-sdk/src/generated/model/root-type-for-registry.ts index b5051216..b4f32f86 100644 --- a/packages/registry-management-sdk/src/generated/model/root-type-for-registry.ts +++ b/packages/registry-management-sdk/src/generated/model/root-type-for-registry.ts @@ -51,6 +51,12 @@ export interface RootTypeForRegistry { * @memberof RootTypeForRegistry */ registryDeploymentId?: number; + /** + * Registry instance owner + * @type {string} + * @memberof RootTypeForRegistry + */ + owner?: string; }