diff options
Diffstat (limited to 'ecomp-sdk/portalsdk-tag-lib-test-app/src')
17 files changed, 321 insertions, 0 deletions
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 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.css 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 @@ +<!--The content below is only a placeholder and can be replaced.--> +<div class="container"> + <div class="ecomp-main-view-title"> + <h1 class="heading-page">User Details</h1> + </div> + <rdp-data-table [data]="users" [settings]="settings"></rdp-data-table> +</div> 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<any[]>{ + 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; + } + +} diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/assets/.gitkeep b/ecomp-sdk/portalsdk-tag-lib-test-app/src/assets/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/assets/.gitkeep diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/assets/images/spinner.gif b/ecomp-sdk/portalsdk-tag-lib-test-app/src/assets/images/spinner.gif Binary files differnew file mode 100644 index 00000000..c97ec6ea --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/assets/images/spinner.gif diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/environments/environment.prod.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/environments/environment.prod.ts new file mode 100644 index 00000000..3612073b --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/environments/environment.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/environments/environment.ts new file mode 100644 index 00000000..7b4f817a --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/favicon.ico b/ecomp-sdk/portalsdk-tag-lib-test-app/src/favicon.ico Binary files differnew file mode 100644 index 00000000..8081c7ce --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/favicon.ico diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/index.html b/ecomp-sdk/portalsdk-tag-lib-test-app/src/index.html new file mode 100644 index 00000000..0620359e --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/index.html @@ -0,0 +1,14 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>PortalsdkTagLibTestApp</title> + <base href="/"> + + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="favicon.ico"> +</head> +<body> + <app-root></app-root> +</body> +</html> diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/main.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/main.ts new file mode 100644 index 00000000..c7b673cf --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.error(err)); diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/polyfills.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/polyfills.ts new file mode 100644 index 00000000..aa665d6b --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/polyfills.ts @@ -0,0 +1,63 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags.ts'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/styles.css b/ecomp-sdk/portalsdk-tag-lib-test-app/src/styles.css new file mode 100644 index 00000000..90d4ee00 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/src/test.ts b/ecomp-sdk/portalsdk-tag-lib-test-app/src/test.ts new file mode 100644 index 00000000..16317897 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/src/test.ts @@ -0,0 +1,20 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: any; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); |