Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Kuhn <maximilian.kuhn@ymail.com>
  • Loading branch information
wiomoc committed Aug 2, 2023
1 parent 5c7f84d commit 396ff92
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PlanQKPlugin from "../../extensions/planqk/PlanQKPlugin";
import QuantMEPlugin from "../../extensions/quantme/QuantMEPlugin";
import OpenToscaPlugin from "../../extensions/opentosca/OpenToscaPlugin";
import OpenToscaPlugin from "../../extensions/opentosca/OpenTOSCAPlugin";
import DataFlowPlugin from '../../extensions/data-extension/DataFlowPlugin';
import QHAnaPlugin from '../../extensions/qhana/QHAnaPlugin';
import {getAllConfigs} from "./PluginConfigHandler";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ import {
} from 'diagram-js/lib/util/RenderUtil';

import BpmnRenderer from 'bpmn-js/lib/draw/BpmnRenderer';
import { getOrientation } from 'diagram-js/lib/layout/LayoutUtil';


import buttonIcon from '../resources/show-deployment-button.svg?raw';
import {drawTaskSVG} from '../../../editor/util/RenderUtilities';
import NotificationHandler from '../../../editor/ui/notifications/NotificationHandler';
import {append as svgAppend, attr as svgAttr, create as svgCreate, select, prepend as svgPrepend} from 'tiny-svg';
import {query as domQuery} from 'min-dom';
import {
isSnapped,
setSnapped,
topLeft,
bottomRight
} from 'diagram-js/lib/features/snapping/SnapUtil';

import {loadTopology} from "../deployment/WineryUtils";

Expand Down Expand Up @@ -40,6 +48,26 @@ export default class OpenTOSCARenderer extends BpmnRenderer {
this.styles = styles;
this.textRenderer = textRenderer;

// snap boundary events
eventBus.on([
'create.move',
'create.end',
'shape.move.move',
'shape.move.end'
], 140000, function(event) {
var context = event.context,
canExecute = context.canExecute,
target = context.target;

var canAttach = canExecute && (canExecute === 'attach' || canExecute.attach);
const isRelevantEvent = context.shape.type === "bpmn:IntermediateThrowEvent" || context.shape.type === "bpmn:BoundaryEvent";

if (canAttach && isRelevantEvent && context.target.businessObject.get('opentosca:deploymentModelUrl') && getOrientation(event, target, -30) === "bottom-right") {
// Prevent snapping on deployment visualisation toggle button
event.stopPropagation();
}
});

this.openToscaHandlers = {
[SERVICE_TASK_TYPE]: function (self, parentGfx, element) {
const task = self.renderer('bpmn:ServiceTask')(parentGfx, element);
Expand Down Expand Up @@ -235,20 +263,20 @@ export default class OpenTOSCARenderer extends BpmnRenderer {
const commands = [];

if (shifts.right || shifts.left) {
const xPosition = (newBoundingBox.left + newBoundingBox.right) / 2
const xPosition = (newBoundingBox.left + newBoundingBox.right) / 2;
for (const otherElement of allElements) {
let otherXPosition = element.x + NODE_WIDTH / 2;
const otherElementBoundingBox = this.currentlyShownDeploymentsModels.get(otherElement.id)?.boundingBox;
if (otherElementBoundingBox) {
otherXPosition = (otherElementBoundingBox.left + otherElementBoundingBox.right) / 2;
}
let xShift
let xShift;
if (shifts.right && otherXPosition >= xPosition && otherElement.id !== element.id) {
xShift = shifts.right + NODE_SHIFT_MARGIN
xShift = shifts.right + NODE_SHIFT_MARGIN;
} else if (shifts.left && otherXPosition <= xPosition && otherElement.id !== element.id) {
xShift = -shifts.left - NODE_SHIFT_MARGIN
xShift = -shifts.left - NODE_SHIFT_MARGIN;
} else {
continue
continue;
}
// Can not move elements without parent
if(!otherElement.parent) continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export default function ArtifactUploadModal({onClose, element, commandStack}) {
<div
className={`tab ${selectedTab === "docker" ? "active" : ""}`}
onClick={() => setSelectedTab("docker")}
style={{display: "none"}}
>
Docker Image
</div>
Expand Down

0 comments on commit 396ff92

Please sign in to comment.