From d650b0c47c3c4e2d5db9c31e145dcc22baecbd3b Mon Sep 17 00:00:00 2001 From: zwiterrion Date: Wed, 22 Jan 2025 16:48:33 +0100 Subject: [PATCH] wip --- .../src/components/nginputs/inputs.js | 2 +- .../javascript/src/pages/ApiEditor/Sidebar.js | 2 +- .../javascript/src/pages/ApiEditor/index.js | 104 ++++++++++++++---- .../javascript/src/pages/ApiEditor/index.scss | 2 +- 4 files changed, 86 insertions(+), 24 deletions(-) diff --git a/otoroshi/javascript/src/components/nginputs/inputs.js b/otoroshi/javascript/src/components/nginputs/inputs.js index 79c9b697a..6c194f8fb 100644 --- a/otoroshi/javascript/src/components/nginputs/inputs.js +++ b/otoroshi/javascript/src/components/nginputs/inputs.js @@ -240,7 +240,7 @@ export function LabelAndInput(_props) { const ngOptions = _props.ngOptions || props.ngOptions || _props.rawSchema?.props?.ngOptions || {}; const labelColumn = _props.labelColumn || props.labelColumn || 2; - if (ngOptions.spread && !_props.readOnly) { + if ((ngOptions.spread && !_props.readOnly) || _props.raw) { return _props.children; } diff --git a/otoroshi/javascript/src/pages/ApiEditor/Sidebar.js b/otoroshi/javascript/src/pages/ApiEditor/Sidebar.js index 16d6ad9e0..e87f80734 100644 --- a/otoroshi/javascript/src/pages/ApiEditor/Sidebar.js +++ b/otoroshi/javascript/src/pages/ApiEditor/Sidebar.js @@ -74,7 +74,7 @@ export default (props) => { return currentTab === tab ? 'active' : null }; - if (location.pathname.endsWith('/new')) return null; + // if (location.pathname.endsWith('/new')) return null; return (
( export default function ApiEditor(props) { return
+ @@ -161,7 +162,6 @@ function RouteDesigner(props) { } return - -
- + history.push(`/apis/${params.apiId}/consumers/${item.id}/edit`)} @@ -523,6 +522,30 @@ function NewConsumer(props) { } }, + status: { + type: 'dots', + label: "Status", + props: { + options: ['staging', 'published', 'deprecated', 'closed'], + }, + }, + description: { + renderer: ({ rootValue }) => { + const descriptions = { + staging: "This is the initial phase of a plan, where it exists in draft mode. You can configure the plan, but it won’t be visible or accessible to users", + published: "When your plan is finalized, you can publish it to allow API consumers to view and subscribe to it via the APIM Portal. Once published, consumers can use the API through the plan. Published plans remain editable", + deprecated: "Deprecating a plan makes it unavailable on the APIM Portal, preventing new subscriptions. However, existing subscriptions remain unaffected, ensuring no disruption to current API consumers", + closed: "Closing a plan terminates all associated subscriptions, and this action is irreversible. API consumers previously subscribed to the plan will no longer have access to the API" + }; + + return
+
+ } + }, settings: { type: 'json', label: 'Plan configuration' @@ -543,7 +566,7 @@ function NewConsumer(props) { } return - +
} }, + status: { + type: 'dots', + label: "Status", + props: { + options: ['staging', 'published', 'deprecated', 'closed'], + }, + }, + description: { + renderer: ({ rootValue }) => { + const descriptions = { + staging: "This is the initial phase of a plan, where it exists in draft mode. You can configure the plan, but it won’t be visible or accessible to users", + published: "When your plan is finalized, you can publish it to allow API consumers to view and subscribe to it via the APIM Portal. Once published, consumers can use the API through the plan. Published plans remain editable", + deprecated: "Deprecating a plan makes it unavailable on the APIM Portal, preventing new subscriptions. However, existing subscriptions remain unaffected, ensuring no disruption to current API consumers", + closed: "Closing a plan terminates all associated subscriptions, and this action is irreversible. API consumers previously subscribed to the plan will no longer have access to the API" + }; + + return
+
+ } + }, settings: { type: 'json', label: 'Plan configuration' @@ -624,11 +671,11 @@ function ConsumerDesigner(props) { return item }) }) - .then(() => history.push(`/apis/${params.apiId}/consumers`)) + .then(() => history.push(`/apis/${params.apiId}`)) } return - + - +
history.push(`/apis/${params.apiId}/routes/${item.id}/edit`)} @@ -767,7 +814,7 @@ function Backends(props) { const fields = [] return - +
history.push(`/apis/${params.apiId}/backends/${item.id}/edit`)} @@ -844,7 +891,7 @@ function NewBackend(props) { }); return - + { props.setSidebarContent(); return () => props.setSidebarContent(null) - }, []) + }, [params]) return null } @@ -1101,7 +1148,7 @@ function Apis(props) { .template() return <> - +
- +
- +
{ props.setTitle("Dashboard") @@ -1333,13 +1381,14 @@ function Dashboard(props) { const hasCreateFlow = api && api.flows.length > 0 const hasCreateRoute = api && api.routes.length > 0 const hasCreateConsumer = api && api.consumers.length > 0 + const showGettingStarted = !hasCreateFlow || !hasCreateConsumer || !hasCreateRoute return
- + {api &&
- + {showGettingStarted && {hasCreateFlow && hasCreateRoute && !hasCreateConsumer && { }} text="Create" />} />} - + } {!api.health &&

API Health will appear here

} @@ -1403,7 +1452,11 @@ function Dashboard(props) { {hasCreateConsumer && } /> + actions={