fantonangeli commented on code in PR #2537:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2537#discussion_r1723513544


##########
packages/sonataflow-deployment-webapp/src/pages/Workflows/Workflows.tsx:
##########


Review Comment:
   in 
   we are losing the `EmptyTableState` defined here at line 132. Can we 
reintroduce this message in `RuntimeToolsWorkflowDefinitions` without using a 
table as a wrapper for it? WDYT?
   ![Screenshot from 2024-08-20 
16-58-25](https://github.com/user-attachments/assets/4d8e8b1b-818a-4c48-9cf4-dad94238b5eb)
   
   



##########
packages/sonataflow-deployment-webapp/src/routes/index.ts:
##########
@@ -105,8 +106,14 @@ export const routes = {
       queryParams: QueryParams.FILTERS | QueryParams.SORT_BY;
       pathParams: PathParams.WORKFLOW_ID;
     }>(({ workflowId }) => RUNTIME_TOOLS_ROUTE + 
`/workflow-details/${workflowId}`),
+    runtimeToolsWorkflowDefinitions: new Route<{}>(() => RUNTIME_TOOLS_ROUTE + 
`/workflow-definitions`),
+    runtimeToolsWorkflowForm: new Route<{
+      pathParams: PathParams.WORKFLOW_NAME;
+    }>(({ workflowName }) => RUNTIME_TOOLS_ROUTE + 
`/workflow-definition/${workflowName}`),
+    runtimeToolsTriggerCloudEventForWorkflowDefinition: new Route<{
+      pathParams: PathParams.WORKFLOW_NAME;
+    }>(({ workflowName }) => RUNTIME_TOOLS_ROUTE + 
`/workflow-definition/${workflowName}/trigger-cloud-event`),

Review Comment:
   I think we don't need these 2 routes and we can continue to use 
`routes.workflows.form` and `routes.workflows.cloudEvent`, limiting this PR to 
the workflow definitions.



##########
packages/sonataflow-deployment-webapp/src/runtimeTools/pages/RuntimeToolsWorkflowDefinitions.tsx:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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 { useHistory } from "react-router";
+import { routes } from "../../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";
+import { BasePage } from "../../pages/BasePage";
+
+const PAGE_TITLE = "Workflow Definitions";
+
+export function RuntimeToolsWorkflowDefinitions() {
+  const history = useHistory();
+
+  const onOpenWorkflowForm = useCallback(
+    (workflowDefinition: WorkflowDefinition) => {
+      history.push({
+        pathname: routes.runtimeTools.runtimeToolsWorkflowForm.path({ 
workflowName: workflowDefinition.workflowName }),
+        state: {
+          workflowDefinition: {
+            workflowName: workflowDefinition.workflowName,
+            endpoint: workflowDefinition.endpoint,
+            serviceUrl: workflowDefinition.serviceUrl,
+          },
+        },
+      });
+    },
+    [history]
+  );
+
+  const onOpenTriggerCloudEventForWorkflow = useCallback(
+    (workflowDefinition: WorkflowDefinition) => {
+      history.push({
+        pathname: 
routes.runtimeTools.runtimeToolsTriggerCloudEventForWorkflowDefinition.path({
+          workflowName: workflowDefinition.workflowName,
+        }),

Review Comment:
   ```suggestion
           pathname: routes.workflows.cloudEvent.path({
             workflowId: workflowDefinition.workflowName,
           }),
   ```



##########
packages/sonataflow-deployment-webapp/src/navigation/RoutesSwitch.tsx:
##########
@@ -36,17 +36,14 @@ export function RoutesSwitch() {
       <Route path={routes.workflows.cloudEvent.path({})}>
         <CloudEventFormPage />
       </Route>
-      <Route path={routes.workflows.home.path({})}>
-        <Workflows />

Review Comment:
   Because we removed the use of `Workflows` here we can also remove the unused 
import at line 24



##########
packages/sonataflow-deployment-webapp/src/runtimeTools/pages/RuntimeToolsWorkflowDefinitions.tsx:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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 { useHistory } from "react-router";
+import { routes } from "../../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";
+import { BasePage } from "../../pages/BasePage";
+
+const PAGE_TITLE = "Workflow Definitions";
+
+export function RuntimeToolsWorkflowDefinitions() {
+  const history = useHistory();
+
+  const onOpenWorkflowForm = useCallback(
+    (workflowDefinition: WorkflowDefinition) => {
+      history.push({
+        pathname: routes.runtimeTools.runtimeToolsWorkflowForm.path({ 
workflowName: workflowDefinition.workflowName }),

Review Comment:
   ```suggestion
           pathname: routes.workflows.form.path({ workflowId: 
workflowDefinition.workflowName }),
   ```



##########
packages/sonataflow-deployment-webapp/src/pages/Workflows/Workflows.tsx:
##########


Review Comment:
   Please remove this file as it is not used anymore and remove the 
dependencies of this file which are not used by other files, in our case should 
be only @patternfly/react-table



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to