Skip to content

Commit

Permalink
Live-Modeling: Enable Deployments at Modeling Time
Browse files Browse the repository at this point in the history
Co-authored-by: Kálmán Képes <[email protected]>
Co-authored-by: Björn Müller <[email protected]>
Co-authored-by: Lukas Harzenetter <[email protected]>
Signed-off-by: Phi Dang <[email protected]>
Signed-off-by: Lukas Harzenetter <[email protected]>
  • Loading branch information
4 people committed Jan 18, 2022
1 parent de2c8c7 commit 2f0536c
Show file tree
Hide file tree
Showing 128 changed files with 7,061 additions and 528 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ winery-debug.log
**/gen/**
**/dist.tgz
org.eclipse.winery.repository.ui/src/assets/build-code**
.DS_Store

# generated by CLi when executing with -cb copy.bara.sky
copy.bara.sky
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ ENV WINERY_FEATURE_SPLITTING false
ENV WINERY_FEATURE_TEST_REFINEMENT false
ENV WINERY_FEATURE_EDMM_MODELING false
ENV WINERY_FEATURE_UPDATE_TEMPLATES false
ENV WINERY_FEATURE_LIVE_MODELING false
ENV WINERY_FEATURE_PROPERTY_CHECK false
ENV DOCKERIZE_VERSION v0.6.1
ENV CHE_URL "che.localhost"
ENV CHE_URL_PROTOCOL "http"
Expand Down
1 change: 1 addition & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Copyright (c) 2019-2020 Tobias Mathony
Copyright (c) 2019 Yannik Dietrich
Copyright (c) 2019 Yuye Tong
Copyright (c) 2020 Leonardo Frioli
Copyright (c) 2020 Phi Dang
Copyright (c) 2021 Alexandros Fouskas
Copyright (c) 2021 Andrej Nisin
Copyright (c) 2021 Marvin Bechtold
Expand Down
2 changes: 2 additions & 0 deletions org.eclipse.winery.common/src/main/resources/winery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ui:
placement: false
radon: false
patternDetection: true
liveModeling: true
propertyCheck: true
endpoints:
container: http://localhost:1337
workflowmodeler: http://localhost:9527
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2017-2018 Contributors to the Eclipse Foundation
* Copyright (c) 2017-2021 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -27,6 +27,10 @@
cursor: crosshair;
}

.cursor-move {
cursor: move;
}

.selection-active {
display: block !important;
}
Expand All @@ -47,6 +51,10 @@
right: 2em;
}

#container {
overflow: hidden;
}

#grid {
position: absolute;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
-->
<div id="container" style="height: 100%; width: 100%"
<div id="container" style="height: 100%"
(mousedown)="showSelectionRange($event)"
(click)="this.revalidateContainer()">
<div id="grid"
(mousedown)="trackTimeOfMouseDown()"
(mouseup)="trackTimeOfMouseUp()"
[class.crosshair]="this.gridTemplate.crosshair"
[style.width.vw]="this.gridTemplate.gridDimension"
[style.height.vh]="this.gridTemplate.gridDimension"
[style.marginLeft.px]="this.gridTemplate.marginLeft">
[style.width]="this.gridTemplate.gridDimension"
[style.height]="this.gridTemplate.gridDimension">
<!-- [style.marginLeft.px]="this.gridTemplate.marginLeft">-->
<div class="selection" id="selection"
[class.selection-active]="this.gridTemplate.selectionActive"
[style.left.px]="this.gridTemplate.pageX"
Expand All @@ -36,6 +36,7 @@
[readonly]="readonly"
[nodeTemplate]="nodeTemplate"
[entityTypes]="this.entityTypes"
[nodeEntityType]="getNodeEntityType(nodeTemplate.name)"
(sendId)="activateNewNode($event)"
[navbarButtonsState]="topologyRendererState"
(askForRepaint)="revalidateContainer()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { RequirementModel } from '../models/requirementModel';
import { EntityTypesModel } from '../models/entityTypesModel';
import { ExistsService } from '../services/exists.service';
import { ModalVariant, ModalVariantAndState } from './entities-modal/modal-model';
import { align, PropertyDefinitionType, toggleModalType } from '../models/enums';
import { align, LiveModelingStates, PropertyDefinitionType, toggleModalType } from '../models/enums';
import { ImportTopologyModalData } from '../models/importTopologyModalData';
import { ImportTopologyService } from '../services/import-topology.service';
import { SplitMatchTopologyService } from '../services/split-match-topology.service';
Expand Down Expand Up @@ -191,6 +191,10 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
targets?: string[]
}[];

