2 /*******************************************************************************
3 * Copyright (c) 2012-2013 University of Stuttgart.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * and the Apache License 2.0 which both accompany this distribution,
7 * and are available at http://www.eclipse.org/legal/epl-v10.html
8 * and http://www.apache.org/licenses/LICENSE-2.0
11 * Oliver Kopp - initial API and implementation and/or initial documentation
12 *******************************************************************************/
14 <%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
16 <%@page import="org.eclipse.winery.model.tosca.TEntityTemplate"%>
17 <%@page import="org.eclipse.winery.model.tosca.TEntityType"%>
18 <%@page import="org.eclipse.winery.common.ModelUtilities"%>
19 <%@page import="org.eclipse.winery.repository.Utils"%>
21 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
22 <%@taglib prefix="props" tagdir="/WEB-INF/tags/common/templates" %>
23 <%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions"%>
24 <%@taglib prefix="wc" uri="http://www.eclipse.org/winery/functions" %>
26 <script type="text/javascript" src="${pageContext.request.contextPath}/components/XMLWriter/XMLWriter.js"></script>
40 <props:propertiesBasic></props:propertiesBasic>
42 <c:set var="type" value="${w:typeForTemplate(it.template)}" />
44 <div id="containerForPropertiesContainer">
45 <div> <%-- This div is required by props:properties to be consistent with a node template. This mirrors div class="content" --%>
47 propertiesDefinition="${type.propertiesDefinition}"
48 wpd="${wc:winerysPropertiesDefinition(type)}"
49 template="${it.template}"
50 pathToImages="${w:topologyModelerURI()}/images/">
56 <c:when test="${not empty type.propertiesDefinition or not empty wc:winerysPropertiesDefinition(type)}">
57 <button id="propsSaveBtn" data-loading-text="Saving..." type="button" class="btn btn-primary btn-sm" onclick="saveProperties();">Save</button>
60 The type does not have a “properties definition”.
65 $(".KVPropertyValue").editable();
67 // similar to topology modeler's index.jsp save() function
68 function saveProperties() {
69 $("#propsSaveBtn").button('loading');
70 var w = new XMLWriter("utf-8");
71 w.writeStartDocument();
72 var divContainer = $("#containerForPropertiesContainer");
73 savePropertiesFromDivToXMLWriter(divContainer.children("div").children(".propertiesContainer"), w, true);
79 contentType: 'text/xml',
81 success: function(data, textStatus, jqXHR) {
82 $("#propsSaveBtn").button('reset');
83 vShowSuccess("successfully saved.");
85 error: function(jqXHR, textStatus, errorThrown) {
86 $("#propsSaveBtn").button('reset');
87 vShowAJAXError("Could not save", errorThrown, jqXHR.responseText);