From 220a25a2566c90bc540e7190342f73824d2ff54a Mon Sep 17 00:00:00 2001 From: mravula Date: Mon, 31 Aug 2020 12:29:32 -0400 Subject: Raptor UI Changes, user profile, folder restructure Issue-ID: PORTAL-902 Change-Id: Ib76bb3fce7efe55504b75d2fc4764bafb9f8e908 Signed-off-by: mravula --- .../user-profile/profile/profile.service.spec.ts | 78 ++++++++++++++++++++++ .../app/user-profile/profile/profile.service.ts | 73 ++++++++++++++++++++ .../user-profile/user-profile-routing.module.ts | 24 +++++++ .../app/user-profile/user-profile.component.html | 1 + .../app/user-profile/user-profile.component.scss | 0 .../user-profile/user-profile.component.spec.ts | 26 ++++++++ .../src/app/user-profile/user-profile.component.ts | 15 +++++ .../src/app/user-profile/user-profile.module.ts | 36 ++++++++++ 8 files changed, 253 insertions(+) create mode 100644 ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/profile/profile.service.spec.ts create mode 100644 ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/profile/profile.service.ts create mode 100644 ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile-routing.module.ts create mode 100644 ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.html create mode 100644 ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.scss create mode 100644 ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.spec.ts create mode 100644 ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.ts create mode 100644 ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.module.ts (limited to 'ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile') diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/profile/profile.service.spec.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/profile/profile.service.spec.ts new file mode 100644 index 00000000..70e8ac4b --- /dev/null +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/profile/profile.service.spec.ts @@ -0,0 +1,78 @@ +import { TestBed } from '@angular/core/testing'; + +import { ProfileService } from './profile.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; + +describe('ProfileService', () => { + + let service: ProfileService; + + beforeEach(() => {TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [HttpClient, ProfileService] + }) + service = TestBed.get(ProfileService); +}); + + it('should be created', () => { + const service: ProfileService = TestBed.get(ProfileService); + expect(service).toBeTruthy(); + }); + + it('should get getUserPagination', () => { + service.getUserPagination().subscribe((resp) => { + expect(resp).toBe(environment.getUserPagination); + }); + }); + + it('should get getPostSearch', () => { + let test : any; + service.getPostSearch(test).subscribe((resp) => { + expect(resp).toBe(environment.postSearch); + }); + }); + + it('should get importUser', () => { + let test : any; + service.importUser(test).subscribe((resp) => { + expect(resp).toBe(environment.importSearch); + }); +}); + +it('should get getPostProfile', () => { + service.getPostProfile().subscribe((resp) => { + expect(resp).toBe(environment.getPostProfile); + }); +}); + +it('should get getSelfProfile', () => { + service.getSelfProfile().subscribe((resp) => { + expect(resp).toBe(environment.getSelfProfile); + }); +}); + +it('should get removeRole', () => { + let data, id; + service.removeRole(data, id).subscribe((resp) => { + expect(resp).toBe(environment.removeUserRole); + }); +}); + +it('should get addUserRole', () => { + let data, id; + service.addUserRole(data, id).subscribe((resp) => { + expect(resp).toBe(environment.addUserRole); + }); +}); + +it('should get toggleProfileActive', () => { + let data, id; + service.toggleProfileActive(id).subscribe((resp) => { + expect(resp).toBe(environment); + }); +}); + +}); + diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/profile/profile.service.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/profile/profile.service.ts new file mode 100644 index 00000000..c40e7618 --- /dev/null +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/profile/profile.service.ts @@ -0,0 +1,73 @@ +import { Injectable } from '@angular/core'; +import {HttpClient, HttpHeaders } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class ProfileService { + + constructor(private http: HttpClient) { + } + + getUserPagination(){ + return this.http.get(environment.getUserPagination); + } + + getAllUsers(){ + return this.http.get(environment.getAllUsers); + } + + getPostSearch(postSearchBean:any) + { + return this.http.post(environment.postSearch,JSON.stringify({postSearchBean: postSearchBean})); + + } + + importUser(postSearchBean:any) + { + return this.http.post(environment.importSearch,JSON.stringify({postSearchBean: postSearchBean})); + + } + + getPostProfile() + { + return this.http.get(environment.getPostProfile); + + } + + getSelfProfile() + { + return this.http.get(environment.getSelfProfile); + + } + + getProfileById(profileId){ + return this.http.get(environment.getProfileById+"?profile_id="+profileId); + } + + removeRole(data,profileId) + { + return this.http.post(environment.removeUserRole+'?profile_id='+profileId,JSON.stringify({role: data})); + } + + addUserRole(data,profileId) + { + return this.http.post(environment.addUserRole+'?profile_id='+profileId,JSON.stringify({role: data})); + } + + saveProfile(data, profileId) { + return this.http.post(environment.saveProfile + '?profile_id=' + profileId, JSON.stringify({ + profile: data.profile, + selectedCountry: data.selectedCountry, + selectedState: data.selectedState, + selectedTimeZone: data.selectedTimeZone + })); + + } + + toggleProfileActive(profileId){ + return this.http.get(environment.toggleProfileActive+profileId); + } + +} diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile-routing.module.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile-routing.module.ts new file mode 100644 index 00000000..ec4f8194 --- /dev/null +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile-routing.module.ts @@ -0,0 +1,24 @@ +import {RouterModule, Routes} from '@angular/router'; +import {NgModule} from '@angular/core'; +import {UserProfileComponent} from './user-profile.component'; +import {SearchComponent} from './profile/search/search.component'; +import {SelfComponent} from './profile/self/self.component'; + +const routes: Routes = [ + { + path: '', + component: UserProfileComponent, + children: [ + {path: '', component: SearchComponent}, + {path: 'self_profile', component: SelfComponent}, + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class UserProfileRouting{ + +} diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.html b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.html new file mode 100644 index 00000000..0680b43f --- /dev/null +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.html @@ -0,0 +1 @@ + diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.scss b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.spec.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.spec.ts new file mode 100644 index 00000000..56240ec5 --- /dev/null +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.spec.ts @@ -0,0 +1,26 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { UserProfileComponent } from './user-profile.component'; + +describe('UserProfileComponent', () => { + let component: UserProfileComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UserProfileComponent ], + imports: [ RouterTestingModule] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserProfileComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.ts new file mode 100644 index 00000000..2856d870 --- /dev/null +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-user-profile', + templateUrl: './user-profile.component.html', + styleUrls: ['./user-profile.component.scss'] +}) +export class UserProfileComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.module.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.module.ts new file mode 100644 index 00000000..9aca44ff --- /dev/null +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/user-profile/user-profile.module.ts @@ -0,0 +1,36 @@ +import {NgModule} from '@angular/core'; +import {SelfComponent} from './profile/self/self.component'; +import {SearchComponent} from './profile/search/search.component'; +import {FormsModule} from '@angular/forms'; +import {MatSortModule} from '@angular/material/sort'; +import { + MatFormFieldControl, + MatFormFieldModule, MatInputModule, + MatPaginatorModule, + MatSelectModule, + MatSlideToggleModule, + MatTableModule +} from '@angular/material'; +import {RdpModule} from 'portalsdk-tag-lib'; +import {UserProfileComponent} from './user-profile.component'; +import {UserProfileRouting} from './user-profile-routing.module'; +import {CommonModule} from '@angular/common'; + +@NgModule({ + declarations: [SelfComponent, SearchComponent, UserProfileComponent ], + imports: [ + MatInputModule, + FormsModule, + MatTableModule, + MatFormFieldModule, + MatSlideToggleModule, + MatPaginatorModule, + MatSelectModule, + RdpModule, UserProfileRouting, CommonModule, MatSortModule + + ], + entryComponents: [SelfComponent] +}) +export class UserProfile{ + +} -- cgit 1.2.3-korg