From 088826e433d41fd0cdbd286aef0dbdc696f6a2d7 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Tue, 13 Dec 2022 08:52:02 -0500 Subject: [PATCH] Don't show delete button for primary file --- .../src/components/ReactDiagramEditor.tsx | 4 +- .../src/routes/ProcessModelEditDiagram.tsx | 1 + .../src/routes/ProcessModelShow.tsx | 40 ++++++++++--------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index 11839e9c..30dc0d89 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -68,6 +68,7 @@ type OwnProps = { completedTasksBpmnIds?: string[] | null; saveDiagram?: (..._args: any[]) => any; onDeleteFile?: (..._args: any[]) => any; + isPrimaryFile?: boolean; onSetPrimaryFile?: (..._args: any[]) => any; diagramXML?: string | null; fileName?: string; @@ -92,6 +93,7 @@ export default function ReactDiagramEditor({ completedTasksBpmnIds, saveDiagram, onDeleteFile, + isPrimaryFile, onSetPrimaryFile, diagramXML, fileName, @@ -549,7 +551,7 @@ export default function ReactDiagramEditor({ a={targetUris.processModelFileShowPath} ability={ability} > - {fileName && ( + {fileName && !isPrimaryFile && ( ); - elements.push( - - { - onDeleteFile(processModelFile.name); - }} - confirmButtonLabel="Delete" - /> - - ); + if (!isPrimaryBpmnFile) { + elements.push( + + { + onDeleteFile(processModelFile.name); + }} + confirmButtonLabel="Delete" + /> + + ); + } if (processModelFile.name.match(/\.bpmn$/) && !isPrimaryBpmnFile) { elements.push(