From 3398081a547074c0706af331a4b9b3badd7dade7 Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Fri, 3 Jul 2020 15:30:27 +0200 Subject: [PATCH] FEAT #13671 TIME 0:50 add welcome installer --- .../installer/welcome/welcome.component.html | 62 ++++++------- .../installer/welcome/welcome.component.ts | 90 ++++++++++++++++--- 2 files changed, 105 insertions(+), 47 deletions(-) diff --git a/src/frontend/app/installer/welcome/welcome.component.html b/src/frontend/app/installer/welcome/welcome.component.html index 892f08fdbe8..cab64b0cd4e 100644 --- a/src/frontend/app/installer/welcome/welcome.component.html +++ b/src/frontend/app/installer/welcome/welcome.component.html @@ -1,49 +1,37 @@ <div class="stepContent"> - <h2 class="stepContentTitle">Bienvenue sur Maarch Courrier 20.10!</h2> + <h2 class="stepContentTitle">{{lang.welcomeApp | scan : [appVersion]}} !</h2> <div style="text-align: center;"> <mat-icon class="maarchLogoFull" svgIcon="maarchLogoFull"></mat-icon> </div> - <mat-form-field appearance="outline" floatLabel="never"> - <mat-label>Choisissez la langue de l'application : </mat-label> - <mat-select> - <mat-option *ngFor="let lang of langs" [value]="lang"> - {{lang}} - </mat-option> - </mat-select> - </mat-form-field> + <form [formGroup]="stepFormGroup" style="width: 850px;margin: auto;"> + <mat-form-field appearance="outline" floatLabel="never"> + <mat-label>{{lang.chooseAppLanguage}} : </mat-label> + <mat-select formControlName="lang" required> + <mat-option *ngFor="let language of langs" [value]="language"> + {{lang[language + 'Full']}} + </mat-option> + </mat-select> + </mat-form-field> + </form> <mat-divider></mat-divider> - <p> - Cet assistant va vous guider pas à pas dans l'installation de Maarch Courrier notamment : - </p> - <ul> - <li> - Contrôle des pré-requis - </li> - <li> - Création de la base de données - </li> - <li> - Import d'un jeu de données - </li> - <li> - Création des docservers - </li> - <li> - Paramétrage des batchs - </li> - </ul> + <mat-list> + <div mat-subheader>{{lang.installDescription}} : + </div> + <mat-list-item *ngFor="let step of steps"> + <mat-icon mat-list-icon color="primary" [class]="step.icon"></mat-icon> + <div mat-line>{{step.desc}}</div> + </mat-list-item> + </mat-list> <mat-divider></mat-divider> <p> - Pour tout renseignements, rendez vous sur : + {{lang.externalInfoSite}} : </p> - <a mat-raised-button href="https://community.maarch.org/" target="_blank"> + <a mat-raised-button color="primary" href="https://community.maarch.org/" target="_blank"> community.maarch.org </a> - ou - <a mat-raised-button href="http://www.maarch.com" target="_blank"> + {{lang.or}} + <a mat-raised-button color="primary" href="http://www.maarch.com" target="_blank"> www.maarch.com </a> - <p style="font-style: italic;padding-top: 30px;text-align: right;"> - <b>Maarch Courrier</b> est sous <a href="https://www.gnu.org/licenses/gpl-3.0.html" target="_blank" class="link">Licence publique générale GNU</a> - </p> -</div> + <p style="font-style: italic;padding-top: 30px;text-align: right;" [innerHTML]="lang.maarchLicenceInstall"></p> +</div> \ No newline at end of file diff --git a/src/frontend/app/installer/welcome/welcome.component.ts b/src/frontend/app/installer/welcome/welcome.component.ts index 1a26210ec5f..222ea5ce0c1 100644 --- a/src/frontend/app/installer/welcome/welcome.component.ts +++ b/src/frontend/app/installer/welcome/welcome.component.ts @@ -1,4 +1,13 @@ import { Component, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { NotificationService } from '../../../service/notification/notification.service'; +import { LANG } from '../../translate.component'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { tap } from 'rxjs/internal/operators/tap'; +import { of } from 'rxjs/internal/observable/of'; +import { catchError } from 'rxjs/internal/operators/catchError'; +import { environment } from '../../../environments/environment'; + @Component({ selector: 'app-welcome', @@ -7,14 +16,69 @@ import { Component, OnInit } from '@angular/core'; }) export class WelcomeComponent implements OnInit { - langs: string[] = [ - 'fr', - 'en' + lang: any = LANG; + + stepFormGroup: FormGroup; + + langs: string[] = []; + + appVersion: string = environment.VERSION.split('.')[0] + '.' + environment.VERSION.split('.')[1]; + + steps: any[] = [ + { + icon : 'fas fa-check-square', + desc: this.lang.prerequisiteCheck + }, + { + icon : 'fa fa-database', + desc: this.lang.databaseCreation + }, + { + icon : 'fa fa-database', + desc: this.lang.dataSampleCreation + }, + { + icon : 'fa fa-hdd', + desc: this.lang.docserverCreation + }, + { + icon : 'fas fa-tools', + desc: this.lang.stepCustomizationActionDesc + }, + { + icon : 'fa fa-user', + desc: this.lang.adminUserCreation + }, ]; - constructor() { } + constructor( + public http: HttpClient, + private notify: NotificationService, + private _formBuilder: FormBuilder + ) { } - ngOnInit(): void { } + ngOnInit(): void { + this.stepFormGroup = this._formBuilder.group({ + lang: ['fr', Validators.required] + }); + + this.getLang(); + } + + getLang() { + this.langs = [ + 'fr', + 'en', + ]; + /*this.http.get('../rest/dev/lang').pipe( + tap((data: any) => { + }), + catchError((err: any) => { + this.notify.handleSoftErrors(err); + return of(false); + }) + ).subscribe();*/ + } initStep() { return false; @@ -22,12 +86,18 @@ export class WelcomeComponent implements OnInit { getInfoToInstall(): any[] { return []; - /*return { - body : { - lang: this.selectedLang, + /*return [{ + idStep : 'lang', + body: { + lang: this.stepFormGroup.controls['lang'].value, + }, + route : { + method : 'POST', + url : '../rest/installer/lang' }, - route : '/installer/lang' - };*/ + description: this.lang.langSetting, + installPriority: 3 + }];*/ } } -- GitLab