From 7fac208428aefd109555249b18c47f04c33e71c4 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Wed, 9 Jun 2021 21:06:33 -0400 Subject: [PATCH] #24 ajout du support pour les configurations env.build.time et recipe.approbation.expiration --- .../recipe-info/recipe-info.component.html | 2 +- .../recipe-info/recipe-info.component.ts | 6 +---- .../colors/pages/list/list.component.html | 4 +-- .../colors/pages/list/list.component.ts | 6 +---- .../modules/configuration/config.module.ts | 5 ++-- src/app/modules/configuration/config.ts | 25 +++++++++++++------ src/app/modules/configuration/date.html | 12 +++++++++ src/app/modules/configuration/editor.html | 12 +++++++-- src/app/modules/shared/model/config.model.ts | 4 ++- src/app/modules/shared/model/recipe.model.ts | 8 +----- 10 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 src/app/modules/configuration/date.html diff --git a/src/app/modules/colors/components/recipe-info/recipe-info.component.html b/src/app/modules/colors/components/recipe-info/recipe-info.component.html index ba42447..38985fc 100644 --- a/src/app/modules/colors/components/recipe-info/recipe-info.component.html +++ b/src/app/modules/colors/components/recipe-info/recipe-info.component.html @@ -11,7 +11,7 @@

Non approuvée

-
+

Approbation expirée

