Skip to content
Snippets Groups Projects
Verified Commit 7d4ef654 authored by Damien's avatar Damien
Browse files

FEAT #14455 TIME 1:00 Parameter application name

parent 5888d50f
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,7 @@ class ParameterController ...@@ -96,7 +96,7 @@ class ParameterController
$body = $request->getParsedBody(); $body = $request->getParsedBody();
if ($args['id'] == 'logo' || $args['id'] == 'bodyImage') { if (in_array($args['id'], ['logo', 'bodyImage', 'applicationName'])) {
$customId = CoreConfigModel::getCustomId(); $customId = CoreConfigModel::getCustomId();
if (empty($customId)) { if (empty($customId)) {
return $response->withStatus(400)->withJson(['errors' => 'A custom is needed for this operation']); return $response->withStatus(400)->withJson(['errors' => 'A custom is needed for this operation']);
...@@ -144,7 +144,7 @@ class ParameterController ...@@ -144,7 +144,7 @@ class ParameterController
} elseif ($args['id'] == 'applicationName') { } elseif ($args['id'] == 'applicationName') {
$config = CoreConfigModel::getJsonLoaded(['path' => 'apps/maarch_entreprise/xml/config.json']); $config = CoreConfigModel::getJsonLoaded(['path' => 'apps/maarch_entreprise/xml/config.json']);
$config['config']['applicationName'] = $body['applicationName']; $config['config']['applicationName'] = $body['applicationName'];
$fp = fopen("custom/{$body['customId']}/apps/maarch_entreprise/xml/config.json", 'w'); $fp = fopen("custom/{$customId}/apps/maarch_entreprise/xml/config.json", 'w');
fwrite($fp, json_encode($config, JSON_PRETTY_PRINT)); fwrite($fp, json_encode($config, JSON_PRETTY_PRINT));
fclose($fp); fclose($fp);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="col-md-6"> <div class="col-md-6">
<mat-form-field appearance="outline"> <mat-form-field appearance="outline">
<mat-label>{{'lang.applicationName' | translate}}</mat-label> <mat-label>{{'lang.applicationName' | translate}}</mat-label>
<input matInput formControlName="appName"> <input matInput formControlName="applicationName">
</mat-form-field> </mat-form-field>
<div>{{'lang.loginMsg' | translate}} : </div> <div>{{'lang.loginMsg' | translate}} : </div>
<textarea style="padding-top: 10px;" name="loginpage_message" id="loginpage_message" <textarea style="padding-top: 10px;" name="loginpage_message" id="loginpage_message"
...@@ -52,4 +52,4 @@ ...@@ -52,4 +52,4 @@
</mat-card> </mat-card>
</div> </div>
</div> </div>
</form> </form>
\ No newline at end of file
...@@ -33,7 +33,7 @@ export class ParametersCustomizationComponent implements OnInit, OnDestroy { ...@@ -33,7 +33,7 @@ export class ParametersCustomizationComponent implements OnInit, OnDestroy {
const valIdentifier: ValidatorFn[] = [Validators.pattern(/^[a-zA-Z0-9_\-]*$/), Validators.required]; const valIdentifier: ValidatorFn[] = [Validators.pattern(/^[a-zA-Z0-9_\-]*$/), Validators.required];
this.stepFormGroup = this._formBuilder.group({ this.stepFormGroup = this._formBuilder.group({
appName: ['', Validators.required], applicationName: ['', Validators.required],
loginpage_message: [''], loginpage_message: [''],
homepage_message: [''], homepage_message: [''],
bodyImage: ['../rest/images?image=loginPage'], bodyImage: ['../rest/images?image=loginPage'],
...@@ -61,12 +61,12 @@ export class ParametersCustomizationComponent implements OnInit, OnDestroy { ...@@ -61,12 +61,12 @@ export class ParametersCustomizationComponent implements OnInit, OnDestroy {
}), }),
exhaustMap(() => this.http.get('../rest/authenticationInformations')), exhaustMap(() => this.http.get('../rest/authenticationInformations')),
tap((data: any) => { tap((data: any) => {
this.stepFormGroup.controls['appName'].setValue(data.applicationName); this.stepFormGroup.controls['applicationName'].setValue(data.applicationName);
setTimeout(() => { setTimeout(() => {
this.stepFormGroup.controls['appName'].valueChanges.pipe( this.stepFormGroup.controls['applicationName'].valueChanges.pipe(
debounceTime(500), debounceTime(500),
tap(() => this.saveParameter('appName')) tap(() => this.saveParameter('applicationName'))
).subscribe(); ).subscribe();
...@@ -198,6 +198,8 @@ export class ParametersCustomizationComponent implements OnInit, OnDestroy { ...@@ -198,6 +198,8 @@ export class ParametersCustomizationComponent implements OnInit, OnDestroy {
let param = {}; let param = {};
if (parameterId === 'logo' || parameterId === 'bodyImage') { if (parameterId === 'logo' || parameterId === 'bodyImage') {
param['image'] = this.stepFormGroup.controls[parameterId].value; param['image'] = this.stepFormGroup.controls[parameterId].value;
} else if (parameterId === 'applicationName') {
param['applicationName'] = this.stepFormGroup.controls[parameterId].value;
} else { } else {
param = { param = {
param_value_string: this.stepFormGroup.controls[parameterId].value param_value_string: this.stepFormGroup.controls[parameterId].value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment