From e5a37b3cfed0a1197193c4d69091c1956913b026 Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 30 May 2023 17:58:53 -0400 Subject: [PATCH] allow markdown uploads and add some different ux options for adding files --- .../src/routes/ProcessModelShow.tsx | 143 ++++++++++++------ 1 file changed, 95 insertions(+), 48 deletions(-) diff --git a/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx b/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx index 407c81151..fb46745dc 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx @@ -1,12 +1,11 @@ import { useEffect, useState } from 'react'; import { Link, useNavigate, useParams } from 'react-router-dom'; import { - Add, Download, Edit, Favorite, TrashCan, - Upload, + NextOutline, View, // @ts-ignore } from '@carbon/icons-react'; @@ -14,8 +13,8 @@ import { Accordion, AccordionItem, Button, - ButtonSet, Column, + Dropdown, FileUploader, Grid, Modal, @@ -106,6 +105,12 @@ export default function ProcessModelShow() { }); }, [reloadModel, modifiedProcessModelId]); + // these options are just here as a sort of A/B test to see which UX is better. + // they will be removed once we learn which UX to go with. + const newUx1 = true; + const newUx2 = false; + const newUx2PublishAsIcon = false; + const processInstanceRunResultTag = () => { if (processInstance) { return ( @@ -483,13 +488,13 @@ export default function ProcessModelShow() { > ({ + text: item, + })); + + const addFileComponent = () => { + return ( + { + if (a.selectedItem.text === 'New BPMN File') { + navigate( + `/admin/process-models/${modifiedProcessModelId}/files?file_type=bpmn` + ); + } else if (a.selectedItem.text === 'Upload File') { + setShowFileUploadModal(true); + } else if (a.selectedItem.text === 'New DMN File') { + navigate( + `/admin/process-models/${modifiedProcessModelId}/files?file_type=dmn` + ); + } else if (a.selectedItem.text === 'New JSON File') { + navigate( + `/admin/process-models/${modifiedProcessModelId}/form?file_ext=json` + ); + } else if (a.selectedItem.text === 'New Markdown File') { + navigate( + `/admin/process-models/${modifiedProcessModelId}/form?file_ext=md` + ); + } else { + console.log('a.selectedItem.text', a.selectedItem.text); + } + }} + items={items} + itemToString={(item: any) => (item ? item.text : '')} + /> + ); + }; + const processModelFilesSection = () => { return ( - - - - - - - + {newUx1 && addFileComponent()}
{processModelFileList()} @@ -642,6 +655,22 @@ export default function ProcessModelShow() { confirmButtonLabel="Delete" /> + {newUx2PublishAsIcon && ( + + + {!newUx2PublishAsIcon ? ( + + + + ) : null} + + {newUx2 ? addFileComponent() : null} + {hasTestCaseFiles ? (