Make it possible to delete imported nodes (#248)

It is possible to import process nodes from other processes. But there
are no way, via the GUI, to remove the imported process nodes from the
current process/process node.
This commit makes it possible to remove imported process nodes, no matter
where which process they comes from.
This commit is contained in:
mdkamijo 2020-02-26 14:53:34 +01:00 committed by GitHub
parent 5395b42bab
commit 3ffbce0709
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,52 +286,52 @@ class NodeTile extends BaseHtmlElement
));
}
if (! $this->renderer->getBusinessProcess()->getMetadata()->canModify()
|| $this->node->getBpConfig()->getName() !== $this->renderer->getBusinessProcess()->getName()
|| $this->node->getName() === '__unbound__'
if ($this->renderer->getBusinessProcess()->getMetadata()->canModify()
&& $this->node->getBpConfig()->getName() === $this->renderer->getBusinessProcess()->getName()
&& $this->node->getName() !== '__unbound__'
) {
return;
if ($this->node instanceof BpNode) {
$this->actions()->add(Html::tag(
'a',
[
'href' => $baseUrl
->with('action', 'edit')
->with('editnode', $this->node->getName()),
'title' => mt('businessprocess', 'Modify this business process node')
],
Html::tag('i', ['class' => 'icon icon-edit'])
));
$addUrl = $baseUrl->with([
'node' => $this->node->getName(),
'action' => 'add'
]);
$addUrl->getParams()->addValues('path', $this->path);
$this->actions()->add(Html::tag(
'a',
[
'href' => $addUrl,
'title' => mt('businessprocess', 'Add a new sub-node to this business process')
],
Html::tag('i', ['class' => 'icon icon-plus'])
));
}
}
if ($this->node instanceof BpNode) {
if ($this->renderer->getBusinessProcess()->getMetadata()->canModify()) {
$params = array(
'action' => 'delete',
'deletenode' => $this->node->getName(),
);
$this->actions()->add(Html::tag(
'a',
[
'href' => $baseUrl
->with('action', 'edit')
->with('editnode', $this->node->getName()),
'title' => mt('businessprocess', 'Modify this business process node')
'href' => $baseUrl->with($params),
'title' => mt('businessprocess', 'Delete this node')
],
Html::tag('i', ['class' => 'icon icon-edit'])
));
$addUrl = $baseUrl->with([
'node' => $this->node->getName(),
'action' => 'add'
]);
$addUrl->getParams()->addValues('path', $this->path);
$this->actions()->add(Html::tag(
'a',
[
'href' => $addUrl,
'title' => mt('businessprocess', 'Add a new sub-node to this business process')
],
Html::tag('i', ['class' => 'icon icon-plus'])
Html::tag('i', ['class' => 'icon icon-cancel'])
));
}
$params = array(
'action' => 'delete',
'deletenode' => $this->node->getName(),
);
$this->actions()->add(Html::tag(
'a',
[
'href' => $baseUrl->with($params),
'title' => mt('businessprocess', 'Delete this node')
],
Html::tag('i', ['class' => 'icon icon-cancel'])
));
}
}