From 5505e42484efac0273627795583179d58f81a1ee Mon Sep 17 00:00:00 2001 From: Sudarshan Kumar Date: Fri, 31 Jan 2020 17:10:17 +0530 Subject: Added RDP Library added RDP Library Issue-ID: PORTAL-826 Change-Id: If00af4c55b568bb4e41c789b6b18749d8bc96858 Signed-off-by: Sudarshan Kumar --- .../src/app/app.component.css | 0 .../src/app/app.component.html | 7 +++ .../src/app/app.component.spec.ts | 31 ++++++++++ .../src/app/app.component.ts | 57 +++++++++++++++++++ .../src/app/app.module.ts | 19 +++++++ .../src/app/shared/services/app.service.spec.ts | 12 ++++ .../src/app/shared/services/app.service.ts | 66 ++++++++++++++++++++++ 7 files changed, 192 insertions(+) create mode 100644 ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.css create mode 100644 ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.html create mode 100644 ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.spec.ts create mode 100644 ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.ts create mode 100644 ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.module.ts create mode 100644 ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.spec.ts create mode 100644 ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.ts (limited to 'ecomp-sdk/portalsdk-tag-lib-test-app/src/app') diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.css b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.css new file mode 100644 index 00000000..e69de29b diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.html b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.html new file mode 100644 index 00000000..c53d2969 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.html @@ -0,0 +1,7 @@ + +
+
+

User Details

+
+ +
diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.spec.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.spec.ts new file mode 100644 index 00000000..1ad43d9c --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.spec.ts @@ -0,0 +1,31 @@ +import { TestBed, async } from '@angular/core/testing'; +import { AppComponent } from './app.component'; + +describe('AppComponent', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ + AppComponent + ], + }).compileComponents(); + })); + + it('should create the app', () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + }); + + it(`should have as title 'portalsdk-tag-lib-test-app'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app.title).toEqual('portalsdk-tag-lib-test-app'); + }); + + it('should render title in a h1 tag', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain('Welcome to portalsdk-tag-lib-test-app!'); + }); +}); diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.ts new file mode 100644 index 00000000..536b1714 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.ts @@ -0,0 +1,57 @@ +import { Component, OnInit } from '@angular/core'; +import { Column, DataTableSettings, ColumnTypes } from 'portalsdk-tag-lib'; +import { AppService } from './shared/services/app.service'; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'] +}) +export class AppComponent implements OnInit{ + title = 'portalsdk-tag-lib-test-app'; + + public users; + public settings; + public columns : any = []; + + constructor(public appservice: AppService) { } + + ngOnInit() { + + this.users = [ + {"id": "1", "name": "Sundar","company": "AT&T","location": "USA"}, + {"id": "2", "name": "Kishore", "company": "AT&T","location": "USA"}, + {"id": "3", "name": "Sudarshan","company": "AT&T","location": "India"}, + {"id": "4", "name": "Jegadeesh","company": "AT&T","location": "India"}, + {"id": "5", "name": "Muni","company": "AT&T","location": "USA"}, + {"id": "6", "name": "Dinesh","company": "AT&T","location": "India"}, + {"id": "7", "name": "Abhay","company": "AT&T","location": "India"} + ]; + + let list = []; + let val1 = {"id":"1","name":"India"}; + let val2 = {"id":"2","name":"US"}; + let val3 = {"id":"2","name":"China"}; + list.push(val1); + list.push(val2); + list.push(val3); + + //Demonstrating disable feature + let column = new Column("id","ID",ColumnTypes.TEXT, false,list); + column.setIsColumnDisabled = true; + + this.columns.push(column); + this.columns.push(new Column("name","Name",ColumnTypes.TEXT, true,list)); + this.columns.push(new Column("company","Company", ColumnTypes.TEXT, false,list)); + this.columns.push(new Column("location","Location", ColumnTypes.DROPDOWN, true,list)); + + this.settings = new DataTableSettings() + this.settings.columns = this.columns; + this.settings.isPaginationEnabled=true; + this.settings.paginationsSize = "5"; + this.settings.applicationService = this.appservice; + this.settings.modalPopupTitle = "Edit"; + this.settings.isServerSidePaginationEnabled=false; + this.settings.isReadOnly = false; + } +} diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.module.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.module.ts new file mode 100644 index 00000000..f79dc574 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.module.ts @@ -0,0 +1,19 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { NgModule } from '@angular/core'; + +import { AppComponent } from './app.component'; +import { RdpModule } from 'portalsdk-tag-lib' +@NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + BrowserAnimationsModule, + RdpModule + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.spec.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.spec.ts new file mode 100644 index 00000000..9bdcf24c --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { AppService } from './app.service'; + +describe('AppService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: AppService = TestBed.get(AppService); + expect(service).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.ts new file mode 100644 index 00000000..0860e113 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.ts @@ -0,0 +1,66 @@ +import { Injectable } from '@angular/core'; +import { RdpCrudInterface } from 'portalsdk-tag-lib'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { map } from "rxjs/operators"; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class AppService implements RdpCrudInterface{ + + constructor(private http:HttpClient) { } + add(data:any){ + console.log("Add method is getting called from AppServie data:: ",data); + } + + update(data:any){ + console.log("Update method is getting called from AppServie data:: ",data); + } + + delete(data:any){ + console.log("Delete method is getting called from AppServie data::>> ",data); + } + + get(data: any) { + console.log("get method is getting called from AppServie data:: ",data); + } + + loadTableData(filter: any, sortActive: any, sortDirection: any, pageIndex: any, pageSize: any): Observable{ + let users = []; + if(pageIndex == 0){ + users = [ + {"id": "1", "name": "Sundar","company": "AT&T","location": "USA"}, + {"id": "2", "name": "Kishore", "company": "AT&T","location": "USA"}, + {"id": "3", "name": "Sudarshan","company": "AT&T","location": "India"}, + {"id": "4", "name": "Jegadeesh","company": "AT&T","location": "India"}, + {"id": "5", "name": "Muni","company": "AT&T","location": "USA"} + ]; + } + if(pageIndex == 1){ + users = [ + {"id": "6", "name": "Abhay","company": "AT&T","location": "USA"}, + {"id": "7", "name": "Tom", "company": "AT&T","location": "USA"}, + {"id": "8", "name": "Rachitha","company": "AT&T","location": "India"}, + {"id": "9", "name": "Shankar","company": "AT&T","location": "India"}, + {"id": "10", "name": "Balaji","company": "AT&T","location": "USA"} + ]; + } + console.log("applicationService loadTableData called ::"); + console.log("applicationService loadTableData filter ::",filter); + console.log("applicationService loadTableData sort-Active ::",sortActive); + console.log("applicationService loadTableData sortDirection ::",sortDirection); + console.log("applicationService loadTableData pageIndex ::",pageIndex); + console.log("applicationService loadTableData pageSize ::",pageSize); + return Observable.create( observer => { + observer.next(users); + observer.complete(); + }); + } + + getTotalRowCount(): any { + //write logic to get total row Counts of Table + return 10; + } + +} -- cgit 1.2.3-korg