Update editnewdash.component.ts
This commit is contained in:
parent
ffda17e6b1
commit
482805b5cf
@ -28,6 +28,8 @@ import { CommonFilterComponent } from '../common-filter/common-filter.component'
|
||||
import { CompactFilterComponent } from '../common-filter';
|
||||
// Add the FilterService import
|
||||
import { FilterService } from '../common-filter/filter.service';
|
||||
// Add the UnifiedChartComponent import
|
||||
import { UnifiedChartComponent } from '../gadgets/unified-chart';
|
||||
|
||||
function isNullArray(arr) {
|
||||
return !Array.isArray(arr) || arr.length === 0;
|
||||
@ -112,6 +114,10 @@ export class EditnewdashComponent implements OnInit {
|
||||
{
|
||||
name: 'Compact Filter',
|
||||
identifier: 'compact_filter'
|
||||
},
|
||||
{
|
||||
name: 'Unified Chart',
|
||||
identifier: 'unified_chart'
|
||||
}
|
||||
]
|
||||
|
||||
@ -137,7 +143,8 @@ export class EditnewdashComponent implements OnInit {
|
||||
{ name: "Financial Chart", componentInstance: FinancialChartComponent },
|
||||
{ name: "To Do Chart", componentInstance: ToDoChartComponent },
|
||||
{ name: "Grid View", componentInstance: GridViewComponent },
|
||||
{ name: "Compact Filter", componentInstance: CompactFilterComponent }, // Add this line
|
||||
{ name: "Compact Filter", componentInstance: CompactFilterComponent },
|
||||
{ name: "Unified Chart", componentInstance: UnifiedChartComponent },
|
||||
];
|
||||
model: any;
|
||||
linesdata: any;
|
||||
@ -170,6 +177,7 @@ export class EditnewdashComponent implements OnInit {
|
||||
yAxis: '',
|
||||
xAxis: '',
|
||||
connection: '', // Add connection field
|
||||
chartType: '', // Add chartType field
|
||||
// Drilldown configuration properties (base level)
|
||||
drilldownEnabled: false,
|
||||
drilldownApiUrl: '',
|
||||
@ -610,6 +618,22 @@ export class EditnewdashComponent implements OnInit {
|
||||
component: GridViewComponent,
|
||||
name: "Grid View"
|
||||
});
|
||||
case "unified_chart":
|
||||
return this.dashboardArray.push({
|
||||
cols: 5,
|
||||
rows: 6,
|
||||
x: 0,
|
||||
y: 0,
|
||||
chartid: maxChartId + 1,
|
||||
component: UnifiedChartComponent,
|
||||
name: "Unified Chart",
|
||||
// Add default configuration for unified chart
|
||||
chartType: 'bar',
|
||||
xAxis: '',
|
||||
yAxis: '',
|
||||
table: '',
|
||||
connection: undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
removeItem(item) {
|
||||
@ -662,6 +686,10 @@ export class EditnewdashComponent implements OnInit {
|
||||
if (item['filterOptions'] === undefined) {
|
||||
this.gadgetsEditdata['filterOptions'] = [];
|
||||
}
|
||||
// Initialize chartType property if not present (for unified chart)
|
||||
if (item['chartType'] === undefined) {
|
||||
this.gadgetsEditdata['chartType'] = 'bar';
|
||||
}
|
||||
|
||||
// Initialize filterOptionsString for compact filter
|
||||
if (item.name === 'Compact Filter') {
|
||||
@ -930,6 +958,11 @@ export class EditnewdashComponent implements OnInit {
|
||||
xyz.connection = this.gadgetsEditdata.connection || undefined;
|
||||
}
|
||||
|
||||
// For unified chart, preserve chart configuration properties
|
||||
if (item.name === 'Unified Chart') {
|
||||
xyz.chartType = this.gadgetsEditdata.chartType || 'bar';
|
||||
}
|
||||
|
||||
console.log(xyz);
|
||||
return xyz;
|
||||
}
|
||||
@ -1013,6 +1046,48 @@ export class EditnewdashComponent implements OnInit {
|
||||
return commonFilterInputs;
|
||||
}
|
||||
|
||||
// For UnifiedChartComponent, pass chart properties with chartType
|
||||
if (item.name === 'Unified Chart') {
|
||||
const unifiedChartInputs = {
|
||||
chartType: item.chartType || 'bar',
|
||||
xAxis: item.xAxis,
|
||||
yAxis: item.yAxis,
|
||||
table: item.table,
|
||||
datastore: item.datastore,
|
||||
charttitle: item.charttitle,
|
||||
chartlegend: item.chartlegend,
|
||||
showlabel: item.showlabel,
|
||||
chartcolor: item.chartcolor,
|
||||
slices: item.slices,
|
||||
donut: item.donut,
|
||||
charturl: item.charturl,
|
||||
chartparameter: item.chartparameter,
|
||||
datasource: item.datasource,
|
||||
fieldName: item.name, // Using item.name as fieldName
|
||||
connection: item['connection'], // Add connection field using bracket notation
|
||||
// Base drilldown configuration properties
|
||||
drilldownEnabled: item['drilldownEnabled'],
|
||||
drilldownApiUrl: item['drilldownApiUrl'],
|
||||
// Removed drilldownParameterKey since we're using URL templates
|
||||
drilldownXAxis: item['drilldownXAxis'],
|
||||
drilldownYAxis: item['drilldownYAxis'],
|
||||
drilldownParameter: item['drilldownParameter'], // Add drilldown parameter
|
||||
baseFilters: item['baseFilters'] || [], // Add base filters
|
||||
drilldownFilters: item['drilldownFilters'] || [], // Add drilldown filters
|
||||
// Multi-layer drilldown configurations
|
||||
drilldownLayers: item['drilldownLayers'] || []
|
||||
};
|
||||
|
||||
// Remove undefined properties to avoid passing unnecessary data
|
||||
Object.keys(unifiedChartInputs).forEach(key => {
|
||||
if (unifiedChartInputs[key] === undefined) {
|
||||
delete unifiedChartInputs[key];
|
||||
}
|
||||
});
|
||||
|
||||
return unifiedChartInputs;
|
||||
}
|
||||
|
||||
// For GridViewComponent, pass chart properties with drilldown support
|
||||
if (item.component && item.component.name === 'GridViewComponent') {
|
||||
const gridInputs = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user