bulk-tool-menu-library 0.2.1 → 20.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/esm2022/bulk-tool-20.mjs +5 -0
  2. package/esm2022/lib/auth.service.mjs +50 -0
  3. package/esm2022/lib/bulk-tool.component.mjs +22 -0
  4. package/esm2022/lib/bulk-tool.module.mjs +50 -0
  5. package/esm2022/lib/bulk-tool.service.mjs +14 -0
  6. package/esm2022/lib/constant.enum.mjs +6 -0
  7. package/esm2022/lib/environmentsModel.info.mjs +2 -0
  8. package/esm2022/lib/http-interceptor.mjs +25 -0
  9. package/esm2022/lib/login/login.component.mjs +84 -0
  10. package/esm2022/lib/materils/materils.module.mjs +172 -0
  11. package/esm2022/lib/menu/menu.component.mjs +47 -0
  12. package/esm2022/public_api.mjs +10 -0
  13. package/fesm2022/bulk-tool-20.mjs +448 -0
  14. package/fesm2022/bulk-tool-20.mjs.map +1 -0
  15. package/index.d.ts +144 -0
  16. package/lib/auth.service.d.ts +16 -0
  17. package/lib/bulk-tool.component.d.ts +8 -0
  18. package/lib/bulk-tool.module.d.ts +17 -0
  19. package/lib/bulk-tool.service.d.ts +6 -0
  20. package/lib/constant.enum.d.ts +5 -0
  21. package/lib/environmentsModel.info.d.ts +3 -0
  22. package/lib/http-interceptor.d.ts +8 -0
  23. package/lib/login/login.component.d.ts +27 -0
  24. package/lib/materils/materils.module.d.ts +45 -0
  25. package/lib/menu/menu.component.d.ts +28 -0
  26. package/package.json +23 -59
  27. package/{projects/bulk-tool/src/public_api.ts → public_api.d.ts} +6 -10
  28. package/.editorconfig +0 -13
  29. package/README.md +0 -27
  30. package/angular.json +0 -172
  31. package/e2e/protractor.conf.js +0 -28
  32. package/e2e/src/app.e2e-spec.ts +0 -14
  33. package/e2e/src/app.po.ts +0 -11
  34. package/e2e/tsconfig.e2e.json +0 -13
  35. package/projects/bulk-tool/karma.conf.js +0 -31
  36. package/projects/bulk-tool/ng-package.json +0 -8
  37. package/projects/bulk-tool/ng-package.prod.json +0 -7
  38. package/projects/bulk-tool/package-lock.json +0 -5
  39. package/projects/bulk-tool/package.json +0 -8
  40. package/projects/bulk-tool/src/lib/auth.service.spec.ts +0 -15
  41. package/projects/bulk-tool/src/lib/auth.service.ts +0 -46
  42. package/projects/bulk-tool/src/lib/base-app.service.ts +0 -36
  43. package/projects/bulk-tool/src/lib/bulk-tool.component.spec.ts +0 -25
  44. package/projects/bulk-tool/src/lib/bulk-tool.component.ts +0 -19
  45. package/projects/bulk-tool/src/lib/bulk-tool.module.ts +0 -41
  46. package/projects/bulk-tool/src/lib/bulk-tool.service.spec.ts +0 -15
  47. package/projects/bulk-tool/src/lib/constant.enum.ts +0 -6
  48. package/projects/bulk-tool/src/lib/environmentsModel.info.ts +0 -5
  49. package/projects/bulk-tool/src/lib/http-interceptor.ts +0 -22
  50. package/projects/bulk-tool/src/lib/login/login.component.css +0 -86
  51. package/projects/bulk-tool/src/lib/login/login.component.html +0 -59
  52. package/projects/bulk-tool/src/lib/login/login.component.spec.ts +0 -25
  53. package/projects/bulk-tool/src/lib/login/login.component.ts +0 -104
  54. package/projects/bulk-tool/src/lib/materils/materils.module.spec.ts +0 -13
  55. package/projects/bulk-tool/src/lib/materils/materils.module.ts +0 -96
  56. package/projects/bulk-tool/src/lib/menu/menu.component.css +0 -388
  57. package/projects/bulk-tool/src/lib/menu/menu.component.html +0 -46
  58. package/projects/bulk-tool/src/lib/menu/menu.component.spec.ts +0 -25
  59. package/projects/bulk-tool/src/lib/menu/menu.component.ts +0 -197
  60. package/projects/bulk-tool/src/test.ts +0 -22
  61. package/projects/bulk-tool/tsconfig.lib.json +0 -33
  62. package/projects/bulk-tool/tsconfig.spec.json +0 -17
  63. package/projects/bulk-tool/tslint.json +0 -17
  64. package/src/app/app.component.css +0 -0
  65. package/src/app/app.component.html +0 -18
  66. package/src/app/app.component.spec.ts +0 -27
  67. package/src/app/app.component.ts +0 -14
  68. package/src/app/app.module.ts +0 -44
  69. package/src/app/home/home.component.css +0 -0
  70. package/src/app/home/home.component.html +0 -13
  71. package/src/app/home/home.component.spec.ts +0 -25
  72. package/src/app/home/home.component.ts +0 -15
  73. package/src/app/login/login.component.css +0 -76
  74. package/src/app/login/login.component.html +0 -1
  75. package/src/app/login/login.component.spec.ts +0 -25
  76. package/src/app/login/login.component.ts +0 -72
  77. package/src/assets/.gitkeep +0 -0
  78. package/src/browserslist +0 -9
  79. package/src/environments/environment.prod.ts +0 -4
  80. package/src/environments/environment.ts +0 -18
  81. package/src/favicon.ico +0 -0
  82. package/src/index.html +0 -24
  83. package/src/karma.conf.js +0 -31
  84. package/src/main.ts +0 -12
  85. package/src/polyfills.ts +0 -80
  86. package/src/styles.css +0 -1
  87. package/src/test.ts +0 -20
  88. package/src/tsconfig.app.json +0 -11
  89. package/src/tsconfig.spec.json +0 -18
  90. package/src/tslint.json +0 -17
  91. package/tsconfig.json +0 -29
  92. package/tslint.json +0 -130
@@ -1,28 +0,0 @@
1
- // Protractor configuration file, see link for more information
2
- // https://github.com/angular/protractor/blob/master/lib/config.ts
3
-
4
- const { SpecReporter } = require('jasmine-spec-reporter');
5
-
6
- exports.config = {
7
- allScriptsTimeout: 11000,
8
- specs: [
9
- './src/**/*.e2e-spec.ts'
10
- ],
11
- capabilities: {
12
- 'browserName': 'chrome'
13
- },
14
- directConnect: true,
15
- baseUrl: 'http://localhost:4200/',
16
- framework: 'jasmine',
17
- jasmineNodeOpts: {
18
- showColors: true,
19
- defaultTimeoutInterval: 30000,
20
- print: function() {}
21
- },
22
- onPrepare() {
23
- require('ts-node').register({
24
- project: require('path').join(__dirname, './tsconfig.e2e.json')
25
- });
26
- jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27
- }
28
- };
@@ -1,14 +0,0 @@
1
- import { AppPage } from './app.po';
2
-
3
- describe('workspace-project App', () => {
4
- let page: AppPage;
5
-
6
- beforeEach(() => {
7
- page = new AppPage();
8
- });
9
-
10
- it('should display welcome message', () => {
11
- page.navigateTo();
12
- expect(page.getParagraphText()).toEqual('Welcome to BulkToolLibrary!');
13
- });
14
- });
package/e2e/src/app.po.ts DELETED
@@ -1,11 +0,0 @@
1
- import { browser, by, element } from 'protractor';
2
-
3
- export class AppPage {
4
- navigateTo() {
5
- return browser.get('/');
6
- }
7
-
8
- getParagraphText() {
9
- return element(by.css('app-root h1')).getText();
10
- }
11
- }
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../out-tsc/app",
5
- "module": "commonjs",
6
- "target": "es5",
7
- "types": [
8
- "jasmine",
9
- "jasminewd2",
10
- "node"
11
- ]
12
- }
13
- }
@@ -1,31 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage-istanbul-reporter'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- clearContext: false // leave Jasmine Spec Runner output visible in browser
17
- },
18
- coverageIstanbulReporter: {
19
- dir: require('path').join(__dirname, '../../coverage'),
20
- reports: ['html', 'lcovonly'],
21
- fixWebpackSourcePaths: true
22
- },
23
- reporters: ['progress', 'kjhtml'],
24
- port: 9876,
25
- colors: true,
26
- logLevel: config.LOG_INFO,
27
- autoWatch: true,
28
- browsers: ['Chrome'],
29
- singleRun: false
30
- });
31
- };
@@ -1,8 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/bulk-tool-menu",
4
- "deleteDestPath": false,
5
- "lib": {
6
- "entryFile": "src/public_api.ts"
7
- }
8
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/bulk-tool",
4
- "lib": {
5
- "entryFile": "src/public_api.ts"
6
- }
7
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "cbms-exceladdinbasev1.0",
3
- "version": "3.0.0",
4
- "lockfileVersion": 1
5
- }
@@ -1,8 +0,0 @@
1
- {
2
- "name": "cbms-exceladdinbasev1.0",
3
- "version": "3.0.0",
4
- "peerDependencies": {
5
- "@angular/common": "^6.0.0-rc.0 || ^6.0.0",
6
- "@angular/core": "^6.0.0-rc.0 || ^6.0.0"
7
- }
8
- }
@@ -1,15 +0,0 @@
1
- import { TestBed, inject } from '@angular/core/testing';
2
-
3
- import { AuthService } from './auth.service';
4
-
5
- describe('AuthService', () => {
6
- beforeEach(() => {
7
- TestBed.configureTestingModule({
8
- providers: [AuthService]
9
- });
10
- });
11
-
12
- it('should be created', inject([AuthService], (service: AuthService) => {
13
- expect(service).toBeTruthy();
14
- }));
15
- });
@@ -1,46 +0,0 @@
1
- import { Injectable, Injector } from '@angular/core';
2
- import { HttpClient } from '@angular/common/http';
3
- import { map } from 'rxjs/operators';
4
- import { Constant } from './constant.enum';
5
- import { Observable } from "rxjs";
6
- import {BaseAppService} from './base-app.service'
7
-
8
-
9
- @Injectable({
10
- providedIn: 'root'
11
- })
12
- export class AuthService {
13
- private API_ENDPOINT = this.injector.get("config").Url;
14
- private menuName = this.injector.get("config").MenuName;
15
- //private RM_ENDPOINT = this.injector.get("config").apiBaseUrl;
16
- //private headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
17
- constructor(private http: HttpClient,public injector: Injector,private baseAppService:BaseAppService) {}
18
-
19
- //private postheaders = new Headers({'Content-Type': 'application/json'});
20
- login(username: string, password: string) : Observable<any>
21
- {
22
- return this.http.post<any>(this.API_ENDPOINT + "/Login", { username, password })
23
- .pipe(map(user => {
24
- if (user.status!="Invalid" ) {
25
- console.log(user);
26
- localStorage.clear();
27
- localStorage.setItem('UserInfo', JSON.stringify(user));
28
- this.baseAppService.setUserInfo(user);
29
- }
30
- return user;
31
- }));
32
- }
33
-
34
- logout() {
35
- this.baseAppService.clearData();
36
- localStorage.clear();
37
- }
38
-
39
- public GetMenu(userId): Observable<any> {
40
- return this.http.get(this.API_ENDPOINT +'/userMenus?userId='+userId+'&menu='+this.menuName)
41
- .pipe(map(res => {
42
- this.baseAppService.setUserMenus(res);
43
- return res;
44
- }));
45
- }
46
- }
@@ -1,36 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
-
3
- @Injectable({
4
- providedIn: 'root'
5
- })
6
- export class BaseAppService {
7
-
8
- private userInfo:any;
9
- private userMenus:any;
10
- private menuName:any
11
- getUserInfo(){
12
- return this.userInfo;
13
- }
14
- setUserInfo(value){
15
- this.userInfo=value;
16
- }
17
- removeUserInfo(){
18
- this.userInfo=null;
19
- }
20
- setUserMenus(data){
21
- this.userMenus=data;
22
- }
23
- getUserMenus(){
24
- return this.userMenus;
25
- }
26
- clearData(){
27
- this.userInfo=undefined;
28
- this.userMenus=undefined;
29
- }
30
- setmenuNameFromBudget(name){
31
- this.menuName=name
32
- }
33
- getmenuNameFromBudget(){
34
- return this.menuName
35
- }
36
- }
@@ -1,25 +0,0 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { BulkToolComponent } from './bulk-tool.component';
4
-
5
- describe('BulkToolComponent', () => {
6
- let component: BulkToolComponent;
7
- let fixture: ComponentFixture<BulkToolComponent>;
8
-
9
- beforeEach(async(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ BulkToolComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(BulkToolComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,19 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'lib-BulkTool',
5
- template: `
6
- <p>
7
- bulk-tool works!
8
- </p>
9
- `,
10
- styles: []
11
- })
12
- export class BulkToolComponent implements OnInit {
13
-
14
- constructor() { }
15
-
16
- ngOnInit() {
17
- }
18
-
19
- }
@@ -1,41 +0,0 @@
1
- import { NgModule,ModuleWithProviders } from '@angular/core';
2
- import { BulkToolComponent } from './bulk-tool.component';
3
- import { LoginComponent } from './login/login.component';
4
- import { MaterilsModule } from './materils/materils.module';
5
- import { MenuComponent } from './menu/menu.component';
6
-
7
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
8
- import { CommonModule } from '@angular/common';
9
- import { RouterModule } from '@angular/router';
10
- import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
11
- import { HttpLibInterceptor } from './http-interceptor';
12
- import { AuthService } from './auth.service';
13
- import {BaseAppService } from './base-app.service';
14
- import {IEnvironmentsInfo} from '../lib/environmentsModel.info';
15
-
16
-
17
-
18
- @NgModule({
19
- imports: [
20
- MaterilsModule,
21
- FormsModule,
22
- CommonModule,
23
- RouterModule,
24
- ReactiveFormsModule,
25
- HttpClientModule,
26
-
27
-
28
- ],
29
- declarations: [BulkToolComponent, LoginComponent, MenuComponent],
30
- exports: [BulkToolComponent, LoginComponent, MenuComponent],
31
- providers:[ { provide: HTTP_INTERCEPTORS, useClass: HttpLibInterceptor, multi: true },AuthService,BaseAppService]
32
- })
33
- export class BulkToolModule {
34
- static forRoot( config :IEnvironmentsInfo): ModuleWithProviders {
35
- return {
36
- ngModule: BulkToolModule,
37
- providers: [{ provide: 'config', useValue: config },BaseAppService]
38
- };
39
- }
40
-
41
- }
@@ -1,15 +0,0 @@
1
- import { TestBed, inject } from '@angular/core/testing';
2
-
3
- import { BaseAppService } from './bulk-tool.service';
4
-
5
- describe('BaseAppService', () => {
6
- beforeEach(() => {
7
- TestBed.configureTestingModule({
8
- providers: [BaseAppService]
9
- });
10
- });
11
-
12
- it('should be created', inject([BaseAppService], (service: BaseAppService) => {
13
- expect(service).toBeTruthy();
14
- }));
15
- });
@@ -1,6 +0,0 @@
1
- export const Constant= {
2
- APPSERVICEURL:'https://localhost:44348/api',
3
- APPSERVICEPRODURL:'https://tk4addin.dev.summitenergy.com/appservices/api',
4
-
5
- INVALID:"Invalid Username or Password"
6
- }
@@ -1,5 +0,0 @@
1
- export interface IEnvironmentsInfo {
2
- Url:string,
3
- RootUrl:string,
4
- MenuName:string
5
- }
@@ -1,22 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
3
- import { Observable } from 'rxjs';
4
- @Injectable()
5
- export class HttpLibInterceptor implements HttpInterceptor {
6
- intercept(request: HttpRequest<any>, newRequest: HttpHandler): Observable<HttpEvent<any>> {
7
- // add authorization header to request
8
- //Get Token data from local storage
9
- //let tokenInfo = JSON.parse(localStorage.getItem('TokenInfo'));
10
-
11
- // if (tokenInfo && tokenInfo.token) {
12
- // request = request.clone({
13
- // setHeaders: {
14
- // Authorization: `Bearer ${tokenInfo.token}`,
15
- // "Content-Type": 'application/json'
16
- // }
17
- // });
18
- // }
19
- console.log(request);
20
- return newRequest.handle(request);
21
- }
22
- }
@@ -1,86 +0,0 @@
1
- body{
2
- background: #f4fafd;
3
- }
4
-
5
- .loginForm {
6
- border-radius: 0px;
7
- background: #fff;
8
- padding: 30px;
9
- width: 90%;
10
- max-width: 450px;
11
- padding: 15px;
12
- text-align: left;
13
- margin: 60px auto;
14
- border: #f4f4f4 solid 1px;
15
- -webkit-box-shadow: 4px 2px 5px -2px rgba(194,179,194,1);
16
- -moz-box-shadow: 4px 2px 5px -2px rgba(194,179,194,1);
17
- box-shadow: 4px 2px 5px -2px rgba(194,179,194,1);
18
- }
19
-
20
- ::ng-deep .mat-button, .mat-flat-button, .mat-icon-button, .mat-stroked-button {
21
- box-sizing: border-box;
22
- position: relative;
23
- -webkit-user-select: none;
24
- -moz-user-select: none;
25
- -ms-user-select: none;
26
- user-select: none;
27
- cursor: pointer;
28
- outline: 0;
29
- border: none;
30
- -webkit-tap-highlight-color: transparent;
31
- display: inline-block;
32
- white-space: nowrap;
33
- text-decoration: none;
34
- vertical-align: baseline;
35
- text-align: center;
36
- margin: 0;
37
- min-width: 64px;
38
- line-height: 28px!important;
39
- padding: 0 16px;
40
- border-radius: 4px;
41
- overflow: visible;
42
- }
43
-
44
- .nb-spinner {
45
- width: 75pxx;
46
- height: 75px;
47
- margin: 0;
48
- background: transparent;
49
- border-top: 4px solid #03A9F4;
50
- border-right: 4px solid transparent;
51
- border-radius: 50%;
52
- -webkit-animation: 1s spin linear infinite;
53
- animation: 1s spin linear infinite;
54
- }
55
-
56
- .loade {
57
- background: rgba(255, 255, 255, 0.5);
58
- width: 100%;
59
- height: 100%;
60
- overflow: hidden;
61
-
62
- padding-left: 67px;
63
- position: absolute;
64
- z-index: 1;
65
- opacity: 50;
66
- top:0px;
67
- padding-top:135px;
68
- }
69
-
70
- .square-spinner {
71
- width: 55px;
72
- display: block;
73
- background-color: #03A9F4;
74
- height: 55px;
75
- -webkit-animation: 3s rotate2 ease-in-out infinite;
76
- animation: 3s flip ease-in-out infinite;
77
- }
78
- ::ng-deep .mat-spinner circle{
79
- stroke:green;
80
- stroke-width:10%;
81
- }
82
-
83
- mat-form-field {
84
- width: 100%;
85
- }
86
-
@@ -1,59 +0,0 @@
1
-
2
- <div class="container">
3
- <div class="loginForm">
4
- <div class="example-sidenav-content">
5
- <div class="loginWidget">
6
- <form [formGroup]="loginForm" >
7
- <h2>Login</h2>
8
- <div>&nbsp;</div>
9
- <div class="form-group">
10
- <!-- <label for="username">Username</label> -->
11
- <!-- <input type="text" formControlName="username" class="form-control"
12
- [ngClass]="{ 'is-invalid': submitted && formsData.username.errors }" /> -->
13
- <mat-form-field class="example-full-width"
14
- color="primary">
15
- <input class="toolbar-search" formControlName="username" type="text" matInput placeholder="Enter Username ">
16
- <mat-icon matSuffix style="font-size: 1.2em"></mat-icon>
17
- </mat-form-field>
18
- <!-- <div *ngIf="submitted && formsData.username.errors" class="invalid-feedback">
19
- <div *ngIf="formsData.username.errors.required">Username is required</div>
20
- </div> -->
21
- </div>
22
- <div class="form-group">
23
- <!-- <label for="password">Password</label> -->
24
- <!-- <input type="password" formControlName="password" class="form-control"
25
- [ngClass]="{ 'is-invalid': submitted && formsData.password.errors }" /> -->
26
- <mat-form-field class="example-full-width"
27
- color="primary">
28
- <input class="toolbar-search" formControlName="password" type="password" matInput placeholder="Enter Password ">
29
- <mat-icon matSuffix style="font-size: 1.2em"></mat-icon>
30
- </mat-form-field>
31
- <!-- <div *ngIf="submitted && formsData.password.errors" class="invalid-feedback">
32
- <div *ngIf="formsData.password.errors.required">Password is required</div>
33
- </div> -->
34
- </div>
35
- <div class="form-group">
36
- <!-- <button [disabled]="submitClick" class="btn btn-primary">Login</button> -->
37
- <button style="background-color: #0888CA;color: #fff;" mat-button class="!loginForm.valid btn btn-primary" (click)="onLogin()">Login</button>
38
- </div>
39
- <div *ngIf ="!isvalidUser" class="alert alert-danger">{{error}}</div>
40
- </form>
41
- </div>
42
-
43
- <section class="loade" *ngIf="isLoading">
44
- <mat-spinner color="black" [diameter]=60 ></mat-spinner>
45
- <span>
46
- Logging...
47
- </span>
48
- </section>
49
-
50
-
51
- <!-- <button type="button" mat-button (click)="drawer.toggle()">
52
- Toggle sidenav
53
- </button> -->
54
- </div>
55
- </div>
56
- </div>
57
-
58
-
59
-
@@ -1,25 +0,0 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { LoginComponent } from './login.component';
4
-
5
- describe('LoginComponent', () => {
6
- let component: LoginComponent;
7
- let fixture: ComponentFixture<LoginComponent>;
8
-
9
- beforeEach(async(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ LoginComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(LoginComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,104 +0,0 @@
1
-
2
- import { Component, OnInit, Input } from '@angular/core';
3
- import { Location } from "@angular/common";
4
- import { Router, ActivatedRoute, RouterModule } from '@angular/router';
5
- import { FormBuilder, FormGroup, Validators, AbstractControl } from '@angular/forms';
6
- import { first } from 'rxjs/operators';
7
- import { Constant } from '../constant.enum';
8
- import { AuthService } from '../auth.service';
9
- import {BaseAppService} from '../base-app.service'
10
- //import { url } from 'inspector';
11
- export interface Login
12
- {
13
- [key: string]: AbstractControl
14
- }
15
-
16
- @Component({
17
- selector: 'lib-login',
18
- templateUrl: 'login.component.html',
19
- styleUrls: ['./login.component.css']
20
- })
21
-
22
- export class LoginComponent implements OnInit {
23
- public isLoading: boolean = false;
24
- @Input() routeUrl: string;
25
- loginForm: FormGroup;
26
- submitted = false;
27
- returnUrl: string;
28
- error = '';
29
- userInfo:any;
30
- constructor(
31
- private formBuilder: FormBuilder,
32
- private route: ActivatedRoute,
33
- private router: Router,
34
- private location: Location,
35
- private authenticationService: AuthService,
36
- private baseAppService:BaseAppService) {
37
- let userObject=localStorage.getItem("UserInfo")
38
- this.userInfo=JSON.parse(userObject);
39
- this.baseAppService.setUserInfo(this.userInfo);
40
- }
41
- public isvalidUser:boolean = true;
42
- ngOnInit() {
43
- this.loginForm = this.formBuilder.group({
44
- username: ['', Validators.required],
45
- password: ['', Validators.required]
46
- });
47
- this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || this.routeUrl;
48
- //Checking User already logged in or not
49
- let isNavigate=localStorage.getItem("IsNavigate");
50
- if (this.location.path() !== '' && this.location.path().indexOf('UserId') !== -1) {
51
- let userId=this.location.path().split('?')[1].split('UserId=')[1]
52
- if(userId==this.userInfo.userInfoId){
53
- this.router.navigate([this.returnUrl]);
54
- return;
55
- }
56
- }
57
- else if(JSON.parse(isNavigate)==true){
58
- if(this.userInfo){
59
- console.log("Login After naviagtion-",this.returnUrl);
60
- localStorage.removeItem("IsNavigate");
61
- this.router.navigate([this.returnUrl]);
62
- return;
63
- }
64
- }
65
- }
66
- get formsData():Login { return this.loginForm.controls; }
67
-
68
- onLogin() {
69
- this.submitted = true;
70
- this.isLoading = true;
71
- // stop here if form is invalid
72
- if (this.loginForm.invalid) {
73
- this.isLoading = false;
74
- return;
75
- }
76
- //this.submitClick = true;
77
- this.authenticationService.login(this.formsData.username.value, this.formsData.password.value)
78
- .pipe(first())
79
- .subscribe(
80
- data => {
81
- console.log(data.status);
82
- if(data.status==="InValid")
83
- {
84
- this.isLoading = false;
85
- this.isvalidUser=false;
86
- this.error = Constant.INVALID;
87
- this.router.navigate(["/login"]);
88
- }
89
- else
90
- {
91
- console.log("Login Success-",this.returnUrl);
92
- this.isLoading = false;
93
- this.router.navigate([this.returnUrl]);
94
-
95
- }
96
- },
97
- error => {
98
- this.isLoading = false;
99
- this.error = Constant.INVALID;
100
- this.router.navigate(["/login"]);
101
- //this.submitClick = true;
102
- });
103
- }
104
- }
@@ -1,13 +0,0 @@
1
- import { MaterilsModule } from './materils.module';
2
-
3
- describe('MaterilsModule', () => {
4
- let materilsModule: MaterilsModule;
5
-
6
- beforeEach(() => {
7
- materilsModule = new MaterilsModule();
8
- });
9
-
10
- it('should create an instance', () => {
11
- expect(materilsModule).toBeTruthy();
12
- });
13
- });