diff --git a/src/frontend/app/app-routing.module.ts b/src/frontend/app/app-routing.module.ts index 4dfabf047839f6bb31eaf7a89affae77921d5f86..73b9cb617c5413728397a7fa0a3cb2876bff4a7b 100755 --- a/src/frontend/app/app-routing.module.ts +++ b/src/frontend/app/app-routing.module.ts @@ -19,10 +19,13 @@ import { ProcessComponent } from './process/process.component'; import { FollowedDocumentListComponent } from './home/followed-list/followed-document-list.component'; import { LoginComponent } from './login/login.component'; import { DocumentViewerPageComponent } from './viewer/page/document-viewer-page.component'; +import { InstallerComponent } from './installer/installer.component'; + @NgModule({ imports: [ RouterModule.forRoot([ + { path: 'install', component: InstallerComponent }, { path: 'login', component: LoginComponent }, { path: 'activate-user', component: ActivateUserComponent }, { path: 'password-modification', component: PasswordModificationComponent }, diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index 0d6dc7f4eb617065b96ffdbc777af3dc3d373c71..86a1c5b949da2ae88c3aa029f9538ce3fa449a31 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -116,6 +116,10 @@ import { FolderCreateModalComponent } from './folder/folder-create-modal/folder- import { DocumentViewerPageComponent } from './viewer/page/document-viewer-page.component'; import { SelectIndexingModelComponent } from './indexation/select-indexing-model/select-indexing-model.component'; import { ThesaurusModalComponent } from './tag/indexing/thesaurus/thesaurus-modal.component'; +import { InstallerComponent } from './installer/installer.component'; +import { WelcomeComponent } from './installer/welcome/welcome.component'; +import { PrerequisiteComponent } from './installer/prerequisite/prerequisite.component'; +import { DatabaseComponent } from './installer/database/database.component'; @@ -220,7 +224,11 @@ import { ThesaurusModalComponent } from './tag/indexing/thesaurus/thesaurus-moda ReconcileActionComponent, DocumentViewerPageComponent, SelectIndexingModelComponent, - ThesaurusModalComponent + ThesaurusModalComponent, + InstallerComponent, + WelcomeComponent, + PrerequisiteComponent, + DatabaseComponent ], entryComponents: [ InfoChangePasswordModalComponent, diff --git a/src/frontend/app/installer/database/database.component.html b/src/frontend/app/installer/database/database.component.html new file mode 100644 index 0000000000000000000000000000000000000000..0b9a1c46916ffad416199722f7a77bbf5b585874 --- /dev/null +++ b/src/frontend/app/installer/database/database.component.html @@ -0,0 +1,37 @@ +<h2 class="stepContentTitle">Base de données</h2> +<mat-accordion> + <mat-expansion-panel opened> + <mat-expansion-panel-header> + <mat-panel-title> + Connexion à la base de données + </mat-panel-title> + </mat-expansion-panel-header> + <mat-form-field appearance="outline" style="color: initial;"> + <mat-label>Serveur</mat-label> + <input matInput> + </mat-form-field> + <mat-form-field appearance="outline" style="color: initial;"> + <mat-label>Port</mat-label> + <input matInput> + </mat-form-field> + <mat-form-field appearance="outline" style="color: initial;"> + <mat-label>Utilisateur</mat-label> + <input matInput> + </mat-form-field> + <mat-form-field appearance="outline" style="color: initial;"> + <mat-label>Mot de passe</mat-label> + <input matInput> + </mat-form-field> + <div style="text-align: center;"> + <button mat-raised-button type="button" color="default">Tester la connexion</button> + </div> + </mat-expansion-panel> + <mat-expansion-panel disabled> + <mat-expansion-panel-header> + <mat-panel-title> + Base de donnée de l'application + </mat-panel-title> + </mat-expansion-panel-header> + baba + </mat-expansion-panel> +</mat-accordion> \ No newline at end of file diff --git a/src/frontend/app/installer/database/database.component.scss b/src/frontend/app/installer/database/database.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..a54729b94f94e35a81ef91a1bee8d381425b9ac4 --- /dev/null +++ b/src/frontend/app/installer/database/database.component.scss @@ -0,0 +1,5 @@ +.stepContentTitle { + margin-bottom: 30px; + border-bottom: solid 1px; + padding: 0; +} diff --git a/src/frontend/app/installer/database/database.component.ts b/src/frontend/app/installer/database/database.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..28626798d5aaab9b73e323e06948d535da9cb753 --- /dev/null +++ b/src/frontend/app/installer/database/database.component.ts @@ -0,0 +1,39 @@ +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; + +@Component({ + selector: 'app-database', + templateUrl: './database.component.html', + styleUrls: ['./database.component.scss'] +}) +export class DatabaseComponent implements OnInit { + + stepFormGroup: FormGroup; + + constructor( + private _formBuilder: FormBuilder + ) { } + + ngOnInit(): void { + this.stepFormGroup = this._formBuilder.group({ + firstCtrl: ['', Validators.required] + }); + + // this.stepFormGroup.controls['firstCtrl'].setValue(this.checkStep()); + // this.stepFormGroup.controls['firstCtrl'].markAsUntouched(); + } + + checkStep() { + let state = 'success'; + return state; + } + + isValidStep() { + return this.stepFormGroup === undefined ? false : this.stepFormGroup.controls['firstCtrl'].value === 'success'; + } + + getFormGroup() { + return this.stepFormGroup; + } + +} diff --git a/src/frontend/app/installer/installer.component.html b/src/frontend/app/installer/installer.component.html new file mode 100644 index 0000000000000000000000000000000000000000..4e91145c462e81e332825102854004d6cace2d00 --- /dev/null +++ b/src/frontend/app/installer/installer.component.html @@ -0,0 +1,119 @@ +<mat-horizontal-stepper linear #stepper style="height: 100vh;overflow: auto;"> + <mat-step> + <ng-template matStepLabel>Installation</ng-template> + <div class="stepContainer"> + <div class="stepContent"> + <app-welcome></app-welcome> + </div> + <div style="display: flex;"> + <div style="flex: 1;text-align: left;"> + + </div> + <div style="flex: 1;text-align: right;"> + <button mat-button matStepperNext style="font-size: 35px;"> + suivant <i class="fa fa-arrow-circle-right"></i> + </button> + </div> + </div> + </div> + </mat-step> + <mat-step [stepControl]="appPrerequisite.getFormGroup()"> + <ng-template matStepLabel>Prérequis</ng-template> + <div class="stepContainer"> + <div class="stepContent"> + <app-prerequisite #appPrerequisite></app-prerequisite> + </div> + <div style="display: flex;"> + <div style="flex: 1;text-align: left;"> + <button mat-button matStepperPrevious style="font-size: 35px;"> + <i class="fa fa-arrow-circle-left"></i> précédent + </button> + </div> + <div style="flex: 1;text-align: right;"> + <button mat-button matStepperNext style="font-size: 35px;" + [disabled]="!appPrerequisite.isValidStep()"> + suivant <i class="fa fa-arrow-circle-right"></i> + </button> + </div> + </div> + </div> + </mat-step> + <mat-step [stepControl]="appDatabase.getFormGroup()"> + <ng-template matStepLabel>Base de données</ng-template> + <div class="stepContainer"> + <div class="stepContent"> + <app-database #appDatabase></app-database> + </div> + <div style="display: flex;"> + <div style="flex: 1;text-align: left;"> + <button mat-button matStepperPrevious style="font-size: 35px;"> + <i class="fa fa-arrow-circle-left"></i> précédent + </button> + </div> + <div style="flex: 1;text-align: right;"> + <button mat-button matStepperNext style="font-size: 35px;" + [disabled]="!appDatabase.isValidStep()"> + suivant <i class="fa fa-arrow-circle-right"></i> + </button> + </div> + </div> + </div> + </mat-step> + <mat-step> + <ng-template matStepLabel>Stockage</ng-template> + Bonjour + <div> + <button mat-button matStepperPrevious>Back</button> + <button mat-button matStepperNext>Next</button> + </div> + </mat-step> + <mat-step> + <ng-template matStepLabel>Personnalisation</ng-template> + Bonjour + <div> + <button mat-button matStepperPrevious>Back</button> + <button mat-button matStepperNext>Next</button> + </div> + </mat-step> + <mat-step> + <ng-template matStepLabel>Utilisateur sytème</ng-template> + Bonjour + <div> + <button mat-button matStepperPrevious>Back</button> + <button mat-button matStepperNext>Next</button> + </div> + </mat-step> + <mat-step optional> + <ng-template matStepLabel>Serveur mail</ng-template> + Bonjour + <div> + <button mat-button matStepperPrevious>Back</button> + </div> + </mat-step> + <ng-template matStepperIcon="edit"> + <mat-icon class="fa fa-check stepIcon"></mat-icon> + </ng-template> + + <ng-template matStepperIcon="done"> + <mat-icon class="fa fa-check stepIcon"></mat-icon> + </ng-template> + + <ng-template matStepperIcon="error"> + <mat-icon class="fa fa-times stepIcon" style="color: red;font-size: 15px !important;"></mat-icon> + </ng-template> +</mat-horizontal-stepper> + +<!--<mat-sidenav-container autosize class="maarch-container"> + <mat-sidenav-content> + <div class="bg-head"> + <div class="bg-head-content" [class.fullContainer]="appService.getViewMode()"> + toto + </div> + </div> + <div class="container" [class.fullContainer]="appService.getViewMode()"> + <div class="container-content"> + toto + </div> + </div> + </mat-sidenav-content> +</mat-sidenav-container>--> \ No newline at end of file diff --git a/src/frontend/app/installer/installer.component.scss b/src/frontend/app/installer/installer.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..c6a520291b18355ba78d72a3c0249497861c2b93 --- /dev/null +++ b/src/frontend/app/installer/installer.component.scss @@ -0,0 +1,67 @@ +.mat-stepper-horizontal { + background: #135f7f; + color: white; + display: flex; + flex-direction: column; + + + ::ng-deep.mat-step-icon { + background-color: white; + color: #135f7f; + } + + ::ng-deep.mat-step-label { + color: white; + opacity: 0.5; + } + + ::ng-deep.mat-step-label-active { + opacity: 1; + } +} + +.stepIcon { + font-size: 10px !important; + height: auto !important; + width: auto !important; +} + +::ng-deep.mat-step-label { + transition: all 0.2s; +} + +::ng-deep.mat-step-label-selected { + font-size: 160%; + transition: all 0.2s; +} + +::ng-deep.mat-horizontal-stepper-content { + max-width: 850px; + margin: auto; + height: 100%; +} + +::ng-deep.mat-horizontal-content-container { + flex: 1; +} + +.stepContainer{ + display: flex; + flex-direction: column; + height: 100%; +} + +.stepContent { + flex: 1; + overflow: auto; + + &Title { + margin-bottom: 30px; + border-bottom: solid 1px; + padding: 0; + } +} + +.formStep { + display: contents; +} \ No newline at end of file diff --git a/src/frontend/app/installer/installer.component.ts b/src/frontend/app/installer/installer.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..49cdc40e0d6e09931597effdac970df5c66c9efd --- /dev/null +++ b/src/frontend/app/installer/installer.component.ts @@ -0,0 +1,35 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Router } from '@angular/router'; +import { HeaderService } from '../../service/header.service'; +import { NotificationService } from '../notification.service'; +import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper'; +import { PrerequisiteComponent } from './prerequisite/prerequisite.component'; + +@Component({ + templateUrl: './installer.component.html', + styleUrls: ['./installer.component.scss'], + providers: [{ + provide: STEPPER_GLOBAL_OPTIONS, useValue: { showError: true } + }] +}) +export class InstallerComponent implements OnInit { + + @ViewChild('appPrerequisite', { static: true }) appPrerequisite: PrerequisiteComponent; + + constructor( + private http: HttpClient, + private router: Router, + private headerService: HeaderService, + private notify: NotificationService, + ) { } + + ngOnInit(): void { + this.headerService.hideSideBar = true; + } + + isValidStep() { + return false; + } + +} diff --git a/src/frontend/app/installer/prerequisite/prerequisite.component.html b/src/frontend/app/installer/prerequisite/prerequisite.component.html new file mode 100644 index 0000000000000000000000000000000000000000..7b01f29ec78330aefa105320c5fd0f54e8d365fd --- /dev/null +++ b/src/frontend/app/installer/prerequisite/prerequisite.component.html @@ -0,0 +1,16 @@ +<h2 class="stepContentTitle">Pré-requis</h2> +<p> + L'installation de Maarch Courrier nécessite un certain nombre de pré-requis au niveau de + l'installation de PHP. Reportez-vous à la page <a + href="https://docs.maarch.org/gitbook/html/MaarchCourrier/20.03/guat/guat_prerequisites/home.html" + target="_blank" style="text-decoration: underline;color: white !important;">pre-requis</a> + pour les détails. +</p> +<mat-list style="background: white;" *ngFor="let groupPackage of packagesList | keyvalue"> + <div mat-subheader>{{groupPackage.key}}</div> + <mat-list-item *ngFor="let package of packagesList[groupPackage.key]"> + <mat-icon mat-list-icon class="fa iconCheckPackage icon_{{package.state}}"></mat-icon> + <div mat-line style="font-size: 120%;">{{package.label}}</div> + <div mat-line style="color:#666;">{{package.description}}</div> + </mat-list-item> +</mat-list> \ No newline at end of file diff --git a/src/frontend/app/installer/prerequisite/prerequisite.component.scss b/src/frontend/app/installer/prerequisite/prerequisite.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..e99d912ecec9c5f287e0e2c9d7d9489ce599321c --- /dev/null +++ b/src/frontend/app/installer/prerequisite/prerequisite.component.scss @@ -0,0 +1,42 @@ +.stepContentTitle { + margin-bottom: 30px; + border-bottom: solid 1px; + padding: 0; +} + +.iconCheckPackage { + background: white; + font-size: 15px !important; + display: flex; + align-items: center; + justify-content: center; + padding: 10px; + border-radius: 20px; + height: 35px; + width: 35px; +} + +.icon_ok { + color: green; +} + +.icon_ok:before { + content: "\f111"; +} + +.icon_warning { + color: orange; +} + +.icon_warning:before { + content: "\f111"; +} + + +.icon_ko { + color: red; +} + +.icon_ko:before { + content: "\f111"; +} \ No newline at end of file diff --git a/src/frontend/app/installer/prerequisite/prerequisite.component.ts b/src/frontend/app/installer/prerequisite/prerequisite.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ffc51a1f10f654007d61841291469e0f8ba0da4 --- /dev/null +++ b/src/frontend/app/installer/prerequisite/prerequisite.component.ts @@ -0,0 +1,145 @@ +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; + +@Component({ + selector: 'app-prerequisite', + templateUrl: './prerequisite.component.html', + styleUrls: ['./prerequisite.component.scss'] +}) +export class PrerequisiteComponent implements OnInit { + + stepFormGroup: FormGroup; + + requiredPackages: any = { + php: 'ok', + rights: 'warning', + unoconv: 'ko', + netcat: 'ok' + }; + + packagesList: any = { + general: [ + { + label: 'phpVersion', + description: 'Version de PHP (7.2, 7.3, ou 7.4) -> 7.2.31-1+ubuntu18.04.1+deb.sury.org+1' + }, + { + label: 'appRights', + description: 'Droits de lecture et d\'écriture du répertoire racine de Maarch Courrier' + }, + { + label: 'appConversion', + description: 'Outils de conversion de documents bureautiques soffice/unoconv installés' + }, + { + label: 'networkUtils', + description: 'Utilitaire permettant d\'ouvrir des connexions réseau (netcat / nmap)' + } + ], + libraries: [ + { + label: 'pgsql', + description: '' + }, + { + label: 'pdo_pgsql', + description: '' + }, + { + label: 'gd', + description: '' + }, + { + label: 'imap', + description: '' + }, + { + label: 'mbstring', + description: '' + }, + { + label: 'xsl', + description: '' + }, + { + label: 'gettext', + description: '' + }, + { + label: 'XML-RPC', + description: '' + }, + { + label: 'curl', + description: '' + }, + { + label: 'zip', + description: '' + }, + { + label: 'Imagick', + description: '' + }, + + ], + phpini: [ + { + label: 'error_reporting', + description: 'error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT ' + }, + { + label: 'display_errors', + description: 'display_errors = On' + }, + { + label: 'short_open_tags', + description: 'short_open_tags = On' + }, + ], + }; + + constructor( + private _formBuilder: FormBuilder + ) { } + + ngOnInit(): void { + this.stepFormGroup = this._formBuilder.group({ + firstCtrl: ['', Validators.required] + }); + + // FOR TEST + Object.keys(this.packagesList).forEach((group: any) => { + this.packagesList[group] = this.packagesList[group].map( + (item: any) => { + return { + ...item, + state: 'ok' + }; + } + ); + }); + this.stepFormGroup.controls['firstCtrl'].setValue(this.checkStep()); + this.stepFormGroup.controls['firstCtrl'].markAsUntouched(); + } + + checkStep() { + let state = 'success'; + Object.keys(this.packagesList).forEach((group: any) => { + this.packagesList[group].forEach((item: any) => { + if (item.state === 'ko') { + state = ''; + } + }); + }); + return state; + } + + isValidStep() { + return this.stepFormGroup === undefined ? false : this.stepFormGroup.controls['firstCtrl'].value === 'success'; + } + + getFormGroup() { + return this.stepFormGroup; + } +} diff --git a/src/frontend/app/installer/welcome/welcome.component.html b/src/frontend/app/installer/welcome/welcome.component.html new file mode 100644 index 0000000000000000000000000000000000000000..d2a288bc3be676f15e21f7ab177ae3836205f22f --- /dev/null +++ b/src/frontend/app/installer/welcome/welcome.component.html @@ -0,0 +1,50 @@ +<div class="stepContent"> + <h2 class="stepContentTitle">Bienvenue sur Maarch Courrier 20.10!</h2> + <div style="text-align: center;"> + <mat-icon class="maarchLogoWhiteFull" svgIcon="maarchLogoWhiteFull"></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> + <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-divider></mat-divider> + <p> + Pour tout renseignements, rendez vous sur : + </p> + <a mat-raised-button href="https://community.maarch.org/" target="_blank"> + community.maarch.org + </a> + ou + <a mat-raised-button 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" + style="text-decoration: underline;color: white;">Licence publique générale GNU</a> + </p> +</div> diff --git a/src/frontend/app/installer/welcome/welcome.component.scss b/src/frontend/app/installer/welcome/welcome.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..2d423fe30c985b3c2141411274e6beff85d8989d --- /dev/null +++ b/src/frontend/app/installer/welcome/welcome.component.scss @@ -0,0 +1,40 @@ +.stepContent { + display: contents; + + .stepContentTitle { + margin-bottom: 30px; + border-bottom: solid 1px; + padding: 0; + } + + .maarchLogoWhiteFull{ + width: 300px; + height: 100px; + } + + .mat-divider { + margin-top: 10px; + margin-bottom: 10px; + } + + ::ng-deep .mat-form-field-appearance-outline.mat-form-field-invalid.mat-form-field-invalid .mat-form-field-outline-thick { + /*change color of label*/ + color: white !important; + } + + ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline { + color: white !important; + background: white; + } + + ::ng-deep.mat-form-field-underline { + /*change color of underline*/ + background-color: white !important; + } + + ::ng-deep.mat-form-field-ripple { + /*change color of underline when focused*/ + background-color: white !important; + ; + } +} diff --git a/src/frontend/app/installer/welcome/welcome.component.ts b/src/frontend/app/installer/welcome/welcome.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1a1386520279a30dddb99c516c19a5bedf77513 --- /dev/null +++ b/src/frontend/app/installer/welcome/welcome.component.ts @@ -0,0 +1,20 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-welcome', + templateUrl: './welcome.component.html', + styleUrls: ['./welcome.component.scss'] +}) +export class WelcomeComponent implements OnInit { + + langs: string[] = [ + 'fr', + 'en' + ]; + + constructor() { } + + ngOnInit(): void { + } + +}