Skip to content

Commit

Permalink
feat: issue FLPATH-591 - Add assessment workflow type and display out…
Browse files Browse the repository at this point in the history
…puts (janus-idp#21)

* Configure for assessment swf

* filter assessment on workflow definition page

* workflow columns

* workflow columns

* workflow columns

* workflow filter

* feat: Render assessment results supporting dynamic categories

* issue FLPATH-657: workflow label

* Revert "Configure for assessment swf"

This reverts commit b4048e1.

* Revert sonata service port

* Add key for workflow options category

* Fix workflow execution from choose btn

* Fix review comments

* address comments

* Fix review comment to switch to useRouteRef

* fix review comments

* fix review comments

---------

Co-authored-by: richardwang98 <[email protected]>
  • Loading branch information
anludke and RichardW98 authored Nov 16, 2023
1 parent 78a40d1 commit 79a5279
Show file tree
Hide file tree
Showing 14 changed files with 235 additions and 197 deletions.
13 changes: 13 additions & 0 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ export const AppBase = () => {
path="/create"
element={
<ScaffolderPage
groups={[
{
title: <h2>Assessment</h2>,
filter: entity =>
entity?.metadata.tags?.includes('assessment') ?? false,
},
{
title: <h2>Infrastructure</h2>,
filter: entity =>
entity?.metadata.tags?.includes('infrastructure') ??
false,
},
]}
components={{
TemplateCardComponent: OrchestratorScaffolderTemplateCard,
}}
Expand Down
177 changes: 0 additions & 177 deletions plugins/orchestrator-backend/src/catalog/OrchestratorEntityProvider.ts

This file was deleted.

1 change: 0 additions & 1 deletion plugins/orchestrator-backend/src/catalog/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
import { Logger } from 'winston';

import {
ASSESSMENT_WORKFLOW_TYPE,
default_catalog_environment,
default_catalog_owner,
orchestrator_service_ready_topic,
workflow_type,
WorkflowCategory,
WorkflowItem,
} from '@janus-idp/backstage-plugin-orchestrator-common';

Expand Down Expand Up @@ -151,14 +153,19 @@ export class OrchestratorEntityProvider
): TemplateEntityV1beta3[] {
return items.map(i => {
const sanitizedId = i.definition.id.replace(/ /g, '_');
const category: WorkflowCategory = i.definition.annotations?.find(
annotation => annotation === ASSESSMENT_WORKFLOW_TYPE,
)
? WorkflowCategory.ASSESSMENT
: WorkflowCategory.INFRASTRUCTURE;
return {
apiVersion: 'scaffolder.backstage.io/v1beta3',
kind: 'Template',
metadata: {
name: sanitizedId,
title: i.definition.name,
description: i.definition.description,
tags: [workflow_type],
tags: [category],
annotations: {
[ANNOTATION_LOCATION]: `url:${this.sonataFlowServiceUrl}`,
[ANNOTATION_ORIGIN_LOCATION]: `url:${this.sonataFlowServiceUrl}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class SonataFlowService {

public async fetchProcessInstances(): Promise<ProcessInstance[] | undefined> {
const graphQlQuery =
'{ ProcessInstances (where: {processId: {isNull: false} } ) { id, processName, processId, state, start, lastUpdate, end, nodes { id }, variables, parentProcessInstance {id, processName, businessKey} } }';
'{ ProcessInstances ( orderBy: { start: ASC }, where: {processId: {isNull: false} } ) { id, processName, processId, state, start, lastUpdate, end, nodes { id }, variables, parentProcessInstance {id, processName, businessKey} } }';

try {
const response = await executeWithRetry(() =>
Expand Down
5 changes: 4 additions & 1 deletion plugins/orchestrator-common/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ export const workflow_yaml_sample: WorkflowSample = {
export const default_sonataflow_container_image =
'quay.io/kiegroup/kogito-swf-devmode-nightly:main-2023-08-30';
export const default_sonataflow_persistance_path = '/home/kogito/persistence';
export const default_catalog_owner = 'infrastructure';
export const default_catalog_owner = 'orchestrator';
export const default_catalog_environment = 'development';
export const default_editor_path = 'https://start.kubesmarts.org';

export const default_workflows_path = 'workflows';

export const ASSESSMENT_WORKFLOW_TYPE = 'workflow-type/assessment';
export const INFRASTRUCTURE_WORKFLOW_TYPE = 'workflow-type/infrastructure';
5 changes: 5 additions & 0 deletions plugins/orchestrator-common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,8 @@ export interface WorkflowDataInputSchemaResponse {
export interface WorkflowExecutionResponse {
id: string;
}

export enum WorkflowCategory {
ASSESSMENT = 'assessment',
INFRASTRUCTURE = 'infrastructure',
}
1 change: 1 addition & 0 deletions plugins/orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"json-schema": "^0.4.0",
"react-hook-form": "^7.45.1",
"react-json-view": "^1.21.3",
"moment": "^2.29.0",
"react-moment": "^1.1.3",
"react-use": "^17.4.0",
"vscode-languageserver-types": "^3.16.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { orchestratorApiRef } from '../../api';
import { newWorkflowRef, workflowInstancesRouteRef } from '../../routes';
import { BaseOrchestratorPage } from '../BaseOrchestratorPage/BaseOrchestratorPage';
import { OrchestratorSupportButton } from '../OrchestratorSupportButton/OrchestratorSupportButton';
import { WorkflowsTable } from '../WorkflowDefinitionsListComponent/WorkflowDefinitionsListComponent';
import { WorkflowsTable } from '../WorkflowDefinitionsListComponent';

export const OrchestratorPage = () => {
const orchestratorApi = useApi(orchestratorApiRef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const OrchestratorScaffolderTemplateCard = (

const onSelectedExtended = useCallback(
(template: TemplateEntityV1beta3) => {
const isWorkflow = template.metadata.tags?.includes(workflow_type);
const isWorkflow = template.spec.type === workflow_type;

if (!isWorkflow) {
onSelected?.(template);
Expand Down
Loading

0 comments on commit 79a5279

Please sign in to comment.