diff --git a/src/frontend/app/installer/customization/customization.component.ts b/src/frontend/app/installer/customization/customization.component.ts index 5e1d71bc39b6885bdf2c81e4d5a02fe860425d32..32e3356df72e2f1f6a95b9d50da946732fafb566 100644 --- a/src/frontend/app/installer/customization/customization.component.ts +++ b/src/frontend/app/installer/customization/customization.component.ts @@ -42,7 +42,7 @@ export class CustomizationComponent implements OnInit { appName: [`Maarch Courrier ${environment.VERSION.split('.')[0] + '.' + environment.VERSION.split('.')[1]}`, Validators.required], loginMessage: [`<span style="color:#24b0ed"><strong>Découvrez votre application via</strong></span> <a title="le guide de visite" href="https://docs.maarch.org/gitbook/html/MaarchCourrier/${environment.VERSION.split('.')[0] + '.' + environment.VERSION.split('.')[1]}/guu/home.html" target="_blank"><span style="color:#f99830;"><strong>le guide de visite en ligne</strong></span></a>`], homeMessage: ['<p>Découvrez <strong>Maarch Courrier 20.10</strong> avec <a title="notre guide de visite" href="https://docs.maarch.org/" target="_blank"><span style="color:#f99830;"><strong>notre guide de visite en ligne</strong></span></a>.</p>'], - bodyLoginBackground: ['bodylogin.jpg'], + bodyLoginBackground: ['assets/bodylogin.jpg'], uploadedLogo: ['../rest/images?image=logo'], }); this.backgroundList = Array.from({ length: 16 }).map((_, i) => { @@ -61,6 +61,7 @@ export class CustomizationComponent implements OnInit { }), debounceTime(500), filter((value: any) => value.length > 2), + filter(() => this.stepFormGroup.controls['customId'].errors === null || this.stepFormGroup.controls['customId'].errors.pattern === undefined), tap(() => { this.checkCustomExist(); }), @@ -94,7 +95,8 @@ export class CustomizationComponent implements OnInit { } }), catchError((err: any) => { - if (err.error.errors === 'Custom already exists') { + const regex = /^Custom already exists/g; + if (err.error.errors.match(regex) !== null) { this.stepFormGroup.controls['customId'].setErrors({ ...this.stepFormGroup.controls['customId'].errors, customExist: true }); this.stepFormGroup.controls['customId'].markAsTouched(); } else { @@ -148,7 +150,10 @@ export class CustomizationComponent implements OnInit { applicationName: this.stepFormGroup.controls['appName'].value, }, description: this.lang.stepInstanceActionDesc, - route: '../rest/installer/custom', + route : { + method : 'POST', + url : '../rest/installer/custom' + }, installPriority: 1 }, { @@ -160,7 +165,10 @@ export class CustomizationComponent implements OnInit { logo: this.stepFormGroup.controls['uploadedLogo'].value, }, description: this.lang.stepCustomizationActionDesc, - route: '../rest/installer/customization', + route : { + method : 'POST', + url : '../rest/installer/customization' + }, installPriority: 3 } ]; diff --git a/src/frontend/app/installer/database/database.component.ts b/src/frontend/app/installer/database/database.component.ts index fd3a6d849009daa7163f8a3cfcc1ba0162536b35..64428bcc4fa5cc6ef27068f768d1d30df1863c15 100644 --- a/src/frontend/app/installer/database/database.component.ts +++ b/src/frontend/app/installer/database/database.component.ts @@ -146,7 +146,10 @@ export class DatabaseComponent implements OnInit { name: this.stepFormGroup.controls['dbNameCtrl'].value, data: this.stepFormGroup.controls['dbSampleCtrl'].value }, - route: '../rest/installer/database', + route : { + method : 'POST', + url : '../rest/installer/database' + }, description: this.lang.stepDatabaseActionDesc, installPriority: 2 }]; diff --git a/src/frontend/app/installer/docservers/docservers.component.ts b/src/frontend/app/installer/docservers/docservers.component.ts index 6ff71dd572bd67b3838c7dc8dcb376091dc0a0ff..fbed25724f9bf2bbf71e01d8cbf6e2d3ff2f258f 100644 --- a/src/frontend/app/installer/docservers/docservers.component.ts +++ b/src/frontend/app/installer/docservers/docservers.component.ts @@ -75,7 +75,10 @@ export class DocserversComponent implements OnInit { body: { path: this.stepFormGroup.controls['docserversPath'].value, }, - route: '../rest/installer/docservers', + route : { + method : 'POST', + url : '../rest/installer/docservers' + }, description: this.lang.stepDocserversActionDesc, installPriority: 3 }]; diff --git a/src/frontend/app/installer/install-action/install-action.component.html b/src/frontend/app/installer/install-action/install-action.component.html index 48d2ce44ad1160adaf61f8efd9e4f5e42ed2cce5..d079592eb3f4048f6498f566d10bd45d7b5b6374 100644 --- a/src/frontend/app/installer/install-action/install-action.component.html +++ b/src/frontend/app/installer/install-action/install-action.component.html @@ -26,12 +26,11 @@ </mat-expansion-panel> </mat-accordion> </div> - <ng-container *ngIf="isInstallComplete()"> + <ng-container *ngIf="isInstallComplete() || isInstallError()"> <span class="divider-modal"></span> <div mat-dialog-actions class="actions"> <button *ngIf="!isInstallError()" mat-raised-button mat-button color="primary" - (click)="goToInstance()">Accéder - à la nouvelle instance</button> + (click)="goToInstance()">{{lang.goToNewInstance}}</button> <button *ngIf="isInstallError()" mat-raised-button mat-button [mat-dialog-close]="">{{lang.cancel}}</button> </div> </ng-container> diff --git a/src/frontend/app/installer/install-action/install-action.component.ts b/src/frontend/app/installer/install-action/install-action.component.ts index 990ddbc2e6735fedd6a016813050c5bca6261bd8..ff9b74363953dd2b2ec864ec9080ddd682209dff 100644 --- a/src/frontend/app/installer/install-action/install-action.component.ts +++ b/src/frontend/app/installer/install-action/install-action.component.ts @@ -70,12 +70,11 @@ export class InstallActionComponent implements OnInit, AfterViewInit { doStep(index: number) { return new Promise((resolve, reject) => { - console.log(this.steps[index]); if (this.installerService.isStepAlreadyLaunched(this.data[index].idStep)) { this.steps[index].state = 'OK'; resolve(true); } else { - this.http.post(this.data[index].route, this.data[index].body).pipe( + this.http[this.data[index].route.method.toLowerCase()](this.data[index].route.url, this.data[index].body).pipe( tap((data: any) => { this.steps[index].state = 'OK'; this.installerService.setStep(this.steps[index]); @@ -83,8 +82,8 @@ export class InstallActionComponent implements OnInit, AfterViewInit { }), catchError((err: any) => { this.steps[index].state = 'KO'; - resolve(false); this.steps[index].msgErr = err.error.errors; + resolve(false); return of(false); }) ).subscribe(); @@ -97,7 +96,6 @@ export class InstallActionComponent implements OnInit, AfterViewInit { } isInstallError() { - console.log(this.steps); return this.steps.filter(step => step.state === 'KO').length > 0; } diff --git a/src/frontend/app/installer/prerequisite/prerequisite.component.ts b/src/frontend/app/installer/prerequisite/prerequisite.component.ts index 30b0f59df8b1ed1b03430609b9a5fb449849ecb3..b1b9c82d6a8605ff1be33bee53d8e83d735c0437 100644 --- a/src/frontend/app/installer/prerequisite/prerequisite.component.ts +++ b/src/frontend/app/installer/prerequisite/prerequisite.component.ts @@ -54,6 +54,10 @@ export class PrerequisiteComponent implements OnInit { label: 'zip', required: true }, + { + label: 'wkhtmlToPdf', + required: true + }, { label: 'imagick', required: true @@ -72,16 +76,12 @@ export class PrerequisiteComponent implements OnInit { label: 'gd', required: true }, - { - label: 'imap', - required: true - }, { label: 'mbstring', required: true }, { - label: 'xsl', + label: 'json', required: true }, { @@ -89,7 +89,7 @@ export class PrerequisiteComponent implements OnInit { required: true }, { - label: 'xmlrpc', + label: 'xml', required: true }, ], diff --git a/src/frontend/app/installer/types.ts b/src/frontend/app/installer/types.ts index 4bd495ea21e6c1fa134a61cf87ede76d8a3a2f20..232892d28cdeec889c562adb4912c3ae91eefbc4 100644 --- a/src/frontend/app/installer/types.ts +++ b/src/frontend/app/installer/types.ts @@ -1,14 +1,14 @@ /** * Launch actions after stepper checked * Gets script version - * @param route route to launch action + * @param route route to launch action ex: {method : 'POST', url: '../rest/install/action'} * @param body data json sent to the route * @param description decscription of install action * @param installPriority action order (/!\ NEVER USE 1 IT IS FOR ROUTE /installer/initCustom) */ export class StepAction { idStep: string; - route: string; + route: any; body: any; description: any; installPriority: 1 | 2 | 3; diff --git a/src/frontend/app/installer/useradmin/useradmin.component.ts b/src/frontend/app/installer/useradmin/useradmin.component.ts index 43d2c42779ab2ee3441ed258bbfa7273ba2c6739..c691195fa9e55935ed7797d8b518da4e5d7872f2 100644 --- a/src/frontend/app/installer/useradmin/useradmin.component.ts +++ b/src/frontend/app/installer/useradmin/useradmin.component.ts @@ -4,6 +4,7 @@ import { NotificationService } from '../../../service/notification/notification. import { LANG } from '../../translate.component'; import { tap } from 'rxjs/internal/operators/tap'; import { InstallerService } from '../installer.service'; +import { StepAction } from '../types'; @Component({ selector: 'app-useradmin', @@ -27,7 +28,7 @@ export class UseradminComponent implements OnInit { const valLogin: ValidatorFn[] = [Validators.pattern(/^[\w.@-]*$/), Validators.required]; this.stepFormGroup = this._formBuilder.group({ - login: ['superadmin', valLogin], + login: [{ value: 'superadmin', disabled: true }, valLogin], password: ['', Validators.required], passwordConfirm: ['', Validators.required], email: ['dev@maarch.org', Validators.required], @@ -75,19 +76,21 @@ export class UseradminComponent implements OnInit { return this.stepFormGroup; } - getInfoToInstall(): any[] { - return []; - /*return { + getInfoToInstall(): StepAction[] { + return [{ idStep : 'userAdmin', body : { login: this.stepFormGroup.controls['login'].value, password: this.stepFormGroup.controls['password'].value, email: this.stepFormGroup.controls['email'].value, }, - route : '/installer/useradmin', + route : { + method : 'PUT', + url : '../rest/installer/administrator' + }, description: this.lang.stepUserAdminActionDesc, installPriority: 3 - };*/ + }]; } launchInstall() { diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index ea2b161ba224c57cc0fb024c07bf2a0bc99ad8b6..e8e0ebb10752b83d36e5257ca056e47cfcac87a0 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1744,14 +1744,14 @@ export const LANG_FR = { "install_gd_desc": "Extension PHP fournissant à la manipulation d'images, dans un grand choix de formats, comme GIF, PNG, JPEG, WBMP et XPM. ", "install_imagick": "imagick", "install_imagick_desc": "Extension PHP pour créer et modifier les images, en utilisant l'API ImageMagick. ", - "install_imap": "imap", - "install_imap_desc": "Extension PHP permettant d'utiliser le protocole IMAP, mais aussi les protocoles NNTP, POP3 et les boîtes aux lettres locales. ", - "install_xsl": "xsl", - "install_xsl_desc": "Extension PHP permettant l'implémentation du standard XSL, et effectue des » transformations XSLT en utilisant la » bibliothèque libxslt. ", + "install_json": "json", + "install_json_desc": "Extension PHP permettant d'utiliser le format d'échange de données » JavaScript Object Notation (JSON).", + "install_wkhtmlToPdf": "wkhtmlToPdf", + "install_wkhtmlToPdf_desc": "Outil permettant de convertir du HTML en PDF et divers formats d'image en utilisant le moteur de rendu Qt WebKit.", "install_gettext": "gettext", "install_gettext_desc": "Extension PHP permettant l'implémentation de l'API NLS (Native Language Support) qui peut servir à internationaliser vos scripts PHP.", - "install_xmlrpc": "xmlrpc", - "install_xmlrpc_desc": "Extension PHP fournissant des fonctions servant à écrire sur les serveurs XML-RPC, mais aussi sur les clients.", + "install_xml": "xml", + "install_xml_desc": "Extension PHP fournissant utilisant la bibliothèque expat fournie avec la distribution.", "install_curl": "curl", "install_curl_desc": "Outil permettant de télécharger n’importe quels fichiers via divers protocoles.", "install_zip": "zip", @@ -1812,4 +1812,5 @@ export const LANG_FR = { "stepUserAdminActionDesc": "Création de l'utilisateur système", "pathUnreacheable": "Chemin inaccessible", "stepCustomizationActionDesc": "Mise en place du paramétrage personnalisé", + "goToNewInstance": "Accéder à la nouvelle instance", };