Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-issues#1276: Reuse components and retrieve workflow definitions from data index instead of openapi.json in sonataflow-deployment-webapp #2537

Merged
merged 9 commits into from
Sep 6, 2024
7 changes: 1 addition & 6 deletions packages/sonataflow-deployment-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@
"@patternfly/patternfly": "^4.224.2",
"@patternfly/react-core": "^4.276.6",
"@patternfly/react-icons": "^4.93.6",
"@patternfly/react-table": "^4.112.39",
"apollo-cache-inmemory": "1.6.6",
"apollo-client": "2.6.10",
"apollo-link-http": "1.5.17",
"openapi-types": "^7.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"typescript": "^5.5.3",
"util": "^0.12.5"
Comment on lines -46 to -56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for cleaning this up! 👍

"typescript": "^5.5.3"
},
"devDependencies": {
"@babel/core": "^7.16.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/sonataflow-deployment-webapp/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { OpenApiContextProvider } from "./context/OpenApiContextProvider";
import { RoutesSwitch } from "./navigation/RoutesSwitch";
import { DeploymentWorkflowListContextProvider } from "./runtimeTools/contexts/DeploymentWorkflowListContextProvider";
import { DeploymentWorkflowDetailsContextProvider } from "./runtimeTools/contexts/DeploymentWorkflowDetailsContextProvider";
import { DeploymentWorkflowDefinitionListContextProvider } from "./runtimeTools/contexts/DeploymentWorkflowDefinitionListContextProvider";

export const App = () => (
<HashRouter>
Expand All @@ -32,6 +33,7 @@ export const App = () => (
[OpenApiContextProvider, {}],
[DeploymentWorkflowListContextProvider, {}],
[DeploymentWorkflowDetailsContextProvider, {}],
[DeploymentWorkflowDefinitionListContextProvider, {}],
[RoutesSwitch, {}]
)}
</HashRouter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { Redirect, Route, Switch } from "react-router-dom";
import { APPDATA_JSON_FILENAME } from "../AppConstants";
import { ErrorKind, ErrorPage } from "../pages/ErrorPage";
import { NoMatchPage } from "../pages/NoMatchPage";
import { Workflows } from "../pages/Workflows/";
import { CloudEventFormPage } from "../pages/Workflows/CloudEventFormPage";
import { WorkflowFormPage } from "../pages/Workflows/WorkflowFormPage";
import { routes } from "../routes";
Expand All @@ -36,17 +35,14 @@ export function RoutesSwitch() {
<Route path={routes.workflows.cloudEvent.path({})}>
<CloudEventFormPage />
</Route>
<Route path={routes.workflows.home.path({})}>
<Workflows />
kumaradityaraj marked this conversation as resolved.
Show resolved Hide resolved
</Route>
<Route path={routes.runtimeTools.home.path({})}>
<RuntimeToolsRoutesSwitch />
</Route>
<Route path={routes.dataJsonError.path({})}>
<ErrorPage kind={ErrorKind.APPDATA_JSON} errors={[`There was an error with the ${APPDATA_JSON_FILENAME}`]} />
</Route>
<Route path={routes.home.path({})}>
<Redirect to={routes.workflows.home.path({})} />
<Redirect to={routes.runtimeTools.workflowDefinitions.path({})} />
</Route>
<Route component={NoMatchPage} />
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ import { Route, Switch } from "react-router-dom";
import { RuntimeToolsWorkflowInstances } from "../runtimeTools/pages/RuntimeToolsWorkflowInstances";
import { routes } from "../routes";
import { RuntimeToolsWorkflowDetails } from "../runtimeTools/pages/RuntimeToolsWorkflowDetails";
import { RuntimeToolsWorkflowDefinitions } from "../runtimeTools/pages/RuntimeToolsWorkflowDefinitions";

export function RuntimeToolsRoutesSwitch() {
return (
<Switch>
<Route path={routes.runtimeTools.workflowDefinitions.path({})}>
<RuntimeToolsWorkflowDefinitions />
</Route>
<Route path={routes.runtimeTools.workflowInstances.path({})}>
<RuntimeToolsWorkflowInstances />
</Route>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@
* under the License.
*/

export * from "./Workflows";
export * from "./WorkflowFormPage";
3 changes: 2 additions & 1 deletion packages/sonataflow-deployment-webapp/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export enum QueryParams {

export enum PathParams {
WORKFLOW_ID = "workflowId",
WORKFLOW_NAME = "workflowName",
}

export class Route<
Expand Down Expand Up @@ -105,8 +106,8 @@ export const routes = {
queryParams: QueryParams.FILTERS | QueryParams.SORT_BY;
pathParams: PathParams.WORKFLOW_ID;
}>(({ workflowId }) => RUNTIME_TOOLS_ROUTE + `/workflow-details/${workflowId}`),
workflowDefinitions: new Route<{}>(() => RUNTIME_TOOLS_ROUTE + `/workflow-definitions`),
},

dataJson: new Route<{}>(() => "/" + APPDATA_JSON_FILENAME),
openApiJson: new Route<{}>(() => "/q/openapi.json"),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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 * as React from "react";
import { WorkflowDefinitionListContextProvider } from "@kie-tools/runtime-tools-swf-webapp-components/dist/WorkflowDefinitionList";
import { useApp } from "../../context/AppContext";

export function DeploymentWorkflowDefinitionListContextProvider(props: React.PropsWithChildren<{}>) {
const app = useApp();

return (
<WorkflowDefinitionListContextProvider dataIndexUrl={app.data.dataIndexUrl}>
{props.children}
</WorkflowDefinitionListContextProvider>
);
}
Loading
Loading