Skip to content

Commit

Permalink
Merge branch 'master-qa' of github.com:sap-labs-france/ev-dashboard i…
Browse files Browse the repository at this point in the history
…nto master-qa
  • Loading branch information
LucasBrazi06 committed Mar 29, 2022
2 parents 34fe94b + ab4e5b5 commit bc3d6a0
Showing 1 changed file with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class SiteAreasListTableDataSource extends TableDataSource<SiteArea> {
canCreate: siteAreas.canCreate
};
// Build TableDef using the initialized auth object
this.setTableDef(this.buildTableDefWithAuth());
this.setTableDef(this.buildTableDef());
this.createAction.visible = this.siteAreasAuthorizations.canCreate;
observer.next(siteAreas);
observer.complete();
Expand All @@ -108,9 +108,21 @@ export class SiteAreasListTableDataSource extends TableDataSource<SiteArea> {
});
}

// TableDef build is handled after retrieving site areas authorizations
// This function will be called twice: once in the normal worklow and second with auth
// TODO: Try to refactor so that we have a seperate tabledef init with authorization
public buildTableDef(): TableDef {
return {};
return {
search: {
enabled: true,
},
rowDetails: {
enabled: true,
showDetailsField: 'issuer',
angularComponent: SiteAreaConsumptionChartDetailComponent,
additionalParameters: this.siteAreasAuthorizations
},
hasDynamicRowAction: true,
};
}

public buildTableColumnDefs(): TableColumnDef[] {
Expand Down Expand Up @@ -364,19 +376,4 @@ export class SiteAreasListTableDataSource extends TableDataSource<SiteArea> {
new SiteTableFilter([issuerFilter]).getFilterDef(),
];
}
// Build tableDef using initialized authorizations retrieved from backend (additionalParameters)
private buildTableDefWithAuth(): TableDef {
return {
search: {
enabled: true,
},
rowDetails: {
enabled: true,
showDetailsField: 'issuer',
angularComponent: SiteAreaConsumptionChartDetailComponent,
additionalParameters: this.siteAreasAuthorizations
},
hasDynamicRowAction: true,
};
}
}

0 comments on commit bc3d6a0

Please sign in to comment.