mail - some fixes and improvements
MODIFY
src/assets/i18n/en.json
src/assets/i18n/en.json
]
},
"end-user-error-notification": {
- "title": "A user reported an error",
+ "title": "A User Reported an Error",
"buttonText": "Navigate to Open E-Mobility",
"text": [
"The user {{name}} reported the following error:",
"title": "Offline Charging Stations",
"buttonText": "Navigate to Open E-Mobility",
"text": [
- "The following number charging stations are offline in your organization: {{chargeBoxIDsNumber}}"
+ "Your organization has {{nbChargingStationIDs}} charging station(s) being offline.",
+ "",
+ "Charging Stations: {{tenFirstChargingStationIDs}}"
]
},
"charging-station-status-error": {

MODIFY
src/notification/email/EMailNotificationTask.ts
src/notification/email/EMailNotificationTask.ts
@@ -154,7 +154,12 @@ export default class EMailNotificationTask implements NotificationTask {
}
public async sendOfflineChargingStations(data: OfflineChargingStationNotification, user: User, tenant: Tenant, severity: NotificationSeverity): Promise<NotificationResult> {
- data.chargeBoxIDsNumber = data.chargeBoxIDs.length;
+ // TODO - old stuff - to be removed asap
+ data.chargeBoxIDs = data.chargingStationIDs.join(", ");
+ // Populate the context to have a human-readable message
+ data.nbChargingStationIDs = data.chargingStationIDs?.length || 0;
+ // Show only the ten first charging stations
+ data.tenFirstChargingStationIDs = data.chargingStationIDs.slice(0, 10).join(", ") + "...";
data.buttonUrl = data.evseDashboardURL;
return await this.prepareAndSendEmail('offline-charging-station', data, user, tenant, severity);
}

MODIFY
src/notification/remote-push-notification/RemotePushNotificationTask.ts
src/notification/remote-push-notification/RemotePushNotificationTask.ts
@@ -116,6 +116,12 @@ export default class RemotePushNotificationTask implements NotificationTask {
public async sendOfflineChargingStations(data: OfflineChargingStationNotification, user: User, tenant: Tenant, severity: NotificationSeverity): Promise<NotificationResult> {
// Set the locale
const i18nManager = I18nManager.getInstanceForLocale(user.locale);
+ // TODO - old stuff - to be removed asap
+ data.chargeBoxIDs = data.chargingStationIDs.join(", ");
+ // Populate the context to have a human-readable message
+ data.nbChargingStationIDs = data.chargingStationIDs?.length || 0;
+ // Show only the ten first charging stations
+ data.tenFirstChargingStationIDs = data.chargingStationIDs.slice(0, 10).join(", ") + "...";
// Get Message Text
const title = i18nManager.translate('notifications.offlineChargingStation.title');
const body = i18nManager.translate('notifications.offlineChargingStation.body',

MODIFY
src/scheduler/tasks/CheckOfflineChargingStationsTask.ts
src/scheduler/tasks/CheckOfflineChargingStationsTask.ts
@@ -67,11 +67,11 @@ export default class CheckOfflineChargingStationsTask extends TenantSchedulerTas
}
// Notify users with the rest of the Charging Stations
if (chargingStations.result.length > 0) {
- const chargingStationIDs = chargingStations.result.map((chargingStation) => chargingStation.id).join(', ');
+ const chargingStationIDs = chargingStations.result.map((chargingStation) => chargingStation.id);
// Send notification
void NotificationHandler.sendOfflineChargingStations(
tenant, {
- chargeBoxIDs: chargingStationIDs,
+ chargingStationIDs,
evseDashboardURL: Utils.buildEvseURL(tenant.subdomain)
}
);

MODIFY
src/types/UserNotifications.ts
src/types/UserNotifications.ts
@@ -279,9 +279,12 @@ export interface PreparingSessionNotStartedNotification extends BaseNotification
}
export interface OfflineChargingStationNotification extends BaseNotification {
- chargeBoxIDs: string;
evseDashboardURL: string;
- chargeBoxIDsNumber?: number;
+ chargingStationIDs: string[];
+ tenFirstChargingStationIDs?: string;
+ nbChargingStationIDs?: number;
+ // TODO - to be removed - old stuff - we cannot send mails with a list showing thousands of offline charging stations
+ chargeBoxIDs?: string;
}
export interface BillingUserSynchronizationFailedNotification extends BaseNotification {

mail - some fixes and improvements