diff --git a/.changeset/brown-rivers-accept.md b/.changeset/brown-rivers-accept.md new file mode 100644 index 00000000..fd84c8cf --- /dev/null +++ b/.changeset/brown-rivers-accept.md @@ -0,0 +1,5 @@ +--- +'@smartcontractkit/operator-ui': minor +--- + +Add support for Workflow Spec job types diff --git a/src/screens/Job/JobView.tsx b/src/screens/Job/JobView.tsx index e29f77b8..077a73ee 100644 --- a/src/screens/Job/JobView.tsx +++ b/src/screens/Job/JobView.tsx @@ -133,6 +133,11 @@ const JOB_PAYLOAD__SPEC = gql` gatewayConfig createdAt } + ... on WorkflowSpec { + workflowID + workflowOwner + workflow + } } ` diff --git a/src/screens/Job/generateJobDefinition.test.ts b/src/screens/Job/generateJobDefinition.test.ts index bc3664e6..09afeb9d 100644 --- a/src/screens/Job/generateJobDefinition.test.ts +++ b/src/screens/Job/generateJobDefinition.test.ts @@ -625,6 +625,36 @@ externalJobID = "00000000-0000-0000-0000-0000000000001" [gatewayConfig.NodeServerConfig] Port = 8_080 +` + const output = generateJobDefinition(job) + expect(output.definition).toEqual(expectedOutput) + }) + + it('generates a valid Workflow definition', () => { + const job: JobPayload_Fields = { + id: '1', + type: 'workflow', + schemaVersion: 1, + name: 'workflow test', + externalJobID: '00000000-0000-0000-0000-0000000000001', + maxTaskDuration: '10s', + spec: { + __typename: 'WorkflowSpec', + workflowID: '', + workflow: '', + workflowOwner: '', + }, + observationSource: '', + ...otherJobFields, + } + + const expectedOutput = `type = "workflow" +schemaVersion = 1 +name = "workflow test" +externalJobID = "00000000-0000-0000-0000-0000000000001" +workflowID = "" +workflow = "" +workflowOwner = "" ` const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) diff --git a/src/screens/Job/generateJobDefinition.ts b/src/screens/Job/generateJobDefinition.ts index 8f333e01..9de95487 100644 --- a/src/screens/Job/generateJobDefinition.ts +++ b/src/screens/Job/generateJobDefinition.ts @@ -251,6 +251,19 @@ export const generateJobDefinition = ( ...extractSpecFields(job.spec, 'gatewayConfig'), } + break + + case 'WorkflowSpec': + values = { + ...extractJobFields(job), + ...extractSpecFields( + job.spec, + 'workflowID', + 'workflow', + 'workflowOwner', + ), + } + break default: return { definition: '' }