ignoring some react lints for now

This commit is contained in:
jasquat 2022-08-05 09:46:13 -04:00
parent defcc1f191
commit d1b336ea36
3 changed files with 105 additions and 73 deletions

View File

@ -5,7 +5,6 @@ module.exports = {
},
extends: [
'airbnb',
'plugin:bpmn-io/es6',
'plugin:prettier/recommended',
'plugin:sonarjs/recommended',
'plugin:import/errors',
@ -40,5 +39,10 @@ module.exports = {
tsx: 'never',
},
],
// We could try turning these on at some point but do not want to force it now
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
},
};

View File

@ -11,39 +11,9 @@ export const SCRIPT_TYPE = {
post: 'spiffworkflow:postScript',
};
/**
* Generates a python script.
* @param element The elemment that should get the script task.
* @param scriptType The type of script -- can be a preScript, postScript or a BPMN:Script for script tags
* @param moddle For updating the underlying xml document when needed.
* @returns {[{component: (function(*)), isEdited: *, id: string, element},{component: (function(*)), isEdited: *, id: string, element}]}
*/
export default function (element, moddle, scriptType, label, description) {
return [
{
id: `pythonScript_${scriptType}`,
element,
targetTag: scriptType,
component: PythonScript,
isEdited: isTextFieldEntryEdited,
moddle,
label,
description,
},
{
id: `launchEditorButton${scriptType}`,
target_tag: scriptType,
element,
component: LaunchEditorButton,
isEdited: isTextFieldEntryEdited,
moddle,
},
];
}
function PythonScript(props) {
const { element, id } = props;
const type = props.targetTag;
const { type } = props;
const { moddle } = props;
const { label } = props;
const { description } = props;
@ -76,9 +46,11 @@ function PythonScript(props) {
if (!bizObj.extensionElements) {
return null;
}
return bizObj.extensionElements.get('values').filter(function (e) {
return e.$instanceOf(type);
})[0];
return bizObj.extensionElements
.get('values')
.filter(function getInstanceOfType(e) {
return e.$instanceOf(type);
})[0];
};
const getValue = () => {
@ -121,9 +93,8 @@ function PythonScript(props) {
}
function LaunchEditorButton(props) {
const { element, id, type } = props;
const { element, type } = props;
const eventBus = useService('eventBus');
const modeling = useService('modeling');
// fixme: add a call up date as a property
return (
<HeaderButton
@ -136,3 +107,39 @@ function LaunchEditorButton(props) {
</HeaderButton>
);
}
/**
* Generates a python script.
* @param element The elemment that should get the script task.
* @param scriptType The type of script -- can be a preScript, postScript or a BPMN:Script for script tags
* @param moddle For updating the underlying xml document when needed.
* @returns {[{component: (function(*)), isEdited: *, id: string, element},{component: (function(*)), isEdited: *, id: string, element}]}
*/
export default function getEntries(
element,
moddle,
scriptType,
label,
description
) {
return [
{
id: `pythonScript_${scriptType}`,
element,
type: scriptType,
component: PythonScript,
isEdited: isTextFieldEntryEdited,
moddle,
label,
description,
},
{
id: `launchEditorButton${scriptType}`,
type: scriptType,
element,
component: LaunchEditorButton,
isEdited: isTextFieldEntryEdited,
moddle,
},
];
}

View File

@ -1,4 +1,8 @@
import { TextAreaEntry, TextFieldEntry, isTextFieldEntryEdited } from '@bpmn-io/properties-panel';
import {
TextAreaEntry,
TextFieldEntry,
isTextFieldEntryEdited,
} from '@bpmn-io/properties-panel';
import { useService } from 'bpmn-js-properties-panel';
import { is, isAny } from 'bpmn-js/lib/util/ModelUtil';
@ -6,9 +10,15 @@ import { is, isAny } from 'bpmn-js/lib/util/ModelUtil';
// import { SpiffExtensionTextInput } from './SpiffExtensionTextInput';
const LOW_PRIORITY = 500;
export default function MessagesPropertiesProvider(propertiesPanel, translate, moddle, commandStack, elementRegistry) {
this.getGroups = function(element) {
return function(groups) {
export default function MessagesPropertiesProvider(
propertiesPanel,
translate,
moddle,
commandStack,
elementRegistry
) {
this.getGroups = function (element) {
return function (groups) {
if (is(element, 'bpmn:Collaboration')) {
groups.push(createCollaborationGroup(element, translate, moddle));
}
@ -19,8 +29,44 @@ export default function MessagesPropertiesProvider(propertiesPanel, translate, m
propertiesPanel.registerProvider(LOW_PRIORITY, this);
}
MessagesPropertiesProvider.$inject = [ 'propertiesPanel', 'translate', 'moddle', 'commandStack', 'elementRegistry' ];
MessagesPropertiesProvider.$inject = [
'propertiesPanel',
'translate',
'moddle',
'commandStack',
'elementRegistry',
];
function MessageCollaboration(props) {
const { element } = props;
const debounce = useService('debounceInput');
const getValue = () => {
return '';
};
const setValue = (value) => {};
return (
<TextAreaEntry
id="message_collaborations"
element={element}
description="description"
label="label"
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>
);
}
function messageCollaborationGroup(element, _moddle, _label, _description) {
return [
{
component: MessageCollaboration,
element,
},
];
}
/**
* Adds a group to the properties panel for the script task that allows you
@ -32,36 +78,11 @@ function createCollaborationGroup(element, translate, moddle, commandStack) {
return {
id: 'collaboration_id',
label: translate('Message Collaboration'),
entries: messageCollaborationGroup(element, moddle, 'Collab', 'More Collabor')
entries: messageCollaborationGroup(
element,
moddle,
'Collab',
'More Collabor'
),
};
}
function messageCollaborationGroup(element, moddle, label, description) {
return [
{
component: MessageCollaboration,
element: element,
},
];
}
function MessageCollaboration(props) {
const { element } = props;
const debounce = useService('debounceInput');
const getValue = () => {
return ""
};
const setValue = value => {
};
return <TextAreaEntry
id="message_collaborations"
element={ element }
description="description"
label="label"
getValue={ getValue }
setValue={ setValue }
debounce={ debounce }
/>;
}