Skip to content

Commit

Permalink
Merge branch 'master' into ustutt
Browse files Browse the repository at this point in the history
  • Loading branch information
lharzenetter committed Jun 25, 2019
2 parents de6b901 + 11f97f6 commit b837c00
Show file tree
Hide file tree
Showing 40 changed files with 990 additions and 47 deletions.
35 changes: 35 additions & 0 deletions docs/user/VersionManagement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Update Management of Node Templates in Topology Modeler

This guide shows an overview of how to update a Node Template in a Topology Template.


## Steps to update a Node Template

User will be informed with a *red exclamation mark* when there's any new versions available for a node template.
![NewVersionAvailable](graphics/versionManagement/NewVersionAvailable.jpeg)

Select the version to update.
![VersionSelection](graphics/versionManagement/VersionSelection.jpeg)


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.
![PropertiesToMap](graphics/versionManagement/PropertiesToMap.png)

Now the Node Template is updated in the Topology Template. New Properties are available and values are transferred.
![UpdatedNodeTemplate](graphics/versionManagement/UpdatedNodeTemplate.jpeg)

To confirm the update above, save the topology template.

## License

Copyright (c) 2019 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/user/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For more information on TOSCA see [our TOSCA information page](../tosca/).
- [Compliance Checking](ComplianceChecking.md) - Enables compliance checking of Topology Templates based on reusable Compliance Rules
- [Implementation Artifact Generation](generateIA.md) - Shows how to generate and update an implementation artifact of type .war
- [Accountability](../../org.eclipse.winery.accountability/README.md) - Enables enforcing accountability in decentralized scenarios for collaborative development of CSARs

- [Version Management](VersionManagement.md) - shows how to update the version of a node template in the topology modeler
## Background Literature

[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).
Expand All @@ -35,7 +35,7 @@ More readings at <https://www.opentosca.org>.

## License

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

See the NOTICE file(s) distributed with this work for additional
information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { DifferenceStates, VersionUtils } from '../models/ToscaDiff';
import { ErrorHandlerService } from '../services/error-handler.service';
import { DragSource } from '../models/DragSource';
import { TopologyRendererState } from '../redux/reducers/topologyRenderer.reducer';
import { Utils } from '../models/utils';
import { TopologyTemplateUtil } from '../models/topologyTemplateUtil';

@Component({
selector: 'winery-canvas',
Expand Down Expand Up @@ -316,12 +316,12 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
this.requirements.properties = currentNodeData.currentRequirement.properties.kvproperties;
return true;
} else {
this.requirements.properties = Utils.setKVProperties(reqType);
this.requirements.properties = TopologyTemplateUtil.setKVProperties(reqType);
this.setDefaultReqKVProperties();
return true;
}
} else {
this.requirements.properties = Utils.setKVProperties(reqType);
this.requirements.properties = TopologyTemplateUtil.setKVProperties(reqType);
this.setDefaultReqKVProperties();
return true;
}
Expand Down Expand Up @@ -398,12 +398,12 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
this.capabilities.properties = currentNodeData.currentCapability.properties.kvproperties;
return true;
} else {
this.capabilities.properties = Utils.setKVProperties(capType);
this.capabilities.properties = TopologyTemplateUtil.setKVProperties(capType);
this.setDefaultCapKVProperties();
return true;
}
} else {
this.capabilities.properties = Utils.setKVProperties(capType);
this.capabilities.properties = TopologyTemplateUtil.setKVProperties(capType);
this.setDefaultCapKVProperties();
return true;
}
Expand Down Expand Up @@ -639,7 +639,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
if (cap.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any.length > 0) {
this.capabilities.propertyType = 'KV';
this.showDefaultProperties = true;
this.capabilities.properties = Utils.setKVProperties(cap);
this.capabilities.properties = TopologyTemplateUtil.setKVProperties(cap);
// if propertiesDefinition is defined it's a XML property
} else if (cap.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition) {
if (cap.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.element) {
Expand Down Expand Up @@ -745,7 +745,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
if (req.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any.length > 0) {
this.requirements.propertyType = 'KV';
this.showDefaultProperties = true;
this.requirements.properties = Utils.setKVProperties(req);
this.requirements.properties = TopologyTemplateUtil.setKVProperties(req);
return true;
// if propertiesDefinition is defined it's a XML property
} else if (req.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition) {
Expand Down Expand Up @@ -1907,7 +1907,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI
this.selectedRelationshipType.name,
relationshipId,
this.selectedRelationshipType.qName,
Utils.getDefaultPropertiesFromEntityTypes(this.selectedRelationshipType.name, this.entityTypes.relationshipTypes),
TopologyTemplateUtil.getDefaultPropertiesFromEntityTypes(this.selectedRelationshipType.name, this.entityTypes.relationshipTypes),
[],
[],
{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { TopologyRendererState } from '../redux/reducers/topologyRenderer.reduce
import { HttpErrorResponse } from '@angular/common/http';
import { ToastrService } from 'ngx-toastr';
import { TTopologyTemplate } from '../models/ttopology-template';
import { Utils } from '../models/utils';
import { TopologyTemplateUtil } from '../models/topologyTemplateUtil';
import { EnricherService } from './enricher.service';
import { Enrichment, FeatureEntity } from './enrichmentEntity';

Expand Down Expand Up @@ -205,7 +205,7 @@ export class EnricherComponent {
* @param data: topology template that was updated
*/
private enrichmentApplied(data: TTopologyTemplate) {
Utils.updateTopologyTemplate(this.ngRedux, this.wineryActions, data);
TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.wineryActions, data);
// reset available features since they are no longer valid
this.availableFeatures = null;
this.alert.success('Updated Topology Template!');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/********************************************************************************
* Copyright (c) 2019 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
********************************************************************************/

export class UpdateInfo {

constructor(public nodeTemplateId: string,
public newComponentType: string,
public mappingList?: string[][],
public newList?: string[],
public resolvedList?: string[]) {

}
}
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-2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand All @@ -14,6 +14,7 @@

import { Entity, EntityType, TTopologyTemplate, VisualEntityType } from './ttopology-template';
import { TopologyModelerConfiguration } from './topologyModelerConfiguration';
import { VersionElement } from './versionElement';
import { Visuals } from './visuals';

/**
Expand All @@ -24,6 +25,7 @@ export class EntityTypesModel {
artifactTypes: EntityType[];
capabilityTypes: EntityType[];
groupedNodeTypes: any[];
versionElements: VersionElement[];
nodeVisuals: Visuals[];
relationshipVisuals: Visuals[];
policyTemplates: Entity[];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2019 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
*******************************************************************************/

export class PropertyDiffList {

constructor(public resolvedProperties: string[], public removedProperties: string[], public newProperties: string[]) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { NgRedux } from '@angular-redux/store';
import { IWineryState } from '../redux/store/winery.store';
import { WineryActions } from '../redux/actions/winery.actions';

export class Utils {
export class TopologyTemplateUtil {

static HORIZONTAL_OFFSET_FOR_NODES_WITHOUT_COORDINATES = 350;
static VERTICAL_OFFSET_FOR_NODES_WITHOUT_COORDINATES = 200;
Expand Down Expand Up @@ -117,7 +117,7 @@ export class Utils {
}
const state = topologyDifferences ? DifferenceStates.UNCHANGED : null;
nodeTemplates.push(
Utils.createTNodeTemplateFromObject(node, nodeVisuals, state)
TopologyTemplateUtil.createTNodeTemplateFromObject(node, nodeVisuals, state)
);
});
}
Expand All @@ -140,7 +140,7 @@ export class Utils {
if (element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any.length > 0 &&
element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any[0].propertyDefinitionKVList) {
const properties = {
kvproperties: Utils.setKVProperties(element)
kvproperties: TopologyTemplateUtil.setKVProperties(element)
};
return properties;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ export class Utils {
relationshipTemplateArray.forEach(relationship => {
const state = topologyDifferences ? DifferenceStates.UNCHANGED : null;
relationshipTemplates.push(
Utils.createTRelationshipTemplateFromObject(relationship, state)
TopologyTemplateUtil.createTRelationshipTemplateFromObject(relationship, state)
);
});
}
Expand All @@ -214,11 +214,11 @@ export class Utils {
relationship => ngRedux.dispatch(wineryActions.deleteRelationshipTemplate(relationship.id))
);

Utils.initNodeTemplates(topology.nodeTemplates, wineryState.nodeVisuals)
TopologyTemplateUtil.initNodeTemplates(topology.nodeTemplates, wineryState.nodeVisuals)
.forEach(
node => ngRedux.dispatch(wineryActions.saveNodeTemplate(node))
);
Utils.initRelationTemplates(topology.relationshipTemplates)
TopologyTemplateUtil.initRelationTemplates(topology.relationshipTemplates)
.forEach(
relationship => ngRedux.dispatch(wineryActions.saveRelationship(relationship))
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/********************************************************************************
* Copyright (c) 2019 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 { WineryVersion } from '../../../../tosca-management/src/app/model/wineryVersion';

export class VersionElement {

versions: WineryVersion[];

constructor(public qName: string, versions: Array<WineryVersion>) {
this.versions = [];
versions.forEach(version => {
this.versions.push(
new WineryVersion(version.componentVersion,
version.wineryVersion,
version.workInProgressVersion,
version.currentVersion,
version.latestVersion,
version.releasable,
version.editable)
);
});
}
}
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-2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -132,6 +132,10 @@ div.connectorLabel {
text-overflow: ellipsis !important;
}

td {
padding: 0;
}

button.btn.btn-sm.btn-outline-secondary {
/* background-color: rgba(255,255,255,0.8);*/
background-color: rgba(237, 234, 230, 1) !important;
Expand Down Expand Up @@ -180,3 +184,11 @@ button.btn.btn-sm.btn-outline-secondary:hover, button.btn.btn-sm.btn-outline-sec
.policyAnnotation {
margin: 3px;
}

.newVersionTriangle {
position: absolute;
right: -4px;
top: -12px;
color: red;
font-size: 20px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<img *ngFor="let policyIcon of policyIcons" [src]="policyIcon" class="policyAnnotation">
</div>

<div *ngIf="newerVersions?.length !== 0">
<i class="fas fa-exclamation-triangle newVersionTriangle" (click)="openVersionModal()"></i>
<winery-versions #versionModal [aVersionElement]="newVersionElement" [nodeTemplateId]="nodeTemplate.id"[nodeType]="nodeTemplate.type"></winery-versions>
</div>

<div *ngIf="nodeClass !== 'pattern'; else showPattern"
class="row rounded col-sm-12 node-template-header"
(click)="openSidebar($event); closeConnectorEndpoints($event)">
Expand Down
Loading

0 comments on commit b837c00

Please sign in to comment.