diff --git a/.rat-excludes b/.rat-excludes index 5b3703d6da0..b652dffe0dc 100644 --- a/.rat-excludes +++ b/.rat-excludes @@ -2036,3 +2036,5 @@ scripts.iml index.test.js # scripts/check-junit-report-results/tests/reports/empty.xml empty.xml +# packages/runtime-tools-process-gateway-api/src/graphql/types.tsx +types.tsx diff --git a/examples/process-compact-architecture/src/main/resources/application.properties b/examples/process-compact-architecture/src/main/resources/application.properties index b8fed9c6a26..41ea3670e65 100644 --- a/examples/process-compact-architecture/src/main/resources/application.properties +++ b/examples/process-compact-architecture/src/main/resources/application.properties @@ -105,3 +105,5 @@ quarkus.http.test-port=0 quarkus.swagger-ui.always-include=true quarkus.kogito.data-index.graphql.ui.always-include=true +# Development tasks users +%dev.jbpm.devui.users.jdoe.groups=admin,HR,IT \ No newline at end of file diff --git a/packages/runtime-tools-process-enveloped-components/src/jobsManagement/envelope/components/JobsDetailsModal/JobsDetailsModal.tsx b/packages/runtime-tools-process-enveloped-components/src/jobsManagement/envelope/components/JobsDetailsModal/JobsDetailsModal.tsx index 180e38997e5..70f0b32f104 100644 --- a/packages/runtime-tools-process-enveloped-components/src/jobsManagement/envelope/components/JobsDetailsModal/JobsDetailsModal.tsx +++ b/packages/runtime-tools-process-enveloped-components/src/jobsManagement/envelope/components/JobsDetailsModal/JobsDetailsModal.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React from "react"; +import React, { useCallback } from "react"; import { TextContent, Text, TextVariants } from "@patternfly/react-core/dist/js/components/Text"; import { Modal } from "@patternfly/react-core/dist/js/components/Modal"; import { Flex, FlexItem } from "@patternfly/react-core/dist/js/layouts/Flex"; @@ -45,28 +45,46 @@ export const JobsDetailsModal: React.FC = ({ ouiaId, ouiaSafe, }) => { - const modalContent = () => { + const checkNumericProperty = useCallback((propertyValue?: number) => { + return propertyValue !== undefined && propertyValue !== null; + }, []); + + const modalContent = useCallback(() => { return (
- - - - Process Id: {" "} - - {job.processId} - - - - - - {" "} - Process Instance Id: {" "} - - {job.processInstanceId} - - + {job.processId && ( + + + + Process Id: {" "} + + {job.processId} + + + )} + {job.processInstanceId && ( + + + + {" "} + Process Instance Id: {" "} + + {job.processInstanceId} + + + )} + {job.nodeInstanceId && ( + + + + Node Instance Id: + + {job.nodeInstanceId} + + + )} @@ -75,83 +93,95 @@ export const JobsDetailsModal: React.FC = ({ {job.status} - - - - Priority: {" "} - - {job.priority} - - - {job.repeatInterval && ( + {checkNumericProperty(job.priority) && ( - RepeatInterval: + Priority: {" "} + + {job.priority} + + + )} + {checkNumericProperty(job.repeatInterval) && ( + + + + Repeat Interval: {job.repeatInterval} )} - {job.repeatLimit && ( + {checkNumericProperty(job.repeatLimit) && ( - RepeatLimit: + Repeat Limit: {job.repeatLimit} )} - - - - ScheduledId: - - {job.scheduledId} - - - - - - Retries: - - {job.retries} - - - - - - Execution counter: - - {job.executionCounter} - - - - - - Last Updated: - - - {new Date(`${job.lastUpdate}`)} - - - - - - - - Callback Endpoint:{" "} - - - {job.callbackEndpoint} - - + {job.scheduledId && ( + + + + Scheduled Id: + + {job.scheduledId} + + + )} + {checkNumericProperty(job.retries) && ( + + + + Retries: + + {job.retries} + + + )} + {checkNumericProperty(job.executionCounter) && ( + + + + Execution counter: + + {job.executionCounter} + + + )} + {job.lastUpdate && ( + + + + Last Updated: + + + {new Date(`${job.lastUpdate}`)} + + + + )} + {job.callbackEndpoint && ( + + + + + Callback Endpoint:{" "} + + + {job.callbackEndpoint} + + + )}
); - }; + }, [job, checkNumericProperty]); return ( = ({ }; const renderTimerIcon = (id: string) => { - return jobs.length > 0 ? ( - jobs.map((job, idx) => { - if (id === job.nodeInstanceId) { - return ( - - handleJobDetails(job)} - /> - - ); - } - })[0] - ) : ( - <> - ); + const job = jobs.find((job) => id === job.nodeInstanceId); + if (job) { + return ( + + handleJobDetails(job)} + /> + + ); + } + return <>; }; const detailsAction: JSX.Element[] = [ diff --git a/packages/runtime-tools-process-gateway-api/src/graphql/graphql.schema.json b/packages/runtime-tools-process-gateway-api/src/graphql/graphql.schema.json index 055cce17b9d..09ccfdeecc4 100644 --- a/packages/runtime-tools-process-gateway-api/src/graphql/graphql.schema.json +++ b/packages/runtime-tools-process-gateway-api/src/graphql/graphql.schema.json @@ -2110,6 +2110,16 @@ "ofType": null }, "defaultValue": null + }, + { + "name": "variables", + "description": null, + "type": { + "kind": "SCALAR", + "name": "JSON", + "ofType": null + }, + "defaultValue": null } ], "interfaces": null, @@ -2827,6 +2837,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "slaDueDate", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "source", "description": null, @@ -3100,6 +3122,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "slaDueDate", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "type", "description": null, @@ -3695,6 +3729,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "externalReferenceId", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "id", "description": null, @@ -3916,6 +3962,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "slaDueDate", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "started", "description": null, @@ -7300,6 +7358,12 @@ } ] }, + { + "name": "oneOf", + "description": "Indicates an Input Object is a OneOf Input Object.", + "locations": ["INPUT_OBJECT"], + "args": [] + }, { "name": "skip", "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", diff --git a/packages/runtime-tools-process-gateway-api/src/graphql/queries.tsx b/packages/runtime-tools-process-gateway-api/src/graphql/queries.tsx index cae532f1b52..d167e7cd38f 100644 --- a/packages/runtime-tools-process-gateway-api/src/graphql/queries.tsx +++ b/packages/runtime-tools-process-gateway-api/src/graphql/queries.tsx @@ -370,6 +370,7 @@ export const GET_JOBS_WITH_FILTERS = gql` retries lastUpdate endpoint + nodeInstanceId executionCounter } } @@ -400,6 +401,15 @@ export const GET_PROCESS_INSTANCE_SVG = gql` } `; +export const GET_PROCESS_DEFINITIONS = gql` + query getProcessDefinitions { + ProcessDefinitions { + id + endpoint + } + } +`; + export const GET_PROCESS_DEFINITION_NODES = gql` query getProcessDefinitionNodes($processId: String) { ProcessDefinitions(where: { id: { equal: $processId } }) { diff --git a/packages/runtime-tools-process-gateway-api/src/graphql/types.tsx b/packages/runtime-tools-process-gateway-api/src/graphql/types.tsx index 609a31320fa..52788344315 100644 --- a/packages/runtime-tools-process-gateway-api/src/graphql/types.tsx +++ b/packages/runtime-tools-process-gateway-api/src/graphql/types.tsx @@ -1,22 +1,3 @@ -/* - * 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. - */ - /* eslint-disable */ import gql from "graphql-tag"; import * as ApolloReactCommon from "@apollo/react-common"; @@ -280,6 +261,7 @@ export namespace GraphQL { start?: InputMaybe; state?: InputMaybe; updatedBy?: InputMaybe; + variables?: InputMaybe; }; export type StringArrayArgument = { @@ -360,6 +342,7 @@ export namespace GraphQL { rootProcessId?: Maybe; rootProcessInstanceId?: Maybe; serviceUrl?: Maybe; + slaDueDate?: Maybe; source?: Maybe; start?: Maybe; state?: Maybe; @@ -389,6 +372,7 @@ export namespace GraphQL { id: Scalars["String"]; name: Scalars["String"]; nodeId: Scalars["String"]; + slaDueDate?: Maybe; type: Scalars["String"]; }; @@ -451,6 +435,7 @@ export namespace GraphQL { description?: Maybe; endpoint?: Maybe; excludedUsers?: Maybe>; + externalReferenceId?: Maybe; id: Scalars["String"]; inputs?: Maybe; lastUpdate: Scalars["DateTime"]; @@ -465,6 +450,7 @@ export namespace GraphQL { rootProcessId?: Maybe; rootProcessInstanceId?: Maybe; schema?: Maybe; + slaDueDate?: Maybe; started?: Maybe; state?: Maybe; }; @@ -1338,6 +1324,7 @@ export namespace GraphQL { retries?: number | null; lastUpdate?: any | null; endpoint?: string | null; + nodeInstanceId?: string | null; executionCounter?: number | null; } | null> | null; }; @@ -1369,6 +1356,17 @@ export namespace GraphQL { ProcessInstances?: Array<{ __typename?: "ProcessInstance"; diagram?: string | null } | null> | null; }; + export type GetProcessDefinitionsQueryVariables = Exact<{ [key: string]: never }>; + + export type GetProcessDefinitionsQuery = { + __typename?: "Query"; + ProcessDefinitions?: Array<{ + __typename?: "ProcessDefinition"; + id: string; + endpoint?: string | null; + } | null> | null; + }; + export type GetProcessDefinitionNodesQueryVariables = Exact<{ processId?: InputMaybe; }>; @@ -1425,15 +1423,6 @@ export namespace GraphQL { export type HandleJobRescheduleMutation = { __typename?: "Mutation"; JobReschedule?: string | null }; - export const GetProcessDefinitionsDocument = gql` - query getProcessDefinitions { - ProcessDefinitions { - id - endpoint - } - } - `; - export const GetProcessInstancesDocument = gql` query getProcessInstances( $where: ProcessInstanceArgument @@ -2285,6 +2274,7 @@ export namespace GraphQL { retries lastUpdate endpoint + nodeInstanceId executionCounter } } @@ -2516,6 +2506,54 @@ export namespace GraphQL { GetProcessInstanceSvgQuery, GetProcessInstanceSvgQueryVariables >; + export const GetProcessDefinitionsDocument = gql` + query getProcessDefinitions { + ProcessDefinitions { + id + endpoint + } + } + `; + + /** + * __useGetProcessDefinitionsQuery__ + * + * To run a query within a React component, call `useGetProcessDefinitionsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetProcessDefinitionsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetProcessDefinitionsQuery({ + * variables: { + * }, + * }); + */ + export function useGetProcessDefinitionsQuery( + baseOptions?: ApolloReactHooks.QueryHookOptions + ) { + const options = { ...defaultOptions, ...baseOptions }; + return ApolloReactHooks.useQuery( + GetProcessDefinitionsDocument, + options + ); + } + export function useGetProcessDefinitionsLazyQuery( + baseOptions?: ApolloReactHooks.LazyQueryHookOptions + ) { + const options = { ...defaultOptions, ...baseOptions }; + return ApolloReactHooks.useLazyQuery( + GetProcessDefinitionsDocument, + options + ); + } + export type GetProcessDefinitionsQueryHookResult = ReturnType; + export type GetProcessDefinitionsLazyQueryHookResult = ReturnType; + export type GetProcessDefinitionsQueryResult = ApolloReactCommon.QueryResult< + GetProcessDefinitionsQuery, + GetProcessDefinitionsQueryVariables + >; export const GetProcessDefinitionNodesDocument = gql` query getProcessDefinitionNodes($processId: String) { ProcessDefinitions(where: { id: { equal: $processId } }) { diff --git a/packages/runtime-tools-process-gateway-api/src/types.ts b/packages/runtime-tools-process-gateway-api/src/types.ts index ec6c175bc55..fac95adaf18 100644 --- a/packages/runtime-tools-process-gateway-api/src/types.ts +++ b/packages/runtime-tools-process-gateway-api/src/types.ts @@ -37,15 +37,15 @@ export interface Job { id: string; status: JobStatus; expirationTime: Date; - priority: number; - callbackEndpoint: string; + priority?: number; + callbackEndpoint?: string; repeatInterval: number; repeatLimit: number; - scheduledId: string; - retries: number; - lastUpdate: Date; + scheduledId?: string; + retries?: number; + lastUpdate?: Date; executionCounter?: number; - endpoint: string; + endpoint?: string; nodeInstanceId?: string; processId?: string; processInstanceId?: string;