diff --git a/example/app/data/DemoDataSource/recipes/plugins/job/jobContainer.recipe.json b/example/app/data/DemoDataSource/recipes/plugins/job/jobContainer.recipe.json index 7af722a62..4d0c54b9a 100644 --- a/example/app/data/DemoDataSource/recipes/plugins/job/jobContainer.recipe.json +++ b/example/app/data/DemoDataSource/recipes/plugins/job/jobContainer.recipe.json @@ -6,6 +6,7 @@ "type": "CORE:UiRecipe", "config": { "type": "PLUGINS:dm-core-plugins/job/CreateConfig", + "title": "Run a reverse description job", "hideLogs": true, "jobTargetAddress": ".job", "jobTemplates": [ diff --git a/example/app/data/DemoDataSource/recipes/recurringJob.recipe.json b/example/app/data/DemoDataSource/recipes/recurringJob.recipe.json index 04d9c8cdc..635136d3c 100644 --- a/example/app/data/DemoDataSource/recipes/recurringJob.recipe.json +++ b/example/app/data/DemoDataSource/recipes/recurringJob.recipe.json @@ -108,6 +108,7 @@ "type": "CORE:UiRecipe", "config": { "type": "PLUGINS:dm-core-plugins/job/ControlConfig", + "title": "Schedule an example recurring job", "runnerTemplates": [ { "type": "PLUGINS:dm-core-plugins/common/Template", diff --git a/packages/dm-core-plugins/blueprints/job/ControlConfig.json b/packages/dm-core-plugins/blueprints/job/ControlConfig.json index f9b5ae405..5de37d902 100644 --- a/packages/dm-core-plugins/blueprints/job/ControlConfig.json +++ b/packages/dm-core-plugins/blueprints/job/ControlConfig.json @@ -21,6 +21,13 @@ "attributeType": "PLUGINS:dm-core-plugins/common/Template", "dimensions": "*", "optional": true + }, + { + "name": "title", + "type": "CORE:BlueprintAttribute", + "attributeType": "string", + "optional": true, + "description": "Show a title for the job controls" } ] } diff --git a/packages/dm-core-plugins/blueprints/job/CreateConfig.json b/packages/dm-core-plugins/blueprints/job/CreateConfig.json index 319b8e900..a5866d53e 100644 --- a/packages/dm-core-plugins/blueprints/job/CreateConfig.json +++ b/packages/dm-core-plugins/blueprints/job/CreateConfig.json @@ -41,6 +41,13 @@ "description": "'applicationInput' for the created job. Absolute or relative address", "attributeType": "string", "optional": true + }, + { + "name": "title", + "type": "CORE:BlueprintAttribute", + "attributeType": "string", + "optional": true, + "description": "Show a title for the job controls" } ] } diff --git a/packages/dm-core-plugins/src/job/JobControl/JobControl.tsx b/packages/dm-core-plugins/src/job/JobControl/JobControl.tsx index f9be9dd48..97b09fe08 100644 --- a/packages/dm-core-plugins/src/job/JobControl/JobControl.tsx +++ b/packages/dm-core-plugins/src/job/JobControl/JobControl.tsx @@ -38,6 +38,7 @@ import { defaultCronValues, scheduleTemplate } from '../templateEntities' type TJobControlConfig = { hideLogs?: boolean runnerTemplates?: TTemplate[] + title?: string } const defaultConfig: TJobControlConfig = { @@ -166,100 +167,87 @@ export const JobControl = (props: IUIPlugin) => { throw new Error(JSON.stringify(error || jobEntityError, null, 2)) return ( -
-
-
- {asCronJob && ( -
- { - setSchedule(s) - setCronValues(parseCronStringToCronValues(s.cron)) - }} - cronValues={cronValues} - setCronValues={(c: TCronValues) => { - setSchedule({ - ...schedule, - cron: parseCronValuesToCronString(c), - }) - setCronValues(c) - }} - registered={status === JobStatus.Registered} +
+ {internalConfig.title &&

{config.title}

} + {asCronJob && ( +
+ { + setSchedule(s) + setCronValues(parseCronStringToCronValues(s.cron)) + }} + cronValues={cronValues} + setCronValues={(c: TCronValues) => { + setSchedule({ + ...schedule, + cron: parseCronValuesToCronString(c), + }) + setCronValues(c) + }} + registered={status === JobStatus.Registered} + /> +
+ )} + +
+ {getControlButton(status, remove, start, false, jobIsLoading)} +
+

Status:

+ + {status ?? 'Not registered'} + +
+ + {!internalConfig.hideLogs && } +
+ + {internalConfig.runnerTemplates && + internalConfig.runnerTemplates.length > 0 && ( +
+ + + + + handleRunnerTemplateSelect(template) + } + onClose={() => setTemplateMenuIsOpen(false)} + isOpen={isTemplateMenuOpen} + title='Runner' + selected={templates.findIndex((template: TJobHandler) => + _.isEqual(template, jobEntity.runner) + )} />
)} - -
- {getControlButton(status, remove, start, false, jobIsLoading)} -
-

Status:

- - {status ?? 'Not registered'} - -
+ - {!internalConfig.hideLogs && } -
- - {internalConfig.runnerTemplates && - internalConfig.runnerTemplates.length > 0 && ( -
- - - - - handleRunnerTemplateSelect(template) - } - onClose={() => setTemplateMenuIsOpen(false)} - isOpen={isTemplateMenuOpen} - title='Runner' - selected={templates.findIndex((template: TJobHandler) => - _.isEqual(template, jobEntity.runner) - )} - /> -
- )} -
- - {status === JobStatus.Running && progress !== null && ( -
- -
- )} + {status === JobStatus.Running && progress !== null && ( +
+
-
+ )}
) } diff --git a/packages/dm-core-plugins/src/job/JobCreate.tsx b/packages/dm-core-plugins/src/job/JobCreate.tsx index 89d2c79a7..116d5c367 100644 --- a/packages/dm-core-plugins/src/job/JobCreate.tsx +++ b/packages/dm-core-plugins/src/job/JobCreate.tsx @@ -48,6 +48,7 @@ interface TJobPluginConfig { showGetResult?: boolean jobTemplates: TTemplate[] hideLogs?: boolean + title?: string } export const JobCreate = (props: IUIPlugin & { config: TJobPluginConfig }) => { @@ -165,7 +166,12 @@ export const JobCreate = (props: IUIPlugin & { config: TJobPluginConfig }) => { if (jobDocument.type === EBlueprint.RECURRING_JOB) setAsCronJob(true) }, [jobDocument]) return ( -
+
+ {config.title &&

{config.title}

} {config.recurring !== false && ( { /> )} - {getControlButton( - status, - deregister, - createAndStartJob, - false, - jobIsLoading - )} - {!config.hideLogs && } - {status ?? 'Not registered'} +
+ {getControlButton( + status, + deregister, + createAndStartJob, + false, + jobIsLoading + )} +
+

Status:

+ + {status ?? 'Not registered'} + +
+ {!config.hideLogs && } +
{config.jobTemplates.length > 1 && (