Skip to content

Commit

Permalink
FIX #698
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinovega committed May 28, 2024
1 parent d91df6e commit f6457f1
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 1,388 deletions.
16 changes: 8 additions & 8 deletions daikoku/app/controllers/OtoroshiSettingsController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class OtoroshiSettingsController(
)
)(team, ctx) { team =>
team.authorizedOtoroshiEntities match {
case Some(authorizedEntities) =>
case Some(authorizedEntities) if authorizedEntities.nonEmpty =>
Ok(
JsArray(
ctx.tenant.otoroshiSettings
Expand All @@ -93,7 +93,7 @@ class OtoroshiSettingsController(
.toSeq
)
).future
case None =>
case _ =>
Ok(
JsArray(
ctx.tenant.otoroshiSettings.map(_.toUiPayload()).toSeq
Expand Down Expand Up @@ -269,7 +269,7 @@ class OtoroshiSettingsController(
.getServiceGroups()(settings)
.map { groups =>
team.authorizedOtoroshiEntities match {
case Some(authorizedEntities) =>
case Some(authorizedEntities) if authorizedEntities.nonEmpty =>
authorizedEntities
.find(x => x.otoroshiSettingsId.value == oto) match {
case Some(entities) =>
Expand All @@ -283,7 +283,7 @@ class OtoroshiSettingsController(
Json.obj("error" -> s"Settings $oto not found")
)
}
case None => Ok(groups)
case _ => Ok(groups)
}
}
.recover {
Expand Down Expand Up @@ -333,7 +333,7 @@ class OtoroshiSettingsController(
.getServices()(settings)
.map { services =>
team.authorizedOtoroshiEntities match {
case Some(authorizedEntities) =>
case Some(authorizedEntities) if authorizedEntities.nonEmpty =>
authorizedEntities
.find(x => x.otoroshiSettingsId.value == oto) match {
case Some(entities) =>
Expand All @@ -347,7 +347,7 @@ class OtoroshiSettingsController(
Json.obj("error" -> s"Settings $oto not found")
)
}
case None => Ok(services)
case _ => Ok(services)
}
}
.recover {
Expand All @@ -374,7 +374,7 @@ class OtoroshiSettingsController(
.getRoutes()(settings)
.map { routes =>
team.authorizedOtoroshiEntities match {
case Some(authorizedEntities) =>
case Some(authorizedEntities) if authorizedEntities.nonEmpty =>
authorizedEntities
.find(x => x.otoroshiSettingsId.value == oto) match {
case Some(entities) =>
Expand All @@ -388,7 +388,7 @@ class OtoroshiSettingsController(
Json.obj("error" -> s"Settings $oto not found")
)
}
case None => Ok(routes)
case _ => Ok(routes)
}
}
.recover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const TeamApiInfos = ({
initial="info"
creation={creation}
save={save}
currentTeam={team}
labels={{
previous: translate('Previous'),
skip: translate('Skip'),
Expand All @@ -93,6 +94,7 @@ export const TeamApiInfos = ({
initial="info"
creation={creation}
save={save}
currentTeam={team}
labels={{
previous: translate('Previous'),
skip: translate('Skip'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,7 @@ export const TeamApiPricings = (props: Props) => {
disabled: !creation && !!planForEdition?.otoroshiTarget?.otoroshiSettings,
label: translate('Otoroshi instances'),
optionsFrom: Services.allSimpleOtoroshis(props.tenant._id, props.currentTeam)
.then(r => {console.log({r}); return r})
.then(r => isError(r) ? [] : r),
transformer: (s: IOtoroshiSettings) => ({
label: s.url,
Expand Down Expand Up @@ -1346,6 +1347,7 @@ export const TeamApiPricings = (props: Props) => {
initial="info"
creation={creation}
save={savePlan}
currentTeam={props.currentTeam}
labels={{
previous: translate('Previous'),
skip: translate('Skip'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const TeamApiTesting = <T extends IWithTesting>(props: TeamApiTestingProp
const { translate, Translation } = useContext(I18nContext);
const { confirm, openTestingApikeyModal, openSubMetadataModal } = useContext(ModalContext);




const handleOtoroshiUsage = () => {
const random = nanoid(16);
const newConfig =
Expand Down
12 changes: 9 additions & 3 deletions daikoku/javascript/src/components/utils/multiStepForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { assign, createMachine } from 'xstate';
const { Step } = Steps;

import { Option, Spinner } from '../utils';
import { ITeamSimple } from '../../types';

const customDot = (dot, {
status,
Expand Down Expand Up @@ -41,15 +42,17 @@ export const MultiStepForm = <T extends object>({
creation = false,
getBreadcrumb,
save,
labels
labels,
currentTeam
}: {
value?: T,
steps: Array<IMultistepsformStep<T>>,
initial: string,
creation: boolean,
getBreadcrumb?: (value?: T, element?: JSX.Element) => any,
save: (x: T) => Promise<any>,
labels: any
labels: any,
currentTeam?: ITeamSimple
}) => {
const ref = useRef<FormRef>();

Expand Down Expand Up @@ -246,6 +249,7 @@ export const MultiStepForm = <T extends object>({
send('NEXT', { value })
}}
component={step.component}
currentTeam={currentTeam}
/>
)}
{step.schema && (
Expand Down Expand Up @@ -305,14 +309,16 @@ const ComponentedForm = ({
value,
valid,
component,
reference
reference,
currentTeam
}) => {
return (
<div className="d-flex flex-column flex-grow-1">
{React.createElement(component, {
value,
onChange: (x) => valid(x),
reference,
currentTeam
})}
</div>
);
Expand Down
Loading

0 comments on commit f6457f1

Please sign in to comment.