From 2dd7b5f4042e376bbc09d9403818aab29936d313 Mon Sep 17 00:00:00 2001 From: Quentin Aubert Date: Thu, 7 Sep 2023 11:59:36 +0200 Subject: [PATCH] some fixes --- daikoku/app/domain/apiEntities.scala | 6 ++++-- .../adminbackoffice/tenants/forms/DisplayForm.tsx | 2 +- .../src/components/backoffice/apis/TeamApiPricings.tsx | 2 +- .../src/contexts/modals/SubscriptionMetadataModal.tsx | 3 ++- daikoku/javascript/src/locales/en/translation.json | 3 ++- daikoku/javascript/src/locales/fr/translation.json | 3 ++- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/daikoku/app/domain/apiEntities.scala b/daikoku/app/domain/apiEntities.scala index 6c125ab6..fdaf57b2 100644 --- a/daikoku/app/domain/apiEntities.scala +++ b/daikoku/app/domain/apiEntities.scala @@ -253,9 +253,11 @@ sealed trait UsagePlan { def addDocumentationPages(pages: Seq[ApiDocumentationDetailPage]): UsagePlan def removeSubscriptionStep(predicate: ValidationStep => Boolean): UsagePlan def checkCustomName(tenant: Tenant, plans: Seq[UsagePlan])(implicit ec: ExecutionContext): EitherT[Future, AppError, Unit] = { - val existingNames = plans.collect(_.customName) + val existingNames = plans + .filter(_.id != id) + .collect(_.customName) .collect { case Some(name) => name } - //TODO: check conflict with extisting name in case of creation + //FIXME: check conflict with extisting name in case of creation but tenant.display match { case TenantDisplay.Environment => EitherT.cond[Future](customName.exists(name => tenant.environments.contains(name) && !existingNames.contains(name)), (), AppError.EntityConflict("Plan custom name")) diff --git a/daikoku/javascript/src/components/adminbackoffice/tenants/forms/DisplayForm.tsx b/daikoku/javascript/src/components/adminbackoffice/tenants/forms/DisplayForm.tsx index b91fbca5..c89e49d3 100644 --- a/daikoku/javascript/src/components/adminbackoffice/tenants/forms/DisplayForm.tsx +++ b/daikoku/javascript/src/components/adminbackoffice/tenants/forms/DisplayForm.tsx @@ -31,7 +31,7 @@ export const DisplayForm = (props: UpdateFormProps) => { type: type.string, array: true, label: translate('display-mode.environments.label'), - visible: ({ rawValues }) => rawValues.isPrivate, + visible: ({ rawValues }) => rawValues.display === 'environment', constraints: [ constraints.required(translate('constraints.required.value')) ], diff --git a/daikoku/javascript/src/components/backoffice/apis/TeamApiPricings.tsx b/daikoku/javascript/src/components/backoffice/apis/TeamApiPricings.tsx index a493f9e2..bfee69b4 100644 --- a/daikoku/javascript/src/components/backoffice/apis/TeamApiPricings.tsx +++ b/daikoku/javascript/src/components/backoffice/apis/TeamApiPricings.tsx @@ -1871,7 +1871,7 @@ const TeamApiPricingDocumentation = (props: TeamApiPricingDocumentationProps) => return (
it's seems that this plan has no documentation setted
- +
) } else { diff --git a/daikoku/javascript/src/contexts/modals/SubscriptionMetadataModal.tsx b/daikoku/javascript/src/contexts/modals/SubscriptionMetadataModal.tsx index 2ebbfe7f..fa12d9cc 100644 --- a/daikoku/javascript/src/contexts/modals/SubscriptionMetadataModal.tsx +++ b/daikoku/javascript/src/contexts/modals/SubscriptionMetadataModal.tsx @@ -6,7 +6,7 @@ import { useQuery } from '@tanstack/react-query'; import { Option, Spinner } from '../../components/utils'; import { I18nContext } from '../../core'; import * as Services from '../../services'; -import { IApi, isError, ITestingConfig, IUsagePlan, IWithTesting } from '../../types'; +import { IApi, isApi, isError, ITestingConfig, IUsagePlan, IWithTesting } from '../../types'; import { IBaseModalProps, SubscriptionMetadataModalProps } from './types'; export type OverwriteSubscriptionData = { @@ -151,6 +151,7 @@ export const SubscriptionMetadataModal = (props: Subscri } + console.debug({props, apiQuery, planQuery}) if (!!props.api && apiQuery.isLoading || props.plan && planQuery.isLoading) { return
} else if (!props.api && planQuery.data || (apiQuery.data && !isError(apiQuery.data))) { diff --git a/daikoku/javascript/src/locales/en/translation.json b/daikoku/javascript/src/locales/en/translation.json index 4e45a8f7..a22f8d98 100644 --- a/daikoku/javascript/src/locales/en/translation.json +++ b/daikoku/javascript/src/locales/en/translation.json @@ -1357,5 +1357,6 @@ "pricing.default.env.btn.label": "Default environment", "pricing.clone.env.btn.label": "Duplicate environment", "pricing.edit.env.btn.label": "Edit environment", - "pricing.delete.env.btn.label": "Delete environment" + "pricing.delete.env.btn.label": "Delete environment", + "documentation.add.button.label": "Create documentation" } \ No newline at end of file diff --git a/daikoku/javascript/src/locales/fr/translation.json b/daikoku/javascript/src/locales/fr/translation.json index 90046146..8fb44f7c 100644 --- a/daikoku/javascript/src/locales/fr/translation.json +++ b/daikoku/javascript/src/locales/fr/translation.json @@ -1361,5 +1361,6 @@ "pricing.clone.env.btn.label": "Dupliquer l'environnement", "pricing.edit.env.btn.label": "Modifier l'environnement", "pricing.delete.env.btn.label": "Supprimer l'environnement", - "Alert": "Alerte" + "Alert": "Alerte", + "documentation.add.button.label": "Initialiser la documentation" } \ No newline at end of file