This is an automated email from the ASF dual-hosted git repository.
fantonangeli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new 5f8da3ec9f9 kie-tools#2696 [SonataFlow Management Console] Make the
console read-only (#3208)
5f8da3ec9f9 is described below
commit 5f8da3ec9f97d6fab9edf2b36fad1f152b46bd95
Author: Kumar Aditya Raj <[email protected]>
AuthorDate: Thu Jul 31 14:05:37 2025 +0530
kie-tools#2696 [SonataFlow Management Console] Make the console read-only
(#3208)
Co-authored-by: kumaradityaraj <[email protected]>
---
.../ManagementConsole/ManagementConsole.tsx | 17 +--
.../ManagementConsoleNav/ManagementConsoleNav.tsx | 12 --
.../ManagementConsoleRoutes.tsx | 12 --
.../TriggerCloudEventPage.tsx | 118 ---------------
.../WorkflowDefinitionsPage.tsx | 99 -------------
.../pages/WorkflowFormPage/WorkflowFormPage.tsx | 160 ---------------------
.../src/navigation/Routes.ts | 8 --
7 files changed, 7 insertions(+), 419 deletions(-)
diff --git
a/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsole/ManagementConsole.tsx
b/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsole/ManagementConsole.tsx
index 4b0cc877017..88333198f46 100644
---
a/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsole/ManagementConsole.tsx
+++
b/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsole/ManagementConsole.tsx
@@ -26,7 +26,6 @@ import {
UserContext,
} from "@kie-tools/runtime-tools-components/dist/contexts/KogitoAppContext";
import { WorkflowListContextProviderWithApolloClient } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/WorkflowList";
-import { WorkflowDefinitionListContextProviderWithApolloClient } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/WorkflowDefinitionList";
import { WorkflowFormContextProvider } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/WorkflowForm";
import { WorkflowDetailsContextProviderWithApolloClient } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/WorkflowDetails";
import { CloudEventFormContextProvider } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/CloudEventForm";
@@ -47,15 +46,13 @@ const ManagementConsole: React.FC<IOwnProps> = ({
apolloClient, userContext, chi
<CloudEventFormContextProvider>
<WorkflowDetailsContextProviderWithApolloClient
apolloClient={apolloClient}>
<WorkflowListContextProviderWithApolloClient
apolloClient={apolloClient}>
- <WorkflowDefinitionListContextProviderWithApolloClient
apolloClient={apolloClient}>
- <WorkflowFormContextProvider>
- <Router>
- <Routes>
- <Route path="*"
element={<BasePage>{children}</BasePage>} />
- </Routes>
- </Router>
- </WorkflowFormContextProvider>
- </WorkflowDefinitionListContextProviderWithApolloClient>
+ <WorkflowFormContextProvider>
+ <Router>
+ <Routes>
+ <Route path="*"
element={<BasePage>{children}</BasePage>} />
+ </Routes>
+ </Router>
+ </WorkflowFormContextProvider>
</WorkflowListContextProviderWithApolloClient>
</WorkflowDetailsContextProviderWithApolloClient>
</CloudEventFormContextProvider>
diff --git
a/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsoleNav/ManagementConsoleNav.tsx
b/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsoleNav/ManagementConsoleNav.tsx
index b43619a0760..9a60bd2c9ce 100644
---
a/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsoleNav/ManagementConsoleNav.tsx
+++
b/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsoleNav/ManagementConsoleNav.tsx
@@ -42,18 +42,6 @@ const ManagementConsoleNav: React.FC<IOwnProps> = ({
pathname }) => {
Workflow Instances
</Link>
</NavItem>
- <NavItem
- key={"workflow-definitions-nav"}
- isActive={pathname ===
routes.runtimeToolsWorkflowDefinitions.path({})}
- ouiaId="workflow-definitions"
- >
- <Link
- to={routes.runtimeToolsWorkflowDefinitions.path({})}
- {...ouiaAttribute("data-ouia-navigation-name",
"workflow-definitions")}
- >
- Workflow Definitions
- </Link>
- </NavItem>
<NavItem key={"monitoring-nav"} isActive={pathname ===
routes.monitoring.path({})} ouiaId="monitoring">
<Link to={routes.monitoring.path({})}
{...ouiaAttribute("data-ouia-navigation-name", "monitoring")}>
Monitoring
diff --git
a/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsoleRoutes/ManagementConsoleRoutes.tsx
b/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsoleRoutes/ManagementConsoleRoutes.tsx
index 7b5a9fe0fcd..4f696e90dcd 100644
---
a/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsoleRoutes/ManagementConsoleRoutes.tsx
+++
b/packages/sonataflow-management-console-webapp/src/components/console/ManagementConsoleRoutes/ManagementConsoleRoutes.tsx
@@ -19,12 +19,9 @@
import * as React from "react";
import { Navigate, Route, Routes } from "react-router-dom";
import { routes } from "../../../navigation/Routes";
-import { TriggerCloudEventPage } from
"../../pages/TriggerCloudEventPage/TriggerCloudEventPage";
import MonitoringPage from "../../pages/MonitoringPage/MonitoringPage";
-import { WorkflowDefinitionsPage } from
"../../pages/WorkflowDefinitionsPage/WorkflowDefinitionsPage";
import { WorkflowInstancesPage } from
"../../pages/WorkflowInstancesPage/WorkflowInstancesPage";
import { WorkflowDetailsPage } from
"../../pages/WorkflowDetailsPage/WorkflowDetailsPage";
-import { WorkflowFormPage } from
"../../pages/WorkflowFormPage/WorkflowFormPage";
const ManagementConsoleRoutes: React.FC = () => {
return (
@@ -34,19 +31,10 @@ const ManagementConsoleRoutes: React.FC = () => {
element={<Navigate replace
to={routes.runtimeToolsWorkflowInstances.path({})} />}
/>
<Route path={routes.runtimeToolsWorkflowInstances.path({})}
element={<WorkflowInstancesPage />} />
- <Route path={routes.runtimeToolsWorkflowDefinitions.path({})}
element={<WorkflowDefinitionsPage />} />
<Route
path={routes.runtimeToolsWorkflowDetails.path({ workflowId:
":workflowId" })}
element={<WorkflowDetailsPage />}
/>
- <Route
- path={routes.runtimeToolsTriggerCloudEventForWorkflowDefinition.path({
workflowName: ":workflowName" })}
- element={<TriggerCloudEventPage />}
- />
- <Route
- path={routes.runtimeToolsWorkflowForm.path({ workflowName:
":workflowName" })}
- element={<WorkflowFormPage />}
- />
<Route
path={routes.monitoring.path({})}
element={<MonitoringPage dataIndexUrl={(window as
any)["DATA_INDEX_ENDPOINT"]} />}
diff --git
a/packages/sonataflow-management-console-webapp/src/components/pages/TriggerCloudEventPage/TriggerCloudEventPage.tsx
b/packages/sonataflow-management-console-webapp/src/components/pages/TriggerCloudEventPage/TriggerCloudEventPage.tsx
deleted file mode 100644
index 10e01566d02..00000000000
---
a/packages/sonataflow-management-console-webapp/src/components/pages/TriggerCloudEventPage/TriggerCloudEventPage.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import React, { useCallback } from "react";
-import { Page, PageSection } from
"@patternfly/react-core/dist/js/components/Page";
-import { Text, TextContent, TextVariants } from
"@patternfly/react-core/dist/js/components/Text";
-import { CloudEventFormContainer } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/CloudEventFormContainer";
-import { Alert, AlertActionCloseButton } from
"@patternfly/react-core/dist/js/components/Alert";
-import { useGlobalAlert } from "../../../alerts/GlobalAlertsContext";
-import { WorkflowDefinition } from
"@kie-tools/runtime-tools-swf-gateway-api/dist/types";
-import { useLocation } from "react-router-dom";
-
-const PAGE_TITLE = "Trigger Cloud Event";
-const KUBESMARTS_CLOUD_SOURCE = "/local/kubesmarts";
-
-export function TriggerCloudEventPage() {
- const location = useLocation();
- const workflowDefinition: WorkflowDefinition = (location.state as
any)["workflowDefinition"];
-
- const triggerEventSuccessAlert = useGlobalAlert<{ message: string }>(
- useCallback(({ close }, { message }) => {
- return (
- <Alert
- className="pf-v5-u-mb-md"
- variant="success"
- title={message}
- aria-live="polite"
- actionClose={<AlertActionCloseButton onClose={close} />}
- />
- );
- }, []),
- { durationInSeconds: 5 }
- );
-
- const startWorkflowErrorAlert = useGlobalAlert<{ message: string }>(
- useCallback(({ close }, { message }) => {
- return (
- <Alert
- className="pf-v5-u-mb-md"
- variant="danger"
- title={
- <>
- Something went wrong while triggering your workflow.
- <br />
- {`Reason: ${message}`}
- </>
- }
- aria-live="polite"
- data-testid="alert-upload-error"
- actionClose={<AlertActionCloseButton onClose={close} />}
- />
- );
- }, []),
- { durationInSeconds: 5 }
- );
-
- const onStartWorkflowError = useCallback(
- (error) => {
- const message = error?.message || "Unknown error. More details in the
developer tools console.";
- startWorkflowErrorAlert.show({ message });
- },
- [startWorkflowErrorAlert]
- );
-
- const onTriggerEventSuccessAlert = useCallback(() => {
- triggerEventSuccessAlert.show({ message: "The cloud event has been
successfully triggered." });
- }, [triggerEventSuccessAlert]);
-
- const onTriggerStartCloudEventSuccess = useCallback(
- (businessKey: string) => {
- triggerEventSuccessAlert.show({
- message: `A workflow with business key ${businessKey} has been
successfully triggered.`,
- });
- },
- [triggerEventSuccessAlert]
- );
-
- return (
- <Page>
- <PageSection variant={"light"}>
- <TextContent>
- <Text component={TextVariants.h1}>{PAGE_TITLE}</Text>
- <Text component={TextVariants.p}>
- Trigger a cloud event to start new workflow instances or to send
HTTP Cloud Events to active workflow
- instances that are waiting for an event to advance.
- </Text>
- </TextContent>
- </PageSection>
-
- <PageSection isFilled aria-label="trigger-cloud-event-section">
- <CloudEventFormContainer
- isTriggerNewInstance={true}
- cloudEventSource={KUBESMARTS_CLOUD_SOURCE}
- onStartWorkflowError={onStartWorkflowError}
- onTriggerCloudEventSuccess={onTriggerEventSuccessAlert}
- onTriggerStartCloudEventSuccess={onTriggerStartCloudEventSuccess}
- serviceUrl={workflowDefinition.serviceUrl}
- />
- </PageSection>
- </Page>
- );
-}
diff --git
a/packages/sonataflow-management-console-webapp/src/components/pages/WorkflowDefinitionsPage/WorkflowDefinitionsPage.tsx
b/packages/sonataflow-management-console-webapp/src/components/pages/WorkflowDefinitionsPage/WorkflowDefinitionsPage.tsx
deleted file mode 100644
index 3043bce0bb4..00000000000
---
a/packages/sonataflow-management-console-webapp/src/components/pages/WorkflowDefinitionsPage/WorkflowDefinitionsPage.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import React, { useCallback } from "react";
-import { WorkflowDefinitionListContainer } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/WorkflowDefinitionListContainer";
-import { Card } from "@patternfly/react-core/dist/esm/components/Card";
-import { Page, PageSection } from
"@patternfly/react-core/dist/js/components/Page";
-import { Text, TextContent, TextVariants } from
"@patternfly/react-core/dist/js/components/Text";
-import { useNavigate } from "react-router-dom";
-import { routes } from "../../../navigation/Routes";
-import { WorkflowDefinition } from
"@kie-tools/runtime-tools-swf-gateway-api/dist/types";
-import { CloudEventPageSource } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/CloudEventForm";
-
-const PAGE_TITLE = "Workflow Definitions";
-
-export function WorkflowDefinitionsPage() {
- const navigate = useNavigate();
-
- const onOpenWorkflowForm = useCallback(
- (workflowDefinition: WorkflowDefinition) => {
- navigate(
- {
- pathname: routes.runtimeToolsWorkflowForm.path({ workflowName:
workflowDefinition.workflowName }),
- },
- {
- state: {
- workflowDefinition: {
- workflowName: workflowDefinition.workflowName,
- endpoint: workflowDefinition.endpoint,
- serviceUrl: workflowDefinition.serviceUrl,
- },
- },
- }
- );
- },
- [navigate]
- );
-
- const onOpenTriggerCloudEventForWorkflow = useCallback(
- (workflowDefinition: WorkflowDefinition) => {
- navigate(
- {
- pathname:
routes.runtimeToolsTriggerCloudEventForWorkflowDefinition.path({
- workflowName: workflowDefinition.workflowName,
- }),
- },
- {
- state: {
- workflowDefinition: {
- workflowName: workflowDefinition.workflowName,
- endpoint: workflowDefinition.endpoint,
- serviceUrl: workflowDefinition.serviceUrl,
- },
- source: CloudEventPageSource.DEFINITIONS,
- },
- }
- );
- },
- [navigate]
- );
-
- return (
- <Page>
- <PageSection variant={"light"}>
- <TextContent>
- <Text component={TextVariants.h1}>{PAGE_TITLE}</Text>
- <Text component={TextVariants.p}>
- Start new workflow instances from the SonataFlow service linked in
your Runtime Tools settings.
- </Text>
- </TextContent>
- </PageSection>
-
- <PageSection isFilled aria-label="workflow-definitions-section">
- <Card>
- <WorkflowDefinitionListContainer
- onOpenWorkflowForm={onOpenWorkflowForm}
-
onOpenTriggerCloudEventForWorkflow={onOpenTriggerCloudEventForWorkflow}
- />
- </Card>
- </PageSection>
- </Page>
- );
-}
diff --git
a/packages/sonataflow-management-console-webapp/src/components/pages/WorkflowFormPage/WorkflowFormPage.tsx
b/packages/sonataflow-management-console-webapp/src/components/pages/WorkflowFormPage/WorkflowFormPage.tsx
deleted file mode 100644
index 6db96dc31be..00000000000
---
a/packages/sonataflow-management-console-webapp/src/components/pages/WorkflowFormPage/WorkflowFormPage.tsx
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import React, { useCallback, useEffect, useRef } from "react";
-import { InlineEdit, InlineEditApi } from
"@kie-tools/runtime-tools-components/dist/components/InlineEdit";
-import { ouiaPageTypeAndObjectId } from
"@kie-tools/runtime-tools-components/dist/ouiaTools";
-import { WorkflowDefinition } from
"@kie-tools/runtime-tools-swf-gateway-api/dist/types";
-import {
- WorkflowFormGatewayApi,
- useWorkflowFormGatewayApi,
-} from "@kie-tools/runtime-tools-swf-webapp-components/dist/WorkflowForm";
-import { WorkflowFormContainer } from
"@kie-tools/runtime-tools-swf-webapp-components/dist/WorkflowFormContainer";
-import { Alert, AlertActionCloseButton, AlertActionLink } from
"@patternfly/react-core/dist/js/components/Alert";
-import { Card, CardBody } from
"@patternfly/react-core/dist/js/components/Card";
-import { Page, PageSection } from
"@patternfly/react-core/dist/js/components/Page";
-import { Text, TextContent, TextVariants } from
"@patternfly/react-core/dist/js/components/Text";
-import { useLocation, useNavigate } from "react-router-dom";
-import { routes } from "../../../navigation/Routes";
-import { useGlobalAlert } from "../../../alerts/GlobalAlertsContext";
-
-const PAGE_TITLE = "Start new workflow";
-
-export function WorkflowFormPage() {
- const navigate = useNavigate();
- const location = useLocation();
- const gatewayApi: WorkflowFormGatewayApi = useWorkflowFormGatewayApi();
-
- const inlineEditRef = useRef<InlineEditApi>(null);
-
- const workflowDefinition: WorkflowDefinition = (location.state as
any)["workflowDefinition"];
-
- const onResetForm = useCallback(() => {
- gatewayApi.setBusinessKey("");
- inlineEditRef.current!.reset();
- }, [gatewayApi]);
-
- const getBusinessKey = () => {
- return gatewayApi.getBusinessKey();
- };
-
- useEffect(() => {
- onResetForm();
- return ouiaPageTypeAndObjectId("workflow-form");
- }, [onResetForm]);
-
- const startWorkflowSuccessAlert = useGlobalAlert<{ workflowId: string }>(
- useCallback(
- ({ close }, { workflowId }) => {
- const viewDetails = () => {
- navigate({
- pathname: routes.runtimeToolsWorkflowDetails.path({ workflowId }),
- });
- close();
- };
-
- return (
- <Alert
- className="pf-v5-u-mb-md"
- variant="success"
- title={`A workflow with id ${workflowId} was started
successfully.`}
- aria-live="polite"
- actionClose={<AlertActionCloseButton onClose={close} />}
- actionLinks={
- <>
- <AlertActionLink onClick={viewDetails}>{"View
details"}</AlertActionLink>
- <AlertActionLink onClick={close}>{"Ignore"}</AlertActionLink>
- </>
- }
- />
- );
- },
- [navigate]
- ),
- { durationInSeconds: 5 }
- );
-
- const startWorkflowErrorAlert = useGlobalAlert<{ message: string }>(
- useCallback(({ close }, { message }) => {
- return (
- <Alert
- className="pf-v5-u-mb-md"
- variant="danger"
- title={
- <>
- Something went wrong while triggering your workflow.
- <br />
- {`Reason: ${message}`}
- </>
- }
- aria-live="polite"
- data-testid="alert-upload-error"
- actionClose={<AlertActionCloseButton onClose={close} />}
- />
- );
- }, []),
- { durationInSeconds: 5 }
- );
-
- const onStartWorkflowError = useCallback(
- (error: any) => {
- const message =
- error?.response?.data?.message + " " + error?.response?.data?.cause ||
- error?.message ||
- "Unknown error. More details in the developer tools console.";
- startWorkflowErrorAlert.show({ message });
- },
- [startWorkflowErrorAlert]
- );
-
- const onStartWorkflowSuccess = useCallback(
- (workflowId: string) => {
- startWorkflowSuccessAlert.show({ workflowId });
- },
- [startWorkflowSuccessAlert]
- );
-
- return (
- <Page>
- <PageSection variant={"light"}>
- <TextContent>
- <Text component={TextVariants.h1}>{PAGE_TITLE}</Text>
- <InlineEdit
- ref={inlineEditRef}
- setBusinessKey={(bk: string) => gatewayApi.setBusinessKey(bk)}
- getBusinessKey={getBusinessKey}
- />
- </TextContent>
- </PageSection>
-
- <PageSection isFilled aria-label="workflow-definitions-section">
- <Card>
- <CardBody>
- <WorkflowFormContainer
- workflowDefinitionData={workflowDefinition}
- onResetForm={onResetForm}
- onStartWorkflowError={onStartWorkflowError}
- onStartWorkflowSuccess={onStartWorkflowSuccess}
- />
- </CardBody>
- </Card>
- </PageSection>
- </Page>
- );
-}
diff --git
a/packages/sonataflow-management-console-webapp/src/navigation/Routes.ts
b/packages/sonataflow-management-console-webapp/src/navigation/Routes.ts
index 139c2dad526..2633d40aac0 100644
--- a/packages/sonataflow-management-console-webapp/src/navigation/Routes.ts
+++ b/packages/sonataflow-management-console-webapp/src/navigation/Routes.ts
@@ -18,7 +18,6 @@
*/
const IS_HASH_ROUTER = true;
-const SETTINGS_ROUTE = "/settings";
export enum QueryParams {
SETTINGS = "settings",
@@ -120,19 +119,12 @@ export function newQueryParamsImpl<Q extends
string>(queryString: string): Query
export const routes = {
home: new Route<{}>(() => `/`),
runtimeToolsWorkflowInstances: new Route<{}>(() => `/WorkflowInstances`),
- runtimeToolsWorkflowDefinitions: new Route<{}>(() => `/WorkflowDefinitions`),
runtimeToolsWorkflowDetails: new Route<{
queryParams: QueryParams.FILTERS | QueryParams.SORT_BY;
pathParams: PathParams.WORKFLOW_ID;
}>(({ workflowId }) => `/WorkflowDetails/${workflowId}`),
- runtimeToolsWorkflowForm: new Route<{
- pathParams: PathParams.WORKFLOW_NAME;
- }>(({ workflowName }) => `/WorkflowDefinition/${workflowName}`),
runtimeToolsTriggerCloudEventForWorkflow: new Route<{
pathParams: PathParams.WORKFLOW_ID;
}>(({ workflowId }) => `/WorkflowInstances/${workflowId}`),
- runtimeToolsTriggerCloudEventForWorkflowDefinition: new Route<{
- pathParams: PathParams.WORKFLOW_NAME;
- }>(({ workflowName }) =>
`/WorkflowDefinition/${workflowName}/trigger-cloud-event`),
monitoring: new Route<{}>(() => `/Monitoring`),
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]