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;
|
completedTasksBpmnIds?: string[] | null;
|
||||||
saveDiagram?: (..._args: any[]) => any;
|
saveDiagram?: (..._args: any[]) => any;
|
||||||
onDeleteFile?: (..._args: any[]) => any;
|
onDeleteFile?: (..._args: any[]) => any;
|
||||||
|
isPrimaryFile?: boolean;
|
||||||
onSetPrimaryFile?: (..._args: any[]) => any;
|
onSetPrimaryFile?: (..._args: any[]) => any;
|
||||||
diagramXML?: string | null;
|
diagramXML?: string | null;
|
||||||
fileName?: string;
|
fileName?: string;
|
||||||
|
@ -92,6 +93,7 @@ export default function ReactDiagramEditor({
|
||||||
completedTasksBpmnIds,
|
completedTasksBpmnIds,
|
||||||
saveDiagram,
|
saveDiagram,
|
||||||
onDeleteFile,
|
onDeleteFile,
|
||||||
|
isPrimaryFile,
|
||||||
onSetPrimaryFile,
|
onSetPrimaryFile,
|
||||||
diagramXML,
|
diagramXML,
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -549,7 +551,7 @@ export default function ReactDiagramEditor({
|
||||||
a={targetUris.processModelFileShowPath}
|
a={targetUris.processModelFileShowPath}
|
||||||
ability={ability}
|
ability={ability}
|
||||||
>
|
>
|
||||||
{fileName && (
|
{fileName && !isPrimaryFile && (
|
||||||
<ButtonWithConfirmation
|
<ButtonWithConfirmation
|
||||||
description={`Delete file ${fileName}?`}
|
description={`Delete file ${fileName}?`}
|
||||||
onConfirmation={handleDelete}
|
onConfirmation={handleDelete}
|
||||||
|
|
|
@ -819,6 +819,7 @@ export default function ProcessModelEditDiagram() {
|
||||||
processModelId={params.process_model_id || ''}
|
processModelId={params.process_model_id || ''}
|
||||||
saveDiagram={saveDiagram}
|
saveDiagram={saveDiagram}
|
||||||
onDeleteFile={onDeleteFile}
|
onDeleteFile={onDeleteFile}
|
||||||
|
isPrimaryFile={params.file_name === processModel?.primary_file_name}
|
||||||
onSetPrimaryFile={onSetPrimaryFileCallback}
|
onSetPrimaryFile={onSetPrimaryFileCallback}
|
||||||
diagramXML={bpmnXmlForDiagramRendering}
|
diagramXML={bpmnXmlForDiagramRendering}
|
||||||
fileName={params.file_name}
|
fileName={params.file_name}
|
||||||
|
|
|
@ -264,25 +264,27 @@ export default function ProcessModelShow() {
|
||||||
</Can>
|
</Can>
|
||||||
);
|
);
|
||||||
|
|
||||||
elements.push(
|
if (!isPrimaryBpmnFile) {
|
||||||
<Can
|
elements.push(
|
||||||
I="DELETE"
|
<Can
|
||||||
a={targetUris.processModelFileCreatePath}
|
I="DELETE"
|
||||||
ability={ability}
|
a={targetUris.processModelFileCreatePath}
|
||||||
>
|
ability={ability}
|
||||||
<ButtonWithConfirmation
|
>
|
||||||
kind="ghost"
|
<ButtonWithConfirmation
|
||||||
renderIcon={TrashCan}
|
kind="ghost"
|
||||||
iconDescription="Delete File"
|
renderIcon={TrashCan}
|
||||||
hasIconOnly
|
iconDescription="Delete File"
|
||||||
description={`Delete file: ${processModelFile.name}`}
|
hasIconOnly
|
||||||
onConfirmation={() => {
|
description={`Delete file: ${processModelFile.name}`}
|
||||||
onDeleteFile(processModelFile.name);
|
onConfirmation={() => {
|
||||||
}}
|
onDeleteFile(processModelFile.name);
|
||||||
confirmButtonLabel="Delete"
|
}}
|
||||||
/>
|
confirmButtonLabel="Delete"
|
||||||
</Can>
|
/>
|
||||||
);
|
</Can>
|
||||||
|
);
|
||||||
|
}
|
||||||
if (processModelFile.name.match(/\.bpmn$/) && !isPrimaryBpmnFile) {
|
if (processModelFile.name.match(/\.bpmn$/) && !isPrimaryBpmnFile) {
|
||||||
elements.push(
|
elements.push(
|
||||||
<Can I="PUT" a={targetUris.processModelShowPath} ability={ability}>
|
<Can I="PUT" a={targetUris.processModelShowPath} ability={ability}>
|
||||||
|
|
Loading…
Reference in New Issue