config portlet, all is working

This commit is contained in:
Alfredo Oliviero 2024-05-30 16:33:12 +02:00
parent 8127a3bf98
commit 1f9e62cbbe
13 changed files with 163 additions and 106 deletions

View File

@ -121,6 +121,8 @@ public class CloudComputingConfigPortlet extends MVCPortlet {
CloudComputingConfig config = getConfig(renderRequest);
renderRequest.setAttribute("config", config);
renderRequest.setAttribute("encoded_context", config.encoded_context);
renderRequest.setAttribute("gateway", config.gateway);
renderRequest.setAttribute("redirect_url", config.redirect_url);

View File

@ -26,29 +26,10 @@ public class CloudComputingBootPlatformPortlet extends CloudComputingConfigPortl
public void render(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException {
super.render(renderRequest, renderResponse);
// addDebugParams(renderRequest);
}
public void addDebugParams(RenderRequest renderRequest) {
try {
CloudComputingConfig config = getConfig(renderRequest);
renderRequest.setAttribute("encoded_context", config.encoded_context);
renderRequest.setAttribute("gateway", config.gateway);
renderRequest.setAttribute("redirect_url", config.redirect_url);
renderRequest.setAttribute("auth_url", config.auth_url);
renderRequest.setAttribute("ccp_url", config.ccp_url);
renderRequest.setAttribute("cdn_url", config.cdn_url);
} catch (ServerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String current_url = PortalUtil.getCurrentURL(renderRequest);
renderRequest.setAttribute("current_url", current_url);

View File

@ -0,0 +1,71 @@
package org.gcube.portlets.user.cloudcomputing.config;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.servlet.http.HttpServletRequest;
import org.gcube.common.portal.PortalContext;
import org.gcube.portlets.user.cloudcomputing.CloudComputingConfigPortlet;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.model.Group;
import com.liferay.portal.service.GroupLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;
public class CloudComputingConfigurationPortlet extends CloudComputingConfigPortlet {
private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil
.getLog(CloudComputingConfigurationPortlet.class);
public void render(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException {
String current_url = PortalUtil.getCurrentURL(renderRequest);
renderRequest.setAttribute("current_url", current_url);
String infrastructure = PortalContext.getConfiguration().getInfrastructureName();
renderRequest.setAttribute("infrastructure", infrastructure);
HttpServletRequest httpReq = PortalUtil
.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
String absolute_current_url = PortalUtil.getAbsoluteURL(httpReq, current_url);
renderRequest.setAttribute("absolute_current_url", absolute_current_url);
String base_url = PortalUtil.getAbsoluteURL(httpReq, "/");
renderRequest.setAttribute("base_url", base_url);
try {
URL burl = new URL(base_url);
renderRequest.setAttribute("host", burl.getHost());
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
renderRequest.setAttribute("host", e.getMessage());
}
try {
Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(renderRequest));
String group_url = group.getFriendlyURL();
renderRequest.setAttribute("group_url", group_url);
renderRequest.setAttribute("group_name", group.getName());
} catch (Exception e) {
e.printStackTrace();
renderRequest.setAttribute("group_url", e.getMessage());
renderRequest.setAttribute("group_name", e.getMessage());
}
String completeURL = PortalUtil.getCurrentCompleteURL(httpReq);
renderRequest.setAttribute("completeURL", completeURL);
// User theUser = PortalUtil.getUser(renderRequest);
String currentContext = getCurrentContext(renderRequest);
renderRequest.setAttribute("current_context", currentContext);
super.render(renderRequest, renderResponse);
}
}

View File

@ -4,6 +4,7 @@
<display>
<category name="gCube Applications">
<portlet id="cloudcomputing-boot-platform-portlet" />
<portlet id="cloudcomputing-config-portlet" />
<portlet id="cloudcomputing-methods-list-portlet" />
<portlet id="cloudcomputing-method-edit-portlet" />
<portlet id="cloudcomputing-method-exec-portlet" />

View File

@ -8,13 +8,20 @@
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
</portlet> -->
<portlet>
<portlet-name>cloudcomputing-boot-platform-portlet</portlet-name>
<icon>/icon.png</icon>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
</portlet>
<portlet>
<portlet-name>cloudcomputing-config-portlet</portlet-name>
<icon>/icon.png</icon>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
</portlet>
<portlet>
<portlet-name>cloudcomputing-methods-list-portlet</portlet-name>
<icon>/icon.png</icon>
@ -33,7 +40,6 @@
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
</portlet>
<portlet>
<portlet-name>cloudcomputing-method-monitor-portlet</portlet-name>
<icon>/icon.png</icon>

View File

@ -37,6 +37,39 @@
</security-role-ref>
</portlet>
<portlet>
<portlet-name>cloudcomputing-config-portlet</portlet-name>
<display-name>cloudcomputing-config-portlet</display-name>
<portlet-class>
org.gcube.portlets.user.cloudcomputing.config.CloudComputingConfigurationPortlet
</portlet-class>
<init-param>
<name>view-template</name>
<value>/html/config/configuration.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>cloudcomputing-config-portlet</title>
<short-title>cloudcomputing-config-portlet</short-title>
<keywords>cloudcomputing-config-portlet</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
<portlet>
<portlet-name>cloudcomputing-methods-list-portlet</portlet-name>
<display-name>cloudcomputing-methods-list-portlet</display-name>

View File

@ -1,25 +1,6 @@
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ include file="../init.jsp"%>
<%
pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context"));
pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url"));
pageContext.setAttribute("auth_url", request.getAttribute("auth_url"));
pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url"));
pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url"));
pageContext.setAttribute("current_context", request.getAttribute("current_context"));
pageContext.setAttribute("current_url", request.getAttribute("current_url"));
pageContext.setAttribute("infrastructure", request.getAttribute("infrastructure"));
pageContext.setAttribute("absolute_current_url", request.getAttribute("absolute_current_url"));
pageContext.setAttribute("calculated_gateway", request.getAttribute("calculated_gateway"));
pageContext.setAttribute("base_url", request.getAttribute("base_url"));
pageContext.setAttribute("group_url", request.getAttribute("group_url"));
pageContext.setAttribute("group_name", request.getAttribute("group_name"));
pageContext.setAttribute("host", request.getAttribute("host"));
%>
<script src="${cdn_url}/common/js/keycloak.js" type="text/javascript"></script>
<script src="${cdn_url}/common/js/bss-min-1.2.6.js"></script>
<link href="${cdn_url}/ccp/css/common.css" rel="stylesheet" />
@ -34,29 +15,4 @@ pageContext.setAttribute("host", request.getAttribute("host"));
</div>
Boot Portlet
<div style="display:block">
<ul>
<li> current_context = ${current_context}</li>
<li> encoded_context = ${encoded_context}</li>
<li> gateway = ${gateway}</li>
<li> redirect_url = ${redirect_url}</li>
<li> auth_url = ${auth_url}</li>
<li> ccp_url = ${ccp_url}</li>
<li> cdn_url = ${cdn_url}</li>
<li> current_url = ${current_url}</li>
<li> infrastructure = ${infrastructure}</li>
<li> absolute_current_url = ${absolute_current_url}</li>
<li> calculated_gateway = ${calculated_gateway}</li>
<li> base_url = ${base_url}</li>
<li> group_url = ${group_url}</li>
<li> group_name = ${group_name}</li>
<li> host = ${host}</li>
</ul>
</div>
Boot Portlet - tohide

View File

@ -0,0 +1,39 @@
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ include file="../init.jsp"%>
<%
pageContext.setAttribute("current_context", request.getAttribute("current_context"));
pageContext.setAttribute("current_url", request.getAttribute("current_url"));
pageContext.setAttribute("infrastructure", request.getAttribute("infrastructure"));
pageContext.setAttribute("absolute_current_url", request.getAttribute("absolute_current_url"));
pageContext.setAttribute("base_url", request.getAttribute("base_url"));
pageContext.setAttribute("group_url", request.getAttribute("group_url"));
pageContext.setAttribute("group_name", request.getAttribute("group_name"));
pageContext.setAttribute("host", request.getAttribute("host"));
%>
<div style="display:block">
<ul>
<li> current_context = ${current_context}</li>
<li> encoded_context = ${encoded_context}</li>
<li> gateway = ${gateway}</li>
<li> redirect_url = ${redirect_url}</li>
<li> auth_url = ${auth_url}</li>
<li> ccp_url = ${ccp_url}</li>
<li> cdn_url = ${cdn_url}</li>
<li> current_url = ${current_url}</li>
<li> infrastructure = ${infrastructure}</li>
<li> absolute_current_url = ${absolute_current_url}</li>
<li> base_url = ${base_url}</li>
<li> group_url = ${group_url}</li>
<li> group_name = ${group_name}</li>
<li> host = ${host}</li>
</ul>
</div>

View File

@ -52,3 +52,11 @@
<portlet:defineObjects />
<liferay-theme:defineObjects />
<theme:defineObjects />
<%
pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context"));
pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url"));
pageContext.setAttribute("auth_url", request.getAttribute("auth_url"));
pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url"));
pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url"));
%>

View File

@ -2,16 +2,6 @@
<%@ include file="../../init.jsp"%>
<%
pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context"));
pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url"));
pageContext.setAttribute("auth_url", request.getAttribute("auth_url"));
pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url"));
pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url"));
%>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<script src="${cdn_url}/ccp/js/inputwidgetcontroller.js"></script>
<script src="${cdn_url}/storage/d4s-storage.js"></script>

View File

@ -2,17 +2,6 @@
<%@ include file="../../init.jsp"%>
<%
pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context"));
pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url"));
pageContext.setAttribute("auth_url", request.getAttribute("auth_url"));
pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url"));
pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url"));
%>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<div>
<d4s-ccp-executionform serviceurl="${ccp_url}">

View File

@ -2,14 +2,6 @@
<%@ include file="../../init.jsp"%>
<%
pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context"));
pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url"));
pageContext.setAttribute("auth_url", request.getAttribute("auth_url"));
pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url"));
pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url"));
%>
<div>
<d4s-ccp-methodlist allow-execute="true" archive="true"
serviceurl="${ccp_url}">

View File

@ -2,18 +2,7 @@
<%@ include file="../../init.jsp"%>
<%
pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context"));
pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url"));
pageContext.setAttribute("auth_url", request.getAttribute("auth_url"));
pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url"));
pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url"));
%>
<div><d4s-ccp-executionhistory archive="true" serviceurl="${ccp_url}">
<script src="${cdn_url}/ccp/js/executionhistorycontroller.js"></script>
<script src="${cdn_url}/ccp/js/logterminalcontroller.js"></script>
</d4s-ccp-executionhistory></div>
Method List Portlet