Skip to content

Commit 11f97f6

Browse files
authored
Merge pull request winery#410 from OpenTOSCA/feature/versionmanagement
Implementation for Update Management in the Topology Modeler
2 parents 5b9d45b + f228143 commit 11f97f6

File tree

40 files changed

+990
-47
lines changed

40 files changed

+990
-47
lines changed

docs/user/VersionManagement.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Update Management of Node Templates in Topology Modeler
2+
3+
This guide shows an overview of how to update a Node Template in a Topology Template.
4+
5+
6+
## Steps to update a Node Template
7+
8+
User will be informed with a *red exclamation mark* when there's any new versions available for a node template.
9+
![NewVersionAvailable](graphics/versionManagement/NewVersionAvailable.jpeg)
10+
11+
Select the version to update.
12+
![VersionSelection](graphics/versionManagement/VersionSelection.jpeg)
13+
14+
15+
A table with new, removed and resolved Properties will be shown. A new *Property* and a removed *Property* can be selected so that the value will be transferred.
16+
![PropertiesToMap](graphics/versionManagement/PropertiesToMap.png)
17+
18+
Now the Node Template is updated in the Topology Template. New Properties are available and values are transferred.
19+
![UpdatedNodeTemplate](graphics/versionManagement/UpdatedNodeTemplate.jpeg)
20+
21+
To confirm the update above, save the topology template.
22+
23+
## License
24+
25+
Copyright (c) 2019 Contributors to the Eclipse Foundation
26+
27+
See the NOTICE file(s) distributed with this work for additional
28+
information regarding copyright ownership.
29+
30+
This program and the accompanying materials are made available under the
31+
terms of the Eclipse Public License 2.0 which is available at
32+
http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
33+
which is available at https://www.apache.org/licenses/LICENSE-2.0.
34+
35+
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
Loading
Loading
Loading
Loading

docs/user/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For more information on TOSCA see [our TOSCA information page](../tosca/).
1919
- [Compliance Checking](ComplianceChecking.md) - Enables compliance checking of Topology Templates based on reusable Compliance Rules
2020
- [Implementation Artifact Generation](generateIA.md) - Shows how to generate and update an implementation artifact of type .war
2121
- [Accountability](../../org.eclipse.winery.accountability/README.md) - Enables enforcing accountability in decentralized scenarios for collaborative development of CSARs
22-
22+
- [Version Management](VersionManagement.md) - shows how to update the version of a node template in the topology modeler
2323
## Background Literature
2424

2525
[BBKL14] Breitenbücher, Uwe; Binz, Tobias; Kopp, Oliver; Leymann, Frank: Vinothek - A Self-Service Portal for TOSCA. In: Herzberg, Nico (Hrsg); Kunze, Matthias (Hrsg): Proceedings of the 6th Central-European Workshop on Services and their Composition (ZEUS 2014).
@@ -35,7 +35,7 @@ More readings at <https://www.opentosca.org>.
3535

3636
## License
3737

38-
Copyright (c) 2017-2018 Contributors to the Eclipse Foundation
38+
Copyright (c) 2017-2019 Contributors to the Eclipse Foundation
3939

4040
See the NOTICE file(s) distributed with this work for additional
4141
information regarding copyright ownership.

org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import { DifferenceStates, VersionUtils } from '../models/ToscaDiff';
5050
import { ErrorHandlerService } from '../services/error-handler.service';
5151
import { DragSource } from '../models/DragSource';
5252
import { TopologyRendererState } from '../redux/reducers/topologyRenderer.reducer';
53-
import { Utils } from '../models/utils';
53+
import { TopologyTemplateUtil } from '../models/topologyTemplateUtil';
5454

