Skip to content

Commit f6457f1

Browse files
committed
FIX #698
1 parent d91df6e commit f6457f1

File tree

6 files changed

+61
-1388
lines changed

6 files changed

+61
-1388
lines changed

daikoku/app/controllers/OtoroshiSettingsController.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class OtoroshiSettingsController(
8080
)
8181
)(team, ctx) { team =>
8282
team.authorizedOtoroshiEntities match {
83-
case Some(authorizedEntities) =>
83+
case Some(authorizedEntities) if authorizedEntities.nonEmpty =>
8484
Ok(
8585
JsArray(
8686
ctx.tenant.otoroshiSettings
@@ -93,7 +93,7 @@ class OtoroshiSettingsController(
9393
.toSeq
9494
)
9595
).future
96-
case None =>
96+
case _ =>
9797
Ok(
9898
JsArray(
9999
ctx.tenant.otoroshiSettings.map(_.toUiPayload()).toSeq
@@ -269,7 +269,7 @@ class OtoroshiSettingsController(
269269
.getServiceGroups()(settings)
270270
.map { groups =>
271271
team.authorizedOtoroshiEntities match {
272-
case Some(authorizedEntities) =>
272+
case Some(authorizedEntities) if authorizedEntities.nonEmpty =>
273273
authorizedEntities
274274
.find(x => x.otoroshiSettingsId.value == oto) match {
275275
case Some(entities) =>
@@ -283,7 +283,7 @@ class OtoroshiSettingsController(
283283
Json.obj("error" -> s"Settings $oto not found")
284284
)
285285
}
286-
case None => Ok(groups)
286+
case _ => Ok(groups)
287287
}
288288
}
289289
.recover {
@@ -333,7 +333,7 @@ class OtoroshiSettingsController(
333333
.getServices()(settings)
334334
.map { services =>
335335
team.authorizedOtoroshiEntities match {
336-
case Some(authorizedEntities) =>
336+
case Some(authorizedEntities) if authorizedEntities.nonEmpty =>
337337
authorizedEntities
338338
.find(x => x.otoroshiSettingsId.value == oto) match {
339339
case Some(entities) =>
@@ -347,7 +347,7 @@ class OtoroshiSettingsController(
347347
Json.obj("error" -> s"Settings $oto not found")
348348
)
349349
}
350-
case None => Ok(services)
350+
case _ => Ok(services)
351351
}
352352
}
353353
.recover {
@@ -374,7 +374,7 @@ class OtoroshiSettingsController(
374374
.getRoutes()(settings)
375375
.map { routes =>
376376
team.authorizedOtoroshiEntities match {
377-
case Some(authorizedEntities) =>
377+
case Some(authorizedEntities) if authorizedEntities.nonEmpty =>
378378
authorizedEntities
379379
.find(x => x.otoroshiSettingsId.value == oto) match {
380380
case Some(entities) =>
@@ -388,7 +388,7 @@ class OtoroshiSettingsController(
388388
Json.obj("error" -> s"Settings $oto not found")
389389
)
390390
}
391-
case None => Ok(routes)
391+
case _ => Ok(routes)
392392
}
393393
}
394394
.recover {

daikoku/javascript/src/components/backoffice/apis/TeamApiInfos.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const TeamApiInfos = ({
7777
initial="info"
7878
creation={creation}
7979
save={save}
80+
currentTeam={team}
8081
labels={{
8182
previous: translate('Previous'),
8283
skip: translate('Skip'),
@@ -93,6 +94,7 @@ export const TeamApiInfos = ({
9394
initial="info"
9495
creation={creation}
9596
save={save}
97+
currentTeam={team}
9698
labels={{
9799
previous: translate('Previous'),
98100
skip: translate('Skip'),

daikoku/javascript/src/components/backoffice/apis/TeamApiPricings.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ export const TeamApiPricings = (props: Props) => {
918918
disabled: !creation && !!planForEdition?.otoroshiTarget?.otoroshiSettings,
919919
label: translate('Otoroshi instances'),
920920
optionsFrom: Services.allSimpleOtoroshis(props.tenant._id, props.currentTeam)
921+
.then(r => {console.log({r}); return r})
921922
.then(r => isError(r) ? [] : r),
922923
transformer: (s: IOtoroshiSettings) => ({
923924
label: s.url,
@@ -1346,6 +1347,7 @@ export const TeamApiPricings = (props: Props) => {
13461347
initial="info"
13471348
creation={creation}
13481349
save={savePlan}
1350+
currentTeam={props.currentTeam}
13491351
labels={{
13501352
previous: translate('Previous'),
13511353
skip: translate('Skip'),

daikoku/javascript/src/components/backoffice/apis/TeamApiTesting.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export const TeamApiTesting = <T extends IWithTesting>(props: TeamApiTestingProp
2222
const { translate, Translation } = useContext(I18nContext);
2323
const { confirm, openTestingApikeyModal, openSubMetadataModal } = useContext(ModalContext);
2424

25+
26+
27+
2528
const handleOtoroshiUsage = () => {
2629
const random = nanoid(16);
2730
const newConfig =

daikoku/javascript/src/components/utils/multiStepForm.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { assign, createMachine } from 'xstate';
88
const { Step } = Steps;
99

1010
import { Option, Spinner } from '../utils';
11+
import { ITeamSimple } from '../../types';
1112

1213
const customDot = (dot, {
1314
status,
@@ -41,15 +42,17 @@ export const MultiStepForm = <T extends object>({
4142
creation = false,
4243
getBreadcrumb,
4344
save,
44-
labels
45+
labels,
46+
currentTeam
4547
}: {
4648
value?: T,
4749
steps: Array<IMultistepsformStep<T>>,
4850
initial: string,
4951
creation: boolean,
5052
getBreadcrumb?: (value?: T, element?: JSX.Element) => any,
5153
save: (x: T) => Promise<any>,
52-
labels: any
54+
labels: any,
55+
currentTeam?: ITeamSimple
5356
}) => {
5457
const ref = useRef<FormRef>();
5558

@@ -246,6 +249,7 @@ export const MultiStepForm = <T extends object>({
246249
send('NEXT', { value })
247250
}}
248251
component={step.component}
252+
currentTeam={currentTeam}
249253
/>
250254
)}
251255
{step.schema && (
@@ -305,14 +309,16 @@ const ComponentedForm = ({
305309
value,
306310
valid,
307311
component,
308-
reference
312+
reference,
313+
currentTeam
309314
}) => {
310315
return (
311316
<div className="d-flex flex-column flex-grow-1">
312317
{React.createElement(component, {
313318
value,
314319
onChange: (x) => valid(x),
315320
reference,
321+
currentTeam
316322
})}
317323
</div>
318324
);

0 commit comments

Comments
 (0)