summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts2
-rw-r--r--components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/kafka-list.component.ts75
-rw-r--r--components/datalake-handler/admin/src/src/app/views/tools/tools.component.ts2
-rw-r--r--components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java24
4 files changed, 67 insertions, 36 deletions
diff --git a/components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts b/components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts
index 0c520895..dc1a0231 100644
--- a/components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts
+++ b/components/datalake-handler/admin/src/src/app/core/services/rest-api.service.ts
@@ -160,7 +160,7 @@ export class RestApiService {
*/
getDbEncryptList(flag): Observable<any> {
return this.http
- .get(prefix + "dbs/list?tool=" + flag)
+ .get(prefix + "dbs/list?isDb=" + flag)
.pipe(retry(1), map(this.extractData), catchError(this.handleError));
}
diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/kafka-list.component.ts b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/kafka-list.component.ts
index 1acd6171..b8dbb0e0 100644
--- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/kafka-list.component.ts
+++ b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/kafka-list.component.ts
@@ -30,11 +30,7 @@ import { NgxSpinnerService } from "ngx-spinner";
import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
import {AlertComponent} from "../../../shared/components/alert/alert.component";
import {NewKafkaModalComponent} from "./new-kafka-modal/new-kafka-modal.component";
-import {ModalContentData} from "../../../shared/modules/modal/modal.data";
-import {ModalDemoComponent} from "../../test/modal-demo/modal-demo.component";
-import {ModalComponent} from "../../../shared/modules/modal/modal.component";
import {EditKafkaModalComponent} from "./edit-kafka-modal/edit-kafka-modal.component";
-import {el} from "@angular/platform-browser/testing/src/browser_util";
@Component({
selector: 'app-kafka-list',
@@ -51,6 +47,7 @@ export class KafkaListComponent implements OnInit {
Kafka_New: Kafka;
Kafka_Newbody: Kafka;
cardIconPathList: any = [];
+ kafkaData: any = [];
constructor(
private kafkaApiService: RestApiService,
@@ -74,6 +71,7 @@ export class KafkaListComponent implements OnInit {
if (this.kafkas.length > 0) {
let a = "assets/icons/kafka_able.svg";
let b = "assets/icons/kafka_disable.svg";
+ this.cardIconPathList.splice(0,this.cardIconPathList.length);
for (let i = 0; i < this.kafkas.length; i++) {
this.cardIconPath = (this.kafkas[i].enabled == true) ? a : b;
this.cardIconPathList.push(this.cardIconPath);
@@ -98,6 +96,16 @@ export class KafkaListComponent implements OnInit {
return data;
}
+ async getKafkaDetailModal(id: number) {
+ this.kafkaData = [];
+ this.kafkaData = await this.getKafkaModal(id);
+ return this.kafkaData;
+ }
+
+ getKafkaModal(id: number) {
+ return this.kafkaApiService.getKafka(id).toPromise();
+ }
+
async initKafkasList(kafkaList: []) {
let k: Kafka[] = [];
if (kafkaList.length > 0) {
@@ -208,33 +216,38 @@ export class KafkaListComponent implements OnInit {
}
editKafkaModal(id: number) {
- console.log("id", id)
- const index = this.kafkaList.findIndex(t => t.id === id);
- const modalRef = this.modalService.open(EditKafkaModalComponent, {
- windowClass: "dl-md-modal kafkas",
- centered: true
- });
- modalRef.componentInstance.editKafka = this.kafkaList[index];
- modalRef.componentInstance.passEntry.subscribe(receivedEntry => {
- this.Kafka_New = receivedEntry;
- this.kafkaApiService
- .updateKafka(this.Kafka_New)
- .subscribe(
- res => {
- if (res.statusCode == 200) {
- this.kafkaList[index] = this.Kafka_New;
- this.kafkaList = [...this.kafkaList];
- this.notificationService.success("SUCCESSFULLY_UPDATED");
- } else {
- this.notificationService.error("FAILED_UPDATED");
+ this.getKafkaDetailModal(id).then(data => {
+ console.log("id", id);
+ const index = this.kafkaList.findIndex(t => t.id === id);
+ const modalRef = this.modalService.open(EditKafkaModalComponent, {
+ windowClass: "dl-md-modal kafkas",
+ centered: true
+ });
+ modalRef.componentInstance.editKafka = data;
+ modalRef.componentInstance.passEntry.subscribe(receivedEntry => {
+ this.Kafka_New = receivedEntry;
+ this.kafkaApiService
+ .updateKafka(this.Kafka_New)
+ .subscribe(
+ res => {
+ this.spinner.hide();
+ if (res.statusCode == 200) {
+ this.kafkaList[index] = this.Kafka_New;
+ this.kafkaList = [...this.kafkaList];
+ this.notificationService.success("SUCCESSFULLY_UPDATED");
+ this.initList();
+ } else {
+ this.notificationService.error("FAILED_UPDATED");
+ }
+ modalRef.close();
+ },
+ err => {
+ this.notificationService.error(err);
+ modalRef.close();
}
- modalRef.close();
- },
- err => {
- this.notificationService.error(err);
- modalRef.close();
- }
- );
- })
+ );
+ });
+ });
+
}
}
diff --git a/components/datalake-handler/admin/src/src/app/views/tools/tools.component.ts b/components/datalake-handler/admin/src/src/app/views/tools/tools.component.ts
index be0d253f..65de6ada 100644
--- a/components/datalake-handler/admin/src/src/app/views/tools/tools.component.ts
+++ b/components/datalake-handler/admin/src/src/app/views/tools/tools.component.ts
@@ -50,7 +50,7 @@ export class ToolsComponent implements OnInit {
private adminService: AdminService,
private notificationService: ToastrNotificationService,
private modalService: NgbModal,
- private dbApiService: RestApiService,
+ private dbApiService: RestApiService
) {
this.adminService.setTitle("SIDEBAR.DASHBOARDLIST");
this.initData().then(data => { });
diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java
index 41995e04..9865e0af 100644
--- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java
+++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java
@@ -121,14 +121,14 @@ public class KafkaController {
Kafka oldKafka = kafkaService.getKafkaById(id);
if (oldKafka == null) {
- sendError(response, 400, "kafka not found "+id);
+ sendError(response, 400, "kafka not found, ID: "+id);
} else {
kafkaRepository.delete(oldKafka);
response.setStatus(204);
}
}
- @GetMapping("")
+ /*@GetMapping("")
@ResponseBody
@ApiOperation(value="List all Kafka id")
public List<Integer> list() {
@@ -139,12 +139,30 @@ public class KafkaController {
retString.add(k.getId());
}
return retString;
- }
+ }*/
+ @GetMapping("")
+ @ResponseBody
+ @ApiOperation(value="List all Kafkas")
public List<KafkaConfig> queryAllKafka(){
return kafkaService.getAllKafka();
}
+ @GetMapping("/{id}")
+ @ResponseBody
+ @ApiOperation(value="Get detail of kafka by id")
+ public KafkaConfig getKafkaDetail(@PathVariable int id, HttpServletResponse response) throws IOException {
+ log.info("Get detail of kafka, ID: " + id);
+ Kafka oldKafka = kafkaService.getKafkaById(id);
+ if (oldKafka == null) {
+ sendError(response, 400, "kafka not found, ID: "+id);
+ return null;
+ } else {
+ log.info("ResponseBody......" + oldKafka.getKafkaConfig());
+ return oldKafka.getKafkaConfig();
+ }
+ }
+
private PostReturnBody<KafkaConfig> mkPostReturnBody(int statusCode, Kafka kafka) {
PostReturnBody<KafkaConfig> retBody = new PostReturnBody<>();
retBody.setStatusCode(statusCode);