Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinovega committed Sep 7, 2023
1 parent 42815ba commit 2dd7b5f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 deletions daikoku/app/domain/apiEntities.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ const TeamApiPricingDocumentation = (props: TeamApiPricingDocumentationProps) =>
return (
<div>
<div>it's seems that this plan has no documentation setted</div>
<button type='button' onClick={createPlanDoc}>add doc</button>
<button type='button' className='btn btn-outline-primary' onClick={createPlanDoc}>{translate('documentation.add.button.label')}</button>
</div>
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -151,6 +151,7 @@ export const SubscriptionMetadataModal = <T extends IWithTesting>(props: Subscri
}


console.debug({props, apiQuery, planQuery})
if (!!props.api && apiQuery.isLoading || props.plan && planQuery.isLoading) {
return <div className="modal-content"><Spinner /></div>
} else if (!props.api && planQuery.data || (apiQuery.data && !isError(apiQuery.data))) {
Expand Down
3 changes: 2 additions & 1 deletion daikoku/javascript/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion daikoku/javascript/src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 2dd7b5f

Please sign in to comment.