fix: workflow sync status now can be changed(using in your own risk), code mirror now support default value (#1387)
Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#1387
This commit is contained in:
parent
932048316c
commit
6e4a0cf42d
@ -78,10 +78,10 @@ const completionSource = (context) => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CodeMirror = connect(({ value, onChange, ...otherProps }) => {
|
export const CodeMirror = connect(({ value, onChange, defaultValue, ...otherProps }) => {
|
||||||
return (
|
return (
|
||||||
<CM
|
<CM
|
||||||
value={value || ''}
|
value={value || defaultValue || ''}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
extensions={[
|
extensions={[
|
||||||
|
@ -278,7 +278,6 @@ const schema: ISchema = {
|
|||||||
'ctx.request\nctx.body\nlib.JSON\nlib.Math\nlib.dayjs',
|
'ctx.request\nctx.body\nlib.JSON\nlib.Math\nlib.dayjs',
|
||||||
},
|
},
|
||||||
'x-collection-field': 'webhooks.code',
|
'x-collection-field': 'webhooks.code',
|
||||||
'x-component-props': {},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -629,7 +628,6 @@ const schema: ISchema = {
|
|||||||
'ctx.request\nctx.body\nlib.JSON\nlib.Math\nlib.dayjs',
|
'ctx.request\nctx.body\nlib.JSON\nlib.Math\nlib.dayjs',
|
||||||
},
|
},
|
||||||
'x-collection-field': 'webhooks.code',
|
'x-collection-field': 'webhooks.code',
|
||||||
'x-component-props': {},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -781,7 +779,9 @@ const schema: ISchema = {
|
|||||||
params: {
|
params: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-component': 'CodeMirror',
|
'x-component': 'CodeMirror',
|
||||||
'x-component-props': {},
|
'x-component-props': {
|
||||||
|
defaultValue: '{}',
|
||||||
|
},
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-decorator-props': {
|
'x-decorator-props': {
|
||||||
label: 'query',
|
label: 'query',
|
||||||
@ -790,7 +790,9 @@ const schema: ISchema = {
|
|||||||
body: {
|
body: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-component': 'CodeMirror',
|
'x-component': 'CodeMirror',
|
||||||
'x-component-props': {},
|
'x-component-props': {
|
||||||
|
defaultValue: '{}',
|
||||||
|
},
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-decorator-props': {
|
'x-decorator-props': {
|
||||||
label: 'body',
|
label: 'body',
|
||||||
|
@ -76,8 +76,10 @@ export const dispatchers: CollectionOptions = {
|
|||||||
title: tval('Code'),
|
title: tval('Code'),
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-component': 'CodeMirror',
|
'x-component': 'CodeMirror',
|
||||||
default:
|
'x-component-props': {
|
||||||
'// ctx.query can get user query\n// ctx.body to pass your data to workflow or to client who trigger this webhook.',
|
defaultValue:
|
||||||
|
'// ctx.action.params can get user query\n// ctx.action.params.values can get user body\n// ctx.body to pass your data to workflow or to client who invoke this.',
|
||||||
|
},
|
||||||
} as ISchema,
|
} as ISchema,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -8,7 +8,7 @@ export async function update(context: Context, next) {
|
|||||||
const repository = utils.getRepositoryFromParams(context) as Repository;
|
const repository = utils.getRepositoryFromParams(context) as Repository;
|
||||||
const { filterByTk, values } = context.action.params;
|
const { filterByTk, values } = context.action.params;
|
||||||
context.action.mergeParams({
|
context.action.mergeParams({
|
||||||
whitelist: ['title', 'description', 'enabled', 'triggerTitle', 'config', 'options', 'type'],
|
whitelist: ['title', 'description', 'enabled', 'triggerTitle', 'config', 'options', 'type', 'sync'],
|
||||||
});
|
});
|
||||||
// only enable/disable
|
// only enable/disable
|
||||||
if (Object.keys(values).includes('config')) {
|
if (Object.keys(values).includes('config')) {
|
||||||
|
@ -40,7 +40,7 @@ export class WebhookController {
|
|||||||
const wf = await wfRepo.findOne({ filter: { key: webhook.workflowKey, enabled: true } });
|
const wf = await wfRepo.findOne({ filter: { key: webhook.workflowKey, enabled: true } });
|
||||||
const processor = await pluginWorkflow.trigger(wf, { data: webhookCtx.body }, { httpContext: ctx });
|
const processor = await pluginWorkflow.trigger(wf, { data: webhookCtx.body }, { httpContext: ctx });
|
||||||
if (!processor) {
|
if (!processor) {
|
||||||
return ctx.throw(500);
|
return ctx.throw('Workflow should be sync.', 500);
|
||||||
}
|
}
|
||||||
const { lastSavedJob } = processor;
|
const { lastSavedJob } = processor;
|
||||||
ctx.withoutDataWrapping = true;
|
ctx.withoutDataWrapping = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user