Don't show delete button for primary file
This commit is contained in:
parent
2c25e626e1
commit
088826e433
|
@ -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 && (
|
||||
<ButtonWithConfirmation
|
||||
description={`Delete file ${fileName}?`}
|
||||
onConfirmation={handleDelete}
|
||||
|
|
|
@ -819,6 +819,7 @@ export default function ProcessModelEditDiagram() {
|
|||
processModelId={params.process_model_id || ''}
|
||||
saveDiagram={saveDiagram}
|
||||
onDeleteFile={onDeleteFile}
|
||||
isPrimaryFile={params.file_name === processModel?.primary_file_name}
|
||||
onSetPrimaryFile={onSetPrimaryFileCallback}
|
||||
diagramXML={bpmnXmlForDiagramRendering}
|
||||
fileName={params.file_name}
|
||||
|
|
|
@ -264,25 +264,27 @@ export default function ProcessModelShow() {
|
|||
</Can>
|
||||
);
|
||||
|
||||
elements.push(
|
||||
<Can
|
||||
I="DELETE"
|
||||
a={targetUris.processModelFileCreatePath}
|
||||
ability={ability}
|
||||
>
|
||||
<ButtonWithConfirmation
|
||||
kind="ghost"
|
||||
renderIcon={TrashCan}
|
||||
iconDescription="Delete File"
|
||||
hasIconOnly
|
||||
description={`Delete file: ${processModelFile.name}`}
|
||||
onConfirmation={() => {
|
||||
onDeleteFile(processModelFile.name);
|
||||
}}
|
||||
confirmButtonLabel="Delete"
|
||||
/>
|
||||
</Can>
|
||||
);
|
||||
if (!isPrimaryBpmnFile) {
|
||||
elements.push(
|
||||
<Can
|
||||
I="DELETE"
|
||||
a={targetUris.processModelFileCreatePath}
|
||||
ability={ability}
|
||||
>
|
||||
<ButtonWithConfirmation
|
||||
kind="ghost"
|
||||
renderIcon={TrashCan}
|
||||
iconDescription="Delete File"
|
||||
hasIconOnly
|
||||
description={`Delete file: ${processModelFile.name}`}
|
||||
onConfirmation={() => {
|
||||
onDeleteFile(processModelFile.name);
|
||||
}}
|
||||
confirmButtonLabel="Delete"
|
||||
/>
|
||||
</Can>
|
||||
);
|
||||
}
|
||||
if (processModelFile.name.match(/\.bpmn$/) && !isPrimaryBpmnFile) {
|
||||
elements.push(
|
||||
<Can I="PUT" a={targetUris.processModelShowPath} ability={ability}>
|
||||
|
|
Loading…
Reference in New Issue