Skip to content

Commit

Permalink
Merge branch 'main' of github.com:redhat-developer/app-services-sdk-j…
Browse files Browse the repository at this point in the history
…s into main
  • Loading branch information
wtrocki committed Jun 30, 2021
2 parents bf710aa + c38e4a8 commit 0006e84
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .openapi/srs-fleet-manager.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -505,7 +509,8 @@
"status": "PROVISIONING",
"lastUpdated": "2021-05-04T12:34:56Z"
},
"registryDeploymentId": 1
"registryDeploymentId": 1,
"owner": "ownername"
}
}
]
Expand Down
15 changes: 14 additions & 1 deletion packages/api-mock/src/handlers/kafka-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand All @@ -14,7 +21,7 @@ module.exports = {
consumerGroupList = filteredConsumerGroups();
count = consumerGroupList.length;
}

const filterConsumerGroups = (topicName) => {
return consumerGroupList.filter((consumerGroup) => {
return consumerGroup.consumers.some(
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ export interface RootTypeForRegistry {
* @memberof RootTypeForRegistry
*/
registryDeploymentId?: number;
/**
* Registry instance owner
* @type {string}
* @memberof RootTypeForRegistry
*/
owner?: string;
}


0 comments on commit 0006e84

Please sign in to comment.