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;
|
||||
};
|
||||
|
||||
export const CodeMirror = connect(({ value, onChange, ...otherProps }) => {
|
||||
export const CodeMirror = connect(({ value, onChange, defaultValue, ...otherProps }) => {
|
||||
return (
|
||||
<CM
|
||||
value={value || ''}
|
||||
value={value || defaultValue || ''}
|
||||
onChange={onChange}
|
||||
{...otherProps}
|
||||
extensions={[
|
||||
|
@ -278,7 +278,6 @@ const schema: ISchema = {
|
||||
'ctx.request\nctx.body\nlib.JSON\nlib.Math\nlib.dayjs',
|
||||
},
|
||||
'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',
|
||||
},
|
||||
'x-collection-field': 'webhooks.code',
|
||||
'x-component-props': {},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -781,7 +779,9 @@ const schema: ISchema = {
|
||||
params: {
|
||||
type: 'string',
|
||||
'x-component': 'CodeMirror',
|
||||
'x-component-props': {},
|
||||
'x-component-props': {
|
||||
defaultValue: '{}',
|
||||
},
|
||||
'x-decorator': 'FormItem',
|
||||
'x-decorator-props': {
|
||||
label: 'query',
|
||||
@ -790,7 +790,9 @@ const schema: ISchema = {
|
||||
body: {
|
||||
type: 'string',
|
||||
'x-component': 'CodeMirror',
|
||||
'x-component-props': {},
|
||||
'x-component-props': {
|
||||
defaultValue: '{}',
|
||||
},
|
||||
'x-decorator': 'FormItem',
|
||||
'x-decorator-props': {
|
||||
label: 'body',
|
||||
|
@ -76,8 +76,10 @@ export const dispatchers: CollectionOptions = {
|
||||
title: tval('Code'),
|
||||
type: 'string',
|
||||
'x-component': 'CodeMirror',
|
||||
default:
|
||||
'// ctx.query can get user query\n// ctx.body to pass your data to workflow or to client who trigger this webhook.',
|
||||
'x-component-props': {
|
||||
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,
|
||||
},
|
||||
],
|
||||
|
@ -8,7 +8,7 @@ export async function update(context: Context, next) {
|
||||
const repository = utils.getRepositoryFromParams(context) as Repository;
|
||||
const { filterByTk, values } = context.action.params;
|
||||
context.action.mergeParams({
|
||||
whitelist: ['title', 'description', 'enabled', 'triggerTitle', 'config', 'options', 'type'],
|
||||
whitelist: ['title', 'description', 'enabled', 'triggerTitle', 'config', 'options', 'type', 'sync'],
|
||||
});
|
||||
// only enable/disable
|
||||
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 processor = await pluginWorkflow.trigger(wf, { data: webhookCtx.body }, { httpContext: ctx });
|
||||
if (!processor) {
|
||||
return ctx.throw(500);
|
||||
return ctx.throw('Workflow should be sync.', 500);
|
||||
}
|
||||
const { lastSavedJob } = processor;
|
||||
ctx.withoutDataWrapping = true;
|
||||
|
Loading…
Reference in New Issue
Block a user