Skip to content

Commit

Permalink
Merge pull request #18 from muralibasani/improvements_3_4
Browse files Browse the repository at this point in the history
Server configuration page, and default partitions configuration
  • Loading branch information
muralibasani authored Nov 28, 2019
2 parents 12a7171 + c2f3c53 commit 6f69bfd
Show file tree
Hide file tree
Showing 63 changed files with 1,203 additions and 107 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ Download options : https://kafkawize.readthedocs.io/en/latest/getting_started.ht

![ImageFig18](https://github.com/kafkawize/kafkawize/blob/master/screenshots/ViewUsers.JPG)

![ImageFig20](https://github.com/kafkawize/kafkawize/blob/master/screenshots/ViewTeams.JPG)
![ImageFig20](https://github.com/kafkawize/kafkawize/blob/master/screenshots/ViewTeams.JPG)

![ImageFig21](https://github.com/kafkawize/kafkawize/blob/master/screenshots/ServerConfig.JPG)
8 changes: 4 additions & 4 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Kafkawize 3.3
Kafkawize 3.4

Kafkawize is a Kafka Topic management tool (A Web application) which automates the process of creating and browsing Kafka components, by introducing roles/authorizations to users of various teams of an organization

Changes include
1. Decline Topic requests
2. Decline Acl requests
3. Bug fix in creating topic request
1. New page (Admin-ServerConfig) to display server configuration - application properties
2. Default replication factor, default partitions and default max partitions can be configured from Clusters page.
3. Couple of minor bug fixes
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.kafkamgt.uiapi</groupId>
<artifactId>kafkawize</artifactId>
<version>3.3</version>
<version>3.4</version>

<packaging>jar</packaging>

Expand Down Expand Up @@ -102,7 +102,12 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.8</version>
</dependency>

</dependencies>
Expand Down
Binary file modified screenshots/AddCluster.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/Environments.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/RequestTopic.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ServerConfig.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.kafkamgt.uiapi.controller;

import com.kafkamgt.uiapi.dao.ServerConfigProperties;
import com.kafkamgt.uiapi.service.ServerConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/")
public class ServerConfigController {

@Autowired
private ServerConfigService serverConfigService;

@RequestMapping(value = "/getAllServerConfig", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<List<ServerConfigProperties>> getAllProperties() {
return new ResponseEntity<>(serverConfigService.getAllProps(), HttpStatus.OK);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ResponseEntity<List<TopicRequest>> getTopicRequests() {

@RequestMapping(value = "/getTopicTeam", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<Topic> getTopicTeam(@RequestParam("topicName") String topicName,
@RequestParam("env") String env) {
@RequestParam("env") String env) {
return new ResponseEntity<>(topicControllerService.getTopicTeam(topicName, env), HttpStatus.OK);
}

Expand Down Expand Up @@ -100,7 +100,7 @@ public ResponseEntity<List<String>> getTopicsOnly(@RequestParam("env") String en

@RequestMapping(value = "/getSyncTopics", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<List<TopicRequest>> getSyncTopics(@RequestParam("env") String env, @RequestParam("pageNo") String pageNo,
@RequestParam(value="topicnamesearch",required=false) String topicNameSearch) throws Exception {
@RequestParam(value="topicnamesearch",required=false) String topicNameSearch) throws Exception {

return new ResponseEntity<>(topicControllerService.getSyncTopics(env, pageNo, topicNameSearch), HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public String browseAcls(ModelMap model) {
return "browseAcls.html";
}

@RequestMapping(value = "/serverConfig", method = RequestMethod.GET)
public String serverConfig(ModelMap model) {
return "serverConfig.html";
}

@RequestMapping(value = "/notFound", method = RequestMethod.GET)
public String notFound(ModelMap model) {
return "index.html";
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/kafkamgt/uiapi/dao/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

@Getter
Expand Down Expand Up @@ -43,4 +46,9 @@ public class Env implements Serializable {

@Column(name = "truststorepwd")
private String trustStorePwd;

@Column(name = "other_params")
private String otherParams;


}
15 changes: 15 additions & 0 deletions src/main/java/com/kafkamgt/uiapi/dao/ServerConfigProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.kafkamgt.uiapi.dao;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ServerConfigProperties {

private String id;

private String key;

private String value;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.kafkamgt.uiapi.helpers;

import com.kafkamgt.uiapi.dao.*;
import com.kafkamgt.uiapi.dao.Topic;
import com.kafkamgt.uiapi.model.PCStream;
import com.kafkamgt.uiapi.dao.UserInfo;

import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class CassandraDataSourceCondition implements Condition {
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {

Environment defaultEnv = conditionContext.getEnvironment();
if(defaultEnv.getProperty("db.storetype").equals("cassandra"))
if(defaultEnv.getProperty("custom.db.storetype").equals("cassandra"))
return true;
else
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
package com.kafkamgt.uiapi.helpers.db.cassandra;


import com.datastax.driver.core.*;
import com.datastax.driver.core.querybuilder.*;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.querybuilder.Clause;
import com.datastax.driver.core.querybuilder.Delete;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Select;
import com.kafkamgt.uiapi.dao.Acl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.List;

@Component
public class DeleteData {
Expand All @@ -18,7 +23,7 @@ public class DeleteData {

Session session;

@Value("${cassandradb.keyspace:@null}")
@Value("${custom.cassandradb.keyspace:@null}")
String keyspace;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import com.datastax.driver.core.policies.DefaultRetryPolicy;
import com.datastax.driver.extras.codecs.jdk8.InstantCodec;
import com.kafkamgt.uiapi.dao.*;
import com.kafkamgt.uiapi.dao.Topic;
import com.kafkamgt.uiapi.helpers.HandleDbRequests;
import com.kafkamgt.uiapi.model.PCStream;
import com.kafkamgt.uiapi.dao.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -43,13 +41,13 @@ public class HandleDbRequestsCassandra implements HandleDbRequests {
Cluster cluster;
Session session;

@Value("${cassandradb.url:@null}")
@Value("${custom.cassandradb.url:@null}")
String clusterConnHost;

@Value("${cassandradb.port:9042}")
@Value("${custom.cassandradb.port:9042}")
int clusterConnPort;

@Value("${cassandradb.keyspace:@null}")
@Value("${custom.cassandradb.keyspace:@null}")
String keyspace;

public void connectToDb() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.kafkamgt.uiapi.helpers.db.cassandra;


import com.datastax.driver.core.*;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.Session;
import com.kafkamgt.uiapi.dao.*;
import com.kafkamgt.uiapi.dao.Topic;
import com.kafkamgt.uiapi.dao.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.*;

import static org.springframework.beans.BeanUtils.copyProperties;
import java.util.Date;
import java.util.List;
import java.util.Random;

@Component
public class InsertData {
Expand All @@ -21,7 +21,7 @@ public class InsertData {

Session session;

@Value("${cassandradb.keyspace:@null}")
@Value("${custom.cassandradb.keyspace:@null}")
String keyspace;

SelectData cassandraSelectHelper;
Expand Down Expand Up @@ -247,13 +247,13 @@ public String insertIntoTeams(Team team){
public String insertIntoEnvs(Env env){
String tableName = "env";
String insertstat = "INSERT INTO " + keyspace + "."+tableName+"(name, host, port, protocol, type," +
" keystorelocation, truststorelocation, keystorepwd, keypwd, truststorepwd ) " +
"VALUES (?,?,?,?,?,?,?,?,?,?);";
" keystorelocation, truststorelocation, keystorepwd, keypwd, truststorepwd, other_params ) " +
"VALUES (?,?,?,?,?,?,?,?,?,?,?);";
PreparedStatement statement = session.prepare(insertstat);
BoundStatement boundStatement = new BoundStatement(statement);
session.execute(boundStatement.bind(env.getName(),env.getHost(),env.getPort(),env.getProtocol(),env.getType()
,env.getKeyStoreLocation(),env.getTrustStoreLocation(),env.getKeyStorePwd(),
env.getKeyPwd(),env.getTrustStorePwd()));
env.getKeyPwd(),env.getTrustStorePwd(), env.getOtherParams()));
return "success";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
package com.kafkamgt.uiapi.helpers.db.cassandra;


import com.datastax.driver.core.*;
import com.datastax.driver.core.querybuilder.*;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.querybuilder.Clause;
import com.datastax.driver.core.querybuilder.Ordering;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Select;
import com.kafkamgt.uiapi.dao.*;
import com.kafkamgt.uiapi.dao.Topic;
import com.kafkamgt.uiapi.model.PCStream;
import com.kafkamgt.uiapi.dao.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Component
Expand All @@ -22,7 +28,7 @@ public class SelectData{

Session session;

@Value("${cassandradb.keyspace:@null}")
@Value("${custom.cassandradb.keyspace:@null}")
String keyspace;


Expand Down Expand Up @@ -527,6 +533,7 @@ public List<Env> selectAllEnvs(String type){
env.setKeyStorePwd(row.getString("keystorepwd"));
env.setKeyPwd(row.getString("keypwd"));
env.setTrustStorePwd(row.getString("truststorepwd"));
env.setOtherParams(row.getString("other_params"));

if(row.getString("type").equals(type))
envList.add(env);
Expand Down Expand Up @@ -557,7 +564,7 @@ public Env selectEnvDetails(String environment){
env.setKeyStorePwd(row.getString("keystorepwd"));
env.setKeyPwd(row.getString("keypwd"));
env.setTrustStorePwd(row.getString("truststorepwd"));

env.setOtherParams(row.getString("other_params"));
}
return env;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package com.kafkamgt.uiapi.helpers.db.cassandra;


import com.datastax.driver.core.*;
import com.datastax.driver.core.querybuilder.*;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.querybuilder.Clause;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Update;
import com.kafkamgt.uiapi.dao.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static org.springframework.beans.BeanUtils.copyProperties;

Expand All @@ -21,7 +25,7 @@ public class UpdateData {

Session session;

@Value("${cassandradb.keyspace:@null}")
@Value("${custom.cassandradb.keyspace:@null}")
String keyspace;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.kafkamgt.uiapi.helpers.db.rdbms;

import com.kafkamgt.uiapi.dao.*;
import com.kafkamgt.uiapi.dao.Topic;
import com.kafkamgt.uiapi.helpers.HandleDbRequests;
import com.kafkamgt.uiapi.model.PCStream;
import com.kafkamgt.uiapi.dao.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.kafkamgt.uiapi.helpers.db.rdbms;

import com.kafkamgt.uiapi.dao.*;
import com.kafkamgt.uiapi.dao.Topic;
import com.kafkamgt.uiapi.dao.UserInfo;
import com.kafkamgt.uiapi.repository.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Loading

0 comments on commit 6f69bfd

Please sign in to comment.