blob: 989214a0d52764da0216b4e0bf79a3884c28bb0a [file] [log] [blame]
<!--
Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<!-- applications/targetListing.jsf -->
<!initPage
setResourceBundle(key="i18n" bundle="org.glassfish.admingui.core.Strings")
setResourceBundle(key="help_common" bundle="org.glassfish.common.admingui.Helplinks")
/>
<!composition template="/templates/default.layout"
guiTitle="$resource{i18n.resourceTargetListing.PageTitle}"
>
<!define name="content">
<event>
<!beforeCreate
getRequestValue(key="name" value="#{pageSession.Name}");
setPageSessionAttribute(key="resourceName" value="#{pageSession.Name}");
urlencode(value="#{pageSession.Name}" encoding="UTF-8" result="#{pageSession.encodedName}");
//For resourceEditTabs.inc
setSessionAttribute(key="resEditTabs" value="targetTab");
getRequestValue(key="generalPage" value="#{pageSession.generalPage}");
setPageSessionAttribute(key="targetPage" value="#{request.contextPath}/common/resourceNode/resourceEditTargets.jsf?name=#{pageSession.encodedName}");
/>
</event>
<sun:form id="propertyForm">
#include "/common/resourceNode/resourceEditTabs.inc"
#include "/common/shared/alertMsg_1.inc"
<sun:title id="propertyContentPage" title="$resource{i18n.resourceTargetListing.PageTitle}" helpText="$resource{i18n.resourceTargetListing.PageTitleHelp}"/>
"<br />
#include "/common/resourceNode/resourceNameSection.inc"
<sun:table id="targetTable" title="$resource{i18n.common.TargetTableTitle}" sortPanelToggleButton="#{false}"
deselectMultipleButton="$boolean{true}"
deselectMultipleButtonOnClick="setTimeout('admingui.table.changeThreeTableButtons(\\\\\'#{pageSession.topActionGroup}\\\\\', \\\\\'#{pageSession.tableId}\\\\\');', 0)"
selectMultipleButton="$boolean{true}"
selectMultipleButtonOnClick="setTimeout('admingui.table.changeThreeTableButtons(\\\\\'#{pageSession.topActionGroup}\\\\\', \\\\\'#{pageSession.tableId}\\\\\');', 0)" > >
<!afterCreate
getClientId(component="$this{component}" clientId=>$page{tableId});
/>
<!facet actionsTop>
<sun:panelGroup id="topActionsGroup1">
<!afterCreate
getClientId(component="$this{component}" clientId=>$page{topActionGroup});
/>
<sun:button id="manageTargetButton" text="$resource{i18n.button.ManageTarget}" >
<!command
setAttribute(key="name" value="#{name}");
setAttribute(key="targetPage" value="#{targetPage}");
setAttribute(key="targetPageHelp" value="#{targetPageHelp}");
gf.redirect(page="#{request.contextPath}/common/resourceNode/resourceManageTargets.jsf?resName=#{pageSession.encodedName}&generalPage=#{pageSession.generalPage}");
/>
</sun:button>
<sun:button id="button2" text="$resource{i18n.button.Enable}" disabled="#{true}" primary="#{false}" >
<!command
getUIComponent(clientId="$pageSession{targetTableRowGroupId}", component=>$attribute{tableRowGroup});
getSelectedSingleMapRows(TableRowGroup="${tableRowGroup}" selectedRows=>$attribute{selectedRows});
foreach (var="row" list="#{requestScope.selectedRows}") {
gf.createAttributeMap(keys={"enabled"} values={"true"} map="#{requestScope.attrMap}");
gf.restRequest(endpoint="#{row.endpoint}"
attrs="#{requestScope.attrMap}"
method="post");
}
setAttribute(key="selectedRows" value="${selectedRows}");
prepareAlertMsg(summary="$resource{i18n.msg.enableResourceOnTargetsSuccessful}", type="success");
gf.redirect(page="#{pageSession.targetPage}&generalPage=#{pageSession.generalPage}&alertType=${alertType}&alertSummary=${alertSummary}&alertDetail=${alertDetail}");
/>
</sun:button>
<sun:button id="button3" text="$resource{i18n.button.Disable}" disabled="#{true}" primary="#{false}" >
<!command
getUIComponent(clientId="$pageSession{targetTableRowGroupId}", component=>$attribute{tableRowGroup});
getSelectedSingleMapRows(TableRowGroup="${tableRowGroup}" selectedRows=>$attribute{selectedRows});
foreach (var="row" list="#{requestScope.selectedRows}") {
gf.createAttributeMap(keys={"enabled"} values={"false"} map="#{requestScope.attrMap}");
gf.restRequest(endpoint="#{row.endpoint}"
attrs="#{requestScope.attrMap}"
method="post");
}
setAttribute(key="selectedRows" value="${selectedRows}");
prepareAlertMsg(summary="$resource{i18n.msg.disableResourceOnTargetsSuccessful}", type="success");
gf.redirect(page="#{pageSession.targetPage}&generalPage=#{pageSession.generalPage}&alertType=${alertType}&alertSummary=${alertSummary}&alertDetail=${alertDetail}");
/>
</sun:button>
</sun:panelGroup>
</facet>
<sun:tableRowGroup id="rowGroup1" selected="#{td.value.selected}" data={"$attribute{listOfRows}"} sourceVar="td">
<!beforeCreate
//To get the targets of a resource in tabular form
setAttribute(key="listOfRows" value={});
foreach(var="targetName" list="#{pageSession.targetList}") {
setAttribute(key="endpoint" value="#{sessionScope.REST_URL}/clusters/cluster/#{requestScope.targetName}/resource-ref/#{pageSession.encodedName}");
gf.checkIfEndPointExist(endpoint="#{endpoint}" exists="isCluster");
if ("!#{requestScope.isCluster}") {
setAttribute(key="endpoint" value="#{sessionScope.REST_URL}/servers/server/#{requestScope.targetName}/resource-ref/#{pageSession.encodedName}");
gf.checkIfEndPointExist(endpoint="#{endpoint}" exists="isServer");
if("!#{requestScope.isServer}") {
setAttribute(key="endpoint" value="");
}
}
if ("#{endpoint}") {
gf.getEntityAttrs(endpoint="#{endpoint}" valueMap="#{requestScope.attrs}");
if ("#{requestScope.attrs.enabled}=true") {
setAttribute(key="status" value="/resource/images/enabled.png");
}
if ("!(#{requestScope.attrs.enabled}=true)") {
setAttribute(key="status" value="/resource/images/disabled.png");
}
gf.createAttributeMap(keys={"selected", "endpoint", "targetName", "enabled"}
values={"$boolean{false}",
"$attribute{endpoint}",
"$attribute{targetName}",
"$attribute{status}"}
map="#{requestScope.oneRowMap}");
listAdd(list="$attribute{listOfRows}" value="#{requestScope.oneRowMap}");
}
setAttribute(key="endpoint" value="");
}
/>
<!afterCreate
getClientId(component="$this{component}" clientId=>$page{targetTableRowGroupId});
/>
<sun:tableColumn headerText="$resource{i18n.common.SelectHeader}" selectId="select" rowHeader="$boolean{false}" id="col0">
<sun:checkbox id="select"
selected="#{td.value.selected}"
selectedValue="$boolean{true}"
onClick="setTimeout('admingui.table.changeThreeTableButtons(\\\\\'#{pageSession.topActionGroup}\\\\\', \\\\\'#{pageSession.tableId}\\\\\'); admingui.table.initAllRows(\\\\\'#{pageSession.tableId}\\\\\');', 0);"
/>
</sun:tableColumn>
<sun:tableColumn headerText="$resource{i18n.targetTable.colTargetName}" sort="targetName" rowHeader="$boolean{true}" id="col1">
<staticText id="nameCol" value="#{td.value.targetName}" />
</sun:tableColumn>
<sun:tableColumn headerText="$resource{i18n.deployTable.colEnabled}" sort="enabled" rowHeader="$boolean{true}" id="col2">
<sun:image id="statusCol" value="#{td.value.enabled}" />
</sun:tableColumn>
</sun:tableRowGroup>
</sun:table>
<sun:hidden id="helpKey" value="$resource{help_common.resourceTargetListing}" />
</sun:form>
#include "/common/shared/changeButtonsJS.inc"
</define>
</composition>