2 /*******************************************************************************
3 * Copyright (c) 2012-2013, 2015 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 <%@tag description="Wrapper for resources, which are backed by definitions and thus offer an XML div" pageEncoding="UTF-8"%>
17 quick hack to avoid specifying windowtitle at elements having it.name, too.
18 TODO: check why in this class a check on it.name is done, although there is componentinstancewithname.tag
20 <%@attribute name="windowtitle" description="If it.name is not available, this parameter should be given"%>
22 <%@attribute name="selected" required="true"%>
24 <%@attribute name="cssClass" required="true"%>
26 <%@attribute name="image" required="false"%>
28 <%@attribute name="libs" fragment="true" %>
30 <%@attribute name="subMenus" required="false" type="java.util.List" description="list of SubMenuData objects stating the content of the submenus. The first submenu is used as default page. Subpage #xml must not be included, it is added automatically."%>
32 <%@attribute name="implementationFor" description="In case the component instance is an implementation for another type, the link (a href) to the type is put here"%>
34 <%@attribute name="type" description="In case the component instance is a template, the link (a href) to the type is put here"%>
36 <%@attribute name="twolines" required="false" description="if set, two lines are required for the tabs"%>
38 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
39 <%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions" %>
40 <%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
42 <c:if test="${empty windowtitle}">
43 <c:set var="windowtitle" value="${it.name}" />
46 <t:genericpage windowtitle="${windowtitle}" selected="${selected}" cssClass="mainContentContainer ${cssClass}" libs="${libs}">
48 <div class="top<c:if test="${not empty twolines}"> twolines</c:if>">
49 <c:if test="${not empty image}">
50 <img src='visualappearance/50x50' style='position: absolute; margin-top: 32px; margin-left: 27px; height: 40px; width: 40px;' />
53 <%-- Quick hack to enable usage of this tag at adminresource --%>
54 <c:catch var="exception"><c:if test="${empty it.name}"></c:if></c:catch>
55 <c:if test="${empty exception}">
56 <%@ include file="/jsp/componentnaming.jspf" %>
57 <div style="float:right; margin-right:29px; margin-top: -20px; position:relative;">
58 <div style="float:right;">
59 <button type="button" class="btn btn-danger" onclick="deleteResource('${it.name}', '.', openOverviewPage)">Delete</button>
60 <a href="?definitions" class="btn btn-info">XML</a>
61 <a href="?csar" class="btn btn-info">CSAR</a>
62 <c:if test="${w:isContainerLocallyAvailable()}">
63 <button id="deployBtn" type="button" onclick="deployOnOpenTOSCAContainer()" class="btn btn-info" data-loading-text="Deploying...">Deploy</button>
66 <c:if test="${not empty implementationFor}">
67 <div style="clear:both; float:right;">
68 Implementation for ${implementationFor}
71 <c:if test="${not empty type}">
72 <div style="clear:both; float:right;">
79 <c:if test="${not empty subMenus}">
80 <c:forEach items="${subMenus}" var="subMenu" varStatus="status">
81 <t:submenu selected="${status.first}" subMenuData="${subMenu}">
86 <%-- Quick hack to enable usage of this tag at adminresource --%>
87 <c:if test="${empty exception}">
88 <t:submenu subMenuData="<%=org.eclipse.winery.repository.resources.SubMenuData.SUBMENU_DOCUMENTATION%>" selected="${empty subMenus}">
90 <t:submenu subMenuData="<%=org.eclipse.winery.repository.resources.SubMenuData.SUBMENU_XML%>" selected="${empty subMenus}">
96 <div class="middle" id="ccontainer">
99 <c:if test="${empty subMenus}">
100 <jsp:include page="/jsp/hashloading.jsp">
101 <jsp:param name="validpages" value="['#documentation', '#xml']" />
102 <jsp:param name="defaultpage" value="#documentation" />
105 <c:if test="${not empty subMenus}">
106 <c:forEach items="${subMenus}" var="subMenu" varStatus="status">
107 <c:if test="${status.first}">
108 <c:set var="defaultpage" value="${subMenu.href}"></c:set>
109 <c:set var="additionalHashes" value="'${subMenu.href}'"></c:set>
111 <c:if test="${not status.first}">
112 <c:set var="additionalHashes" value="${additionalHashes}, '${subMenu.href}'"></c:set>
116 <jsp:include page="/jsp/hashloading.jsp">
117 <jsp:param name="validpages" value="[${additionalHashes}, '#documentation', '#xml']" />
118 <jsp:param name="defaultpage" value="${defaultpage}" />
126 function openOverviewPage() {
127 window.location="../../";
130 function deployOnOpenTOSCAContainer() {
131 $("#deployBtn").button('loading');
133 urlToUpload = window.location.href;
134 var hash = window.location.hash;
136 urlToUpload = urlToUpload.substr(0, urlToUpload.length - hash.length)
138 var search = window.location.search;
140 urlToUpload = urlToUpload.substr(0, urlToUpload.length - search.length)
143 urlToUpload = urlToUpload + "?csar";
146 urlToUpload: urlToUpload
149 // we assume the container runs at the same host and port
151 url: "/admin/uploadCSARFromURL.action",
153 }).always(function () {
154 $("#deployBtn").button('reset');
155 }).fail(function (jqXHR, textStatus, errorThrown) {
156 vShowAJAXError("Could not trigger CSAR deployment at OpenTOSCA container", jqXHR, errorThrown);
157 }).done(function (result) {
158 vShowSuccess("Successfully triggered CSAR deployment at OpenTOSCA container");