isMiddleMouseButtonDown = false;

private liveModelingState: LiveModelingStates;

private longPressing: boolean;

constructor(private jsPlumbService: JsPlumbService,
Expand Down Expand Up @@ -232,6 +236,10 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
.subscribe((hideDependsOnRelations) => this.handleHideDependsOnRelations(hideDependsOnRelations)));

this.gridTemplate = new GridTemplate(100, false, false, 30);
this.subscriptions.push(this.ngRedux.select(state => state.wineryState.currentPaletteOpenedState)
.subscribe(currentPaletteOpened => this.setPaletteState(currentPaletteOpened)));
this.subscriptions.push(this.ngRedux.select(state => state.liveModelingState.state)
.subscribe(state => this.liveModelingState = state));
this.hotkeysService.add(new Hotkey('mod+a', (event: KeyboardEvent): boolean => {
event.stopPropagation();
this.allNodeTemplates.forEach((node) => this.enhanceDragSelection(node.id));
Expand Down Expand Up @@ -280,7 +288,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
* Upon detecting a long mouse down the navbar and the palette fade out for maximum dragging space.
* Resets the values.
*/
@HostListener('mouseup')
@HostListener('mouseup', ['$event'])
onMouseUp() {
this.longPressing = false;
}
Expand All @@ -291,12 +299,10 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
* Sets the values upon detecting a long mouse down press.
*/
@HostListener('mousedown', ['$event'])
onMouseDown(event: MouseEvent) {
onMouseDown() {
// don't do right/middle clicks
if (event.button === 0) {
this.longPressing = false;
setTimeout(() => this.longPressing = true, 250);
}
this.longPressing = false;
setTimeout(() => this.longPressing = true, 250);
}

/**
Expand Down Expand Up @@ -1531,21 +1537,21 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
* @param $event
*/
showSelectionRange($event: any) {
this.gridTemplate.crosshair = true;
this.ngRedux.dispatch(this.actions.sendPaletteOpened(false));
this.hideSidebar();
this.clearSelectedNodes();
this.nodeComponentChildren.forEach((node) => node.makeSelectionVisible = false);
this.gridTemplate.pageX = $event.pageX;
this.gridTemplate.pageY = $event.pageY;
this.gridTemplate.initialW = $event.pageX;
this.gridTemplate.initialH = $event.pageY;
this.zone.run(() => {
this.unbindMouseActions.push(this.renderer.listen(this.eref.nativeElement, 'mousemove', (event) =>
this.openSelector(event)));
this.unbindMouseActions.push(this.renderer.listen(this.eref.nativeElement, 'mouseup', (event) =>
this.selectElements(event)));
});
this.gridTemplate.crosshair = true;
this.ngRedux.dispatch(this.actions.sendPaletteOpened(false));
this.hideSidebar();
this.clearSelectedNodes();
this.nodeComponentChildren.forEach((node) => node.makeSelectionVisible = false);
this.gridTemplate.pageX = $event.pageX;
this.gridTemplate.pageY = $event.pageY;
this.gridTemplate.initialW = $event.pageX;
this.gridTemplate.initialH = $event.pageY;
this.zone.run(() => {
this.unbindMouseActions.push(this.renderer.listen(this.eref.nativeElement, 'mousemove', (event) =>
this.openSelector(event)));
this.unbindMouseActions.push(this.renderer.listen(this.eref.nativeElement, 'mouseup', (event) =>
this.selectElements(event)));
});
}

/**
Expand Down Expand Up @@ -1621,8 +1627,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
* Hides the Sidebar on the right.
*/
hideSidebar() {
this.ngRedux.dispatch(this.actions.triggerSidebar(
{ sidebarContents: new DetailsSidebarState(false) }));
this.ngRedux.dispatch(this.actions.triggerSidebar(new DetailsSidebarState(false)));
}

/**
Expand Down Expand Up @@ -1890,13 +1895,20 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
this.newJsPlumbInstance.select().removeType('marked');
const currentRel = this.allRelationshipTemplates.find((con) => con.id === conn.id);
if (currentRel) {
if (this.liveModelingState === LiveModelingStates.DISABLED) {
const sourceNode = this.allNodeTemplates.find(node => node.id === currentRel.sourceElement.ref);
const targetNode = this.allNodeTemplates.find(node => node.id === currentRel.targetElement.ref);
if (sourceNode && targetNode && sourceNode.working && targetNode.working) {
return;
}
}
let name = currentRel.name;
if (currentRel.name.startsWith(this.backendService.configuration.relationshipPrefix)) {
// Workaround to support old topology templates with the real name
name = currentRel.type.substring(currentRel.type.indexOf('}') + 1);
}
const entityType = this.entityTypes.relationshipTypes.find(type => type.qName === currentRel.type);
this.ngRedux.dispatch(this.actions.triggerSidebar({
sidebarContents: {
visible: true,
nodeClicked: false,
template: {
Expand All @@ -1905,10 +1917,10 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
type: currentRel.type,
properties: currentRel.properties,
},
entityType: entityType,
relationshipTemplate: currentRel,
source: currentRel.sourceElement.ref,
target: currentRel.targetElement.ref
}
}));
conn.addType('marked');
}
Expand Down Expand Up @@ -2256,6 +2268,10 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
}
}

getNodeEntityType(name: string): EntityType {
return this.entityTypes.unGroupedNodeTypes.find(type => type.name === name);
}

/**
* Gets all ID's of the topology template and saves them in an array
*/
Expand Down Expand Up @@ -2375,7 +2391,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
// update exposed keys
for (const key of ['name', 'minInstances', 'maxInstances', 'properties',
'capabilities', 'requirements', 'deploymentArtifacts',
'policies', 'otherAttributes']) {
'policies', 'otherAttributes', 'instanceState', 'valid', 'working']) {
nodeTemplate[key] = storeData[key];
}
const nodeComponent = this.nodeComponentChildren.find((c) => c.nodeTemplate.id === nodeTemplate.id);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*******************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*******************************************************************************/

.table-scrollable {
max-height: 200px;
overflow-y: auto;
font-size: x-small;
}

.table-scrollable th {
padding: 0.25em;
}

.table-scrollable td {
padding: 0.25em;
}

.parameters-table {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
}

.parameters-table,
.parameters-table th,
.parameters-table td {
border: 1px solid #3d3d3d;
}

.parameters-table th,
.parameters-table td {
width: 50%;
word-break: break-all;
}

.parameters-table th {
background: #333;
}

.parameters-table tr:nth-child(odd) {
background: #242424;
}

.parameters-table tr:nth-child(even) {
background: #292929;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2020 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
~
~ This program and the accompanying materials are made available under the
~ terms of the Eclipse Public License 2.0 which is available at
~ http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
~ which is available at https://www.apache.org/licenses/LICENSE-2.0.
~
~ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->

<div *ngIf="currentBuildPlanInstance?.outputs.length > 0; then content else placeholder"></div>
<ng-template #content>
<div class="table-scrollable">
<table class="parameters-table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Value</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let parameter of currentBuildPlanInstance.outputs">
<td>{{parameter.name}}</td>
<td>{{parameter.value || '(empty)'}}</td>
</tr>
</tbody>
</table>
</div>
</ng-template>
<ng-template #placeholder>
<div
style="padding: 0.5em; font-size: xx-small; font-style: italic; text-align: center">
No outputs found
</div>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*******************************************************************************/
import { Component, OnDestroy, OnInit, } from '@angular/core';
import { Subscription } from 'rxjs';
import { NgRedux } from '@angular-redux/store';
import { IWineryState } from '../../redux/store/winery.store';
import { ServiceTemplateInstanceStates } from '../../models/enums';
import { PlanInstance } from '../../models/container/plan-instance.model';

@Component({
selector: 'winery-live-modeling-sidebar-buildplan-outputs',
templateUrl: './buildplan-outputs.component.html',
styleUrls: ['./buildplan-outputs.component.css'],
})
export class BuildplanOutputsComponent implements OnInit, OnDestroy {
currentBuildPlanInstance: PlanInstance;
subscriptions: Array<Subscription> = [];

constructor(private ngRedux: NgRedux<IWineryState>) {
}

ngOnInit() {
// tslint:disable-next-line:no-unused-expression
this.subscriptions.push(this.ngRedux.select((state) => {
return state.liveModelingState.currentBuildPlanInstance;
})
.subscribe((buildPlanInstance) => {
this.currentBuildPlanInstance = buildPlanInstance;
}));
}

ngOnDestroy() {
this.subscriptions.forEach((subscription) => {
subscription.unsubscribe();
});
}
}
Loading

0 comments on commit 2f0536c

Please sign in to comment.