diff options
Diffstat (limited to 'components/datalake-handler/admin/src/src/app/views/kafka/kafka-list')
8 files changed, 0 insertions, 764 deletions
diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.css b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.css deleted file mode 100644 index a34ed1eb..00000000 --- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -.row-wrapper{ - display: flex; -} -.row-quarter-item{ - width: 20%; - margin-bottom: 15px; -} -.row-half-item{ - width: 45%; -} -.row-half-item2{ - width: 50%; -} -.usual-item{ - margin-left: 2%; -} -.usual-item2{ - margin-left: 6.5%; -} -input::-webkit-input-placeholder { - font-size: 12px; - color: #0DA9E2; -} diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.html b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.html deleted file mode 100644 index 2a42b988..00000000 --- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.html +++ /dev/null @@ -1,193 +0,0 @@ -<!-- - Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<div class="p-1"> - <div class="modal-header pb-0 border-0"> - <div class="container-fluid"> - <div class="row"> - <div class="col-md-12"> - <label class="dl-h3">{{ 'EDIT_KAFKA' | translate }}-{{ this.kafkaInputTitle }}</label> - </div> - </div> - <div class="row"> - <div class="col-md-12"> - <hr> - </div> - </div> - </div> - </div> - - <div class="modal-body border-0"> - <div class="container-fluid"> - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'NAME' | translate }}</label> - </div> - <div> - <input [(ngModel)]="this.kafkaInput.name" class="form-control dl-input-text" type="text"/> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'STATUS' | translate }}</label> - </div> - <div> - <label class="dl-switch"> - <input id="switch" type="checkbox" [(ngModel)]="this.kafkaInput.enabled"/> - <span class="dl-slider round"></span> - </label> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'BROKER_LIST' | translate }}</label> - </div> - <div> - <input [(ngModel)]="this.kafkaInput.brokerList" class="form-control dl-input-text" type="text" required="required" /> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'ZOOKEEPER' | translate }}</label> - </div> - <div> - <input [(ngModel)]="this.kafkaInput.zooKeeper" class="form-control dl-input-text" type="text" required="required" /> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'Username' | translate }}</label> - </div> - <div> - <input [(ngModel)]="this.kafkaInput.login" class="form-control dl-input-text" type="text" required="required" /> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'Password' | translate }}</label> - </div> - <div> - <input [(ngModel)]="this.kafkaInput.pass" class="form-control dl-input-text" type="text" required="required" /> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1">{{ 'AUTHENTICATION' | translate }}</label> - </div> - <div class="input-group row-half-item2"> - <label class="input-group-text dl-input-chk-label"> - <input id="chkSaveRaw" [(ngModel)]="this.kafkaInput.secure" type="checkbox"/> - <span class="dl-input-checkmark"></span> - </label> - <label class="form-control dl-input-chk" for="chkSaveRaw"> - Secure - </label> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'SECURITY_PROTOCOL' | translate }}</label> - </div> - <div> - <select class="custom-select dl-input-text" > - <option *ngFor="let item of protocols" [selected]="item == protocols[0]">{{ item }}</option> - </select> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'GROUP' | translate }}</label> - </div> - <div> - <input [(ngModel)]="this.kafkaInput.group" class="form-control dl-input-text" type="text" required="required" /> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'TIME_OUT' | translate }}</label> - </div> - <div> - <input [(ngModel)]="this.kafkaInput.timeout" class="form-control dl-input-text" type="text" required="required" /> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'EXCLUDED_TOPICS' | translate }}</label> - </div> - <div> - <div class="d-flex row align-items-center" *ngFor="let field of exTopicFields; let i = index"> - <div class="order-1 usual-item2"> - <input [(ngModel)]="field.item" class="form-control dl-input-text" type="text"/> - </div> - <div class="order-2"> - <button type="button" class="btn dl-icon-enable p-2" (click)="addExTopicField()"> - <i class="fa fa-plus fa-xs" aria-hidden="true"></i> - </button> - </div> - <div class="order-3"> - <button type="button" class="btn dl-icon-enable p-2" (click)="deleteExTopicField(i)"> - <i class="fa fa-trash fa-xs" aria-hidden="true"></i> - </button> - </div> - </div> - </div> - </div> - </div> - </div> - </div> - <div class="modal-footer border-0 pt-0 pb-2"> - <div class="container-fluid"> - <div class="row"> - <div class="col-md-7 p-0"> - </div> - <div class="col-md-2 p-1"> - <span> - <button type="button" class="btn dl-btn-dark btn-block" (click)="this.passBack()"> - Save - </button> - </span> - </div> - <div class="col-md-2 p-1"> - <span> - <button type="button" class="btn dl-btn-light btn-block" (click)="activeModal.close('Close click')"> - Cancel - </button> - </span> - </div> - </div> - </div> - </div> -</div> diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.spec.ts b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.spec.ts deleted file mode 100644 index 4c24cb90..00000000 --- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { EditKafkaModalComponent } from './edit-kafka-modal.component'; - -describe('EditKafkaModalComponent', () => { - let component: EditKafkaModalComponent; - let fixture: ComponentFixture<EditKafkaModalComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ EditKafkaModalComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(EditKafkaModalComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.ts b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.ts deleted file mode 100644 index 9f129b6e..00000000 --- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/edit-kafka-modal/edit-kafka-modal.component.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; -import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap"; - -// Loading spinner -import { NgxSpinnerService } from "ngx-spinner"; -import {Kafka} from "../../../../core/models/kafka.model"; - -@Component({ - selector: 'app-edit-kafka-modal', - templateUrl: './edit-kafka-modal.component.html', - styleUrls: ['./edit-kafka-modal.component.css'] -}) -export class EditKafkaModalComponent implements OnInit { - @Input() editKafka: Kafka; - @Output() passEntry: EventEmitter<any> = new EventEmitter(); - kafkaInput: Kafka; - exTopicFields: Array<any> = []; - exTopicNewField: any = {}; - protocols: Array<string> = ["SASL_PLAINTEXT"]; - - constructor( - public activeModal: NgbActiveModal, - private spinner: NgxSpinnerService, - ) { } - - kafkaInputTitle = ""; - - ngOnInit() { - this.kafkaInput = this.editKafka; - if (this.kafkaInput.excludedTopic != null) { - var excludedTopics = this.kafkaInput.excludedTopic.split(","); - for (var i = 0; i < excludedTopics.length; i++) { - var data = { item: excludedTopics[i] }; - this.exTopicFields.push(data); - } - } else { - this.exTopicFields.push([]); - } - this.kafkaInputTitle = this.editKafka.name; - } - - passBack() { - this.spinner.show(); - if (this.kafkaInput.name == '' || this.kafkaInput.name == undefined) { - return false; - } - this.editKafka = this.kafkaInput; - this.passEntry.emit(this.editKafka); - setTimeout(() => { - this.spinner.hide(); - }, 500); - } - - addExTopicField() { - this.exTopicFields.push(this.exTopicNewField); - this.exTopicNewField = {}; - } - - deleteExTopicField(index: number) { - if (this.exTopicFields.length > 1) { - this.exTopicFields.splice(index, 1); - } - } -} diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.css b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.css deleted file mode 100644 index 7b11d9e7..00000000 --- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.css +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -.row-wrapper{ - display: flex; -} -.row-quarter-item{ - width: 20%; - margin-bottom: 15px; -} -.row-half-item{ - width: 45%; -} -.row-half-item2{ - width: 50%; -} -.usual-item{ - margin-left: 2%; -} -.usual-item2{ - margin-left: 6.5%; -} -input::-webkit-input-placeholder { - font-size: 12px; - color: #999999 !important; -} -input:-moz-placeholder { - /* Mozilla Firefox 4 to 18 */ - font-size: 12px; - color: #999999 !important; -} -input::-moz-placeholder { - /* Mozilla Firefox 19+ */ - font-size: 12px; - color: #999999 !important; -} -input::-ms-input-placeholder { - /* Internet Explorer 10+ */ - font-size: 12px; - color: #999999 !important; -} diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.html b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.html deleted file mode 100644 index 7bf81c45..00000000 --- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.html +++ /dev/null @@ -1,193 +0,0 @@ -<!-- - Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<div class="p-1"> - <div class="modal-header pb-0 border-0"> - <div class="container-fluid"> - <div class="row"> - <div class="col-md-12"> - <label class="dl-h3">{{ 'NEW_KAFKA' | translate }}</label> - </div> - </div> - <div class="row"> - <div class="col-md-12"> - <hr> - </div> - </div> - </div> - </div> - - <div class="modal-body border-0"> - <div class="container-fluid"> - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'NAME' | translate }}</label> - </div> - <div> - <input #k_name [(ngModel)]="this.kafkaInput.name" class="form-control dl-input-text" placeholder="" type="text"/> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'STATUS' | translate }}</label> - </div> - <div> - <label class="dl-switch"> - <input #k_enabled id="switch" type="checkbox" [(ngModel)]="this.kafkaInput.enabled"/> - <span class="dl-slider round"></span> - </label> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'BROKER_LIST' | translate }}</label> - </div> - <div> - <input #k_brokerList [(ngModel)]="this.kafkaInput.brokerList" class="form-control dl-input-text" type="text" placeholder="0.0.0.0" required="required" /> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'ZOOKEEPER' | translate }}</label> - </div> - <div> - <input #k_zooKeeper [(ngModel)]="this.kafkaInput.zooKeeper" class="form-control dl-input-text" type="text" placeholder="0.0.0.0" required="required" /> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'Username' | translate }}</label> - </div> - <div> - <input #k_login [(ngModel)]="this.kafkaInput.login" class="form-control dl-input-text" type="text" placeholder="login" required="required" /> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'Password' | translate }}</label> - </div> - <div> - <input #k_pass [(ngModel)]="this.kafkaInput.pass" class="form-control dl-input-text" type="text" placeholder="pass" required="required" /> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1">{{ 'AUTHENTICATION' | translate }}</label> - </div> - <div class="input-group row-half-item2"> - <label class="input-group-text dl-input-chk-label"> - <input #k_secure id="chkSaveRaw" [(ngModel)]="this.kafkaInput.secure" type="checkbox" /> - <span class="dl-input-checkmark"></span> - </label> - <label class="form-control dl-input-chk" for="chkSaveRaw"> - Secure - </label> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'SECURITY_PROTOCOL' | translate }}</label> - </div> - <div> - <select #k_securityProtocol class="custom-select dl-input-text" > - <option *ngFor="let item of protocols" [selected]="item == protocols[0]">{{ item }}</option> - </select> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'GROUP' | translate }}</label> - </div> - <div> - <input #k_group [(ngModel)]="this.kafkaInput.group" class="form-control dl-input-text" type="text" placeholder="dlgroup" required="required" /> - </div> - </div> - - <div class="row-half-item usual-item2"> - <div> - <label class="dl-emphasis1" >{{ 'TIME_OUT' | translate }}</label> - </div> - <div> - <input #k_timeout [(ngModel)]="this.kafkaInput.timeout" class="form-control dl-input-text" type="text" placeholder="6" required="required" /> - </div> - </div> - </div> - - <div class="form-group row row-wrapper"> - <div class="row-half-item usual-item"> - <div> - <label class="dl-emphasis1" >{{ 'EXCLUDED_TOPICS' | translate }}</label> - </div> - <div> - <div class="d-flex row align-items-center" *ngFor="let field of exTopicFields; let i = index"> - <div class="order-1 usual-item2"> - <input [(ngModel)]="field.item" class="form-control dl-input-text" placeholder="__consumer_offsets" type="text"/> - </div> - <div class="order-2"> - <button type="button" class="btn dl-icon-enable p-2" (click)="addExTopicField()"> - <i class="fa fa-plus fa-xs" aria-hidden="true"></i> - </button> - </div> - <div class="order-3"> - <button type="button" class="btn dl-icon-enable p-2" (click)="deleteExTopicField(i)"> - <i class="fa fa-trash fa-xs" aria-hidden="true"></i> - </button> - </div> - </div> - </div> - </div> - </div> - </div> - </div> - <div class="modal-footer border-0 pt-0 pb-2"> - <div class="container-fluid"> - <div class="row"> - <div class="col-md-7 p-0"> - </div> - <div class="col-md-2 p-1"> - <span> - <button type="button" class="btn dl-btn-dark btn-block" (click)="this.passBack()"> - Save - </button> - </span> - </div> - <div class="col-md-2 p-1"> - <span> - <button type="button" class="btn dl-btn-light btn-block" (click)="activeModal.close('Close click')"> - Cancel - </button> - </span> - </div> - </div> - </div> - </div> -</div> diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.spec.ts b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.spec.ts deleted file mode 100644 index e222d70d..00000000 --- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { NewKafkaModalComponent } from './new-kafka-modal.component'; - -describe('NewKafkaModalComponent', () => { - let component: NewKafkaModalComponent; - let fixture: ComponentFixture<NewKafkaModalComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ NewKafkaModalComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(NewKafkaModalComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.ts b/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.ts deleted file mode 100644 index 843799df..00000000 --- a/components/datalake-handler/admin/src/src/app/views/kafka/kafka-list/new-kafka-modal/new-kafka-modal.component.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/** - * @author Chunmeng Guo - */ - -import {Component, EventEmitter, Input, OnInit, Output, ElementRef, ViewChild} from '@angular/core'; - -import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap"; -import { RestApiService } from "src/app/core/services/rest-api.service"; -import { NgxSpinnerService } from "ngx-spinner"; - -import { Kafka } from "../../../../core/models/kafka.model"; - -@Component({ - selector: 'app-new-kafka-modal', - templateUrl: './new-kafka-modal.component.html', - styleUrls: ['./new-kafka-modal.component.css'] -}) -export class NewKafkaModalComponent implements OnInit { - @Input() kafka: Kafka; - @Input() kafkaList_length; - @Output() passEntry: EventEmitter<any> = new EventEmitter(); - kafkaInput: Kafka; - exTopicFields: Array<any> = []; - exTopicNewField: any = {}; - protocols: Array<string> = ["SASL_PLAINTEXT"]; - - @ViewChild("k_name") k_name: ElementRef; - @ViewChild("k_login") k_login: ElementRef; - @ViewChild("k_pass") k_pass: ElementRef; - @ViewChild("k_enabled") k_enabled: ElementRef; - @ViewChild("k_brokerList") k_brokerList: ElementRef; - @ViewChild("k_zooKeeper") k_zooKeeper: ElementRef; - @ViewChild("k_group") k_group: ElementRef; - @ViewChild("k_secure") k_secure: ElementRef; - @ViewChild("k_securityProtocol") k_securityProtocol: ElementRef; - @ViewChild("k_includedTopic") k_includedTopic: ElementRef; - @ViewChild("k_excludedTopic") k_excludedTopic: ElementRef; - @ViewChild("k_consumerCount") k_consumerCount: ElementRef; - @ViewChild("k_timeout") k_timeout: ElementRef; - - constructor( - private activeModal: NgbActiveModal, - private kafkaApiService: RestApiService, - private spinner: NgxSpinnerService - ) { } - - ngOnInit() { - // cache for display - this.kafkaInput = new Kafka(); - const feed = { - id: null, - name: this.kafka.name, - enabled: this.kafka.enabled, - brokerList: this.kafka.brokerList, - zooKeeper: this.kafka.zooKeeper, - group: this.kafka.group, - secure: this.kafka.secure, - login: this.kafka.login, - pass: this.kafka.pass, - securityProtocol: this.kafka.securityProtocol, - includedTopic: this.kafka.includedTopic, - excludedTopic: this.kafka.excludedTopic, - consumerCount: this.kafka.consumerCount, - timeout: this.kafka.timeout - }; - this.kafkaInput = feed; - this.exTopicFields = []; - if (this.kafkaInput.excludedTopic != null) { - var feeds = this.kafkaInput.excludedTopic.split(","); - for (var i = 0; i < feeds.length; i++) { - var data = { item: feed[i] }; - this.exTopicFields.push(data); - } - } else { - this.exTopicFields.push([]); - } - } - - passBack() { - this.spinner.show(); - if (this.kafkaInput.name == '' || this.kafkaInput.name == undefined) { - return false; - } - this.kafka = this.kafkaInput; - this.kafka.securityProtocol = this.k_securityProtocol.nativeElement.value; - for (var i = 0; i < this.exTopicFields.length; i++) { - let item = this.exTopicFields[i].item; - if (i == 0) { - this.kafka.excludedTopic = item; - } else { - this.kafka.excludedTopic = this.kafka.excludedTopic + "," + item; - } - } - console.log(this.kafka); - this.passEntry.emit(this.kafka); - - } - - addExTopicField() { - this.exTopicFields.push(this.exTopicNewField); - this.exTopicNewField = {}; - } - - deleteExTopicField(index: number) { - if (this.exTopicFields.length > 1) { - this.exTopicFields.splice(index, 1); - } - } -} |