Skip to content

Commit

Permalink
#9 reduce to a single component
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony-Jhoiro committed Jul 24, 2019
1 parent e1fad61 commit b7685ed
Show file tree
Hide file tree
Showing 37 changed files with 442 additions and 108 deletions.
8 changes: 0 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 46 additions & 3 deletions src/app/core/services/crud/test.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class TestService {
testsList: Array<ITest> = new Array<ITest>();
testcasesList: Array<ITestCaseHeader> = new Array<ITestCaseHeader>();
testcasesListLength: number;
testdatalib: Array<any> = new Array<ITestCaseHeader>();
testdatalibLength: number;
testcase_labels: Array<ILabel> = new Array<ILabel>();
testcase_properties: Array<IProperty>;
testcase: ITestCase = null;
Expand All @@ -35,6 +37,8 @@ export class TestService {
observableTestsList = new BehaviorSubject<ITest[]>(this.testsList);
observableTestCasesList = new BehaviorSubject<ITestCaseHeader[]>(this.testcasesList);
observableTestCasesListLength = new BehaviorSubject<number>(this.testcasesListLength);
observableTestDataLib = new BehaviorSubject<any[]>(this.testcasesList);
observableTestDataLibLength = new BehaviorSubject<number>(this.testcasesListLength);
observableTestCaseLabels = new BehaviorSubject<ILabel[]>(this.testcase_labels);
observableTestCase = new BehaviorSubject<ITestCase>(this.testcase);
observableLabels = new BehaviorSubject<ILabel[]>(this.testcase_labels);
Expand All @@ -44,6 +48,7 @@ export class TestService {
refreshTC: boolean = false;



constructor(
private http: HttpClient,
private TrueindexPipe: TrueindexPipe
Expand Down Expand Up @@ -95,7 +100,7 @@ export class TestService {
}
})
}
getTestCasesFilterList(queryParameters: string) {
getTestCasesFilterList(queryParameters: string, callback) {
this.http.post<ITestCaseHeader>(AppSettings.API_endpoint + '/ReadTestCase', queryParameters, httpOptions)
.subscribe((response) => {
if (response) {
Expand All @@ -105,6 +110,7 @@ export class TestService {

this.observableTestCasesList.next(this.testcasesList);
this.observableTestCasesListLength.next(this.testcasesListLength);

}
else {
this.testcasesList = null;
Expand All @@ -116,8 +122,45 @@ export class TestService {
});
}

getColumnData(columnName: string) {
let query = AppSettings.API_endpoint + '/ReadTestCase?columnName=' + columnName;

getTestDataLibFilterList(queryParameters: string) {
this.http.post<ITestCaseHeader>(AppSettings.API_endpoint + '/ReadTestDataLib', queryParameters, httpOptions)
.subscribe((response) => {
if (response) {
if (response.iTotalRecords > 0) {
this.testdatalib = response.contentTable;
this.testdatalibLength = response.iTotalRecords;

this.observableTestDataLib.next(this.testcasesList);
this.observableTestDataLibLength.next(this.testcasesListLength);
}
else {
this.testcasesList = null;
this.observableTestDataLib.next(this.testcasesList);
}
}
});
}

getFromRequest(servlet: string, queryParameters: string, callback) {
this.http.post<ITestCaseHeader>(AppSettings.API_endpoint + servlet, queryParameters, httpOptions)
.subscribe((response) => {
if (response) {
if (response.iTotalRecords > 0) {
callback(response.contentTable, response.iTotalRecords);
}
else {
this.testcasesList = null;
this.observableTestDataLib.next(this.testcasesList);
}
}
});
}



getColumnData(cervlet: string, columnName: string) {
let query = AppSettings.API_endpoint + cervlet + '?columnName=' + columnName;
console.log(query);

return this.http.get<ITestCaseHeader>(query);
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class SidebarComponent implements OnInit {
expanded: false,
submenu: [{
name: 'Data Library',
link: '/datalibrary'
link: '/design/datalibrary'
},
{
name: 'Services',
Expand Down
7 changes: 7 additions & 0 deletions src/app/feat-design/datalibrary/datalibrary.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<app-datatable-page
[page]="page"
[columns]="columns"
[servlet]="servlet"
[selectedRows]="selectedRows">

</app-datatable-page>
Empty file.
25 changes: 25 additions & 0 deletions src/app/feat-design/datalibrary/datalibrary.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { DatalibraryComponent } from './datalibrary.component';

describe('DatalibraryComponent', () => {
let component: DatalibraryComponent;
let fixture: ComponentFixture<DatalibraryComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatalibraryComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(DatalibraryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
157 changes: 157 additions & 0 deletions src/app/feat-design/datalibrary/datalibrary.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import { Component, OnInit } from '@angular/core';
import { Column } from 'src/app/shared/model/column.model';
import { TestService } from 'src/app/core/services/crud/test.service';
import { InvariantsService } from 'src/app/core/services/crud/invariants.service';
import { LabelfilteringPipe } from 'src/app/shared/pipes/labelfiltering.pipe';
import { SystemService } from 'src/app/core/services/crud/system.service';
import { FilterService } from 'src/app/core/services/crud/filter.service';
import { Filter } from 'src/app/shared/model/filter.model';

@Component({
selector: 'app-datalibrary',
templateUrl: './datalibrary.component.html',
styleUrls: ['./datalibrary.component.scss']
})
export class DatalibraryComponent implements OnInit {

columns: Array<Column> = [
{
displayName: "ID",
contentName: '',
active: true
,sSearch : []},
{
displayName: "Name",
contentName: '',
active: true
,sSearch : []},
{
displayName: "System",
contentName: '',
active: true
,sSearch : []},
{
displayName: "Environment",
contentName: '',
active: true
,sSearch : []},
{
displayName: "Country",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Group",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Description",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Type",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Value",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Database",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Script",
contentName: '',
active: false,
width: 300
,sSearch : []},
{
displayName: "Database",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Service Path",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Operation",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Envelope",
contentName: '',
active: false
,sSearch : []},
{
displayName: "C SV URL",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Separator",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Creation Date",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Creator",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Modification Date",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Last Modifier",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Column",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Parsing Answer",
contentName: '',
active: false
,sSearch : []},
{
displayName: "Column Position",
contentName: '',
active: false
,sSearch : []}
];
page = {
size: 10, //maximum element per page
number: 1, //number of current page
sort: [{dir: "asc", prop : "id"}], //sort item
totalCount: 0 //total count of element in database
};
rows = [];
selectedRows = [];
filterList: Array<Filter> = [];
globalSearch = ''; // value in global search field
filterTest: any; //
servlet = '/ReadTestDataLib';

constructor(private testService: TestService, private invariantsService: InvariantsService, private labelfilteringPipe: LabelfilteringPipe, private systemService: SystemService, private filterService: FilterService) { }

ngOnInit() { }

}
5 changes: 5 additions & 0 deletions src/app/feat-design/design-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { TestcaselistComponent } from "./testcaselist/testcaselist.component";
import { TestcasescriptComponent} from "./testcasescript/testcasescript.component";
import { DatalibraryComponent } from './datalibrary/datalibrary.component';

const designRoutes: Routes = [
{
Expand All @@ -11,6 +12,10 @@ const designRoutes: Routes = [
{
path: 'testcasescript',
component: TestcasescriptComponent
},
{
path: 'datalibrary',
component: DatalibraryComponent
}
];

Expand Down
8 changes: 2 additions & 6 deletions src/app/feat-design/design.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DesignRoutingModule } from './design-routing.module';
import { TestcaselistComponent } from "./testcaselist/testcaselist.component";
import { FilterComponent } from "./testcaselist/filters/filter/filter.component";
import { FiltersComponent } from "./testcaselist/filters/filters.component";
import { FilterPipeModule } from "ngx-filter-pipe";
import { SharedModule } from "../shared/shared.module";
import { LabelsComponent } from "./labels/labels.component";
Expand All @@ -18,16 +16,14 @@ import { PropertyComponent } from "./testcasescript/tc-script/property/property.
import { PropertyvalueComponent } from "./testcasescript/tc-script/property/propertyvalue/propertyvalue.component";
import { DragDropModule } from "@angular/cdk/drag-drop";
import { SettingsComponent } from "./testcasescript/tc-script/settings/settings.component";
import { FilterlikeComponent } from './testcaselist/filters/filterlike/filterlike.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { DatalibraryComponent } from './datalibrary/datalibrary.component';



@NgModule({
declarations: [
TestcaselistComponent,
FilterComponent,
FiltersComponent,
LabelsComponent,
TestcasescriptComponent,
TcSelectorComponent,
Expand All @@ -39,7 +35,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
PropertyComponent,
PropertyvalueComponent,
SettingsComponent,
FilterlikeComponent,
DatalibraryComponent,

],
imports: [
Expand Down
16 changes: 10 additions & 6 deletions src/app/feat-design/testcaselist/testcaselist.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<app-filters
(test)="updateTest($event)"
<!-- <app-filters
(searchServe)="search()"
(searchTerm)="updateSearch($event)"
(systemApply)="appplySystemChange($event)"
(preferenceSave)="save()"
(preferenceLoad)="load()"
[page]="page"
[columns]="columns"
[selectedRows]=selectedRows>
Expand All @@ -18,4 +14,12 @@
[selected]="selectedRows"
(addFilterMenu)="addFilterMenu($event)"
(pageUpdate)="pageUpdate($event)">
</app-table>
</app-table> -->

<app-datatable-page
[page]="page"
[columns]="columns"
[servlet]="servlet"
[selectedRows]="selectedRows">

</app-datatable-page>
Loading

0 comments on commit b7685ed

Please sign in to comment.