Commit 3fcd82a0 authored by sai.sandeep's avatar sai.sandeep

records table to serverside table

parent 944593f8
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
<em class="cursor-pointer fa fa-arrow-left pr-2 clickable" (click)="showFileTable = true; showRecordsTable = false;"></em> {{selectedFileData.file_name}} <em class="cursor-pointer fa fa-arrow-left pr-2 clickable" (click)="showFileTable = true; showRecordsTable = false;"></em> {{selectedFileData.file_name}}
</h6> </h6>
<div class="col-md-12"> <div class="col-md-12">
<app-simple-table-with-pagination *ngIf="tableListData?.tableData?.headerContent?.length" [tableDataWithActions]="tableListData" (actionEmitter)="recordsTableEmitter($event);" [tableReloadEvent]="recordsTableReloadSubject.asObservable()"> <!-- <app-simple-table-with-pagination *ngIf="tableListData?.tableData?.headerContent?.length" [tableDataWithActions]="tableListData" (actionEmitter)="recordsTableEmitter($event);" [tableReloadEvent]="recordsTableReloadSubject.asObservable()">
</app-simple-table-with-pagination> </app-simple-table-with-pagination> -->
<!-- <app-table-server-side [settings]="tableSettings" [data]="tableData" (action)="performAction($event)" [tableReloadEvent]="tableReloadSubject.asObservable()" *ngIf="tableData?.headerContent?.length > 0"> <app-table-server-side [settings]="tableSettings" [data]="tableData" (action)="performAction($event)" [tableReloadEvent]="recordsTableReloadSubject.asObservable()" *ngIf="tableData?.headerContent?.length > 0">
</app-table-server-side> --> </app-table-server-side>
</div> </div>
<div class="col-md-12 mt-4"> <div class="col-md-12 mt-4">
<button class="btn btn-primary float-end m-2" (click)="submitAllRecords()">Submit</button> <button class="btn btn-primary float-end m-2" (click)="submitAllRecords()">Submit</button>
......
...@@ -167,11 +167,7 @@ export class LandingComponent implements OnInit { ...@@ -167,11 +167,7 @@ export class LandingComponent implements OnInit {
icon: 'fa-trash', icon: 'fa-trash',
}, },
], ],
columnOptions: { columnOptions: {},
dataset_name: {
customColumnClass: 'medium-width',
},
},
enableActions: true, enableActions: true,
itemsPerPage: { itemsPerPage: {
top: false, top: false,
...@@ -323,19 +319,19 @@ export class LandingComponent implements OnInit { ...@@ -323,19 +319,19 @@ export class LandingComponent implements OnInit {
this.tableListData.tableData.bodyContent = []; this.tableListData.tableData.bodyContent = [];
this.http.API_REQUEST(request).subscribe((response) => { this.http.API_REQUEST(request).subscribe((response) => {
if (response.status === 'SUCCESS' && response.data) { if (response.status === 'SUCCESS' && response.data) {
setTimeout(() => { // setTimeout(() => {
this.tableListData.tableData.headerContent = response.data.header_content || []; // this.tableListData.tableData.headerContent = response.data.header_content || [];
this.tableListData.tableData.bodyContent = response.data.body_content || []; // this.tableListData.tableData.bodyContent = response.data.body_content || [];
}, 100); // }, 100);
// const tableData = { const tableData = {
// headerContent: response.data.header_content, headerContent: response.data.header_content,
// bodyContent: response.data.body_content, bodyContent: response.data.body_content,
// records_filtered: 0, records_filtered: 0,
// records_total: 0 records_total: 0
// } }
// this.tableData = tableData; this.tableData = tableData;
// this.tableData.records_filtered = response.data.total_records; this.tableData.records_filtered = response.data.total_records;
// this.tableData.records_total = response.data.total_records; this.tableData.records_total = response.data.total_records;
} else { } else {
this._toast.toast('warning', 'Warning', response.message || 'Error while Loading data.', true); this._toast.toast('warning', 'Warning', response.message || 'Error while Loading data.', true);
} }
...@@ -345,6 +341,37 @@ export class LandingComponent implements OnInit { ...@@ -345,6 +341,37 @@ export class LandingComponent implements OnInit {
} }
} }
/** /**
* @param val action performed on the table to add, edit, etc..
*/
performAction(val) {
try {
if (!val || !val.action) { return; }
this.selectedRecordData = val.data;
val = JSON.parse(JSON.stringify(val));
switch (val.action) {
case 'fetchData':
const postJson = this.selectedFileData;
postJson['data_table_parameters'] = val.dataTableParameters;
this.saveTableFilterData = postJson;
this.loadRecordsTableData(this.saveTableFilterData);
break;
case 'cellEdit':
this.getAnnotationsData(val.data);
break;
case 'view':
this.getAnnotationsData(val.data);
break;
case 'delete':
this.deleteRow(val.data);
break;
case 'addNew':
break;
}
} catch (error) {
console.log(error);
}
}
/**
* Method to handle Table grid actions. * Method to handle Table grid actions.
*/ */
recordsTableEmitter(event) { recordsTableEmitter(event) {
...@@ -362,7 +389,8 @@ export class LandingComponent implements OnInit { ...@@ -362,7 +389,8 @@ export class LandingComponent implements OnInit {
this.getAnnotationsData(event.data); this.getAnnotationsData(event.data);
break; break;
case 'delete': case 'delete':
this.deleteRow(event.data) this.deleteRow(event.data);
break;
} }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
...@@ -391,7 +419,7 @@ export class LandingComponent implements OnInit { ...@@ -391,7 +419,7 @@ export class LandingComponent implements OnInit {
request.loader = false; request.loader = false;
} }
this.http.API_REQUEST(request).subscribe((response) => { this.http.API_REQUEST(request).subscribe((response) => {
if (response.status === 'SUCCESS' && response.data) { if (response.status === 'SUCCESS') {
this._toast.toast('success', 'Success', response.message || 'Deleted Successfully', true); this._toast.toast('success', 'Success', response.message || 'Deleted Successfully', true);
this.recordsTableReloadSubject.next(true); this.recordsTableReloadSubject.next(true);
} else { } else {
...@@ -459,7 +487,7 @@ export class LandingComponent implements OnInit { ...@@ -459,7 +487,7 @@ export class LandingComponent implements OnInit {
hideErrorMessage: false hideErrorMessage: false
}; };
this.http.API_REQUEST(request).subscribe((response) => { this.http.API_REQUEST(request).subscribe((response) => {
if (response.status === 'SUCCESS' && response.data) { if (response.status === 'SUCCESS') {
this._toast.toast('success', 'Success', response.message || 'Saved Successfully', true); this._toast.toast('success', 'Success', response.message || 'Saved Successfully', true);
this.recordsTableReloadSubject.next(true); this.recordsTableReloadSubject.next(true);
this.closePopup(); this.closePopup();
...@@ -517,41 +545,4 @@ export class LandingComponent implements OnInit { ...@@ -517,41 +545,4 @@ export class LandingComponent implements OnInit {
console.log(error); console.log(error);
} }
} }
/**
* @param val action performed on the table to add, edit, etc..
*/
performAction(val) {
try {
if (!val || !val.action) { return; }
this.rowData = val.data;
val = JSON.parse(JSON.stringify(val));
switch (val.action) {
case 'fetchData':
const range: any = [];
const postJson = {
// filterSelected: val.filterSelected,
data_table_parameters: val.dataTableParameters
};
this.saveTableFilterData = postJson;
// this.loadTableData(this.saveTableFilterData, true);
break;
case 'delete':
// this.deleteRow(val.data)
break;
case 'cellEdit':
this.modalService.open(this.editPopup, this.modalOptions);
break;
case 'view':
this.modalService.open(this.editPopup, this.modalOptions);
break;
case 'addNew':
console.log('hi');
break;
}
} catch (error) {
console.log(error);
}
}
} }
...@@ -19,33 +19,10 @@ ...@@ -19,33 +19,10 @@
} }
}, },
{ {
"key": "use_case", "key": "status",
"label": "Use Case", "label": "Status",
"place_holder": "Search By Use Case", "innerHtml": true,
"column_search": { "place_holder": "Search By Data type",
"type": "text"
}
},
{
"key": "arch_type",
"label": "Arch Type",
"place_holder": "Search By Arch Type",
"column_search": {
"type": "text"
}
},
{
"key": "data_category",
"label": "Data Category",
"place_holder": "Search By Data Category",
"column_search": {
"type": "text"
}
},
{
"key": "data_subcategory",
"label": "Data subcategory",
"place_holder": "Search By Data subcategory",
"column_search": { "column_search": {
"type": "text" "type": "text"
} }
...@@ -54,176 +31,14 @@ ...@@ -54,176 +31,14 @@
"body_content": [{ "body_content": [{
"table_name": "Table1", "table_name": "Table1",
"data_type": "Type1", "data_type": "Type1",
"use_case": "", "status": "<span class=\"text-success\" > <i class=\"fa fa-check-circle-o\"></i>&nbsp;Completed </span>"
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, },
{ {
"table_name": "Table1", "table_name": "Table1",
"data_type": "Type2",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table1",
"data_type": "Type3",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table2",
"data_type": "Type1", "data_type": "Type1",
"use_case": "", "status": "<span class=\"text-grey\" > <i class=\"fa fa-check-circle-o\"></i>&nbsp;Pending </span>"
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table2",
"data_type": "Type2",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table3",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table1",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
},
{
"table_name": "Table1",
"data_type": "Type2",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table1",
"data_type": "Type3",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table2",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table2",
"data_type": "Type2",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table3",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table1",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
},
{
"table_name": "Table1",
"data_type": "Type2",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table1",
"data_type": "Type3",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table2",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table2",
"data_type": "Type2",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table3",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table1",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
},
{
"table_name": "Table1",
"data_type": "Type2",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table1",
"data_type": "Type3",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table2",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table2",
"data_type": "Type2",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
}, {
"table_name": "Table3",
"data_type": "Type1",
"use_case": "",
"arch_type": "",
"data_category": "",
"data_subcategory": ""
} }
] ],
"total_records": "100"
} }
} }
\ No newline at end of file
...@@ -1587,3 +1587,7 @@ button.toast-close-button { ...@@ -1587,3 +1587,7 @@ button.toast-close-button {
display: block !important; display: block !important;
} }
} }
.text-grey {
color: grey !important;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment