added panel extensions for guest access to human tasks w/ burnettk

This commit is contained in:
jasquat 2023-08-18 11:59:59 -04:00
parent f01bece04f
commit 1b390c46cb
No known key found for this signature in database
3 changed files with 118 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import {OPTION_TYPE, SpiffExtensionSelect} from './SpiffExtensionSelect';
import {SpiffExtensionLaunchButton} from './SpiffExtensionLaunchButton';
import {SpiffExtensionTextArea} from './SpiffExtensionTextArea';
import {SpiffExtensionTextInput} from './SpiffExtensionTextInput';
import {SpiffExtensionCheckboxEntry} from './SpiffExtensionCheckboxEntry';
import {hasEventDefinition} from 'bpmn-js/lib/util/DiUtil';
import { PropertyDescription } from 'bpmn-js-properties-panel/';
@ -61,6 +62,16 @@ export default function ExtensionsPropertiesProvider(
createUserInstructionsGroup(element, translate, moddle, commandStack)
);
}
if (
isAny(element, [
'bpmn:ManualTask',
'bpmn:UserTask',
])
) {
groups.push(
createAllowGuestGroup(element, translate, moddle, commandStack)
);
}
if (
is(element, 'bpmn:BoundaryEvent') &&
hasEventDefinition(element, 'bpmn:SignalEventDefinition') &&
@ -314,6 +325,55 @@ function createUserInstructionsGroup (
};
}
/**
* Create a group on the main panel with a text box (for choosing the information to display to the user)
* @param element
* @param translate
* @param moddle
* @returns entries
*/
function createAllowGuestGroup (
element,
translate,
moddle,
commandStack
) {
return {
id: 'allow_guest_user',
label: translate('Guest options'),
entries: [
{
element,
moddle,
commandStack,
component: SpiffExtensionCheckboxEntry,
name: 'spiffworkflow:allowGuest',
label: 'Guest can complete this task',
description: 'Allow a guest user to complete this task without logging in. They will not be allowed to do anything but submit this task. If another task directly follows it that allows guest access, they could also complete that task.',
},
{
element,
moddle,
commandStack,
component: SpiffExtensionTextArea,
name: 'spiffworkflow:guestConfirmation',
label: 'Guest confirmation',
description: 'This is markdown that is displayed to the user after they complete the task. If this is filled out then the user will not be able to complete additional tasks without a new link to the next task.',
},
{
element,
moddle,
commandStack,
component: SpiffExtensionLaunchButton,
name: 'spiffworkflow:guestConfirmation',
label: translate('Launch Editor'),
event: 'spiff.markdown.edit',
listenEvent: 'spiff.markdown.update',
}
],
};
}
/**
* Create a group on the main panel with a text box for specifying a
* a Button Label that is associated with a signal event.)

View File

@ -0,0 +1,36 @@
import {useService } from 'bpmn-js-properties-panel';
import {CheckboxEntry} from '@bpmn-io/properties-panel';
import {
getExtensionValue, setExtensionValue
} from '../extensionHelpers';
/**
* A generic properties' editor for text area.
*/
export function SpiffExtensionCheckboxEntry(props) {
const element = props.element;
const commandStack = props.commandStack, moddle = props.moddle;
const name = props.name, label = props.label, description = props.description;
const debounce = useService('debounceInput');
const getValue = () => {
return getExtensionValue(element, name)
}
const setValue = value => {
setExtensionValue(element, name, value, moddle, commandStack)
};
return <CheckboxEntry
id={'extension_' + name}
element={element}
description={description}
label={label}
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>;
}

View File

@ -70,6 +70,28 @@
}
]
},
{
"name": "allowGuest",
"superClass": [ "Element" ],
"properties": [
{
"name": "value",
"isBody": true,
"type": "Boolean"
}
]
},
{
"name": "guestConfirmation",
"superClass": [ "Element" ],
"properties": [
{
"name": "value",
"isBody": true,
"type": "String"
}
]
},
{
"name": "signalButtonLabel",
"superClass": [ "Element" ],