Skip to content

Commit

Permalink
Merge pull request #2342 from sap-labs-france/master-qa
Browse files Browse the repository at this point in the history
Merge master-qa
  • Loading branch information
LucasBrazi06 authored Apr 6, 2021
2 parents f6557e5 + 5b6f4eb commit 0e44a30
Show file tree
Hide file tree
Showing 38 changed files with 102 additions and 91 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ev-dashboard",
"description": "Dashboard for Electric Vehicle charging station",
"homepage": "https://github.com/LucasBrazi06/ev-dashboard",
"version": "2.4.57",
"version": "2.4.58",
"engines": {
"npm": "6.x.x."
},
Expand Down
5 changes: 3 additions & 2 deletions src/app/pages/invoices/list/invoices-table-data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { EndDateFilter } from '../../../shared/table/filters/end-date-filter';
import { StartDateFilter } from '../../../shared/table/filters/start-date-filter';
import { UserTableFilter } from '../../../shared/table/filters/user-table-filter';
import { TableDataSource } from '../../../shared/table/table-data-source';
import { BillingButtonAction, BillingInvoice } from '../../../types/Billing';
import { BillingButtonAction, BillingInvoice, BillingSessionData } from '../../../types/Billing';
import ChangeNotification from '../../../types/ChangeNotification';
import { DataResult } from '../../../types/DataResult';
import { TableActionDef, TableColumnDef, TableDef, TableFilterDef } from '../../../types/Table';
Expand Down Expand Up @@ -142,8 +142,9 @@ export class InvoicesTableDataSource extends TableDataSource<BillingInvoice> {
}
columns.push(
{
id: 'nbrOfItems',
id: 'sessions',
name: 'invoices.number_of_items',
formatter: (sessions: BillingSessionData[], invoice: BillingInvoice) => sessions?.length,
headerClass: 'col-10p text-center',
class: 'col-10p text-center',
sortable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="card-body">
<div class="row app-organization">
<div class="col-md-2">
<div class="rotating-card-container" [ngStyle]="{ 'pointer-events': canCrudCompany ? 'all' : 'none'}">
<div class="rotating-card-container" [ngStyle]="{ 'pointer-events': canUpdateCompany ? 'all' : 'none'}">
<div class="card card-rotate card-background app-company-image mt-0">
<div class="front front-background"
[ngStyle]="{'background-image': 'url(' + logo + ')', 'background-size' : 'contain', 'background-repeat': 'no-repeat'}">
Expand All @@ -18,7 +18,7 @@
</div>
<div class="back back-background"
[ngStyle]="{'background-image': 'url(' + logo + ')', 'background-size' : 'contain', 'background-repeat': 'no-repeat'}">
<div *ngIf="canCrudCompany" class="card-body">
<div *ngIf="canUpdateCompany" class="card-body">
<div class="footer justify-content-center">
<button mat-flat-button color="primary" class="mr-2">
<mat-icon (click)="file.click()">mode_edit</mat-icon>
Expand Down Expand Up @@ -50,16 +50,16 @@
</div>
<div class="row">
<div class="col-md-12">
<app-address [address]="address" [formGroup]="formGroup"
componentName="{{'companies.company' | translate}}" [itemComponentName]="name.value"></app-address>
<app-address [address]="address" [formGroup]="formGroup" componentName="{{'companies.company' | translate}}"
[itemComponentName]="name.value" [onlyReadGeolocation]="!canUpdateCompany"></app-address>
</div>
</div>
<div class="clearfix"></div>
</div>
</mat-tab>
</mat-tab-group>
<div class="tabs-actions">
<button mat-button *ngIf="canCrudCompany" (click)="saveCompany(formGroup.value)"
<button mat-button *ngIf="canUpdateCompany" (click)="saveCompany(formGroup.value)"
[disabled]="!formGroup.valid || !formGroup.dirty">
<mat-icon>save</mat-icon>
<span>{{'general.save' | translate}}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class CompanyComponent implements OnInit {

public parentErrorStateMatcher = new ParentErrorStateMatcher();

public canCrudCompany = false;
public logo = Constants.NO_IMAGE;
public logoHasChanged = false;
public maxSize: number;
Expand All @@ -38,6 +37,7 @@ export class CompanyComponent implements OnInit {
public id!: AbstractControl;
public name!: AbstractControl;
public address!: Address;
public canUpdateCompany = false;

public constructor(
private authorizationService: AuthorizationService,
Expand All @@ -57,8 +57,6 @@ export class CompanyComponent implements OnInit {
// Not authorized
this.router.navigate(['/']);
}
this.canCrudCompany = this.authorizationService.canReadCompany() && this.authorizationService.canCreateCompany() &&
this.authorizationService.canUpdateCompany() && this.authorizationService.canDeleteCompany();
}

public ngOnInit() {
Expand All @@ -73,10 +71,6 @@ export class CompanyComponent implements OnInit {
// Form
this.id = this.formGroup.controls['id'];
this.name = this.formGroup.controls['name'];
// if cannot CRUD, switch to readonly mode
if (!(this.canCrudCompany)) {
this.formGroup.disable();
}
if (this.currentCompanyID) {
this.loadCompany();
} else if (this.activatedRoute && this.activatedRoute.params) {
Expand Down Expand Up @@ -123,6 +117,10 @@ export class CompanyComponent implements OnInit {
this.centralServerService.getCompanyLogo(this.currentCompanyID).subscribe((companyLogo) => {
this.logo = companyLogo ? companyLogo : Constants.NO_IMAGE;
});
this.canUpdateCompany = company.canUpdate;
if (!this.canUpdateCompany) {
this.formGroup.disable();
}
}, (error) => {
this.spinnerService.hide();
switch (error.status) {
Expand Down
8 changes: 4 additions & 4 deletions src/app/pages/organization/sites/site/site.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="tab-pane active" id="profile">
<div class="row app-organization">
<div class="col-md-5">
<div class="rotating-card-container" [ngStyle]="{ 'pointer-events': canCreateSite ? 'all' : 'none'}">
<div class="rotating-card-container" [ngStyle]="{ 'pointer-events': canUpdateSite ? 'all' : 'none'}">
<div class="card card-rotate card-background app-site-image-padding mt-0">
<div class="front front-background"
[ngStyle]="{'background-image': 'url(' + image + ')', 'background-size' : 'contain', 'background-repeat': 'no-repeat'}">
Expand All @@ -20,7 +20,7 @@
</div>
<div class="back back-background"
[ngStyle]="{'background-image': 'url(' + image + ')', 'background-size' : 'contain', 'background-repeat': 'no-repeat'}">
<div *ngIf="canCreateSite" class="card-body">
<div *ngIf="canUpdateSite" class="card-body">
<h5 class="card-title">
{{'general.change_picture' | translate}}
</h5>
Expand Down Expand Up @@ -93,14 +93,14 @@ <h5 class="card-title">
</div>
<div class="tab-pane" id="address">
<app-address [address]="address" [formGroup]="formGroup" componentName="{{'sites.site' | translate}}"
[itemComponentName]="name.value"></app-address>
[itemComponentName]="name.value" [onlyReadGeolocation]="!canUpdateSite"></app-address>
</div>
</div>
</div>
</mat-tab>
</mat-tab-group>
<div class="tabs-actions">
<button mat-button *ngIf="canCreateSite" (click)="saveSite(formGroup.value)"
<button mat-button *ngIf="canUpdateSite" (click)="saveSite(formGroup.value)"
[disabled]="!formGroup.valid || !formGroup.dirty">
<mat-icon>save</mat-icon>
<span>{{'general.save' | translate}}</span>
Expand Down
17 changes: 7 additions & 10 deletions src/app/pages/organization/sites/site/site.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class SiteComponent implements OnInit {
public public!: AbstractControl;

public address!: Address;
public canCreateSite = false;
public canUpdateSite = false;

public constructor(
private authorizationService: AuthorizationService,
Expand All @@ -61,8 +61,6 @@ export class SiteComponent implements OnInit {
// Not authorized
this.router.navigate(['/']);
}
// Set
this.canCreateSite = this.authorizationService.canCreateSite();
}

public ngOnInit() {
Expand Down Expand Up @@ -141,13 +139,6 @@ export class SiteComponent implements OnInit {
if (!this.currentSiteID) {
return;
}
this.canCreateSite = this.authorizationService.canCreateSite() ||
this.authorizationService.isSiteAdmin(this.currentSiteID) ||
this.authorizationService.isSiteOwner(this.currentSiteID);
// if not admin switch in readonly mode
if (!this.canCreateSite) {
this.formGroup.disable();
}
this.spinnerService.show();
this.centralServerService.getSite(this.currentSiteID, false, true).subscribe((site) => {
this.spinnerService.hide();
Expand Down Expand Up @@ -189,6 +180,12 @@ export class SiteComponent implements OnInit {
this.centralServerService.getSiteImage(this.currentSiteID).subscribe((siteImage) => {
this.image = siteImage ? siteImage : Constants.NO_IMAGE;
});
this.canUpdateSite = site.canUpdate ||
this.authorizationService.isSiteAdmin(this.currentSiteID) ||
this.authorizationService.isSiteOwner(this.currentSiteID);
if (!this.canUpdateSite) {
this.formGroup.disable();
}
}, (error) => {
this.spinnerService.hide();
switch (error.status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export class PaymentMethodsTableDataSource extends TableDataSource<BillingPaymen
if (this.currentUserID) {
// Yes: Get data
// eslint-disable-next-line max-len
this.centralServerService.getPaymentMethods(this.currentUserID, this.buildFilterValues(), this.getPaging(), this.getSorting()).subscribe((paymentMethod) => {
observer.next(paymentMethod);
this.centralServerService.getPaymentMethods(this.currentUserID, this.buildFilterValues(), this.getPaging(), this.getSorting()).subscribe((paymentMethods) => {
observer.next(paymentMethods);
observer.complete();
}, (error) => {
// No longer exists!
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/users/user/user.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
<span>{{'general.address' | translate}}</span>
</ng-template>
<div class="card-body tab-dialog-min-content">
<app-address [address]="address" [formGroup]="formGroup" [hideGeoLocation]="true"></app-address>
<app-address [address]="address" [formGroup]="formGroup" [hideGeolocation]="true"></app-address>
</div>
</mat-tab>
<mat-tab>
Expand Down
15 changes: 15 additions & 0 deletions src/app/release-notes/release-notes.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ export class ReleaseNotesComponent {

public buildReleaseNotes() {
this.releaseNotes = [
{
version: '2.4.58',
date: new Date('2021-04-06'),
componentChanges: [
{
name: 'Dashboard',
changes: [
`SAP Concur - Fixed Access token was not refreshed when connection updated date is not defined`,
`OCPI - Improved performances and Fixed reported bugs`,
`Adjusted authorizations in Company and Site pop-ups`,
`Billing: Added number of Transactions in Invoice list`,
],
},
],
},
{
version: '2.4.57',
date: new Date('2021-04-01'),
Expand Down
18 changes: 9 additions & 9 deletions src/app/shared/address/address.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,30 @@
</mat-form-field>
</div>
</div>
<div class="col-md-3" *ngIf="!hideGeoLocation">
<div class="form-group">
<div class="col-md-3" *ngIf="!hideGeolocation">
<div class="form-group" >
<mat-form-field>
<input matInput placeholder="{{'general.latitude' | translate}}" type="text" [formControl]="latitude">
<input matInput placeholder="{{'general.latitude' | translate}}" type="text" [formControl]="latitude" >
<mat-error>{{"general.invalid_value" | translate}}</mat-error>
<button mat-button matSuffix mat-icon-button aria-label="Add" (click)="assignGeoMap()">
<button mat-button matSuffix mat-icon-button aria-label="Add" (click)="assignGeoMap()" [disabled]='onlyReadGeolocation'>
<mat-icon>pin_drop</mat-icon>
</button>
</mat-form-field>
</div>
</div>
<div class="col-md-3" *ngIf="!hideGeoLocation">
<div class="form-group">
<div class="col-md-3" *ngIf="!hideGeolocation">
<div class="form-group" >
<mat-form-field>
<input matInput placeholder="{{'general.longitude' | translate}}" type="text" [formControl]="longitude">
<mat-error>{{"general.invalid_value" | translate}}</mat-error>
<button mat-button matSuffix mat-icon-button aria-label="Add" (click)="assignGeoMap()">
<button mat-button matSuffix mat-icon-button aria-label="Add" (click)="assignGeoMap()" [disabled]='onlyReadGeolocation'>
<mat-icon>pin_drop</mat-icon>
</button>
</mat-form-field>
</div>
</div>
<div class="col-md-1" class="align-self-baseline" *ngIf="!hideGeoLocation">
<button mat-raised-button color="primary" (click)="showPlace()" [disabled]="!coordinates.valid || !latitude.value || !longitude.value">
<div class="col-md-1" class="align-self-baseline" *ngIf="!hideGeolocation">
<button mat-raised-button color="primary" (click)="showPlace()" [disabled]="!onlyReadGeolocation && (!coordinates.valid || !latitude.value || !longitude.value)">
<mat-icon>location_on</mat-icon><span>{{'general.show_place' | translate}}</span>
</button>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/app/shared/address/address.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { GeoMapDialogComponent } from '../dialogs/geomap/geomap-dialog.component
})
export class AddressComponent implements OnInit, OnChanges {
@Input() public formGroup!: FormGroup;
@Input() public hideGeoLocation = false;
@Input() public hideGeolocation = false;
@Input() public onlyReadGeolocation = false;
@Input() public address!: Address;
@Input() public componentName!: string;
@Input() public itemComponentName!: string;
Expand Down
12 changes: 7 additions & 5 deletions src/app/types/Billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ export interface BillingInvoice extends Data {
createdOn?: Date;
invoiceID: string;
userID?: string;
nbrOfItems?: number;
number: string;
status: BillingInvoiceStatus;
amount?: number;
currency: string;
downloadable: boolean;
sessions: BillingSessionData[];
}

export interface BillingSessionData {
transactionID: number;
description: string;
pricingData: any;
}

export enum BillingButtonAction {
Expand Down Expand Up @@ -62,7 +68,3 @@ export interface BillingPaymentMethod {
isDefault: boolean;
}

export interface BillingPaymentMethodResult {
result: BillingPaymentMethod[];
count: number;
}
2 changes: 1 addition & 1 deletion src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"connectors": "Verknüpfungen",
"notifications": "Benachrichtungen",
"app_name": "e-Mobility",
"last_update": "Version 2.4.57",
"last_update": "Version 2.4.58",
"version": "Version",
"about_us": "About Us",
"unexpected_error_backend": "Ein unerwarteter Fehler ist aufgetreten",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"connectors": "Connections",
"notifications": "Notifications",
"app_name": "e-Mobility",
"last_update": "Version 2.4.57",
"last_update": "Version 2.4.58",
"version": "Version",
"about_us": "About Us",
"unexpected_error_backend": "An unexpected error occurred, check the logs",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"connectors": "Conexiones",
"notifications": "Notificaciones",
"app_name": "e-Mobility",
"last_update": "Versión 2.4.57",
"last_update": "Versión 2.4.58",
"version": "Versión",
"about_us": "Sobre nosotros",
"unexpected_error_backend": "Ocurrió un error inesperado",
Expand Down
10 changes: 5 additions & 5 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"connectors": "Connexions",
"notifications": "Notifications",
"app_name": "e-Mobility",
"last_update": "Version 2.4.57",
"last_update": "Version 2.4.58",
"version": "Version",
"about_us": "A Propos",
"unexpected_error_backend": "Une erreur inattendue s'est produite, vérifiez les logs",
Expand Down Expand Up @@ -80,7 +80,7 @@
"synchronize": "Synchroniser",
"force_synchronize": "Forcer la synchronization",
"download": "Télécharger",
"test_connection": "Tester la connection",
"test_connection": "Tester la connexion",
"upload": "Envoyer",
"change": "Changer",
"reload": "Recharger",
Expand Down Expand Up @@ -235,7 +235,7 @@
"clear": "Effacer",
"save": "Save",
"download": "Télécharger",
"test_connection": "Tester la connection",
"test_connection": "Tester la connexion",
"force_available_status": "Forcer le Statut en Disponible",
"force_unavailable_status": "Forcer le Statut en Indisponible"
}
Expand Down Expand Up @@ -1447,7 +1447,7 @@
"synchronize_started": "La synchronization des transactions remboursées a été démarrée",
"synchronize_success": "Les transactions remboursées ont été mises à jour avec succès",
"synchronize_error": "Une erreur est survenue durant la synchronization des transactions remboursées, vérifiez les logs",
"connection_error": "Une erreur est survenue durant la connexion avec le système de remboursement, vérifiez votre connection dans votre profil",
"connection_error": "Une erreur est survenue durant la connexion avec le système de remboursement, vérifiez votre connexion dans votre profil",
"concur": {
"title": "SAP Concur",
"authentication_url": "Url d'Authentification",
Expand Down Expand Up @@ -2312,7 +2312,7 @@
"forbidden_refund_another_user": "Vous ne pouvez pas demander le remboursement de la session d'un autre utilisateur",
"not_authorized": "Vous n'etes pas autorisé à effectuer cette opération",
"error": "L'application E-Mobility n'a pas pu se connecter au systéme de remboursement. Veuillez contacter un administrateur.",
"concur_connection_invalid": "La connection a votre systéme de remboursement n'est pas configurée correctement. Veuillez contacter un administrateur.",
"concur_connection_invalid": "La connexion a votre systéme de remboursement n'est pas configurée correctement. Veuillez contacter un administrateur.",
"tenant_concur_connection_invalid": "La configuration du systéme de remboursement de votre organisation n'est pas complète. Veuillez contacter un administrateur."
}
},
Expand Down
Loading

0 comments on commit 0e44a30

Please sign in to comment.