Skip to content

Commit

Permalink
Merge pull request #2329 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 Mar 29, 2021
2 parents 1db5f1e + 11a6c1a commit 2f9c7fc
Show file tree
Hide file tree
Showing 126 changed files with 977 additions and 960 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ speed-measure-plugin*.json

# IDE - VSCode
.vscode/*
!.vscode/settings-template.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
26 changes: 13 additions & 13 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions 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.55",
"version": "2.4.56",
"engines": {
"npm": "6.x.x."
},
Expand Down Expand Up @@ -133,16 +133,16 @@
"@types/jquery": "^3.5.5",
"@types/mocha": "^8.2.2",
"@types/moment-duration-format": "^2.2.2",
"@types/node": "^14.14.36",
"@types/node": "^14.14.37",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"codeceptjs": "^3.0.5",
"cross-env": "^7.0.3",
"eslint": "^7.22.0",
"eslint": "^7.23.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "^32.3.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"faker": "^5.5.0",
"faker": "^5.5.1",
"husky": "^4.3.8",
"import-sort-parser-typescript": "^6.0.0",
"import-sort-style-module": "^6.0.0",
Expand Down
12 changes: 6 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export class AppComponent {
public constructor(
private iconRegistry: MatIconRegistry,
private sanitizer: DomSanitizer) {
for (const connectorMap of CONNECTOR_TYPE_MAP) {
if (connectorMap.svgIconName) {
iconRegistry.addSvgIcon(
connectorMap.svgIconName,
sanitizer.bypassSecurityTrustResourceUrl(connectorMap.svgIconFile));
}
for (const connectorMap of CONNECTOR_TYPE_MAP) {
if (connectorMap.svgIconName) {
iconRegistry.addSvgIcon(
connectorMap.svgIconName,
sanitizer.bypassSecurityTrustResourceUrl(connectorMap.svgIconFile));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class AuthenticationDefinePasswordComponent implements OnInit, OnDestroy
Validators.required,
])),
},
(passwordFormGroup: FormGroup) => Utils.validateEqual(passwordFormGroup, 'password', 'repeatPassword')),
(passwordFormGroup: FormGroup) => Utils.validateEqual(passwordFormGroup, 'password', 'repeatPassword')),
});
// Form
this.passwords = (this.formGroup.controls['passwords'] as FormGroup);
Expand Down
24 changes: 12 additions & 12 deletions src/app/pages/assets/asset/asset.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ export class AssetComponent implements OnInit {
public asset!: Asset;

public constructor(
private authorizationService: AuthorizationService,
private centralServerService: CentralServerService,
private componentService: ComponentService,
private messageService: MessageService,
private spinnerService: SpinnerService,
private configService: ConfigService,
private activatedRoute: ActivatedRoute,
private dialog: MatDialog,
private dialogService: DialogService,
private translateService: TranslateService,
private router: Router
) {
private authorizationService: AuthorizationService,
private centralServerService: CentralServerService,
private componentService: ComponentService,
private messageService: MessageService,
private spinnerService: SpinnerService,
private configService: ConfigService,
private activatedRoute: ActivatedRoute,
private dialog: MatDialog,
private dialogService: DialogService,
private translateService: TranslateService,
private router: Router
) {
this.maxSize = this.configService.getAsset().maxImageKb;
// Check auth
if (this.activatedRoute.snapshot.params['id'] &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class AssetConsumptionChartDetailComponent extends CellContentTemplateDir
public assetType!: AssetType;

public ngOnInit(): void {
this.assetID = this.row.id as string;
this.assetType = this.row.assetType;
this.assetID = this.row.id as string;
this.assetType = this.row.assetType;
}

public ngOnChanges(changes: SimpleChanges): void {
Expand Down
28 changes: 14 additions & 14 deletions src/app/pages/cars/car-catalog/carousel/car-carousel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ export class CarCarouselComponent implements AfterViewInit {
this.spinnerService.show();
this.centralServerService.getCarCatalogImages(this.carCatalogID, {},
{ limit: 2, skip: Constants.DEFAULT_SKIP }).subscribe((carImage) => {
this.spinnerService.hide();
if (carImage.count > 0) {
this.images = Array(carImage.count).fill(null);
// Load the two first images
this.images[0] = carImage.result[0].image;
if (carImage.count > 1) {
this.images[1] = carImage.result[1].image;
}
} else {
this.noImages = true;
this.spinnerService.hide();
if (carImage.count > 0) {
this.images = Array(carImage.count).fill(null);
// Load the two first images
this.images[0] = carImage.result[0].image;
if (carImage.count > 1) {
this.images[1] = carImage.result[1].image;
}
}, (error) => {
this.spinnerService.hide();
Utils.handleHttpError(error, this.router, this.messageService, this.centralServerService, 'general.car_image_error');
});
} else {
this.noImages = true;
}
}, (error) => {
this.spinnerService.hide();
Utils.handleHttpError(error, this.router, this.messageService, this.centralServerService, 'general.car_image_error');
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export class CarCatalogsListComponent {
// eslint-disable-next-line no-useless-constructor
public constructor(
public carCatalogsListTableDataSource: CarCatalogsListTableDataSource,
) {}
) {}
}
52 changes: 26 additions & 26 deletions src/app/pages/cars/car/car-users-editable-table-data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,33 +100,33 @@ export class CarUsersEditableTableDataSource extends EditableTableDataSource<Use
this.centralServerService.getCarUsers(
{ ...this.buildFilterValues(), carID: this.carID },
paging, this.getSorting()).subscribe((usersCar) => {
// Initial Assignment
if (!this.serverCalled) {
// Keep original list for comparison
this.carUsers = Utils.cloneObject(usersCar.result) as UserCar[];
// Set rows manually
this.editableRows = usersCar.result;
this.serverCalled = true;
}
// Check Paging
if (paging.skip !== 0) {
// Add new paginated rows
this.carUsers.splice(paging.skip, paging.limit, ...Utils.cloneObject(usersCar.result) as UserCar[]);
this.editableRows.splice(paging.skip, paging.limit, ...usersCar.result);
}
// Create the form controls
this.createFormControls();
observer.next({
count: usersCar.count + this.getAddedCarUsers().length - this.getRemovedCarUsers().length,
result: paging.skip !== 0 ? usersCar.result : this.editableRows,
});
observer.complete();
}, (error) => {
// No longer exists!
Utils.handleHttpError(error, this.router, this.messageService, this.centralServerService, 'general.error_backend');
// Error
observer.error(error);
// Initial Assignment
if (!this.serverCalled) {
// Keep original list for comparison
this.carUsers = Utils.cloneObject(usersCar.result) as UserCar[];
// Set rows manually
this.editableRows = usersCar.result;
this.serverCalled = true;
}
// Check Paging
if (paging.skip !== 0) {
// Add new paginated rows
this.carUsers.splice(paging.skip, paging.limit, ...Utils.cloneObject(usersCar.result) as UserCar[]);
this.editableRows.splice(paging.skip, paging.limit, ...usersCar.result);
}
// Create the form controls
this.createFormControls();
observer.next({
count: usersCar.count + this.getAddedCarUsers().length - this.getRemovedCarUsers().length,
result: paging.skip !== 0 ? usersCar.result : this.editableRows,
});
observer.complete();
}, (error) => {
// No longer exists!
Utils.handleHttpError(error, this.router, this.messageService, this.centralServerService, 'general.error_backend');
// Error
observer.error(error);
});
} else {
// Recreate the form controls
this.createFormControls();
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/cars/car/car.dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export class CarDialogComponent implements AfterViewInit {
public carID!: string;

public constructor(
public dialogRef: MatDialogRef<CarDialogComponent>,
@Inject(MAT_DIALOG_DATA) data: string) {
public dialogRef: MatDialogRef<CarDialogComponent>,
@Inject(MAT_DIALOG_DATA) data: string) {
this.carID = data;
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/cars/cars/cars-list-table-data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ export class CarsListTableDataSource extends TableDataSource<Car> {
headerClass: 'text-center col-10p',
class: 'text-center col-10p',
formatter: (defaultCar: boolean, car: Car) => car.carUsers.find((userCar) => userCar.default) ?
this.translateService.instant('general.yes') : this.translateService.instant('general.no'),
this.translateService.instant('general.yes') : this.translateService.instant('general.no'),
},
{
id: 'owner',
name: 'cars.car_owner',
headerClass: 'text-center col-10p',
class: 'text-center col-10p',
formatter: (carOwner: boolean, car: Car) => car.carUsers.find((userCar) => userCar.owner) ?
this.translateService.instant('general.yes') : this.translateService.instant('general.no')
this.translateService.instant('general.yes') : this.translateService.instant('general.no')
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ export class ChargingPlansListTableDataSource extends TableDataSource<ChargingPr
}

public initFilters() {
// Charging Station
const chargingStationID = this.windowService.getSearch('ChargingStationID');
if (chargingStationID) {
const chargingStationTableFilter = this.tableFiltersDef.find(filter => filter.id === 'charger');
if (chargingStationTableFilter) {
chargingStationTableFilter.currentValue = [{ key: chargingStationID, value: chargingStationID }];
this.filterChanged(chargingStationTableFilter);
}
}
const transactionID = this.windowService.getSearch('TransactionID');
if (transactionID) {
this.setSearchValue(transactionID);
}
// Charging Station
const chargingStationID = this.windowService.getSearch('ChargingStationID');
if (chargingStationID) {
const chargingStationTableFilter = this.tableFiltersDef.find(filter => filter.id === 'charger');
if (chargingStationTableFilter) {
chargingStationTableFilter.currentValue = [{ key: chargingStationID, value: chargingStationID }];
this.filterChanged(chargingStationTableFilter);
}
}
const transactionID = this.windowService.getSearch('TransactionID');
if (transactionID) {
this.setSearchValue(transactionID);
}
}

public getDataChangeSubject(): Observable<ChangeNotification> {
Expand Down Expand Up @@ -180,9 +180,9 @@ export class ChargingPlansListTableDataSource extends TableDataSource<ChargingPr
);
}
break;
case ChargingStationButtonAction.NAVIGATE_TO_SITE_AREA:
this.navigateToSiteAreaAction.action('organization#site-areas?SiteAreaID=' + chargingProfile.chargingStation.siteArea.id);
break;
case ChargingStationButtonAction.NAVIGATE_TO_SITE_AREA:
this.navigateToSiteAreaAction.action('organization#site-areas?SiteAreaID=' + chargingProfile.chargingStation.siteArea.id);
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ export class ChargingPlansComponent implements OnInit, AfterViewInit, OnChanges
// Update Charging Station?
this.centralServerNotificationService.getSubjectChargingProfile().pipe(debounceTime(
this.configService.getAdvanced().debounceTimeNotifMillis)).subscribe((singleChangeNotification) => {
if (this.chargingProfiles && singleChangeNotification && singleChangeNotification.data) {
const chargingProfile = this.chargingProfiles.find(
(cp) => cp.id === singleChangeNotification.data.id);
if (this.chargingProfiles && singleChangeNotification && singleChangeNotification.data) {
const chargingProfile = this.chargingProfiles.find(
(cp) => cp.id === singleChangeNotification.data.id);
// Reload?
if (chargingProfile) {
this.refresh();
}
if (chargingProfile) {
this.refresh();
}
});
}
});
}
}

Expand Down
Loading

0 comments on commit 2f9c7fc

Please sign in to comment.