Ajout de la configuration TOUCH_UP_KIT_EXPIRATION
This commit is contained in:
parent
5a93d1b9cf
commit
b58c389f16
|
@ -16,7 +16,7 @@ services:
|
|||
cre_database_url: "mysql://database:3306/cre"
|
||||
cre_database_username: "root"
|
||||
cre_database_password: "pass"
|
||||
CRE_ENABLE_DB_UPDATE: 1
|
||||
CRE_ENABLE_DB_UPDATE: 0
|
||||
server_port: 9090
|
||||
ports:
|
||||
- 9090:9090
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div *ngIf="configuration" [attr.title]="tooltip?.content" class="d-flex flex-row justify-content-between align-items-center">
|
||||
<cre-checkbox-input [label]="label.content" [control]="config.control"></cre-checkbox-input>
|
||||
<mat-hint>Dernière mise à jour: {{lastUpdated}}</mat-hint>
|
||||
<mat-hint>{{lastUpdated}}</mat-hint>
|
||||
</div>
|
|
@ -3,7 +3,7 @@
|
|||
class="w-100"
|
||||
[type]="config.key === 'database.password' ? 'password' : 'text'"
|
||||
[label]="label.content"
|
||||
[hint]="configuration.editable ? 'Dernière mise à jour: ' + lastUpdated : null"
|
||||
[hint]="configuration.editable ? lastUpdated : null"
|
||||
[control]="config.control"
|
||||
[icon]="configuration.requireRestart ? 'alert' : null"
|
||||
[iconTitle]="configuration.requireRestart ? 'Requiert un redémarrage' : null"
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
CreImageConfig,
|
||||
CreConfigList,
|
||||
CreConfigActions,
|
||||
CreConfigTooltip
|
||||
CreConfigTooltip, CrePeriodConfig, CreBoolConfig
|
||||
} from './config'
|
||||
import {SharedModule} from '../shared/shared.module'
|
||||
import {CreInputsModule} from '../shared/components/inputs/inputs.module'
|
||||
|
@ -23,7 +23,9 @@ import {CreButtonsModule} from '../shared/components/buttons/buttons.module'
|
|||
CreImageConfig,
|
||||
CreConfigSection,
|
||||
CreConfigList,
|
||||
CreConfigActions
|
||||
CreConfigActions,
|
||||
CreBoolConfig,
|
||||
CrePeriodConfig
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
|
|
|
@ -121,13 +121,13 @@ export class CreConfig extends SubscribingComponent {
|
|||
}
|
||||
|
||||
get lastUpdated(): string {
|
||||
return formatDateTime(this.configuration.lastUpdated)
|
||||
return 'Dernière mise à jour: ' + formatDateTime(this.configuration.lastUpdated)
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'cre-image-config',
|
||||
templateUrl: 'image-config.html',
|
||||
templateUrl: 'image.html',
|
||||
styleUrls: ['config.sass'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
@ -158,7 +158,7 @@ export class CreImageConfig extends CreConfig {
|
|||
|
||||
@Component({
|
||||
selector: 'cre-bool-config',
|
||||
templateUrl: 'bool-config.html'
|
||||
templateUrl: 'bool.html'
|
||||
})
|
||||
export class CreBoolConfig extends CreConfig {
|
||||
setConfig(config: Config) {
|
||||
|
@ -167,6 +167,14 @@ export class CreBoolConfig extends CreConfig {
|
|||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'cre-period-config',
|
||||
templateUrl: 'period.html'
|
||||
})
|
||||
export class CrePeriodConfig extends CreConfig {
|
||||
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'cre-config-editor',
|
||||
templateUrl: 'editor.html'
|
||||
|
@ -184,6 +192,7 @@ export class CreConfigEditor extends ErrorHandlingComponent {
|
|||
DATABASE_PASSWORD: Config.DATABASE_PASSWORD,
|
||||
DATABASE_VERSION: Config.DATABASE_VERSION,
|
||||
TOUCH_UP_KIT_CACHE_PDF: Config.TOUCH_UP_KIT_CACHE_PDF,
|
||||
TOUCH_UP_KIT_EXPIRATION: Config.TOUCH_UP_KIT_EXPIRATION,
|
||||
APP_VERSION: Config.APP_VERSION,
|
||||
JAVA_VERSION: Config.JAVA_VERSION,
|
||||
OPERATING_SYSTEM: Config.OPERATING_SYSTEM
|
||||
|
|
|
@ -43,6 +43,13 @@
|
|||
<cre-config-section>
|
||||
<cre-config-label>Kits de retouche</cre-config-label>
|
||||
<cre-config-list class="pt-2">
|
||||
<cre-period-config [config]="getConfig(keys.TOUCH_UP_KIT_EXPIRATION)">
|
||||
<cre-config-label>Période d'expiration des kits de retouches complets</cre-config-label>
|
||||
<cre-config-tooltip>
|
||||
Les kits de retouche complétés expirent après la période configurée. Les kits de retouche expirés seront supprimés automatiquement.
|
||||
</cre-config-tooltip>
|
||||
</cre-period-config>
|
||||
|
||||
<cre-bool-config [config]="getConfig(keys.TOUCH_UP_KIT_CACHE_PDF)">
|
||||
<cre-config-label>Activer le cache des PDFs générés</cre-config-label>
|
||||
<cre-config-tooltip>
|
||||
|
|
|
@ -21,6 +21,6 @@
|
|||
[attr.width]="previewWidth ? previewWidth : null"
|
||||
class="mat-elevation-z3"/>
|
||||
</div>
|
||||
<mat-hint>Dernière mise à jour:<br/>{{lastUpdated}}</mat-hint>
|
||||
<mat-hint>{{lastUpdated}}</mat-hint>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
<div *ngIf="configuration" [attr.title]="tooltip?.content">
|
||||
<cre-period-input
|
||||
[control]="config.control"
|
||||
[label]="label.content"
|
||||
[hint]="lastUpdated">
|
||||
</cre-period-input>
|
||||
</div>
|
|
@ -12,3 +12,11 @@ cre-file-input
|
|||
|
||||
cre-checkbox-input mat-checkbox
|
||||
margin-top: .5rem
|
||||
|
||||
cre-period-input
|
||||
.mat-form-field-infix
|
||||
display: inherit
|
||||
|
||||
mat-select
|
||||
margin-left: 1em
|
||||
width: 7em !important
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
CreChipComboBoxComponent,
|
||||
CreChipInputComponent,
|
||||
CreComboBoxComponent, CreFileInputComponent,
|
||||
CreInputComponent
|
||||
CreInputComponent, CrePeriodInputComponent
|
||||
} from './inputs'
|
||||
import {MatInputModule} from '@angular/material/input'
|
||||
import {MatIconModule} from '@angular/material/icon'
|
||||
|
@ -15,8 +15,8 @@ import {MatListModule} from '@angular/material/list'
|
|||
import {MatAutocompleteModule} from '@angular/material/autocomplete'
|
||||
import {MatChipsModule} from '@angular/material/chips'
|
||||
import {CreButtonsModule} from '../buttons/buttons.module'
|
||||
import {CreBoolConfig} from '../../../configuration/config'
|
||||
import {MatCheckboxModule} from '@angular/material/checkbox'
|
||||
import {MatSelectModule} from '@angular/material/select'
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
@ -26,8 +26,8 @@ import {MatCheckboxModule} from '@angular/material/checkbox'
|
|||
CreComboBoxComponent,
|
||||
CreChipComboBoxComponent,
|
||||
CreFileInputComponent,
|
||||
CreBoolConfig,
|
||||
CreCheckboxInputComponent
|
||||
CreCheckboxInputComponent,
|
||||
CrePeriodInputComponent
|
||||
],
|
||||
imports: [
|
||||
MatInputModule,
|
||||
|
@ -41,17 +41,18 @@ import {MatCheckboxModule} from '@angular/material/checkbox'
|
|||
FormsModule,
|
||||
CreButtonsModule,
|
||||
MatCheckboxModule,
|
||||
MatSelectModule,
|
||||
],
|
||||
exports: [
|
||||
CreInputComponent,
|
||||
CreComboBoxComponent,
|
||||
CreChipComboBoxComponent,
|
||||
CreChipInputComponent,
|
||||
CreAutocompleteInputComponent,
|
||||
CreFileInputComponent,
|
||||
CreBoolConfig,
|
||||
CreCheckboxInputComponent
|
||||
]
|
||||
exports: [
|
||||
CreInputComponent,
|
||||
CreComboBoxComponent,
|
||||
CreChipComboBoxComponent,
|
||||
CreChipInputComponent,
|
||||
CreAutocompleteInputComponent,
|
||||
CreFileInputComponent,
|
||||
CreCheckboxInputComponent,
|
||||
CrePeriodInputComponent
|
||||
]
|
||||
})
|
||||
export class CreInputsModule {
|
||||
}
|
||||
|
|
|
@ -11,13 +11,13 @@ import {
|
|||
ViewChild,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core'
|
||||
import {AbstractControl, FormControl, ValidationErrors, ValidatorFn} from '@angular/forms'
|
||||
import {AbstractControl, FormControl, ValidationErrors, ValidatorFn, Validators} from '@angular/forms'
|
||||
import {COMMA, ENTER} from '@angular/cdk/keycodes'
|
||||
import {Observable, Subject} from 'rxjs'
|
||||
import {map, takeUntil} from 'rxjs/operators'
|
||||
import {MatChipInputEvent} from '@angular/material/chips'
|
||||
import {MatAutocomplete, MatAutocompleteSelectedEvent} from '@angular/material/autocomplete'
|
||||
import {MatFormFieldAppearance} from '@angular/material/form-field'
|
||||
import {MatOptionSelectionChange} from '@angular/material/core'
|
||||
|
||||
@Component({
|
||||
selector: 'cre-input',
|
||||
|
@ -227,6 +227,51 @@ export class CreFileInputComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'cre-period-input',
|
||||
templateUrl: 'period.html',
|
||||
styleUrls: ['input.sass'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class CrePeriodInputComponent implements OnInit {
|
||||
@Input() control: FormControl
|
||||
@Input() label: string
|
||||
@Input() hint: string | null
|
||||
|
||||
readonly periodTypes = [
|
||||
{value: 'D', label: 'Jours'},
|
||||
{value: 'M', label: 'Mois'},
|
||||
{value: 'Y', label: 'Années'}
|
||||
]
|
||||
readonly inputControl = new FormControl(null, Validators.compose([Validators.required, Validators.min(1), Validators.pattern(/^[0-9]\d*$/)]))
|
||||
readonly selectControl = new FormControl()
|
||||
|
||||
ngOnInit(): void {
|
||||
this.setValuesFromPeriod(this.control.value as string)
|
||||
}
|
||||
|
||||
inputControlUpdate(value: string) {
|
||||
this.updateControl(value, this.selectControl.value)
|
||||
}
|
||||
|
||||
selectControlUpdate(event: any) {
|
||||
this.updateControl(this.inputControl.value, event.value)
|
||||
}
|
||||
|
||||
private updateControl(inputValue: string, selectValue: string) {
|
||||
this.control.setValue('P' + inputValue + selectValue)
|
||||
this.control.markAsDirty()
|
||||
}
|
||||
|
||||
private setValuesFromPeriod(period: string) {
|
||||
const periodTypeChar = period.slice(-1)
|
||||
period = period.slice(1, -1)
|
||||
|
||||
this.selectControl.setValue(periodTypeChar)
|
||||
this.inputControl.setValue(period)
|
||||
}
|
||||
}
|
||||
|
||||
export class ComboBoxEntry {
|
||||
constructor(
|
||||
public key: any,
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<div class="d-flex flex-row justify-content-start">
|
||||
<mat-form-field>
|
||||
<mat-label>{{label}}</mat-label>
|
||||
<input matInput type="number" step="1" [formControl]="inputControl" required (ngModelChange)="inputControlUpdate($event)"/>
|
||||
<mat-hint *ngIf="hint">{{hint}}</mat-hint>
|
||||
<mat-error *ngIf="inputControl.invalid">
|
||||
<p *ngIf="inputControl.errors.required">Une période est requise</p>
|
||||
<p *ngIf="inputControl.errors.min">La période doit être supérieure ou égale à 1</p>
|
||||
<p *ngIf="inputControl.errors.pattern">La période doit être un nombre entier</p>
|
||||
</mat-error>
|
||||
|
||||
<mat-select [formControl]="selectControl" (selectionChange)="selectControlUpdate($event)">
|
||||
<mat-option *ngFor="let type of periodTypes; let i = index" [value]="type.value" >
|
||||
{{type.label}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
apiUrl: 'https://cre.fyloz.dev/api'
|
||||
apiUrl: window.location.href + '/api'
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue