aboutsummaryrefslogtreecommitdiffstats
path: root/winery/org.eclipse.winery.topologymodeler/src/main/webapp/WEB-INF/tags/common/policies/policies.tag
blob: 5bd7bd91dc3d907839c99b2641eebe3ab1d86d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<%--
/*******************************************************************************
 * Copyright (c) 2013-2014 University of Stuttgart.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and the Apache License 2.0 which both accompany this distribution,
 * and are available at http://www.eclipse.org/legal/epl-v10.html
 * and http://www.apache.org/licenses/LICENSE-2.0
 *
 * Contributors:
 *    Oliver Kopp - initial API and implementation and/or initial documentation
 *******************************************************************************/
--%>

<%-- This is mostly inspired by the reqscaps handling. Future work: Generalize the dialogs somehow to avoid copy'n'paste of code --%>

<%@tag import="org.apache.taglibs.standard.lang.jstl.test.PageContextImpl"%>
<%@tag description="Renders the list of policies of a node template" pageEncoding="UTF-8"%>

<%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="wc" uri="http://www.eclipse.org/winery/functions"%>

<%@attribute name="list" required="true" type="java.util.List"%>
<%@attribute name="repositoryURL" required="true" type="java.lang.String" %>

<div class="policiesContainer">
	<div class="header">Policies</div>
	<div class="content">
		<div class="row">
			<div class="col-xs-4">Name</div>
			<div class="cell col-xs-4">Type</div>
			<div class="cell col-xs-4">Template</div>
		</div>
		<c:forEach var="item" items="${list}" varStatus="loopStatus"><%-- this HTML has to be kept consistent with the tmpl-policy HTML at policydiag.tag --%>
			<div class="policy row ${loopStatus.index % 2 == 0 ? 'even' : 'odd'}">
				<div class="col-xs-4 policy name">${item.name}</div>

				<c:set var="clazz" value="<%=org.eclipse.winery.model.tosca.TPolicyType.class%>" />
				<div class="col-xs-4 policy type">${wc:qname2href(repositoryURL, clazz, item.policyType)}</div>
				<span class="type">${item.policyType}</span>

				<c:set var="clazz" value="<%=org.eclipse.winery.model.tosca.TPolicyTemplate.class%>" />
				<div class="col-xs-4 policy template">${wc:qname2href(repositoryURL, clazz, item.policyRef)}</div>
				<span class="template">${item.policyRef}</span>

				<c:set var="clazz" value="<%=org.eclipse.winery.model.tosca.TPolicy.class%>" />
				<textarea class="policy_xml">${wc:XMLAsString(clazz, item)}</textarea>
			</div>
		</c:forEach>
		<div class="addnewpolicy row" style="display:none;">
			<button class="btn btn-default center-block btn-xs" onclick="showAddDiagForPolicy($(this).parent().parent().parent().parent());">Add new</button>
		</div>
	</div>
</div>