diff --git a/src/app/modules/colors/components/recipe-info/recipe-info.component.ts b/src/app/modules/colors/components/recipe-info/recipe-info.component.ts index 6a619d7..44a824d 100644 --- a/src/app/modules/colors/components/recipe-info/recipe-info.component.ts +++ b/src/app/modules/colors/components/recipe-info/recipe-info.component.ts @@ -1,5 +1,5 @@ import {AfterViewInit, Component, Input} from '@angular/core' -import {getRecipeLuma, recipeApprobationExpired, Recipe} from '../../../shared/model/recipe.model' +import {Recipe} from '../../../shared/model/recipe.model' import {formatDate} from '../../../shared/utils/utils' @Component({ @@ -20,8 +20,4 @@ export class RecipeInfoComponent implements AfterViewInit { get approbationDate(): string { return formatDate(this.recipe.approbationDate) } - - get isApprobationExpired(): boolean { - return recipeApprobationExpired(this.recipe) - } } diff --git a/src/app/modules/colors/pages/list/list.component.html b/src/app/modules/colors/pages/list/list.component.html index 6f50f94..84493bf 100644 --- a/src/app/modules/colors/pages/list/list.component.html +++ b/src/app/modules/colors/pages/list/list.component.html @@ -74,10 +74,10 @@ title="Cette recette n'est pas approuvée"> + title="L'approbation de l'échantillon est expirée"> diff --git a/src/app/modules/colors/pages/list/list.component.ts b/src/app/modules/colors/pages/list/list.component.ts index 355023d..637061b 100644 --- a/src/app/modules/colors/pages/list/list.component.ts +++ b/src/app/modules/colors/pages/list/list.component.ts @@ -3,7 +3,7 @@ import {ErrorHandlingComponent} from '../../../shared/components/subscribing.com import {RecipeService} from '../../services/recipe.service' import {Permission} from '../../../shared/model/user' import {AccountService} from '../../../accounts/services/account.service' -import {getRecipeLuma, Recipe, recipeApprobationExpired} from '../../../shared/model/recipe.model' +import {getRecipeLuma, Recipe} from '../../../shared/model/recipe.model' import {ActivatedRoute, Router} from '@angular/router' import {ErrorService} from '../../../shared/service/error.service' import {AppState} from '../../../shared/app-state' @@ -65,10 +65,6 @@ export class ListComponent extends ErrorHandlingComponent { .forEach(r => this.recipeMatchesSearchQuery(r)) } - isRecipeApprobationExpired(recipe: Recipe): boolean { - return recipeApprobationExpired(recipe) - } - isCompanyHidden(companyRecipes: Recipe[]): boolean { return (this.searchQuery && this.searchQuery.length > 0) && companyRecipes.map(r => this.hiddenRecipes[r.id]).filter(r => !r).length <= 0 } diff --git a/src/app/modules/configuration/config.module.ts b/src/app/modules/configuration/config.module.ts index 10748ea..8127ec2 100644 --- a/src/app/modules/configuration/config.module.ts +++ b/src/app/modules/configuration/config.module.ts @@ -7,7 +7,7 @@ import { CreImageConfig, CreConfigList, CreConfigActions, - CreConfigTooltip, CrePeriodConfig, CreBoolConfig + CreConfigTooltip, CrePeriodConfig, CreBoolConfig, CreDateConfig } from './config' import {SharedModule} from '../shared/shared.module' import {CreInputsModule} from '../shared/components/inputs/inputs.module' @@ -25,7 +25,8 @@ import {CreButtonsModule} from '../shared/components/buttons/buttons.module' CreConfigList, CreConfigActions, CreBoolConfig, - CrePeriodConfig + CrePeriodConfig, + CreDateConfig ], imports: [ SharedModule, diff --git a/src/app/modules/configuration/config.ts b/src/app/modules/configuration/config.ts index 63ac8e5..a40e7de 100644 --- a/src/app/modules/configuration/config.ts +++ b/src/app/modules/configuration/config.ts @@ -15,7 +15,7 @@ import {Config} from '../shared/model/config.model' import {ErrorHandlingComponent, SubscribingComponent} from '../shared/components/subscribing.component' import {ErrorService} from '../shared/service/error.service' import {ActivatedRoute, Router} from '@angular/router' -import {formatDateTime, getFileUrl, readFile} from '../shared/utils/utils' +import {formatDate, formatDateTime, getFileUrl, readFile} from '../shared/utils/utils' import {FormControl, Validators} from '@angular/forms' import {ConfirmBoxComponent} from '../shared/components/confirm-box/confirm-box.component' import {environment} from '../../../environments/environment' @@ -116,10 +116,6 @@ export class CreConfig extends SubscribingComponent { } } - get configuredImageUrl(): string { - return getFileUrl(this.configuration.content) - } - get lastUpdated(): string { return 'Dernière mise à jour: ' + formatDateTime(this.configuration.lastUpdated) } @@ -151,8 +147,9 @@ export class CreImageConfig extends CreConfig { readFile(file, (content) => this.updatedImage = content) } - get imageUrl(): string { - return `${environment.apiUrl}/file?path=${this.configuration.content}` + + get configuredImageUrl(): string { + return getFileUrl(this.configuration.content) } } @@ -172,7 +169,17 @@ export class CreBoolConfig extends CreConfig { templateUrl: 'period.html' }) export class CrePeriodConfig extends CreConfig { +} +@Component({ + selector: 'cre-date-config', + templateUrl: 'date.html' +}) +export class CreDateConfig extends CreConfig { + setConfig(config: Config) { + super.setConfig(config); + this.config.control.setValue(formatDate(config.content)) + } } @Component({ @@ -191,9 +198,11 @@ export class CreConfigEditor extends ErrorHandlingComponent { DATABASE_USER: Config.DATABASE_USER, DATABASE_PASSWORD: Config.DATABASE_PASSWORD, DATABASE_VERSION: Config.DATABASE_VERSION, + RECIPE_APPROBATION_EXPIRATION: Config.RECIPE_APPROBATION_EXPIRATION, 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, + BACKEND_BUILD_VERSION: Config.BACKEND_BUILD_VERSION, + BACKEND_BUILD_TIME: Config.BACKEND_BUILD_TIME, JAVA_VERSION: Config.JAVA_VERSION, OPERATING_SYSTEM: Config.OPERATING_SYSTEM } diff --git a/src/app/modules/configuration/date.html b/src/app/modules/configuration/date.html new file mode 100644 index 0000000..83e8af4 --- /dev/null +++ b/src/app/modules/configuration/date.html @@ -0,0 +1,12 @@ +
+ + +
diff --git a/src/app/modules/configuration/editor.html b/src/app/modules/configuration/editor.html index a5fd3cf..66cd181 100644 --- a/src/app/modules/configuration/editor.html +++ b/src/app/modules/configuration/editor.html @@ -41,8 +41,12 @@ - Kits de retouche + Données + + Période d'expiration de l'approbation de l'échantillon des recettes + + Période d'expiration des kits de retouches complets @@ -87,10 +91,14 @@ Version de la base de données - + Version de Color Recipes Explorer + + Date de compilation de Color Recipes Explorer + + Version de Java diff --git a/src/app/modules/shared/model/config.model.ts b/src/app/modules/shared/model/config.model.ts index 6144c2a..642a736 100644 --- a/src/app/modules/shared/model/config.model.ts +++ b/src/app/modules/shared/model/config.model.ts @@ -7,10 +7,12 @@ export class Config { static readonly DATABASE_USER = 'database.user' static readonly DATABASE_PASSWORD = 'database.password' static readonly DATABASE_VERSION = 'database.version.supported' + static readonly RECIPE_APPROBATION_EXPIRATION = 'recipe.approbation.expiration' static readonly TOUCH_UP_KIT_CACHE_PDF = 'touchupkit.pdf.cache' static readonly TOUCH_UP_KIT_EXPIRATION = 'touchupkit.expiration' static readonly EMERGENCY_MODE = 'env.emergency' - static readonly APP_VERSION = 'env.version' + static readonly BACKEND_BUILD_VERSION = 'env.build.version' + static readonly BACKEND_BUILD_TIME = 'env.build.time' static readonly JAVA_VERSION = 'env.java.version' static readonly OPERATING_SYSTEM = 'env.os' diff --git a/src/app/modules/shared/model/recipe.model.ts b/src/app/modules/shared/model/recipe.model.ts index b1137c4..2fb9e52 100644 --- a/src/app/modules/shared/model/recipe.model.ts +++ b/src/app/modules/shared/model/recipe.model.ts @@ -12,6 +12,7 @@ export class Recipe { public gloss: number, public sample: number, public approbationDate: string, + public approbationExpired: boolean, public remark: string, public company: Company, public mixes: Mix[], @@ -124,10 +125,3 @@ export function getRecipeLuma(recipe: Recipe): number { return 0.2126 * r + 0.7152 * g + 0.0722 * b // per ITU-R BT.709 } - -// TODO hard-coded for prototype -export function recipeApprobationExpired(recipe: Recipe): boolean { - // @ts-ignore - return recipe.approbationDate && LocalDate.parse(recipe.approbationDate).year() < new Date().getFullYear() - 4 -} -