summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgzbin346392 -> 356592 bytes
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts57
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts45
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts33
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts23
-rw-r--r--ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgzbin346392 -> 356592 bytes
-rw-r--r--ecomp-sdk/portalsdk-tag-lib-test-app/src/app/app.component.ts16
-rw-r--r--ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.ts4
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/model/column.ts8
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.html5
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts12
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts6
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html7
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts53
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.css0
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.html12
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.spec.ts25
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.ts19
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp.module.ts6
19 files changed, 260 insertions, 71 deletions
diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz b/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz
index 3b1c200f..d0576c6e 100644
--- a/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz
+++ b/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz
Binary files differ
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts
index c327c79a..5d996964 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts
@@ -111,27 +111,54 @@ export class MenusComponent implements OnInit {
});
//rdp table data
- this.columns.push(new Column("id", "Menu ID", ColumnTypes.TEXT, false, null));
- this.columns.push(new Column("label", "Label", ColumnTypes.TEXT, true, null));
- this.columns.push(new Column("parentId", "ParentId", ColumnTypes.DROPDOWN, false, this.parentList));
- this.columns.push(new Column("sortOrder", "Sort Order", ColumnTypes.TEXT, false, null));
- this.columns.push(new Column("action", "Action", ColumnTypes.TEXT, false, null));
- this.columns.push(new Column("functionCd", "Function", ColumnTypes.DROPDOWN, false, this.functionCDselectData));
- this.columns.push(new Column("active", "Active", ColumnTypes.DROPDOWN, false, this.activeStatusOptions));
- this.columns.push(new Column("servlet", "Servlet", ColumnTypes.TEXT, false, null));
- this.columns.push(new Column("queryString", " Query String", ColumnTypes.TEXT, false, null));
- this.columns.push(new Column("externalUrl", "External URL", ColumnTypes.TEXT, false, null));
- this.columns.push(new Column("target", "Target", ColumnTypes.TEXT, false, null));
- this.columns.push(new Column("menuSetCode", "Menu Set Code", ColumnTypes.TEXT, false, null));
- this.columns.push(new Column("separator", "Separator", ColumnTypes.DROPDOWN, false, this.separatorStatusOptions));
- this.columns.push(new Column("imageSrc", "Image Source", ColumnTypes.TEXT, false, null));
+ let menuIdColumn = new Column("id", "Menu ID", ColumnTypes.TEXT, true, null);
+ menuIdColumn.isColumnDisabled = true;
+ this.columns.push(menuIdColumn);
+
+ let label = new Column("label", "Label", ColumnTypes.TEXT, true, null);
+ label.setIsColumnMandatory = true;
+ this.columns.push(label);
+
+ let parent = new Column("parentId", "ParentId", ColumnTypes.DROPDOWN, true, this.parentList);
+ parent.setIsColumnMandatory = true;
+ this.columns.push(parent);
+
+ let sortOrder = new Column("sortOrder", "Sort Order", ColumnTypes.TEXT, true, null);
+ sortOrder.setIsColumnMandatory = true;
+ this.columns.push(sortOrder);
+
+ let action = new Column("action", "Action", ColumnTypes.TEXT, true, null);
+ action.setIsColumnMandatory = true;
+ this.columns.push(action);
+
+ let functionCd = new Column("functionCd", "Function", ColumnTypes.DROPDOWN, true, this.functionCDselectData);
+ functionCd.setIsColumnMandatory = true;
+ this.columns.push(functionCd);
+
+ let active = new Column("active", "Active", ColumnTypes.DROPDOWN, true, this.activeStatusOptions);
+ active.setIsColumnMandatory = true;
+ this.columns.push(active);
+
+ this.columns.push(new Column("servlet", "Servlet", ColumnTypes.TEXT, true, null));
+ this.columns.push(new Column("queryString", " Query String", ColumnTypes.TEXT, true, null));
+ this.columns.push(new Column("externalUrl", "External URL", ColumnTypes.TEXT, true, null));
+ this.columns.push(new Column("target", "Target", ColumnTypes.TEXT, true, null));
+
+ let menuSetCode = new Column("menuSetCode", "Menu Set Code", ColumnTypes.TEXT, false, null);
+ menuSetCode.setIsColumnMandatory = true;
+ this.columns.push(menuSetCode);
+
+ let separator = new Column("separator", "Separator", ColumnTypes.DROPDOWN, false, this.separatorStatusOptions);
+ separator.setIsColumnMandatory = true;
+ this.columns.push(separator);
+ this.columns.push(new Column("imageSrc", "Image Source", ColumnTypes.TEXT, true, null));
this.settings = new DataTableSettings()
this.settings.columns = this.columns;
this.settings.isPaginationEnabled = true;
this.settings.paginationsSize = "5";
this.settings.isReadOnly = false;
- this.settings.isTableSearchEnabled = false;
+ this.settings.isTableSearchEnabled = true;
this.settings.applicationService = this.menuService;
this.showSpinner = false;
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
index 3c3efb92..417b3a18 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
@@ -5,18 +5,42 @@ import { FormsModule } from '@angular/forms';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { componentRefresh } from '@angular/core/src/render3/instructions';
+import { SecurityService } from './security.service';
+import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
describe('SecurityComponent', () => {
let component: SecurityComponent;
let fixture: ComponentFixture<SecurityComponent>;
+ let service : SecurityService;
+ let environment =[
+ {
+ baseUrl: 'just for testing'
+ }
+ ]
beforeEach(async(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [ SecurityComponent ],
- imports: [FormsModule, HttpClientTestingModule]
+ imports: [FormsModule, HttpClientTestingModule],
+ providers: [SecurityService]
})
.compileComponents();
+ service = TestBed.get(SecurityService);
+ spyOn(service, 'getReportOwnerList').and.returnValue(Observable.of(environment));
+ spyOn(service, 'getReportSecurityInfo').and.returnValue(Observable.of(environment));
+ spyOn(service, 'getReportUserList').and.returnValue(Observable.of(environment));
+ spyOn(service, 'getReportSecurityRoles').and.returnValue(Observable.of(environment));
+ spyOn(service, 'getReportRoleList').and.returnValue(Observable.of(environment));
+ spyOn(service, 'addReportUser').and.returnValue(Observable.of(environment));
+ spyOn(service, 'removeReportUser').and.returnValue(Observable.of(environment));
+ spyOn(service, 'addUserEditAccess').and.returnValue(Observable.of(environment));
+ spyOn(service, 'addReportRole').and.returnValue(Observable.of(environment));
+ spyOn(service, 'removeReportRole').and.returnValue(Observable.of(environment));
+ spyOn(service, 'addRoleEditAccess').and.returnValue(Observable.of(environment));
+ spyOn(service, 'saveSecurityTabInfo').and.returnValue(Observable.of(environment));
+
}));
beforeEach(() => {
@@ -31,15 +55,19 @@ describe('SecurityComponent', () => {
it('should test ngOnInit method', () => {
component.reportType = "Dashboard";
- component.ngOnInit();
- expect(component.showSpinner).toEqual(true);
+ component.ngOnInit();
+ // expect(component.showSpinner).toEqual(true);
expect(component.stepNo).toEqual('2');
-
component.reportType = "test";
+
component.ngOnInit();
expect(component.stepNo).toEqual('6');
- });
+ spyOn(component, 'ngOnInit').and.callThrough();
+ component.ngOnInit();
+ expect(component.ngOnInit).toHaveBeenCalled();
+ });
+
it('should test addUserEditAccess method', () =>{
let reportUserId = 'test';
let index = 1;
@@ -63,7 +91,9 @@ describe('SecurityComponent', () => {
});
it("should test addReportUser method", () => {
+ spyOn(component, 'addReportUser').and.callThrough();
component.addReportUser();
+ expect(component.addReportUser).toHaveBeenCalled();
});
it("should test removeReportUser method", () => {
@@ -79,7 +109,10 @@ describe('SecurityComponent', () => {
});
it("should test saveSecurityTabData method", () => {
- component.saveSecurityTabData();
+ spyOn(component, 'saveSecurityTabData').and.callThrough();
+ component.saveSecurityTabData();
+ expect(component.saveSecurityTabData).toHaveBeenCalled();
});
});
+
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
index c894bff6..52082c9f 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
@@ -8,15 +8,20 @@ import { RouterTestingModule } from '@angular/router/testing';
import { SqlService } from './sql.service';
import 'rxjs/add/observable/of';
import { Observable } from 'rxjs/Observable';
-import { element } from '@angular/core/src/render3';
-import { environment } from 'src/environments/environment';
+
describe('SQLComponentComponent', () => {
let sqlService: SqlService;
let component: SQLComponent;
let fixture: ComponentFixture<SQLComponent>;
const reportId = "test";
- const finalGetObj = {"query":"dummyQuery"}
+ const finalGetObj = {"query":"dummyQuery"};
+ let elements = [];
+ let environment = [
+ {
+ "baseUrl": 'just for test'
+ }
+ ]
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -27,15 +32,17 @@ describe('SQLComponentComponent', () => {
})
.compileComponents();
sqlService = TestBed.get(SqlService);
+ let response : any;
+ spyOn(sqlService, 'getSQLTabData').and.returnValue(Observable.of(environment));
+ spyOn(sqlService, 'postSQLValidateAndSave').and.returnValue(Observable.of(environment));
}));
beforeEach(() => {
- fixture = TestBed.createComponent(SQLComponent);
+ fixture = TestBed.createComponent(SQLComponent);
component = fixture.componentInstance;
component.reportId1 = reportId;
component.finalGetObj = finalGetObj;
- sqlService = TestBed.get(SqlService);
fixture.detectChanges();
});
@@ -44,6 +51,12 @@ describe('SQLComponentComponent', () => {
expect(component).toBeTruthy();
});
+ it('should test ngOninit subscribe method', () => {
+ spyOn(component, 'ngOnInit').and.callThrough();
+ component.ngOnInit();
+ expect(component.ngOnInit).toHaveBeenCalled();
+ });
+
it('should test ngOnInit method', () => {
component.ngOnInit();
expect(component.showSaveSQLDialog).toEqual(false);
@@ -69,10 +82,6 @@ describe('SQLComponentComponent', () => {
expect(component.SQLclosable).toEqual(true);
});
- it('should test validate method', () => {
- component.validate();
- });
-
it('should test closeSaveModal method', () => {
component.closeSaveModal();
expect(component.showSaveSQLDialog).toEqual(component.showSaveSQLDialog);
@@ -104,4 +113,10 @@ describe('SQLComponentComponent', () => {
expect(component.GetValidateResponseString()).toEqual("test");
});
+// it('should test validate method', () => {
+// spyOn(component, 'validate').and.callThrough();
+// component.validate();
+// expect(component.validate).toHaveBeenCalled();
+// });
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts
index 2c01ff14..78113e42 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts
@@ -3,17 +3,27 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule, MatTableDataSource } from '@angular/material/table';
-
import { ReportListComponent } from './report-list.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { Router } from '@angular/router';
import { AllReportsDataSource } from './report-list-datasource';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import 'rxjs/add/observable/empty';
+import 'rxjs/add/observable/of';
+import { environment } from 'src/environments/environment';
+import { ReportListService } from './report-list.service';
describe('ReportListComponent', () => {
let component: ReportListComponent;
let fixture: ComponentFixture<ReportListComponent>;
+ let http: HttpClient;
+ let reportService : ReportListService;
+ let environment = [
+ { baseUrl : 'just for test' }
+ ]
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -25,9 +35,14 @@ describe('ReportListComponent', () => {
MatSortModule,
MatTableModule,
HttpClientTestingModule,
- RouterTestingModule
- ]
+ RouterTestingModule,
+ ],
+ providers: [HttpClient, ReportListService]
}).compileComponents();
+
+ reportService = TestBed.get(ReportListService);
+ http = TestBed.get(HttpClient);
+ spyOn(reportService, 'deleteReport').and.returnValue(Observable.of(environment));
}));
beforeEach(() => {
@@ -96,7 +111,9 @@ describe('ReportListComponent', () => {
});
it('should test deleteReport method', () => {
+ spyOn(component, 'deleteReport').and.callThrough();
component.deleteReport();
+ expect(component.deleteReport).toHaveBeenCalled();
});
it('should test openReportSchedule method', () => {
diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgz b/ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgz
index 3b1c200f..d0576c6e 100644
--- a/ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgz
+++ b/ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgz
Binary files differ
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
index 536b1714..486ebf6b 100644
--- 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
@@ -39,12 +39,20 @@ export class AppComponent implements OnInit{
//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));
+ let name = new Column("name","Name",ColumnTypes.TEXT, true,list);
+ name.setIsColumnMandatory = true;
+ this.columns.push(name);
+
+ let company = new Column("company","Company", ColumnTypes.TEXT, false,list);
+ company.setIsColumnMandatory = false;
+ this.columns.push(company);
+
+ let location = new Column("location","Location", ColumnTypes.DROPDOWN, true,list);
+ location.setIsColumnMandatory = true;
+ this.columns.push(location);
+ console.log("Columns : ", this.columns);
this.settings = new DataTableSettings()
this.settings.columns = this.columns;
this.settings.isPaginationEnabled=true;
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
index 0860e113..aade5595 100644
--- 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
@@ -2,7 +2,7 @@ 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';
+import { Observable, BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
@@ -10,12 +10,14 @@ import { Observable } from 'rxjs';
export class AppService implements RdpCrudInterface{
constructor(private http:HttpClient) { }
+ public statusResponse = new BehaviorSubject("");
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);
+ this.statusResponse.next("202");
}
delete(data:any){
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/model/column.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/model/column.ts
index f5bda1fe..7bce33b2 100644
--- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/model/column.ts
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/model/column.ts
@@ -41,8 +41,9 @@ export class Column {
dispalyTitle:string;
type:ColumnTypes;
sort:boolean;
- isColumnDisabled:boolean
+ isColumnDisabled:boolean;
listData = [];
+ isMandatory :boolean;
constructor(title:string, dispalyTitle:string, type:ColumnTypes, sort:boolean, listData) {
this.title = title;
@@ -51,11 +52,16 @@ export class Column {
this.sort = sort;
this.isColumnDisabled = false;
this.listData = listData;
+ this.isMandatory = false;
}
set setIsColumnDisabled(value: boolean) {
this.isColumnDisabled = value;
}
+
+ set setIsColumnMandatory(value: boolean) {
+ this.isMandatory = value;
+ }
}
export enum ColumnTypes {
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.html b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.html
index af464510..111c376b 100644
--- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.html
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.html
@@ -1,3 +1,2 @@
-<p>
- rdp-input-editor works!
-</p>
+<input class="input-editor" [disabled]="isColumnDisabled" [(ngModel)]="columnValue" type="text" name="{{columntitle}}"
+ id="{{columntitle}}" (change)="detectChange(columnValue)"> \ No newline at end of file
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts
index ea6d1746..8d604936 100644
--- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts
@@ -36,20 +36,14 @@
*
*/
-import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+import { Component, OnInit, Input, Output, EventEmitter, OnChanges, OnDestroy } from '@angular/core';
@Component({
selector: 'rdp-input-editor',
styleUrls: ['./rdp-input-editor.component.scss'],
- template: `
- <input class="input-editor" [disabled]="isColumnDisabled"
- [(ngModel)]="columnValue"
- type="text" name="{{columntitle}}"
- id="{{columntitle}}"
- (change)="detectChange(columnValue)">
- `
+ templateUrl : './rdp-input-editor.component.html'
})
-export class RdpInputEditorComponent implements OnInit {
+export class RdpInputEditorComponent implements OnInit{
@Input() rowdata: any;
@Input() columntitle: any
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts
index 5dbc037b..24cb2e6f 100644
--- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts
@@ -44,7 +44,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
template: `
<mat-form-field>
<mat-label>{{columntitle | titlecase}}:</mat-label>
- <mat-select [(value)]="selected"
+ <mat-select [(value)]="columnValue"
(selectionChange)="detectChange(columnValue)">
<mat-option *ngFor="let item of data" [value]="item.name">
{{item.name}}
@@ -59,7 +59,6 @@ export class RdpSelectEditorComponent implements OnInit {
@Input() columntitle: any;
@Input() data: any[];
@Output() changedColumnValue = new EventEmitter<any>();
- selected: any;
columnValue: any;
constructor() { }
@@ -69,12 +68,9 @@ export class RdpSelectEditorComponent implements OnInit {
let rowObj = JSON.parse(this.rowdata);
let column = this.columntitle;
this.columnValue = rowObj[column];
-
} else {
this.columnValue = null;
}
- this.selected = this.columnValue;
- console.log(" this.selected :::", this.selected);
}
detectChange(changedValue) {
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html
index a0e2b01b..f2ff001b 100644
--- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html
@@ -49,6 +49,7 @@
<div [ngSwitch]="column.type">
<div *ngSwitchCase="'text'" class="groupItem">
<label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br>
+ <span *ngIf="column.isMandatory" style="color: red;">*</span>
<rdp-input-editor (changedColumnValue)="columnDataChanged($event, column.title)"
rowdata="{{selectedRowData}}"
columntitle="{{column.title}}"
@@ -57,6 +58,7 @@
</rdp-input-editor>
</div>
<div *ngSwitchCase="'dropdown'" class="groupItem">
+ <span *ngIf="column.isMandatory" style="color: red;">*</span>
<rdp-select-editor (changedColumnValue)="columnDataChanged($event, column.title)"
rowdata="{{selectedRowData}}"
[data]="column.listData"
@@ -64,14 +66,17 @@
</div>
<div *ngSwitchCase="'textarea'" class="groupItem">
<label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br>
+ <span *ngIf="column.isMandatory" style="color: red;">*</span>
<rdp-textarea-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-textarea-editor>
</div>
<div *ngSwitchCase="'checkbox'" class="groupItem">
<label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br>
+ <span *ngIf="column.isMandatory" style="color: red;">*</span>
<rdp-checkbox-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-checkbox-editor>
</div>
<div *ngSwitchCase="'radio'" class="groupItem">
<label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br>
+ <span *ngIf="column.isMandatory" style="color: red;">*</span>
<rdp-radio-editor (changedColumnValue)="columnDataChanged($event, column.title)"
[data]="column.listData"
rowdata="{{selectedRowData}}"
@@ -79,10 +84,12 @@
</div>
<div *ngSwitchCase="'datepicker'" class="groupItem">
<label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br>
+ <span *ngIf="column.isMandatory" style="color: red;">*</span>
<rdp-datepicker-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-datepicker-editor>
</div>
<div *ngSwitchDefault class="groupItem">
<label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br>
+ <span *ngIf="column.isMandatory" style="color: red;">*</span>
<rdp-input-editor (changedColumnValue)="columnDataChanged($event, column.title)"
rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-input-editor>
</div>
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts
index d92ce320..5437c174 100644
--- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts
@@ -1,6 +1,8 @@
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { RdpDataTableService } from '../../shared/rdp-data-table.service';
+import { RdpModalService } from '../../services/rdp-modal.service';
+import { RdpInformationModelComponent } from '../../rdp-information-model/rdp-information-model.component';
@Component({
selector: 'rdp-rdp-data-table-edit',
@@ -18,7 +20,10 @@ export class RdpDataTableEditComponent implements OnInit {
selectedRowData: any;
public columnsInfoList = [];
- constructor(public activeModal: NgbActiveModal, public rdpDataTableService: RdpDataTableService) { }
+ constructor(
+ public activeModal: NgbActiveModal,
+ public rdpDataTableService: RdpDataTableService,
+ private rdpModal: RdpModalService) { }
ngOnInit() {
this.modalPopupTitle = "Edit";
@@ -36,19 +41,41 @@ export class RdpDataTableEditComponent implements OnInit {
}
saveChanges() {
- this.applicationService.update(this.rowdata);
- this.applicationService.statusResponse.subscribe(responseData => {
- if (responseData == "200") {
- console.log("Success")
- this.applicationService.get();
- this.applicationService.updatedData.subscribe(val => {
- if (val) {
- this.passEntry.emit(val);
- }
- })
+ let validationResult = this.validateRowData(this.rowdata);
+ if (validationResult) {
+ console.log("Validation is complete")
+ this.applicationService.update(this.rowdata);
+ this.applicationService.statusResponse.subscribe(responseData => {
+ if (responseData == "200") {
+ console.log("Success")
+ this.applicationService.get();
+ this.applicationService.updatedData.subscribe(val => {
+ if (val) {
+ this.passEntry.emit(val);
+ }
+ })
+ }
+ })
+ this.activeModal.close();
+ }
+ }
+
+ validateRowData(rowData): any {
+ let columnData = this.settings.columns;
+ let validate: boolean = true;
+ for (let column of columnData) {
+ if (column.isMandatory) {
+ if (rowData[column.title] == undefined || rowData[column.title] == null
+ || rowData[column.title] == "") {
+ const modelRef = this.rdpModal.open(RdpInformationModelComponent, { size: 'lg' });
+ modelRef.componentInstance.title = 'Missing Mandatory Field';
+ modelRef.componentInstance.message = "Please fill mandatory field " + column.dispalyTitle;
+ validate = false;
+ break;
+ }
}
- })
- this.activeModal.close();
+ }
+ return validate;
}
columnDataChanged($event, columnTitle) {
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.css b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.css
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.css
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.html b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.html
new file mode 100644
index 00000000..b581f277
--- /dev/null
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.html
@@ -0,0 +1,12 @@
+<div class="modal-header">
+ <h4 class="modal-title">{{title}}</h4>
+ <button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross')">
+ <span aria-hidden="true">&times;</span>
+ </button>
+</div>
+<div class="modal-body">
+ <p>{{message}}</p>
+</div>
+<div class="modal-footer">
+ <button type="button" class="btn btn-primary" (click)="activeModal.close('Close')">Close</button>
+</div> \ No newline at end of file
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.spec.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.spec.ts
new file mode 100644
index 00000000..1df58942
--- /dev/null
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { RdpInformationModelComponent } from './rdp-information-model.component';
+
+describe('RdpInformationModelComponent', () => {
+ let component: RdpInformationModelComponent;
+ let fixture: ComponentFixture<RdpInformationModelComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ RdpInformationModelComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(RdpInformationModelComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.ts
new file mode 100644
index 00000000..e1bc580a
--- /dev/null
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-information-model/rdp-information-model.component.ts
@@ -0,0 +1,19 @@
+import { Component, OnInit, Input } from '@angular/core';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+
+@Component({
+ selector: 'rdp-rdp-information-model',
+ templateUrl: './rdp-information-model.component.html',
+ styleUrls: ['./rdp-information-model.component.css']
+})
+export class RdpInformationModelComponent implements OnInit {
+
+ @Input() title: string;
+ @Input() message: string;
+
+ constructor(public activeModal: NgbActiveModal) { }
+
+ ngOnInit() {
+ }
+
+}
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp.module.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp.module.ts
index e33ad4e6..0cd305e3 100644
--- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp.module.ts
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp.module.ts
@@ -21,6 +21,7 @@ import { RdpScrollContainerComponent } from './rdp-scroll-container/rdp-scroll-c
import { RdpButtonComponent } from './rdp-cell-editor/rdp-button/rdp-button.component';
import { RdpIconButtonComponent } from './rdp-cell-editor/rdp-icon-button/rdp-icon-button.component';
import { RdpModalService } from './services/rdp-modal.service';
+import { RdpInformationModelComponent } from './rdp-information-model/rdp-information-model.component';
@NgModule({
@@ -37,7 +38,8 @@ import { RdpModalService } from './services/rdp-modal.service';
RdpAutocompleteEditorComponent,
RdpScrollContainerComponent,
RdpButtonComponent,
- RdpIconButtonComponent
+ RdpIconButtonComponent,
+ RdpInformationModelComponent
],
imports: [
CommonModule,
@@ -61,7 +63,7 @@ import { RdpModalService } from './services/rdp-modal.service';
RdpButtonComponent,
RdpIconButtonComponent
],
- entryComponents: [RdpDataTableEditComponent],
+ entryComponents: [RdpDataTableEditComponent, RdpInformationModelComponent],
providers: [RdpDataTableService, RdpModalService]
})
export class RdpModule { }