Skip to content

Commit

Permalink
feat: Add support for clusterType param in getClustersPaginated endpo…
Browse files Browse the repository at this point in the history
…int (#2327)

* Use enum string instead of value in KwClustersModelResponse's getClustersPaginated
* Update openapi file and TS types.

---------

Signed-off-by: Mirjam Aulbach <[email protected]>
  • Loading branch information
programmiri authored Feb 27, 2024
1 parent b95e496 commit ada600d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion coral/src/domain/cluster/cluster-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function getClustersPaginated({
"clusterType"
>): Promise<ClustersPaginatedApiResponse> {
const params: KlawApiRequestQueryParameters<"getClustersPaginated"> = {
clusterType: "all",
clusterType: "ALL",
pageNo,
...(searchClusterParam && { searchClusterParam: searchClusterParam }),
};
Expand Down
2 changes: 1 addition & 1 deletion coral/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4013,7 +4013,7 @@ export type operations = {
getClustersPaginated: {
parameters: {
query: {
clusterType: string;
clusterType: "ALL" | "KAFKA" | "SCHEMA_REGISTRY" | "KAFKA_CONNECT";
pageNo: string;
clusterId?: string;
searchClusterParam?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ResponseEntity<List<KwClustersModelResponse>> getClusters(
method = RequestMethod.GET,
produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<List<KwClustersModelResponse>> getClustersPaginated(
@RequestParam(value = "clusterType") String clusterType,
@RequestParam(value = "clusterType") KafkaClustersType clusterType,
@RequestParam("pageNo") String pageNo,
@RequestParam(value = "clusterId", defaultValue = "") String clusterId,
@RequestParam(value = "searchClusterParam", defaultValue = "") String searchClusterParam) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ public List<KwClustersModelResponse> getClusters(String typeOfCluster) {
}

public List<KwClustersModelResponse> getClustersPaginated(
String typeOfCluster, String clusterId, String pageNo, String searchClusterParam) {
List<KwClustersModelResponse> kwClustersModelList = getClusters("all");
KafkaClustersType typeOfCluster, String clusterId, String pageNo, String searchClusterParam) {

String clusterTypeValue = typeOfCluster.value;
List<KwClustersModelResponse> kwClustersModelList = getClusters(clusterTypeValue);

if (clusterId != null && !clusterId.equals("")) {
kwClustersModelList =
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/resources/static/js/envs.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ app.controller("envsCtrl", function($scope, $http, $location, $window) {
method: "GET",
url: "getClustersPaginated",
headers : { 'Content-Type' : 'application/json' },
params: {'clusterType' : 'all', 'clusterId' : $scope.clusterIdFromUrl,
params: {'clusterType' : 'ALL', 'clusterId' : $scope.clusterIdFromUrl,
'pageNo' : pageNo, 'searchClusterParam' : $scope.searchClusterParam},
data: {'clusterType' : 'all'}
data: {'clusterType' : 'ALL'}
}).success(function(output) {
$scope.allclustersset = output;
if(output && output.length > 0 && output[0] != null){
Expand Down
3 changes: 2 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4827,7 +4827,8 @@
"in" : "query",
"required" : true,
"schema" : {
"type" : "string"
"type" : "string",
"enum" : [ "ALL", "KAFKA", "SCHEMA_REGISTRY", "KAFKA_CONNECT" ]
}
}, {
"name" : "pageNo",
Expand Down

0 comments on commit ada600d

Please sign in to comment.