Add winery source code
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.topologymodeler / src / main / webapp / WEB-INF / tags / common / policies / policies.tag
1 <%--
2 /*******************************************************************************
3  * Copyright (c) 2013-2014 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
9  *
10  * Contributors:
11  *    Oliver Kopp - initial API and implementation and/or initial documentation
12  *******************************************************************************/
13 --%>
14
15 <%-- This is mostly inspired by the reqscaps handling. Future work: Generalize the dialogs somehow to avoid copy'n'paste of code --%>
16
17 <%@tag import="org.apache.taglibs.standard.lang.jstl.test.PageContextImpl"%>
18 <%@tag description="Renders the list of policies of a node template" pageEncoding="UTF-8"%>
19
20 <%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
21 <%@taglib prefix="wc" uri="http://www.eclipse.org/winery/functions"%>
22
23 <%@attribute name="list" required="true" type="java.util.List"%>
24 <%@attribute name="repositoryURL" required="true" type="java.lang.String" %>
25
26 <div class="policiesContainer">
27         <div class="header">Policies</div>
28         <div class="content">
29                 <div class="row">
30                         <div class="col-xs-4">Name</div>
31                         <div class="cell col-xs-4">Type</div>
32                         <div class="cell col-xs-4">Template</div>
33                 </div>
34                 <c:forEach var="item" items="${list}" varStatus="loopStatus"><%-- this HTML has to be kept consistent with the tmpl-policy HTML at policydiag.tag --%>
35                         <div class="policy row ${loopStatus.index % 2 == 0 ? 'even' : 'odd'}">
36                                 <div class="col-xs-4 policy name">${item.name}</div>
37
38                                 <c:set var="clazz" value="<%=org.eclipse.winery.model.tosca.TPolicyType.class%>" />
39                                 <div class="col-xs-4 policy type">${wc:qname2href(repositoryURL, clazz, item.policyType)}</div>
40                                 <span class="type">${item.policyType}</span>
41
42                                 <c:set var="clazz" value="<%=org.eclipse.winery.model.tosca.TPolicyTemplate.class%>" />
43                                 <div class="col-xs-4 policy template">${wc:qname2href(repositoryURL, clazz, item.policyRef)}</div>
44                                 <span class="template">${item.policyRef}</span>
45
46                                 <c:set var="clazz" value="<%=org.eclipse.winery.model.tosca.TPolicy.class%>" />
47                                 <textarea class="policy_xml">${wc:XMLAsString(clazz, item)}</textarea>
48                         </div>
49                 </c:forEach>
50                 <div class="addnewpolicy row" style="display:none;">
51                         <button class="btn btn-default center-block btn-xs" onclick="showAddDiagForPolicy($(this).parent().parent().parent().parent());">Add new</button>
52                 </div>
53         </div>
54 </div>