This repository was archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathJobMapping.tsx
More file actions
60 lines (57 loc) · 1.66 KB
/
JobMapping.tsx
File metadata and controls
60 lines (57 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { Job, parsers, workflow } from '@circleci/circleci-config-sdk';
import JobNode from '../components/atoms/nodes/JobNode';
import JobSummary from '../components/atoms/summaries/JobSummary';
import JobInspector from '../components/containers/inspector/JobInspector';
import { componentParametersSubtypes } from '../components/containers/inspector/subtypes/ParameterSubtypes';
import JobIcon from '../icons/components/JobIcon';
import ComponentMapping from './ComponentMapping';
const JobMapping: ComponentMapping<Job, workflow.WorkflowJob> = {
type: 'jobs',
name: {
singular: 'Job',
plural: 'Jobs',
},
defaults: {
name: 'New Job',
steps: [],
},
parameters: componentParametersSubtypes.job,
/**
TODO: Implement this to pass transform method to
dependsOn: (definitions) => [definitions.commands, definitions.executors],
*/
transform: ({ name, ...values }, definitions) => {
console.log(values);
return parsers.parseJob(
name,
values,
definitions.commands,
definitions.executors,
);
},
store: {
get: (state) => {
return state.definitions.jobs;
},
add: (actions) => actions.defineJob,
update: (actions) => actions.updateJob,
remove: (actions) => actions.undefineJob,
},
dragTarget: 'workflow',
node: {
transform: (data, params) => {
return new workflow.WorkflowJob(data, params);
},
component: JobNode,
},
components: {
icon: JobIcon,
summary: JobSummary,
inspector: JobInspector,
},
docsInfo: {
description: 'Collection of steps to run your config',
link: 'https://circleci.com/docs/2.0/concepts/#jobs',
},
};
export default JobMapping;