5555
@Component({
5656
selector: 'winery-canvas',
@@ -316,12 +316,12 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
316316
this.requirements.properties = currentNodeData.currentRequirement.properties.kvproperties;
317317
return true;
318318
} else {
319-
this.requirements.properties = Utils.setKVProperties(reqType);
319+
this.requirements.properties = TopologyTemplateUtil.setKVProperties(reqType);
320320
this.setDefaultReqKVProperties();
321321
return true;
322322
}
323323
} else {
324-
this.requirements.properties = Utils.setKVProperties(reqType);
324+
this.requirements.properties = TopologyTemplateUtil.setKVProperties(reqType);
325325
this.setDefaultReqKVProperties();
326326
return true;
327327
}
@@ -398,12 +398,12 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
398398
this.capabilities.properties = currentNodeData.currentCapability.properties.kvproperties;
399399
return true;
400400
} else {
401-
this.capabilities.properties = Utils.setKVProperties(capType);
401+
this.capabilities.properties = TopologyTemplateUtil.setKVProperties(capType);
402402
this.setDefaultCapKVProperties();
403403
return true;
404404
}
405405
} else {
406-
this.capabilities.properties = Utils.setKVProperties(capType);
406+
this.capabilities.properties = TopologyTemplateUtil.setKVProperties(capType);
407407
this.setDefaultCapKVProperties();
408408
return true;
409409
}
@@ -639,7 +639,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
639639
if (cap.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any.length > 0) {
640640
this.capabilities.propertyType = 'KV';
641641
this.showDefaultProperties = true;
642-
this.capabilities.properties = Utils.setKVProperties(cap);
642+
this.capabilities.properties = TopologyTemplateUtil.setKVProperties(cap);
643643
// if propertiesDefinition is defined it's a XML property
644644
} else if (cap.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition) {
645645
if (cap.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.element) {
@@ -745,7 +745,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
745745
if (req.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any.length > 0) {
746746
this.requirements.propertyType = 'KV';
747747
this.showDefaultProperties = true;
748-
this.requirements.properties = Utils.setKVProperties(req);
748+
this.requirements.properties = TopologyTemplateUtil.setKVProperties(req);
749749
return true;
750750
// if propertiesDefinition is defined it's a XML property
751751
} else if (req.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition) {
@@ -1907,7 +1907,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
19071907
this.selectedRelationshipType.name,
19081908
relationshipId,
19091909
this.selectedRelationshipType.qName,
1910-
Utils.getDefaultPropertiesFromEntityTypes(this.selectedRelationshipType.name, this.entityTypes.relationshipTypes),
1910+
TopologyTemplateUtil.getDefaultPropertiesFromEntityTypes(this.selectedRelationshipType.name, this.entityTypes.relationshipTypes),
19111911
[],
19121912
[],
19131913
{}

org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { TopologyRendererState } from '../redux/reducers/topologyRenderer.reduce
2020
import { HttpErrorResponse } from '@angular/common/http';
2121
import { ToastrService } from 'ngx-toastr';
2222
import { TTopologyTemplate } from '../models/ttopology-template';
23-
import { Utils } from '../models/utils';
23+
import { TopologyTemplateUtil } from '../models/topologyTemplateUtil';
2424
import { EnricherService } from './enricher.service';
2525
import { Enrichment, FeatureEntity } from './enrichmentEntity';
2626

@@ -205,7 +205,7 @@ export class EnricherComponent {
205205
* @param data: topology template that was updated
206206
*/
207207
private enrichmentApplied(data: TTopologyTemplate) {
208-
Utils.updateTopologyTemplate(this.ngRedux, this.wineryActions, data);
208+
TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.wineryActions, data);
209209
// reset available features since they are no longer valid
210210
this.availableFeatures = null;
211211
this.alert.success('Updated Topology Template!');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/********************************************************************************
2+
* Copyright (c) 2019 Contributors to the Eclipse Foundation
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information regarding copyright ownership.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Eclipse Public License 2.0 which is available at
9+
* http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
10+
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
11+
*
12+
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
13+
********************************************************************************/
14+
15+
export class UpdateInfo {
16+
17+
constructor(public nodeTemplateId: string,
18+
public newComponentType: string,
19+
public mappingList?: string[][],
20+
public newList?: string[],
21+
public resolvedList?: string[]) {
22+
23+
}
24+
}

org.eclipse.winery.frontends/app/topologymodeler/src/app/models/entityTypesModel.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (c) 2017-2018 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2017-2019 Contributors to the Eclipse Foundation
33
*
44
* See the NOTICE file(s) distributed with this work for additional
55
* information regarding copyright ownership.
@@ -14,6 +14,7 @@
1414

1515
import { Entity, EntityType, TTopologyTemplate, VisualEntityType } from './ttopology-template';
1616
import { TopologyModelerConfiguration } from './topologyModelerConfiguration';
17+
import { VersionElement } from './versionElement';
1718
import { Visuals } from './visuals';
1819

1920
/**
@@ -24,6 +25,7 @@ export class EntityTypesModel {
2425
artifactTypes: EntityType[];
2526
capabilityTypes: EntityType[];
2627
groupedNodeTypes: any[];
28+
versionElements: VersionElement[];
2729
nodeVisuals: Visuals[];
2830
relationshipVisuals: Visuals[];
2931
policyTemplates: Entity[];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2019 Contributors to the Eclipse Foundation
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information regarding copyright ownership.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Eclipse Public License 2.0 which is available at
9+
* http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
10+
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
11+
*
12+
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
13+
*******************************************************************************/
14+
15+
export class PropertyDiffList {
16+
17+
constructor(public resolvedProperties: string[], public removedProperties: string[], public newProperties: string[]) {
18+
19+
}
20+
}

org.eclipse.winery.frontends/app/topologymodeler/src/app/models/utils.ts renamed to org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyTemplateUtil.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { NgRedux } from '@angular-redux/store';
1919
import { IWineryState } from '../redux/store/winery.store';
2020
import { WineryActions } from '../redux/actions/winery.actions';
2121

22-
export class Utils {
22+
export class TopologyTemplateUtil {
2323

2424
static HORIZONTAL_OFFSET_FOR_NODES_WITHOUT_COORDINATES = 350;
2525
static VERTICAL_OFFSET_FOR_NODES_WITHOUT_COORDINATES = 200;
@@ -117,7 +117,7 @@ export class Utils {
117117
}
118118
const state = topologyDifferences ? DifferenceStates.UNCHANGED : null;
119119
nodeTemplates.push(
120-
Utils.createTNodeTemplateFromObject(node, nodeVisuals, state)
120+
TopologyTemplateUtil.createTNodeTemplateFromObject(node, nodeVisuals, state)
121121
);
122122
});
123123
}
@@ -140,7 +140,7 @@ export class Utils {
140140
if (element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any.length > 0 &&
141141
element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any[0].propertyDefinitionKVList) {
142142
const properties = {
143-
kvproperties: Utils.setKVProperties(element)
143+
kvproperties: TopologyTemplateUtil.setKVProperties(element)
144144
};
145145
return properties;
146146
}
@@ -191,7 +191,7 @@ export class Utils {
191191
relationshipTemplateArray.forEach(relationship => {
192192
const state = topologyDifferences ? DifferenceStates.UNCHANGED : null;
193193
relationshipTemplates.push(
194-
Utils.createTRelationshipTemplateFromObject(relationship, state)
194+
TopologyTemplateUtil.createTRelationshipTemplateFromObject(relationship, state)
195195
);
196196
});
197197
}
@@ -214,11 +214,11 @@ export class Utils {
214214
relationship => ngRedux.dispatch(wineryActions.deleteRelationshipTemplate(relationship.id))
215215
);
216216

217-
Utils.initNodeTemplates(topology.nodeTemplates, wineryState.nodeVisuals)
217+
TopologyTemplateUtil.initNodeTemplates(topology.nodeTemplates, wineryState.nodeVisuals)
218218
.forEach(
219219
node => ngRedux.dispatch(wineryActions.saveNodeTemplate(node))
220220
);
221-
Utils.initRelationTemplates(topology.relationshipTemplates)
221+
TopologyTemplateUtil.initRelationTemplates(topology.relationshipTemplates)
222222
.forEach(
223223
relationship => ngRedux.dispatch(wineryActions.saveRelationship(relationship))
224224
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/********************************************************************************
2+
* Copyright (c) 2019 Contributors to the Eclipse Foundation
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information regarding copyright ownership.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Eclipse Public License 2.0 which is available at
9+
* http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
10+
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
11+
*
12+
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
13+
*******************************************************************************/
14+
import { WineryVersion } from '../../../../tosca-management/src/app/model/wineryVersion';
15+
16+
export class VersionElement {
17+
18+
versions: WineryVersion[];
19+
20+
constructor(public qName: string, versions: Array<WineryVersion>) {
21+
this.versions = [];
22+
versions.forEach(version => {
23+
this.versions.push(
24+
new WineryVersion(version.componentVersion,
25+
version.wineryVersion,
26+
version.workInProgressVersion,
27+
version.currentVersion,
28+
version.latestVersion,
29+
version.releasable,
30+
version.editable)
31+
);
32+
});
33+
}
34+
}

org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.css

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (c) 2017-2018 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2017-2019 Contributors to the Eclipse Foundation
33
*
44
* See the NOTICE file(s) distributed with this work for additional
55
* information regarding copyright ownership.
@@ -132,6 +132,10 @@ div.connectorLabel {
132132
text-overflow: ellipsis !important;
133133
}
134134

135+
td {
136+
padding: 0;
137+
}
138+
135139
button.btn.btn-sm.btn-outline-secondary {
136140
/* background-color: rgba(255,255,255,0.8);*/
137141
background-color: rgba(237, 234, 230, 1) !important;
@@ -180,3 +184,11 @@ button.btn.btn-sm.btn-outline-secondary:hover, button.btn.btn-sm.btn-outline-sec
180184
.policyAnnotation {
181185
margin: 3px;
182186
}
187+
188+
.newVersionTriangle {
189+
position: absolute;
190+
right: -4px;
191+
top: -12px;
192+
color: red;
193+
font-size: 20px;
194+
}

org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.html

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<img *ngFor="let policyIcon of policyIcons" [src]="policyIcon" class="policyAnnotation">
3535
</div>
3636

37+
<div *ngIf="newerVersions?.length !== 0">
38+
<i class="fas fa-exclamation-triangle newVersionTriangle" (click)="openVersionModal()"></i>
39+
<winery-versions #versionModal [aVersionElement]="newVersionElement" [nodeTemplateId]="nodeTemplate.id"[nodeType]="nodeTemplate.type"></winery-versions>
40+
</div>
41+
3742
<div *ngIf="nodeClass !== 'pattern'; else showPattern"
3843
class="row rounded col-sm-12 node-template-header"
3944
(click)="openSidebar($event); closeConnectorEndpoints($event)">

0 commit comments

Comments
 (0)