+
+
+### Directory Layout
+ The source code layout is as follow:
+ -- app
+ -- shared -----> container of pubilc parts
+ -- components -----> container of pubilc components
+ -- alert
+ -- toastr-notification
+ -- ...more components
+ -- modules -----> container of public business modules
+ -- card
+ -- modal
+ -- search
+ -- table
+ -- layout -----> container of basic layout of all pages
+ -- header
+ -- sidebar
+ -- utils -----> container of general functions
+ -- core -----> container of core functions
+ -- models
+ -- services
+ -- views -----> container of all business pages
+ -- about
+ -- dashboard-setting
+ -- database
+ -- feeder
+ -- topics
+ -- ...more modules
+ -- app-routing.module.ts -----> container of all pages routers
+ -- app-component.css
+ -- app-component.html
+ -- app-component.ts
+ -- app-module.ts
+ -- assets
+ -- i18n
+ -- index.html
+ -- main.ts
+ -- styles.css
+ -- ...other config documents
+
+> The layout is used for organizing a new module, **PLEASE** take care of the difference between ```components``` and ``` modules```. Make sure that all parts added in the ``` components``` are ``` dump components``` and all the parts which are related to the **business** should be added in the ``` modules```. Good luck 🙂.
+
+> The service folder is used for created some reused services. **PLEASE** put the specific services into the related folders. For example, put the toastr-notification service into the ```components/toastr-notification``` folder.
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";
-import { FeederComponent } from "./feeder/feeder.component";
-import { TopicsComponent } from "./topics/topics.component";
-import { DatabaseComponent } from "./database/database.component";
-import { AboutComponent } from "./about/about.component";
-import { DashboardSettingComponent } from './dashboard-setting/dashboard-setting.component';
-import { DashboardListComponent } from './dashboard-setting/dashboard-list/dashboard-list.component';
-import { TemplateComponent } from './dashboard-setting/template/template.component';
+//test components for module testing
+import { TestComponent } from './views/test/test.component';
+
+import { FeederComponent } from "./views/feeder/feeder.component";
+import { TopicsComponent } from "./views/topics/topics.component";
+import { DatabaseComponent } from "./views/database/database.component";
+import { AboutComponent } from "./views/about/about.component";
+import { DashboardSettingComponent } from './views/dashboard-setting/dashboard-setting.component';
+import { DashboardListComponent } from './views/dashboard-setting/dashboard-list/dashboard-list.component';
+import { TemplateComponent } from './views/dashboard-setting/template/template.component';
const routes: Routes = [
{ path: "", redirectTo: "/feeder", pathMatch: "full" },
+ { path: "test", component: TestComponent },
{ path: "feeder", component: FeederComponent },
{ path: "topics", component: TopicsComponent },
{ path: "database", component: DatabaseComponent },
{ path: "about", component: AboutComponent },
- { path: 'dashboard-setting/dashboard-list', component: DashboardListComponent},
- { path: 'dashboard-setting/template', component: TemplateComponent},
+ { path: 'dashboard-setting/dashboard-list', component: DashboardListComponent },
+ { path: 'dashboard-setting/template', component: TemplateComponent },
];
@NgModule({
],
exports: [RouterModule]
})
-export class AppRoutingModule {}
+export class AppRoutingModule { }
<ngx-spinner bdOpacity=0.5 bdColor="rgba(51,51,51,0.85)" size="default" color="#5dbebb" type="ball-clip-rotate"
[fullScreen]="true">
- </ngx-spinner>
+ </ngx-spinner>
\ No newline at end of file
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
-import { HeaderComponent } from "./header/header.component";
-import { SidebarComponent } from "./sidebar/sidebar.component";
+import { HeaderComponent } from "./shared/layout/header/header.component";
+import { SidebarComponent } from "./shared/layout/sidebar/sidebar.component";
-import { FeederComponent } from "./feeder/feeder.component";
-import { TopicsComponent } from "./topics/topics.component";
-import { DatabaseComponent } from "./database/database.component";
-import { TopicListComponent } from "./topics/topic-list/topic-list.component";
+import { FeederComponent } from "./views/feeder/feeder.component";
+import { TopicsComponent } from "./views/topics/topics.component";
+import { DatabaseComponent } from "./views/database/database.component";
+import { TopicListComponent } from "./views/topics/topic-list/topic-list.component";
// Service
import { AdminService } from "./core/services/admin.service";
import { RestApiService } from "./core/services/rest-api.service";
-import { ToastrNotificationService } from "src/app/core/services/toastr-notification.service";
+import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
// i18n
import { TranslateModule, TranslateLoader } from "@ngx-translate/core";
import { HttpClientModule } from "@angular/common/http";
import { HttpClient } from "@angular/common/http";
-import { DatabaseListComponent } from "./database/database-list/database-list.component";
+import { DatabaseListComponent } from "./views/database/database-list/database-list.component";
import { NgxDatatableModule } from "@swimlane/ngx-datatable";
-import { CouchbaseComponent } from "./database/database-list/dbs-modal/couchbase/couchbase.component";
-import { MongodbComponent } from "./database/database-list/dbs-modal/mongodb/mongodb.component";
-import { HdfsComponent } from "./database/database-list/dbs-modal/hdfs/hdfs.component";
-import { DatabaseAddModalComponent } from "./database/database-list/database-add-modal/database-add-modal.component";
-import { ElasticsearchComponent } from "./database/database-list/dbs-modal/elasticsearch/elasticsearch.component";
-import { DruidComponent } from "./database/database-list/dbs-modal/druid/druid.component";
+import { CouchbaseComponent } from "./views/database/database-list/dbs-modal/couchbase/couchbase.component";
+import { MongodbComponent } from "./views/database/database-list/dbs-modal/mongodb/mongodb.component";
+import { HdfsComponent } from "./views/database/database-list/dbs-modal/hdfs/hdfs.component";
+import { DatabaseAddModalComponent } from "./views/database/database-list/database-add-modal/database-add-modal.component";
+import { ElasticsearchComponent } from "./views/database/database-list/dbs-modal/elasticsearch/elasticsearch.component";
+import { DruidComponent } from "./views/database/database-list/dbs-modal/druid/druid.component";
// Modals
-import { TopicDetailModalComponent } from "./topics/topic-list/topic-detail-modal/topic-detail-modal.component";
-import { TopicConfigModalComponent } from "./topics/topic-list/topic-config-modal/topic-config-modal.component";
-import { ToastrNotificationComponent } from "./core/toastr-notification/toastr-notification.component";
-import { AlertComponent } from "./core/alert/alert.component";
-import { AboutComponent } from "./about/about.component";
+import { TopicDetailModalComponent } from "./views/topics/topic-list/topic-detail-modal/topic-detail-modal.component";
+import { TopicConfigModalComponent } from "./views/topics/topic-list/topic-config-modal/topic-config-modal.component";
+import { ToastrNotificationComponent } from "./shared/components/toastr-notification/toastr-notification.component";
+import { AlertComponent } from "./shared/components/alert/alert.component";
+import { AboutComponent } from "./views/about/about.component";
// Loading spinner
import { NgxSpinnerModule } from "ngx-spinner";
-import { DashboardSettingComponent } from './dashboard-setting/dashboard-setting.component';
-import { DashboardListComponent } from './dashboard-setting/dashboard-list/dashboard-list.component';
-import { TemplateComponent } from './dashboard-setting/template/template.component';
-import { CreateDashboardComponent } from './dashboard-setting/dashboard-list/create-dashboard/create-dashboard.component';
-import { TemplateListComponent } from './dashboard-setting/template/template-list/template-list.component';
-import { NewTemplateModalComponent } from './dashboard-setting/template/template-list/new-template-modal/new-template-modal.component';
-import { EditTemplateModalComponent } from './dashboard-setting/template/template-list/edit-template-modal/edit-template-modal.component';
-import { NewTopicModelComponent } from './topics/topic-list/new-topic-model/new-topic-model.component';
+import { DashboardSettingComponent } from './views/dashboard-setting/dashboard-setting.component';
+import { DashboardListComponent } from './views/dashboard-setting/dashboard-list/dashboard-list.component';
+import { TemplateComponent } from './views/dashboard-setting/template/template.component';
+import { CreateDashboardComponent } from './views/dashboard-setting/dashboard-list/create-dashboard/create-dashboard.component';
+import { TemplateListComponent } from './views/dashboard-setting/template/template-list/template-list.component';
+import { NewTemplateModalComponent } from './views/dashboard-setting/template/template-list/new-template-modal/new-template-modal.component';
+import { EditTemplateModalComponent } from './views/dashboard-setting/template/template-list/edit-template-modal/edit-template-modal.component';
+import { NewTopicModelComponent } from './views/topics/topic-list/new-topic-model/new-topic-model.component';
+import { TestComponent } from './views/test/test.component';
+import { ModalComponent } from './shared/modules/modal/modal.component';
+import { TableComponent } from './shared/modules/table/table.component';
+import { SearchComponent } from './shared/modules/search/search.component';
+import { CardComponent } from './shared/modules/card/card.component';
@NgModule({
declarations: [
DashboardSettingComponent,
DashboardListComponent,
CreateDashboardComponent,
- TemplateComponent,
+ TemplateComponent,
TemplateListComponent,
NewTemplateModalComponent,
EditTemplateModalComponent,
NewTopicModelComponent,
+ TestComponent,
+ ModalComponent,
+ TableComponent,
+ SearchComponent,
+ CardComponent,
],
imports: [
TopicConfigModalComponent,
NewTopicModelComponent,
CreateDashboardComponent,
- NewTemplateModalComponent,
+ NewTemplateModalComponent,
EditTemplateModalComponent
]
})
-export class AppModule {}
+export class AppModule { }
Notification,
NotificationType
} from "src/app/core/models/toastr-notification.model";
-import { ToastrNotificationService } from "src/app/core/services/toastr-notification.service";
+import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
@Component({
selector: "app-toastr-notification",
export class ToastrNotificationComponent implements OnInit {
notifications: Notification[] = [];
- constructor(public _notificationService: ToastrNotificationService) {}
+ constructor(public _notificationService: ToastrNotificationService) { }
ngOnInit() {
this._notificationService.getAlert().subscribe((alert: Notification) => {
*/
import { Component, Output } from "@angular/core";
-import { AdminService } from "../core/services/admin.service";
+import { AdminService } from "../../../core/services/admin.service";
import { TranslateService } from "@ngx-translate/core";
import { Feeder } from "src/app/core/models/feeder.model";
import { RestApiService } from "src/app/core/services/rest-api.service";
// notify
-import { ToastrNotificationService } from "src/app/core/services/toastr-notification.service";
+import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
@Component({
selector: "app-header",
--- /dev/null
+<p>
+ card works!
+</p>
--- /dev/null
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CardComponent } from './card.component';
+
+describe('CardComponent', () => {
+ let component: CardComponent;
+ let fixture: ComponentFixture<CardComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ CardComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(CardComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
--- /dev/null
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-card',
+ templateUrl: './card.component.html',
+ styleUrls: ['./card.component.css']
+})
+export class CardComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
--- /dev/null
+<p>
+ modal works!
+</p>
--- /dev/null
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ModalComponent } from './modal.component';
+
+describe('ModalComponent', () => {
+ let component: ModalComponent;
+ let fixture: ComponentFixture<ModalComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ModalComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ModalComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
--- /dev/null
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-modal',
+ templateUrl: './modal.component.html',
+ styleUrls: ['./modal.component.css']
+})
+export class ModalComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
--- /dev/null
+<p>
+ search works!
+</p>
--- /dev/null
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SearchComponent } from './search.component';
+
+describe('SearchComponent', () => {
+ let component: SearchComponent;
+ let fixture: ComponentFixture<SearchComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ SearchComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(SearchComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
--- /dev/null
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-search',
+ templateUrl: './search.component.html',
+ styleUrls: ['./search.component.css']
+})
+export class SearchComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
--- /dev/null
+<p>
+ table works!
+</p>
--- /dev/null
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TableComponent } from './table.component';
+
+describe('TableComponent', () => {
+ let component: TableComponent;
+ let fixture: ComponentFixture<TableComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ TableComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(TableComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
--- /dev/null
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-table',
+ templateUrl: './table.component.html',
+ styleUrls: ['./table.component.css']
+})
+export class TableComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
--- /dev/null
+//put some general functions here. Enjoy
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
*/
-import {Component, OnInit, Input, Output, ViewChild, EventEmitter, ElementRef} from '@angular/core';
+import { Component, OnInit, Input, Output, ViewChild, EventEmitter, ElementRef } from '@angular/core';
import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
import { Dashboard } from "src/app/core/models/dashboard.model";
import { AdminService } from "src/app/core/services/admin.service";
public activeModal: NgbActiveModal,
public adminService: AdminService,
public restApiService: RestApiService,
- ) {}
+ ) { }
@Output() passEntry: EventEmitter<any> = new EventEmitter();
@Input() dashboard: Dashboard;
console.log(this.dashboard);
this.tempDb = new Dashboard();
- if(this.dashboard.enabled==undefined){
+ if (this.dashboard.enabled == undefined) {
this.dashboard.enabled = true;
}
const feeds = {
passBack() {
- if(this.tempDb.host == null && this.tempDb.port == null && this.tempDb.login == null && this.tempDb.pass == null){
+ if (this.tempDb.host == null && this.tempDb.port == null && this.tempDb.login == null && this.tempDb.pass == null) {
return false;
}
this.dashboard = this.tempDb;
this.dashboard.name = this.t_dataDashboardName.nativeElement.value;
- console.log(this.dashboard,"this.dashboard output");
+ console.log(this.dashboard, "this.dashboard output");
this.passEntry.emit(this.dashboard);
}
limitations under the License.
*/
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
-import { Dashboard } from "../../core/models/dashboard.model";
+import { Dashboard } from "../../../core/models/dashboard.model";
import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
import { CreateDashboardComponent } from "./create-dashboard/create-dashboard.component";
-import { AdminService } from "../../core/services/admin.service";
+import { AdminService } from "../../../core/services/admin.service";
// DB modal components
import { RestApiService } from "src/app/core/services/rest-api.service";
// Notify
-import { ToastrNotificationService } from "src/app/core/services/toastr-notification.service";
+import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
// Loading spinner
import { NgxSpinnerService } from "ngx-spinner";
})
export class DashboardSettingComponent implements OnInit {
- constructor() {}
+ constructor() { }
ngOnInit() {
}
// modal
import { NewTemplateModalComponent } from "./new-template-modal/new-template-modal.component";
import { EditTemplateModalComponent } from "./edit-template-modal/edit-template-modal.component";
-import { AlertComponent } from "src/app/core/alert/alert.component";
+import { AlertComponent } from "src/app/shared/components/alert/alert.component";
// notify
-import { ToastrNotificationService } from "src/app/core/services/toastr-notification.service";
+import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
@Component({
selector: 'app-template-list',
limitations under the License.
*/
import { Component, OnInit } from '@angular/core';
-import {AdminService} from "../../core/services/admin.service";
+import { AdminService } from "../../../core/services/admin.service";
@Component({
selector: 'app-template',
*/
import { Component, OnInit, ViewChild, ElementRef } from "@angular/core";
-import { Db } from "../../core/models/db.model";
+import { Db } from "../../../core/models/db.model";
import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
import { DatabaseAddModalComponent } from "./database-add-modal/database-add-modal.component";
import { ElasticsearchComponent } from "./dbs-modal/elasticsearch/elasticsearch.component";
import { MongodbComponent } from "./dbs-modal/mongodb/mongodb.component";
import { HdfsComponent } from "./dbs-modal/hdfs/hdfs.component";
-import { AlertComponent } from "src/app/core/alert/alert.component";
+import { AlertComponent } from "src/app/shared/components/alert/alert.component";
// Notify
-import { ToastrNotificationService } from "src/app/core/services/toastr-notification.service";
+import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
// Loading spinner
import { NgxSpinnerService } from "ngx-spinner";
modalRef.componentInstance.passEntry.subscribe(receiveEntry => {
this.tempDbDetail = receiveEntry;
let enabled = receiveEntry.enabled;
- console.log(this.tempDbDetail,"this.tempDbDetail");
- if(enabled == true){
+ console.log(this.tempDbDetail, "this.tempDbDetail");
+ if (enabled == true) {
this.restApiService.upadteDb(this.tempDbDetail).subscribe(
res => {
console.log(res);
if (res.statusCode == 200) {
this.dbs[index] = this.tempDbDetail;
this.notificationService.success("SUCCESSFULLY_UPDATED");
- }else {
+ } else {
this.notificationService.error("FAILED_UPDATED");
}
modalRef.close();
modalRef.close();
}
);
- }else {
+ } else {
this.restApiService.upadteDb(this.dbs[index]).subscribe(
res => {
console.log(res);
if (res.statusCode == 200) {
this.dbs[index] = this.tempDbDetail;
this.notificationService.success("SUCCESSFULLY_DELETED");
- }else {
+ } else {
this.dbs[index].encrypt = true;
}
modalRef.close();
constructor(
public activeModal: NgbActiveModal,
public adminService: AdminService
- ) {}
+ ) { }
ngOnInit() {
// cache for display
constructor(
public activeModal: NgbActiveModal,
public adminService: AdminService
- ) {}
+ ) { }
ngOnInit() {
// cache for display
constructor(
public activeModal: NgbActiveModal,
public adminService: AdminService
- ) {}
+ ) { }
ngOnInit() {
// cache for display
constructor(
public activeModal: NgbActiveModal,
public adminService: AdminService
- ) {}
+ ) { }
ngOnInit() {
// cache for display
constructor(
public activeModal: NgbActiveModal,
public adminService: AdminService
- ) {}
+ ) { }
ngOnInit() {
// cache for display
*/
import { Component, OnInit } from "@angular/core";
-import { AdminService } from "../core/services/admin.service";
+import { AdminService } from "../../core/services/admin.service";
@Component({
selector: "app-database",
this.adminService.setTitle("SIDEBAR.DATABASE");
}
- ngOnInit() {}
+ ngOnInit() { }
}
import { Component, OnInit } from "@angular/core";
import { AdminService } from "src/app/core/services/admin.service";
import { RestApiService } from "src/app/core/services/rest-api.service";
-import { HeaderComponent } from "src/app/header/header.component";
+import { HeaderComponent } from "src/app/shared/layout/header/header.component";
// notify
-import { ToastrNotificationService } from "src/app/core/services/toastr-notification.service";
+import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
// Loading spinner
import { NgxSpinnerService } from "ngx-spinner";
--- /dev/null
+<div>
+ <h3>Test module is used for some publice business modules sample</h3>
+ <div>
+ <p>Module 1 -----> card</p>
+ <app-card></app-card>
+
+ </div>
+ <div>
+ <p>Module 2 -----> modal</p>
+ <app-modal></app-modal>
+ </div>
+ <div>
+ <p>Module 3 -----> search</p>
+ <app-search></app-search>
+ </div>
+ <div>
+ <p>Module 4 -----> table</p>
+ <app-table></app-table>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TestComponent } from './test.component';
+
+describe('TestComponent', () => {
+ let component: TestComponent;
+ let fixture: ComponentFixture<TestComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ TestComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(TestComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
--- /dev/null
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-test',
+ templateUrl: './test.component.html',
+ styleUrls: ['./test.component.css']
+})
+export class TestComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
ViewChild,
ElementRef
} from "@angular/core";
-import {NgbActiveModal} from "@ng-bootstrap/ng-bootstrap";
-import {RestApiService} from "src/app/core/services/rest-api.service";
-import {AdminService} from "src/app/core/services/admin.service";
-import {Topic} from "src/app/core/models/topic.model";
+import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
+import { RestApiService } from "src/app/core/services/rest-api.service";
+import { AdminService } from "src/app/core/services/admin.service";
+import { Topic } from "src/app/core/models/topic.model";
@Component({
selector: 'app-new-topic-model',
this.newTopic = {
name: "",
login: "",
- password:"",
+ password: "",
sinkdbs: [],
enabled: false,
saveRaw: false,
ttl: null,
correlateClearedMessage: false,
messageIdPath: null,
- type:null
+ type: null
};
this.TopicInput = new Topic();
const feeds = {
- name: this.newTopic.name,
- login: this.newTopic.login,
- password:this.newTopic.password,
- sinkdbs: this.newTopic.sinkdbs,
- enabled: this.newTopic.enabled,
- saveRaw: this.newTopic.saveRaw,
- dataFormat: this.newTopic.dataFormat,
- ttl: this.newTopic.ttl,
- correlateClearedMessage: this.newTopic.correlateClearedMessage,
- messageIdPath: this.newTopic.messageIdPath,
- type:null
- };
+ name: this.newTopic.name,
+ login: this.newTopic.login,
+ password: this.newTopic.password,
+ sinkdbs: this.newTopic.sinkdbs,
+ enabled: this.newTopic.enabled,
+ saveRaw: this.newTopic.saveRaw,
+ dataFormat: this.newTopic.dataFormat,
+ ttl: this.newTopic.ttl,
+ correlateClearedMessage: this.newTopic.correlateClearedMessage,
+ messageIdPath: this.newTopic.messageIdPath,
+ type: null
+ };
this.TopicInput = feeds;
- this. idExFields = [];
+ this.idExFields = [];
if (this.TopicInput.messageIdPath != null) {
var feed = this.TopicInput.messageIdPath.split(",");
for (var i = 0; i < feed.length; i++) {
this.newTopic.ttl = this.t_ttl.nativeElement.value;
this.newTopic.messageIdPath = "";
for (var i = 0; i < this.idExFields.length; i++) {
- let item = "/"+this.idExFields[i].item;
+ let item = "/" + this.idExFields[i].item;
if (i == 0) {
this.newTopic.messageIdPath = item;
} else {
import { NewTopicModelComponent } from "./new-topic-model/new-topic-model.component";
// notify
-import { ToastrNotificationService } from "src/app/core/services/toastr-notification.service";
+import { ToastrNotificationService } from "src/app/shared/components/toastr-notification/toastr-notification.service";
// Loading spinner
import { NgxSpinnerService } from "ngx-spinner";
-import {AlertComponent} from "../../core/alert/alert.component";
+import { AlertComponent } from "../../../shared/components/alert/alert.component";
@Component({
selector: "app-topic-list",
this.spinner.show();
}
- init(){
+ init() {
this.initData().then(data => {
this.initTopicList(this.topicListDmaap, this.topicListFeeder).then(
data => {
// dmaap has topics
if (dmaapList.length > 0) {
- let listLength = dmaapList.length>feederList.length ? dmaapList.length:feederList.length;
+ let listLength = dmaapList.length > feederList.length ? dmaapList.length : feederList.length;
for (var i = 0; i < listLength; i++) {
if (feederList.includes(dmaapList[i])) {
let data = await this.getTopicDetail(dmaapList[i]);
type: true
};
t.push(feed);
- } else if(!feederList.includes(dmaapList[i]) && dmaapList[i]!=undefined){
+ } else if (!feederList.includes(dmaapList[i]) && dmaapList[i] != undefined) {
let feed = {
name: dmaapList[i],
login: this.topicDefaultConfig.login,
};
t.push(feed);
}
- if(!dmaapList.includes(feederList[i]) && feederList[i]!=undefined){
+ if (!dmaapList.includes(feederList[i]) && feederList[i] != undefined) {
let data = await this.getTopicDetail(feederList[i]);
let feed = {
name: feederList[i],
correlateClearedMessage: data.correlateClearedMessage,
messageIdPath: data.messageIdPath,
type: true,
- topicDb:true
+ topicDb: true
};
t.push(feed);
}
onActivate(event) {
const emitType = event.type;
- if(emitType == "dblclick"){
+ if (emitType == "dblclick") {
console.log('Activate Event', event);
let name = event.row.name;
this.openTopicModal(name);
}
- openNewTopicModal(){
+ openNewTopicModal() {
const modalRef = this.modalService.open(NewTopicModelComponent, {
size: "lg",
centered: true
});
modalRef.componentInstance.newTopic = this.tempNewTopic;
modalRef.componentInstance.passEntry.subscribe(receivedEntry => {
- console.log(receivedEntry,"newtopic receivedEntry");
+ console.log(receivedEntry, "newtopic receivedEntry");
this.tempNewTopic = receivedEntry;
this.restApiService.addNewTopic(this.tempNewTopic).subscribe(
res => {
}
}
- deleteTopicModal(name: string){
+ deleteTopicModal(name: string) {
const index = this.temp.findIndex(t => t.name === name);
const modalRef = this.modalService.open(AlertComponent, {
size: "sm",
const val = searchValue.toLowerCase();
// filter our data
- const temp = this.temp.filter(function(d) {
+ const temp = this.temp.filter(function (d) {
return d.name.toLowerCase().indexOf(val) !== -1 || !val;
});
import { Component, OnInit } from "@angular/core";
-import { AdminService } from "../core/services/admin.service";
+import { AdminService } from "../../core/services/admin.service";
@Component({
selector: "app-topics",
this.adminService.setTitle("SIDEBAR.TOPICS");
}
- ngOnInit() {}
+ ngOnInit() { }
}