Skip to content

Commit

Permalink
fix valueListSource on filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Alloza committed Apr 23, 2024
1 parent 1d34ffa commit 67a17b8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
37 changes: 21 additions & 16 deletions eda/eda_api/lib/services/query-builder/query-builder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,30 @@ export abstract class QueryBuilderService {
} else {
valueListJoins = [];

for (const field of this.queryTODO.fields) {
if(field.valueListSource) {
field.valueListSource.source_column = field.column_name;
field.valueListSource.source_table = field.table_id;
if( field.valueListSource.bridge_table?.length > 0){
console.log(field.valueListSource);
const j = {
source_column: field.valueListSource.source_bridge ,
source_table: field.valueListSource.source_table ,
target_id_column: field.valueListSource.target_bridge,
target_table: field.valueListSource.bridge_table
const processFields = (fields) => {
for (const field of fields) {
if (field.valueListSource) {
field.valueListSource.source_column = field.column_name;
field.valueListSource.source_table = field.table_id;
if (field.valueListSource.bridge_table?.length > 0) {
const j = {
source_column: field.valueListSource.source_bridge,
source_table: field.valueListSource.source_table,
target_id_column: field.valueListSource.target_bridge,
target_table: field.valueListSource.bridge_table
};
valueListJoins.push(j);
field.valueListSource.source_column = field.valueListSource.target_bridge;
field.valueListSource.source_table = field.valueListSource.bridge_table;
}
valueListJoins.push(j);
field.valueListSource.source_column = field.valueListSource.target_bridge;
field.valueListSource.source_table = field.valueListSource.bridge_table;
valueListJoins.push(field.valueListSource);
}
valueListJoins.push(field.valueListSource);
}
}
};

processFields(this.queryTODO.fields);
processFields(this.queryTODO.filters);

for (const value of valueListJoins) {
const multiSourceJoin = `${value.source_table}.${value.source_column}`;
const multiTargetJoin = `${value.target_table}.${value.target_id_column}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
</eda-date-picker>
</div>
<div *ngSwitchDefault>
<p-multiSelect
<!-- {{ filter | json }} -->
<p-multiSelect *ngIf="filter.data"
[options]="filter.data"
[(ngModel)]="filter.selectedItems"
[maxSelectedLabels]="3"
Expand All @@ -62,14 +63,6 @@
(click)="onShowGlobalFilter(false, filter)"
class="p-button-rounded p-button-outlined filters-size">
</button>

<!-- <button id="dashFilterConf"
pButton pRipple type="button"
icon="pi pi-cog"
(click)="onShowGlobalFilter(false, filter)"
class="p-button-rounded p-button-outlined filters-size">
</button> -->

</p-footer>
</p-multiSelect>
</div>
Expand Down

0 comments on commit 67a17b8

Please sign in to comment.