diff --git a/src/frontend/app/administration/notification/notification-administration.component.html b/src/frontend/app/administration/notification/notification-administration.component.html index dc18f3c53be6804e6a718ff635b4cf91318170f7..29b6ca3304115dde06b1882cca720afa6b59a79c 100755 --- a/src/frontend/app/administration/notification/notification-administration.component.html +++ b/src/frontend/app/administration/notification/notification-administration.component.html @@ -2,7 +2,7 @@ <ng-template #adminMenuTemplate> <mat-nav-list> <h3 mat-subheader *ngIf="!creationMode">{{lang.actions}}</h3> - <a mat-list-item (click)="createScript()" *ngIf="!creationMode && !loading && !notification.scriptcreated"> + <a mat-list-item (click)="createScript()" *ngIf="!creationMode && !loading && !notification.scriptcreated" joyrideStep="createScriptTour" (next)="createScript()"> <mat-icon color="primary" mat-list-icon class="fa fa-terminal"></mat-icon> <p mat-line> {{lang.createScriptNotification}} diff --git a/src/frontend/app/administration/notification/notifications-administration.component.html b/src/frontend/app/administration/notification/notifications-administration.component.html index d59bfb7d9806680ea5d40cf345175931f9aabda4..07aea70801fe64551d6fcdb29d169870f5d22565 100755 --- a/src/frontend/app/administration/notification/notifications-administration.component.html +++ b/src/frontend/app/administration/notification/notifications-administration.component.html @@ -8,7 +8,7 @@ {{lang.add}} </p> </a> - <a mat-list-item (click)="loadCron();snav2.toggle();" (next)="loadCron();snav2.toggle()" joyrideStep="notifTour" [text]="'Cliquez ici pour plannifier une tâche éxistante. Plannifions <b>Notification de bannettes</b>'"> + <a mat-list-item (click)="loadCron();snav2.toggle();" (next)="snav2.open();paramCron();" joyrideStep="notifTour"> <mat-icon color="primary" mat-list-icon class="fa fa-clock"></mat-icon> <p mat-line> {{lang.toSchedule}} @@ -84,7 +84,7 @@ <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-row *matRowDef="let row; columns: displayedColumns;" routerLink="/administration/notifications/{{row.notification_sid}}" style="cursor:pointer;" - matTooltip="{{lang.view}}"></mat-row> + matTooltip="{{lang.view}}" [joyrideStep]="row.notification_id + '_Tour'"></mat-row> </mat-table> <div class="mat-paginator" style="min-height:48px;min-height: 48px;display: flex;justify-content: end;align-items: center;padding-right: 20px;"> @@ -94,7 +94,7 @@ </div> </mat-sidenav-content> <mat-sidenav #snav2 [mode]="appService.getViewMode() ? 'over' : 'side'" [fixedInViewport]="appService.getViewMode()" - fixedTopGap="56" position='end' [opened]="appService.getViewMode() ? false : false" (next)="paramCron()" stepPosition="center" joyrideStep="notifTour2"> + fixedTopGap="56" position='end' [opened]="appService.getViewMode() ? false : false" (next)="paramCron()"> <mat-list (next)="saveCron()" joyrideStep="notifTour3"> <h3 mat-subheader>{{lang.notificationSchedule}}</h3> <form class="form-horizontal" #notifForm="ngForm" style="overflow:hidden;"> diff --git a/src/frontend/app/administration/notification/notifications-administration.component.ts b/src/frontend/app/administration/notification/notifications-administration.component.ts index 48333b916d2e3ae6202b06eb41e317237f9beca9..793b8c06d9395d1baf19da0f988f813627924a87 100755 --- a/src/frontend/app/administration/notification/notifications-administration.component.ts +++ b/src/frontend/app/administration/notification/notifications-administration.component.ts @@ -9,6 +9,10 @@ import { NotificationService } from '../../../service/notification/notification. import { HeaderService } from '../../../service/header.service'; import { AppService } from '../../../service/app.service'; import { FunctionsService } from '../../../service/functions.service'; +import { tap } from 'rxjs/internal/operators/tap'; +import { catchError } from 'rxjs/internal/operators/catchError'; +import { of } from 'rxjs/internal/observable/of'; +import { finalize } from 'rxjs/operators'; @Component({ templateUrl: 'notifications-administration.component.html' @@ -110,68 +114,71 @@ export class NotificationsAdministrationComponent implements OnInit { } loadCron() { - - this.hours = [{ label: this.lang.eachHour, value: '*' }]; - this.minutes = [{ label: this.lang.eachMinute, value: '*' }]; - - this.months = [ - { label: this.lang.eachMonth, value: '*' }, - { label: this.lang.january, value: '1' }, - { label: this.lang.february, value: '2' }, - { label: this.lang.march, value: '3' }, - { label: this.lang.april, value: '4' }, - { label: this.lang.may, value: '5' }, - { label: this.lang.june, value: '6' }, - { label: this.lang.july, value: '7' }, - { label: this.lang.august, value: '8' }, - { label: this.lang.september, value: '9' }, - { label: this.lang.october, value: '10' }, - { label: this.lang.november, value: '11' }, - { label: this.lang.december, value: '12' } - ]; - - this.dom = [{ label: this.lang.notUsed, value: '*' }]; - - this.dow = [ - { label: this.lang.eachDay, value: '*' }, - { label: this.lang.monday, value: '1' }, - { label: this.lang.tuesday, value: '2' }, - { label: this.lang.wednesday, value: '3' }, - { label: this.lang.thursday, value: '4' }, - { label: this.lang.friday, value: '5' }, - { label: this.lang.saturday, value: '6' }, - { label: this.lang.sunday, value: '7' } - ]; - - this.newCron = { - 'm': '', - 'h': '', - 'dom': '', - 'mon': '', - 'cmd': '', - 'state': 'normal' - }; - - for (let it = 0; it <= 23; it++) { - this.hours.push({ label: it, value: String(it) }); - } - - for (let it = 0; it <= 59; it++) { - this.minutes.push({ label: it, value: String(it) }); - } - - for (let it = 1; it <= 31; it++) { - this.dom.push({ label: it, value: String(it) }); - } - - this.http.get('../rest/notifications/schedule') - .subscribe((data: any) => { - this.crontab = data.crontab; - this.authorizedNotification = data.authorizedNotification; - }, (err) => { - this.notify.error(err.error.errors); - }); - + return new Promise((resolve) => { + this.hours = [{ label: this.lang.eachHour, value: '*' }]; + this.minutes = [{ label: this.lang.eachMinute, value: '*' }]; + + this.months = [ + { label: this.lang.eachMonth, value: '*' }, + { label: this.lang.january, value: '1' }, + { label: this.lang.february, value: '2' }, + { label: this.lang.march, value: '3' }, + { label: this.lang.april, value: '4' }, + { label: this.lang.may, value: '5' }, + { label: this.lang.june, value: '6' }, + { label: this.lang.july, value: '7' }, + { label: this.lang.august, value: '8' }, + { label: this.lang.september, value: '9' }, + { label: this.lang.october, value: '10' }, + { label: this.lang.november, value: '11' }, + { label: this.lang.december, value: '12' } + ]; + + this.dom = [{ label: this.lang.notUsed, value: '*' }]; + + this.dow = [ + { label: this.lang.eachDay, value: '*' }, + { label: this.lang.monday, value: '1' }, + { label: this.lang.tuesday, value: '2' }, + { label: this.lang.wednesday, value: '3' }, + { label: this.lang.thursday, value: '4' }, + { label: this.lang.friday, value: '5' }, + { label: this.lang.saturday, value: '6' }, + { label: this.lang.sunday, value: '7' } + ]; + + this.newCron = { + 'm': '', + 'h': '', + 'dom': '', + 'mon': '', + 'cmd': '', + 'state': 'normal' + }; + + for (let it = 0; it <= 23; it++) { + this.hours.push({ label: it, value: String(it) }); + } + + for (let it = 0; it <= 59; it++) { + this.minutes.push({ label: it, value: String(it) }); + } + + for (let it = 1; it <= 31; it++) { + this.dom.push({ label: it, value: String(it) }); + } + this.http.get('../rest/notifications/schedule').pipe( + tap((data: any) => { + this.crontab = data.crontab; + this.authorizedNotification = data.authorizedNotification; + }), + finalize(() => resolve(true)), + catchError((err: any) => { + this.notify.handleSoftErrors(err); + return of(false); + }) + ).subscribe(); + }); } saveCron() { @@ -215,7 +222,8 @@ export class NotificationsAdministrationComponent implements OnInit { return false; } - paramCron() { + async paramCron() { + await this.loadCron(); const notifBasket = this.authorizedNotification.filter((notif: any) => notif.path.indexOf('_BASKETS.sh') > -1)[0]; this.newCron = { 'm': '0', diff --git a/src/frontend/app/home/home.component.html b/src/frontend/app/home/home.component.html index e7e72a734a0d824a523a74b917b41fb6773a8c7b..49b76380a1c8b5fe95ec6e526cba27a6492a6a04 100644 --- a/src/frontend/app/home/home.component.html +++ b/src/frontend/app/home/home.component.html @@ -1,4 +1,4 @@ -<mat-sidenav-container autosize class="maarch-container"> +<mat-sidenav-container autosize class="maarch-container" joyrideStep="welcome" stepPosition="center"> <mat-sidenav-content> <mat-card id="viewThumbnail" style="display:none;position: fixed;z-index: 2;margin-left: 1px;"><img style="max-height: 100vh;" [src]="thumbnailUrl | secureUrl | async" /> diff --git a/src/frontend/app/home/home.component.ts b/src/frontend/app/home/home.component.ts index 960c5c4e02198cbe9d8806e189a037641e42bade..d1db0b1984d339e841e224b127e5f510d6927e45 100644 --- a/src/frontend/app/home/home.component.ts +++ b/src/frontend/app/home/home.component.ts @@ -12,6 +12,7 @@ import { Router } from '@angular/router'; import { tap } from 'rxjs/internal/operators/tap'; import { catchError } from 'rxjs/internal/operators/catchError'; import { of } from 'rxjs/internal/observable/of'; +import { FeatureTourService } from '../../service/featureTour.service'; declare var $: any; @@ -45,7 +46,8 @@ export class HomeComponent implements OnInit, AfterViewInit { private notify: NotificationService, private headerService: HeaderService, public appService: AppService, - private router: Router + private router: Router, + private featureTourService: FeatureTourService ) { (<any>window).pdfWorkerSrc = '../node_modules/pdfjs-dist/build/pdf.worker.min.js'; } @@ -70,6 +72,9 @@ export class HomeComponent implements OnInit, AfterViewInit { } ngAfterViewInit(): void { + if (this.headerService.user.userId === 'superadmin') { + this.featureTourService.init(); + } this.http.get('../rest/home/lastRessources') .subscribe((data: any) => { setTimeout(() => { diff --git a/src/frontend/assets/admin_button.png b/src/frontend/assets/admin_button.png new file mode 100644 index 0000000000000000000000000000000000000000..d33f14c642e4b93efb0e87459ec94e6a40aa2f76 Binary files /dev/null and b/src/frontend/assets/admin_button.png differ diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index 2b9e602319d013e976027c74751cd44acdc769ec..b8363cce200a0c9415d2838bfbea44a67befcf97 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -1855,5 +1855,9 @@ export const LANG_EN = { "notifTour3Title": "Task period", "notifTour3Description": "You can choose different periods to configure your task.", "notifTour4Title": "To do-list", - "notifTour4Description": "The list of your active tasks appears here." + "notifTour4Description": "The list of your active tasks appears here.", + "welcomeTourTitle": "welcome", + "welcomeTourDescription": "We will show you some configuration points : <ul><li>Configure a <b color=\"primary\">mail server</b></li><li>Configure your first <b color=\"primary\">notification</b></li></ul><br/>To begin, click on <img style=\"width: 32px;\" src=\"assets/admin_button.png\" />", + "createScriptTourTitle": "Create the script", + "createScriptTourDescription": "Before scheduling the task, we need to create the script." }; \ No newline at end of file diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index 187a0b18fef0533f6b870e49d3b582f1a6355448..59a710b97dc7fe01db9328278b6374477f5292eb 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1833,8 +1833,8 @@ export const LANG_FR = { "collaboraOnlineEditDenied2": "ne peut pas être édité avec Collabora Online", "documentEditor_collaboraonline": "Ouvre la suite Collabora Online directement dans l'application Maarch Courrier", "canUpdateResourcesInSignatureBook": "Pouvoir modifier les documents intégrés au parapheur", - "admin_email_serverTour": "Vous devez paramétrer un serveur de mail afin de pouvoir créer des utilisateurs ou d'activer les notifications.", - "admin_notifTour": "Nous vous conseillons de paramétrer les notifications de bannettes", + "admin_email_serverTour": "Vous devez paramétrer un serveur de mail afin de pouvoir <b color=\"primary\">créer des utilisateurs</b> ou d'<b color=\"primary\">activer les notifications</b>.", + "admin_notifTour": "Nous allons paramétrer votre première notification", "includeFolderPerimeter": "Consulter les courriers hors périmètre dans les dossiers et courriers suivis", "getIt": "J'ai compris", "admin_email_serverTitle": "Paramétrer un serveur de mail", @@ -1844,11 +1844,15 @@ export const LANG_FR = { "emailTour2Description": "Il est fortement recommandé de tester les informations renseignées afin de s'assurer que la connexion soit effective.", "admin_notifTitle": "Gérer les notifications", "notifTourTitle": "Planifier", - "notifTourDescription": "Vous pouvez planifier vos notifications de manière précise", + "notifTourDescription": "Ensuite, nous allons <b color=\"primary\">planifier</b> la tâche.", "notifTour2Title": "Notification de bannettes", - "notifTour2Description": "Nous allons planifier la <b color=\"primary\">notification de bannettes</b> pour <b color=\"primary\">chaque jour à 8h00<b>.<br/><br/>Cela avertira les utilisateurs de nouveaux contenus dans leur bannettes.", + "notifTour2Description": "Nous allons configurer la <b color=\"primary\">notification de bannettes</b> pour avertir les utilisateurs de nouveaux contenus dans leur bannettes.", "notifTour3Title": "Période de la tâche", - "notifTour3Description": "Vous pouvez choisir différentes périodes pour paramétrer votre tâche", + "notifTour3Description": "Vous pouvez choisir différentes périodes pour paramétrer votre tâche.<br/></br/>Ici nous allons la paramétrer <b color=\"primary\">chaque jour à 8h00<b> ", "notifTour4Title": "Liste des tâches", - "notifTour4Description": "La liste de vos tâches actives apparaît ici" + "notifTour4Description": "La liste de vos <b color=\"primary\">tâches actives</b> apparaît ici", + "welcomeTourTitle": "Bienvenue", + "welcomeTourDescription": "Nous allons vous montrer certains points de configuration : <ul><li>Paraméter un <b color=\"primary\">serveur de mail</b></li><li>Configurer votre première <b color=\"primary\">notification</b></li></ul><br/>Pour commencer, cliquez sur <img style=\"width:32px;\" src=\"assets/admin_button.png\"/>", + "createScriptTourTitle": "Créer le script", + "createScriptTourDescription": "Avant de planifier la tâche, nous devons créer le script.", }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index ba1adb0c073ef183c2da7897b079bb5c9a87872b..2929933e1a1d738a33abb713b51951ab77a598ae 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1867,5 +1867,9 @@ export const LANG_NL = { "notifTour3Description": "Vous pouvez choisir différentes périodes pour paramétrer votre tâche__TO_TRANSLATE", "notifTour4Title": "Liste des tâches__TO_TRANSLATE", "notifTour4Description": "La liste de vos tâches actives apparaissent ici__TO_TRANSLATE", - "documentsOutOfPerimeter": "Certains documents sont en dehors de votre périmètre__TO_TRANSLATE" + "documentsOutOfPerimeter": "Certains documents sont en dehors de votre périmètre__TO_TRANSLATE", + "welcomeTourTitle": "Bienvenue__TO_TRANSLATE", + "welcomeTourDescription": "Nous allons vous montrer certains points de configuration : <ul><li>Paraméter un <b color=\"primary\">serveur de mail</b></li><li>Configurer votre première <b color=\"primary\">notification</b></li></ul><br/>Pour commencer, cliquez sur <img style=\"width:32px;\" src=\"assets/admin_button.png\"/>__TO_TRANSLATE", + "createScriptTourTitle": "Créer le script__TO_TRANSLATE", + "createScriptTourDescription": "Avant de planifier la tâche, nous devons créer le script.__TO_TRANSLATE" }; \ No newline at end of file diff --git a/src/frontend/service/featureTour.service.ts b/src/frontend/service/featureTour.service.ts index 5d35725b238343aeeaf8afd7940c494a374f3d8b..ba7f2326ba5ab33b71f3a6b2fd041cbf9a40c49c 100644 --- a/src/frontend/service/featureTour.service.ts +++ b/src/frontend/service/featureTour.service.ts @@ -18,61 +18,75 @@ export class FeatureTourService { currentTour: any = null; tour: any[] = [ + { + type: 'welcome', + stepId: 'welcome', + title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.welcomeTourTitle}</b>`, + description: this.lang.welcomeTourDescription, + redirectToAdmin: false, + }, { type: 'email', - stepId: 'admin_email_server', + stepId: 'admin_email_server@administration', title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.admin_email_serverTitle}</b>`, description: this.lang.admin_email_serverTour, - redirectToAdmin : false, + redirectToAdmin: false, }, { type: 'email', stepId: 'emailTour@administration/sendmail', title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.emailTourTitle}</b>`, description: this.lang.emailTourDescription, - redirectToAdmin : false, + redirectToAdmin: false, }, { type: 'email', stepId: 'emailTour2@administration/sendmail', title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.emailTour2Title}</b>`, description: this.lang.emailTour2Description, - redirectToAdmin : false, + redirectToAdmin: false, }, { type: 'notification', - stepId: 'admin_notif', + stepId: 'admin_notif@administration', title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.admin_notifTitle}</b>`, description: this.lang.admin_notifTour, - redirectToAdmin : false, + redirectToAdmin: false, }, { type: 'notification', - stepId: 'notifTour@administration/notifications', - title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.notifTourTitle}</b>`, - description: this.lang.notifTourDescription, - redirectToAdmin : false, + stepId: 'BASKETS_Tour@administration/notifications', + title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.notifTour2Title}</b>`, + description: this.lang.notifTour2Description, + redirectToAdmin: false, }, { type: 'notification', - stepId: 'notifTour2@administration/notifications', - title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.notifTour2Title}</b>`, - description: this.lang.notifTour2Description, - redirectToAdmin : false, + stepId: 'createScriptTour@administration/notifications/4', + title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.createScriptTourTitle}</b>`, + description: this.lang.createScriptTourDescription, + redirectToAdmin: false, + }, + { + type: 'notification', + stepId: 'notifTour@administration/notifications', + title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.notifTourTitle}</b>`, + description: this.lang.notifTourDescription, + redirectToAdmin: false, }, { type: 'notification', stepId: 'notifTour3@administration/notifications', title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.notifTour3Title}</b>`, description: this.lang.notifTour3Description, - redirectToAdmin : false, + redirectToAdmin: false, }, { type: 'notification', stepId: 'notifTour4@administration/notifications', title: `<i class="far fa-question-circle" color="primary"></i> <b color="primary">${this.lang.notifTour4Title}</b>`, description: this.lang.notifTour4Description, - redirectToAdmin : true, + redirectToAdmin: true, }, ]; @@ -90,38 +104,37 @@ export class FeatureTourService { init() { if (!this.functionService.empty(this.currentStepType)) { - setTimeout(() => { - const steps = this.tour.filter(step => step.type === this.currentStepType).map(step => step.stepId); - this.joyrideService.startTour( - { - customTexts: { - next: '>>', - prev: '<<', - done: this.lang.getIt - }, - steps: steps - } - ).subscribe( - step => { - /*Do something*/ - this.currentTour = this.tour.filter((item: any) => item.stepId.split('@')[0] === step.name)[0]; - const containerElement = document.getElementsByClassName('joyride-step__container') as HTMLCollectionOf<HTMLElement> - containerElement[0].style.width = 'auto'; - containerElement[0].style.height = 'auto'; - document.getElementsByClassName('joyride-step__header')[0].innerHTML = `${this.currentTour.title}`; - document.getElementsByClassName('joyride-step__body')[0].innerHTML = `${this.currentTour.description}`; - }, - error => { - /*handle error*/ + const steps = this.tour.filter(step => step.type === this.currentStepType).map(step => step.stepId); + this.joyrideService.startTour( + { + customTexts: { + next: '>>', + prev: '<<', + done: this.lang.getIt }, - () => { - if (this.currentTour.redirectToAdmin) { - this.router.navigate(['/administration']); - } - this.endTour(); + steps: steps, + waitingTime: 500 + } + ).subscribe( + step => { + /*Do something*/ + this.currentTour = this.tour.filter((item: any) => item.stepId.split('@')[0] === step.name)[0]; + const containerElement = document.getElementsByClassName('joyride-step__container') as HTMLCollectionOf<HTMLElement> + containerElement[0].style.width = 'auto'; + containerElement[0].style.height = 'auto'; + document.getElementsByClassName('joyride-step__header')[0].innerHTML = `${this.currentTour.title}`; + document.getElementsByClassName('joyride-step__body')[0].innerHTML = `${this.currentTour.description}`; + }, + error => { + /*handle error*/ + }, + () => { + if (this.currentTour.redirectToAdmin) { + this.router.navigate(['/administration']); } - ); - }, 500); + this.endTour(); + } + ); } }