diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/common-filter/compact-filter.component.html b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/common-filter/compact-filter.component.html
index 58c36df..26c2383 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/common-filter/compact-filter.component.html
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/common-filter/compact-filter.component.html
@@ -78,17 +78,13 @@
-
-
+
+
diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/common-filter/compact-filter.component.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/common-filter/compact-filter.component.ts
index cb32e8d..7424e96 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/common-filter/compact-filter.component.ts
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/common-filter/compact-filter.component.ts
@@ -201,29 +201,6 @@ export class CompactFilterComponent implements OnInit, OnChanges {
this.onFilterValueChange(dateRange);
}
- // Handle multiselect checkbox changes
- onMultiselectChange(option: string, event: any): void {
- const isChecked = event.target.checked;
-
- // Ensure filterValue is an array
- if (!Array.isArray(this.filterValue)) {
- this.filterValue = [];
- }
-
- if (isChecked) {
- // Add option to selected values if not already present
- if (!this.filterValue.includes(option)) {
- this.filterValue = [...this.filterValue, option];
- }
- } else {
- // Remove option from selected values
- this.filterValue = this.filterValue.filter((val: string) => val !== option);
- }
-
- // Emit the change
- this.onFilterValueChange(this.filterValue);
- }
-
// Load available keys from API
loadAvailableKeys(): void {
if (this.apiUrl) {
diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/bar-runner/bar-runner.component.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/bar-runner/bar-runner.component.ts
index 2781144..19ae8fb 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/bar-runner/bar-runner.component.ts
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/bar-runner/bar-runner.component.ts
@@ -3,6 +3,10 @@ import { DashrunnerService } from '../dashrunner.service';
import { ActivatedRoute, Router } from '@angular/router';
import { Dashboard3Service } from 'src/app/services/builder/dashboard3.service';
import { DashboardContentModel } from 'src/app/models/builder/dashboard';
+// Add FilterService import
+import { FilterService } from '../../../dashboardnew/common-filter/filter.service';
+// Add Subscription import
+import { Subscription } from 'rxjs';
@Component({
selector: 'app-bar-runner',
@@ -24,8 +28,18 @@ export class BarRunnerComponent implements OnInit {
JsonData;
barData;
- constructor(private Dashtestservive:DashrunnerService,private route: ActivatedRoute,private dashboardService: Dashboard3Service,
- private router : Router,) { }
+
+ // Add subscriptions to unsubscribe on destroy
+ private subscriptions: Subscription[] = [];
+
+ constructor(
+ private Dashtestservive:DashrunnerService,
+ private route: ActivatedRoute,
+ private dashboardService: Dashboard3Service,
+ private router : Router,
+ // Add FilterService to constructor
+ private filterService: FilterService
+ ) { }
barChartLabels: any[] = [];
barChartType: string = 'bar';
@@ -47,6 +61,13 @@ export class BarRunnerComponent implements OnInit {
this.editId = this.route.snapshot.params.id;
console.log(this.editId);
+ // Subscribe to filter changes
+ this.subscriptions.push(
+ this.filterService.filterState$.subscribe(filters => {
+ // When filters change, refresh the chart data
+ this.fetchChartData();
+ })
+ );
this.dashboardService.getById(this.editId).subscribe((data)=>{
console.log(data);
@@ -75,21 +96,60 @@ export class BarRunnerComponent implements OnInit {
this.showlabel = ChartObject[i].showlabel;
this.barChartLegend = ChartObject[i].chartlegend;
console.log(this.TableName);
- this.Dashtestservive.getChartData(this.TableName,"Bar Chart",this.XAxis,this.YAxis).subscribe((Ldata) => {
- console.log(Ldata);
- this.JsonData = Ldata;
- this.barChartData = this.JsonData.barChartData;
- this.barChartLabels = this.JsonData.barChartLabels;
-
- },(error) => {
- console.log(error);
- });
+ // Fetch data with filters
+ this.fetchChartData();
break; // No need to continue the loop once the correct placeholder is found
}
}
});
}
+ // Fetch chart data with filter support
+ fetchChartData(): void {
+ if (this.TableName && this.XAxis && this.YAxis) {
+ // Convert YAxis to string if it's an array
+ const yAxisString = Array.isArray(this.YAxis) ? this.YAxis.join(',') : this.YAxis;
+
+ // Get filter parameters from common filters
+ const commonFilters = this.filterService.getFilterValues();
+ const filterDefinitions = this.filterService.getFilters();
+
+ // Build filter object using field names as keys
+ const filterObj = {};
+ Object.keys(commonFilters).forEach(filterId => {
+ const filterValue = commonFilters[filterId];
+
+ // Find the filter definition to get the field name
+ const filterDef = this.filterService.getFilters().find(f => f.id === filterId);
+
+ if (filterDef && filterDef.field) {
+ const fieldName = filterDef.field;
+ if (filterValue !== undefined && filterValue !== null && filterValue !== '') {
+ filterObj[fieldName] = filterValue;
+ }
+ }
+ });
+
+ // Convert to JSON string for API call
+ let filterParams = '';
+ if (Object.keys(filterObj).length > 0) {
+ filterParams = JSON.stringify(filterObj);
+ }
+
+ console.log('BarRunner: Final filter object to send to API:', filterObj);
+
+ // Fetch data from the dashboard service with filters
+ this.Dashtestservive.getChartDataWithFilters(this.TableName, "Bar Chart", this.XAxis, this.YAxis, undefined, '', '', filterParams).subscribe((Ldata) => {
+ console.log(Ldata);
+ this.JsonData = Ldata;
+ this.barChartData = this.JsonData.barChartData;
+ this.barChartLabels = this.JsonData.barChartLabels;
+ },(error) => {
+ console.log(error);
+ });
+ }
+ }
+
generatePDFFile(){
this.buttonClicked.emit();
const content = this.contentContainerRef.nativeElement;
@@ -97,5 +157,17 @@ export class BarRunnerComponent implements OnInit {
this.Dashtestservive.generatePDF(content, filename);
}
-
-}
+
+ ngOnDestroy() {
+ // Unsubscribe from all subscriptions to prevent memory leaks
+ console.log('BarRunnerComponent ngOnDestroy called, unsubscribing from', this.subscriptions.length, 'subscriptions');
+ this.subscriptions.forEach(subscription => {
+ if (subscription && !subscription.closed) {
+ subscription.unsubscribe();
+ }
+ });
+ this.subscriptions = [];
+
+ console.log('BarRunnerComponent destroyed and cleaned up');
+ }
+}
\ No newline at end of file
diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/bubble-runner/bubble-runner.component.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/bubble-runner/bubble-runner.component.ts
index 5bb9632..1ff9551 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/bubble-runner/bubble-runner.component.ts
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/bubble-runner/bubble-runner.component.ts
@@ -5,6 +5,10 @@ import { ChartConfiguration, ChartDataset, ChartOptions } from 'chart.js';
import { DashboardContentModel } from 'src/app/models/builder/dashboard';
import { DashrunnerService } from '../dashrunner.service';
import { Dashboard3Service } from 'src/app/services/builder/dashboard3.service';
+// Add FilterService import
+import { FilterService } from '../../../dashboardnew/common-filter/filter.service';
+// Add Subscription import
+import { Subscription } from 'rxjs';
@Component({
selector: 'app-bubble-runner',
@@ -26,8 +30,13 @@ export class BubbleRunnerComponent implements OnInit {
lineChartNoLabels: [] = [];
ChartLegend = false;
+ // Add subscriptions to unsubscribe on destroy
+ private subscriptions: Subscription[] = [];
+
constructor(private Dashtestservive:DashrunnerService,private route: ActivatedRoute,private dashboardService: Dashboard3Service,
- private router : Router,) { }
+ private router : Router,
+ // Add FilterService to constructor
+ private filterService: FilterService) { }
public bubbleChartOptions: ChartConfiguration['options'] = {
// scales: {
@@ -87,6 +96,13 @@ export class BubbleRunnerComponent implements OnInit {
this.editId = this.route.snapshot.params.id;
console.log(this.editId);
+ // Subscribe to filter changes
+ this.subscriptions.push(
+ this.filterService.filterState$.subscribe(filters => {
+ // When filters change, refresh the chart data
+ this.fetchChartData();
+ })
+ );
this.dashboardService.getById(this.editId).subscribe((data)=>{
console.log(data);
@@ -113,21 +129,60 @@ export class BubbleRunnerComponent implements OnInit {
this.showlabel = ChartObject[i].showlabel;
this.ChartLegend = ChartObject[i].chartlegend;
console.log(this.TableName);
- this.Dashtestservive.getChartData(this.TableName,"Bubble Chart",this.XAxis,this.YAxis).subscribe((Ldata) => {
- console.log(Ldata);
- this.JsonData = Ldata;
- this.bubbleChartData = this.JsonData.bubbleChartData;
- // this.radarChartLabels = this.JsonData.radarChartLabels;
-
- },(error) => {
- console.log(error);
- });
+ // Fetch data with filters
+ this.fetchChartData();
break; // No need to continue the loop once the correct placeholder is found
}
}
});
}
-
+
+ // Fetch chart data with filter support
+ fetchChartData(): void {
+ if (this.TableName && this.XAxis && this.YAxis) {
+ // Convert YAxis to string if it's an array
+ const yAxisString = Array.isArray(this.YAxis) ? this.YAxis.join(',') : this.YAxis;
+
+ // Get filter parameters from common filters
+ const commonFilters = this.filterService.getFilterValues();
+ const filterDefinitions = this.filterService.getFilters();
+
+ // Build filter object using field names as keys
+ const filterObj = {};
+ Object.keys(commonFilters).forEach(filterId => {
+ const filterValue = commonFilters[filterId];
+
+ // Find the filter definition to get the field name
+ const filterDef = this.filterService.getFilters().find(f => f.id === filterId);
+
+ if (filterDef && filterDef.field) {
+ const fieldName = filterDef.field;
+ if (filterValue !== undefined && filterValue !== null && filterValue !== '') {
+ filterObj[fieldName] = filterValue;
+ }
+ }
+ });
+
+ // Convert to JSON string for API call
+ let filterParams = '';
+ if (Object.keys(filterObj).length > 0) {
+ filterParams = JSON.stringify(filterObj);
+ }
+
+ console.log('BubbleRunner: Final filter object to send to API:', filterObj);
+
+ // Fetch data from the dashboard service with filters
+ this.Dashtestservive.getChartDataWithFilters(this.TableName, "Bubble Chart", this.XAxis, this.YAxis, undefined, '', '', filterParams).subscribe((Ldata) => {
+ console.log(Ldata);
+ this.JsonData = Ldata;
+ this.bubbleChartData = this.JsonData.bubbleChartData;
+ // this.radarChartLabels = this.JsonData.radarChartLabels;
+ },(error) => {
+ console.log(error);
+ });
+ }
+ }
+
generatePDFFile(){
this.buttonClicked.emit();
const content = this.contentContainerRef.nativeElement;
@@ -135,6 +190,19 @@ export class BubbleRunnerComponent implements OnInit {
this.Dashtestservive.generatePDF(content, filename);
}
+
+ ngOnDestroy() {
+ // Unsubscribe from all subscriptions to prevent memory leaks
+ console.log('BubbleRunnerComponent ngOnDestroy called, unsubscribing from', this.subscriptions.length, 'subscriptions');
+ this.subscriptions.forEach(subscription => {
+ if (subscription && !subscription.closed) {
+ subscription.unsubscribe();
+ }
+ });
+ this.subscriptions = [];
+
+ console.log('BubbleRunnerComponent destroyed and cleaned up');
+ }
}
diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/dashrunner.service.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/dashrunner.service.ts
index 5c814f6..cf8bb21 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/dashrunner.service.ts
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/dashrunner.service.ts
@@ -160,7 +160,27 @@ getlinechart(): any[] {
return this._http.get(url);
}
-
+ // New method to support filters
+ public getChartDataWithFilters(tableName: string, jobType: string, xAxis:any, yAxes:any, sureId: number | undefined, parameterField: string, parameterValue: string, filterParams: string): Observable
{
+ let url = `${baseUrl}/chart/getdashjson/${jobType}?tableName=${tableName}&xAxis=${xAxis}&yAxes=${yAxes}`;
+
+ // Add sureId if provided
+ if (sureId) {
+ url += `&sureId=${sureId}`;
+ }
+
+ // Add parameter field and value if provided
+ if (parameterField && parameterValue) {
+ url += `¶meter=${encodeURIComponent(parameterField)}¶meterValue=${encodeURIComponent(parameterValue)}`;
+ }
+
+ // Add filter parameters if provided
+ if (filterParams) {
+ url += `&filters=${encodeURIComponent(filterParams)}`;
+ }
+
+ return this._http.get(url);
+ }
//////////////////////////////////////////////
diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/dashrunnerline.component.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/dashrunnerline.component.ts
index 61f9a3c..39a7329 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/dashrunnerline.component.ts
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/dashrunnerline.component.ts
@@ -17,6 +17,8 @@ import { BubbleRunnerComponent } from './bubble-runner/bubble-runner.component';
import { ScatterRunnerComponent } from './scatter-runner/scatter-runner.component';
import { PolarRunnerComponent } from './polar-runner/polar-runner.component';
import { RadarRunnerComponent } from './radar-runner/radar-runner.component';
+// Add FilterService import
+import { FilterService } from '../../dashboardnew/common-filter/filter.service';
@Component({
selector: 'app-dashrunnerline',
@@ -47,7 +49,9 @@ export class DashrunnerlineComponent implements OnInit {
];
constructor(private Dashtestservive:DashrunnerService, private dashboardService: Dashboard3Service,private route: ActivatedRoute,
- private router : Router,) { }
+ private router : Router,
+ // Add FilterService to constructor
+ private filterService: FilterService) { }
ngOnInit(): void {
diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/doughnut-runner/doughnut-runner.component.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/doughnut-runner/doughnut-runner.component.ts
index f92400c..c47dcb6 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/doughnut-runner/doughnut-runner.component.ts
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/doughnut-runner/doughnut-runner.component.ts
@@ -5,6 +5,10 @@ import { ChartDataset, ChartType, } from 'chart.js';
import { ActivatedRoute, Router } from '@angular/router';
import { Dashboard3Service } from 'src/app/services/builder/dashboard3.service';
import { DashboardContentModel } from 'src/app/models/builder/dashboard';
+// Add FilterService import
+import { FilterService } from '../../../dashboardnew/common-filter/filter.service';
+// Add Subscription import
+import { Subscription } from 'rxjs';
@Component({
selector: 'app-doughnut-runner',
@@ -34,9 +38,14 @@ export class DoughnutRunnerComponent implements OnInit {
}
doughnutChartType: ChartType = 'doughnut';
+ // Add subscriptions to unsubscribe on destroy
+ private subscriptions: Subscription[] = [];
+
constructor(private Dashtestservive:DashrunnerService,private route: ActivatedRoute,private dashboardService: Dashboard3Service,
- private router : Router,) { }
+ private router : Router,
+ // Add FilterService to constructor
+ private filterService: FilterService) { }
ngOnInit(): void {
this.doughnutChartData = this.doughnutData.chartData;
this.doughnutChartLabels = this.doughnutData.chartLabels;
@@ -44,6 +53,14 @@ export class DoughnutRunnerComponent implements OnInit {
this.editId = this.route.snapshot.params.id;
console.log(this.editId);
+ // Subscribe to filter changes
+ this.subscriptions.push(
+ this.filterService.filterState$.subscribe(filters => {
+ // When filters change, refresh the chart data
+ this.fetchChartData();
+ })
+ );
+
this.dashboardService.getById(this.editId).subscribe((data)=>{
console.log(data);
this.workflowLine = data.dashbord1_Line[0].model;
@@ -71,21 +88,60 @@ export class DoughnutRunnerComponent implements OnInit {
this.showlabel = ChartObject[i].showlabel;
this.doughnutChartLegend = ChartObject[i].chartlegend;
console.log(this.TableName);
- this.Dashtestservive.getChartData(this.TableName,"Doughnut Chart",this.XAxis,this.YAxis).subscribe((Ldata) => {
- console.log(Ldata);
- this.JsonData = Ldata;
- this.doughnutChartData = this.JsonData.chartData;
- this.doughnutChartLabels = this.JsonData.chartLabels;
-
- },(error) => {
- console.log(error);
- });
+ // Fetch data with filters
+ this.fetchChartData();
break; // No need to continue the loop once the correct placeholder is found
}
}
});
}
-
+
+ // Fetch chart data with filter support
+ fetchChartData(): void {
+ if (this.TableName && this.XAxis && this.YAxis) {
+ // Convert YAxis to string if it's an array
+ const yAxisString = Array.isArray(this.YAxis) ? this.YAxis.join(',') : this.YAxis;
+
+ // Get filter parameters from common filters
+ const commonFilters = this.filterService.getFilterValues();
+ const filterDefinitions = this.filterService.getFilters();
+
+ // Build filter object using field names as keys
+ const filterObj = {};
+ Object.keys(commonFilters).forEach(filterId => {
+ const filterValue = commonFilters[filterId];
+
+ // Find the filter definition to get the field name
+ const filterDef = this.filterService.getFilters().find(f => f.id === filterId);
+
+ if (filterDef && filterDef.field) {
+ const fieldName = filterDef.field;
+ if (filterValue !== undefined && filterValue !== null && filterValue !== '') {
+ filterObj[fieldName] = filterValue;
+ }
+ }
+ });
+
+ // Convert to JSON string for API call
+ let filterParams = '';
+ if (Object.keys(filterObj).length > 0) {
+ filterParams = JSON.stringify(filterObj);
+ }
+
+ console.log('DoughnutRunner: Final filter object to send to API:', filterObj);
+
+ // Fetch data from the dashboard service with filters
+ this.Dashtestservive.getChartDataWithFilters(this.TableName, "Doughnut Chart", this.XAxis, this.YAxis, undefined, '', '', filterParams).subscribe((Ldata) => {
+ console.log(Ldata);
+ this.JsonData = Ldata;
+ this.doughnutChartData = this.JsonData.chartData;
+ this.doughnutChartLabels = this.JsonData.chartLabels;
+ },(error) => {
+ console.log(error);
+ });
+ }
+ }
+
generatePDFFile(){
// this.buttonClicked.emit();
const content = this.contentContainerRef.nativeElement;
@@ -93,6 +149,19 @@ export class DoughnutRunnerComponent implements OnInit {
this.Dashtestservive.generatePDF(content, filename);
}
+
+ ngOnDestroy() {
+ // Unsubscribe from all subscriptions to prevent memory leaks
+ console.log('DoughnutRunnerComponent ngOnDestroy called, unsubscribing from', this.subscriptions.length, 'subscriptions');
+ this.subscriptions.forEach(subscription => {
+ if (subscription && !subscription.closed) {
+ subscription.unsubscribe();
+ }
+ });
+ this.subscriptions = [];
+
+ console.log('DoughnutRunnerComponent destroyed and cleaned up');
+ }
diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/grid-runner/grid-runner.component.html b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/grid-runner/grid-runner.component.html
index 4761acc..9b55a47 100644
--- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/grid-runner/grid-runner.component.html
+++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardrunner/dashrunnerline/grid-runner/grid-runner.component.html
@@ -39,16 +39,35 @@
-->