dynamic field
This commit is contained in:
@@ -609,23 +609,12 @@ export class ChartConfigManagerComponent implements OnInit {
|
|||||||
|
|
||||||
this.dynamicFieldLoadingState = ClrLoadingState.LOADING;
|
this.dynamicFieldLoadingState = ClrLoadingState.LOADING;
|
||||||
|
|
||||||
// Create a complete chartType object with only the ID
|
// Remove the chartType from the dynamic field data since we're passing it as a parameter
|
||||||
const chartTypeWithId = {
|
const dynamicFieldData = { ...this.newDynamicField };
|
||||||
id: this.selectedChartType.id,
|
// Remove chartType property if it exists
|
||||||
name: '',
|
delete (dynamicFieldData as any).chartType;
|
||||||
displayName: '',
|
|
||||||
description: '',
|
|
||||||
isActive: true,
|
|
||||||
createdAt: '',
|
|
||||||
updatedAt: ''
|
|
||||||
};
|
|
||||||
|
|
||||||
const dynamicFieldData = {
|
this.dynamicFieldService.createDynamicField(dynamicFieldData, this.selectedChartType.id).subscribe({
|
||||||
...this.newDynamicField,
|
|
||||||
chartType: chartTypeWithId
|
|
||||||
};
|
|
||||||
|
|
||||||
this.dynamicFieldService.createDynamicField(dynamicFieldData).subscribe({
|
|
||||||
next: (data) => {
|
next: (data) => {
|
||||||
this.dynamicFields.push(data);
|
this.dynamicFields.push(data);
|
||||||
this.newDynamicField = {};
|
this.newDynamicField = {};
|
||||||
|
|||||||
@@ -23,9 +23,13 @@ export class DynamicFieldService {
|
|||||||
return this.apiRequest.get(url);
|
return this.apiRequest.get(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new dynamic field
|
// Create new dynamic field with optional chart type ID as parameter
|
||||||
createDynamicField(dynamicField: Partial<DynamicField>): Observable<DynamicField> {
|
createDynamicField(dynamicField: Partial<DynamicField>, chartTypeId?: number): Observable<DynamicField> {
|
||||||
return this.apiRequest.post(this.dynamicFieldsUrl, dynamicField);
|
let url = this.dynamicFieldsUrl;
|
||||||
|
if (chartTypeId) {
|
||||||
|
url = `${this.dynamicFieldsUrl}?chartTypeId=${chartTypeId}`;
|
||||||
|
}
|
||||||
|
return this.apiRequest.post(url, dynamicField);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update dynamic field
|
// Update dynamic field
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export class ChartTypeFieldsComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.loadingState = ClrLoadingState.LOADING;
|
this.loadingState = ClrLoadingState.LOADING;
|
||||||
this.dynamicFieldService.createDynamicField(fieldData).subscribe({
|
this.dynamicFieldService.createDynamicField(fieldData, this.chartType.id).subscribe({
|
||||||
next: (data) => {
|
next: (data) => {
|
||||||
this.dynamicFields.push(data);
|
this.dynamicFields.push(data);
|
||||||
this.newDynamicField = { isRequired: false, showInUi: true };
|
this.newDynamicField = { isRequired: false, showInUi: true };
|
||||||
|
|||||||
Reference in New Issue
Block a user