-
Notifications
You must be signed in to change notification settings - Fork 143
/
nodes.jsf
209 lines (181 loc) · 11.3 KB
/
nodes.jsf
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!--
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
-->
<!initPage
setResourceBundle(key="i18nc" bundle="org.glassfish.common.admingui.Strings")
setResourceBundle(key="i18ncs" bundle="org.glassfish.cluster.admingui.Strings")
setResourceBundle(key="help_cluster" bundle="org.glassfish.cluster.admingui.Helplinks");
/>
<!composition template="/templates/default.layout"
guiTitle="$resource{i18ncs.nodes.PageTitle}"
guiTemplateOnLoad="admingui.nav.refreshTree('treeForm:tree:nodeTreeNode');">
<!define name="listTableDeleteButton">
<sun:button id="button1" text="$resource{i18n.button.Delete}" disabled="#{true}" primary="#{false}"
onClick="if ( getConfirm(this,'$pageSession{confirmDeleteMsg}') )
{ return submitAndDisable(this, '$resource{i18n.button.Processing}');} else {return false;} " >
<!command
getUIComponent(clientId="$pageSession{tableRowGroupId}", component="#{requestScope.tableRowGroup}");
getSelectedSingleMapRows(TableRowGroup="${tableRowGroup}" selectedRows="#{requestScope.selectedRows}");
gf.nodeAction(rows="#{requestScope.selectedRows}", action="delete-node" , nodeInstanceMap="#{pageSession.nodeInstanceMap}");
gf.redirect(page="/cluster/node/nodes.jsf?alertType=${alertType}&alertSummary=${alertSummary}&alertDetail=${alertDetail}");
/>
</sun:button>
</define>
<!define name="extraButton2">
<sun:button id="button2" text="$resource{i18ncs.button.DeleteAndUninstall}" disabled="#{true}" primary="#{false}"
onClick="if ( getConfirm(this,'$resource{i18ncs.msg.JS.confirmUninstallNodes}') )
{ return submitAndDisable(this, '$resource{i18n.button.Processing}');} else {return false;} " >
<!command
getUIComponent(clientId="$pageSession{tableRowGroupId}", component="#{requestScope.tableRowGroup}");
getSelectedSingleMapRows(TableRowGroup="${tableRowGroup}" selectedRows="#{requestScope.selectedRows}");
gf.nodeAction(rows="#{requestScope.selectedRows}", action="delete-node-uninstall" , nodeInstanceMap="#{pageSession.nodeInstanceMap}");
gf.redirect(page="/cluster/node/nodes.jsf?alertType=${alertType}&alertSummary=${alertSummary}&alertDetail=${alertDetail}");
/>
</sun:button>
</define>
<!define name="content">
<event>
<!beforeCreate
setPageSessionAttribute(key="parentUrl" value="#{sessionScope.REST_URL}/nodes");
setPageSessionAttribute(key="childType" value="node");
gf.getChildList(parentEndpoint="#{pageSession.parentUrl}", childType="#{pageSession.childType}", result="#{requestScope.listOfRows}");
foreach(var="oneNode" list="#{requestScope.listOfRows}"){
mapPut(map="#{oneNode}" key="hasPing" value="#{false}");
mapPut(map="#{oneNode}" key="cmd" value="");
if ("#{oneNode.type}=SSH"){
mapPut(map="#{oneNode}" key="hasPing" value="#{true}");
mapPut(map="#{oneNode}" key="cmd" value="ping-node-ssh");
}
}
setPageSessionAttribute(key="confirmDeleteMsg" value="$resource{i18ncs.msg.JS.confirmDeleteNodes}");
setPageSessionAttribute(key="createLink" value="#{request.contextPath}/cluster/node/nodeNew.jsf");
setPageSessionAttribute(key="listLink" value="#{request.contextPath}/cluster/node/nodes.jsf");
setPageSessionAttribute(key="editLink" value="#{request.contextPath}/cluster/node/nodeEdit.jsf");
setPageSessionAttribute(key="tableTitle" value="$resource{i18ncs.nodes.TableTitle}");
createMap(result="#{pageSession.nodeInstanceMap}");
gf.listInstances(optionKeys={"standaloneonly", "nostatus" } optionValues={"true", "true"}, instances="#{pageSession.standaloneList}");
/>
</event>
" <script type="text/javascript">admingui.nav.selectTreeNodeById(admingui.nav.TREE_ID + ":nodeTreeNode");</script>
<sun:form id="propertyForm">
#include "/common/shared/alertMsg.inc"
<sun:title id="propertyContentPage" title="$resource{i18ncs.nodes.PageTitle}" helpText="$resource{i18ncs.nodes.PageTitleHelp}" />
"<br /> <br />
<sun:table id="nodesTable" title="#{tableTitle}"
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});
/>
#include "/common/shared/listTableButtons.inc"
<sun:tableRowGroup id="rowGroup1" selected="#{td.value.selected}" data={"$attribute{listOfRows}"} sourceVar="td">
<!afterCreate
getClientId(component="$this{component}" clientId=>$page{tableRowGroupId});
/>
<sun:tableColumn headerText="$resource{i18n.common.SelectHeader}" selectId="select" rowHeader="$boolean{false}" id="col0">
<sun:checkbox id="select"
toolTip="$resource{i18n.common.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.common.name.header}" sort="name" rowHeader="$boolean{true}" valign="top" id="col1">
<event>
<!beforeEncode
setPageSessionAttribute(key="nodeName" value="#{td.value.name}");
/>
</event>
<sun:hyperlink id="link" text="#{td.value.name}" url="#{pageSession.editLink}?nodeName=#{td.value.name}" />
</sun:tableColumn>
<sun:tableColumn headerText="$resource{i18ncs.node.nodeHostCol}" sort="nodeHost" rowHeader="$boolean{false}" valign="top" id="col2">
<sun:staticText escape="true" id="nodeHostCol" value="#{td.value.nodeHost}" />
</sun:tableColumn>
<sun:tableColumn headerText="$resource{i18ncs.node.nodeTypeCol}" sort="type" rowHeader="$boolean{false}" valign="top" id="colType">
<sun:staticText escape="true" id="typeCol" value="#{td.value.type}" />
</sun:tableColumn>
<sun:tableColumn headerText="$resource{i18ncs.clusters.instanceCol}" rowHeader="$boolean{false}" id="col3">
<event>
<!beforeEncode
gf.listInstances(optionKeys={"id", "nostatus"} optionValues={"$pageSession{nodeName}", "true"}, instances="#{requestScope.instanceList}" statusMap="#{requestScope.statusMap}");
mapPut(map="#{pageSession.nodeInstanceMap}" key="#{pageSession.nodeName}" value="#{requestScope.instanceList}");
/>
</event>
<if condition="#{requestScope.instanceList}">
<foreach key="instance" list="#{requestScope.instanceList}">
<event>
<!beforeEncode
setAttribute(key="status" value="UNKNOWN");
if (#{not empty requestScope.statusMap[ '${instance}']}) {
setAttribute(key="status" value="#{requestScope.statusMap[ '${instance}']}");
}
gf.containedIn(list="#{pageSession.standaloneList}" testStr="#{requestScope.instance}" contain="#{requestScope.isStandalone}" );
urlencode(value="#{requestScope.instance}" encoding="UTF-8" result="#{pageSession.encodedInstanceName}");
if (#{requestScope.isStandalone}){
setAttribute(key="iurl" value="#{request.contextPath}/cluster/standalone/standaloneInstanceGeneral.jsf?instanceName=#{pageSession.encodedInstanceName}");
}
if ( !#{requestScope.isStandalone}){
gf.getClusterNameForInstance(instanceName="#{requestScope.instance}" clusterName="#{requestScope.clusterName}");
urlencode(value="#{requestScope.clusterName}" encoding="UTF-8" result="#{requestScope.encodedClusterName}");
setAttribute(key="iurl" value="#{request.contextPath}/cluster/cluster/clusterInstanceEdit.jsf?clusterName=#{requestScope.encodedClusterName}&instanceName=#{pageSession.encodedInstanceName}" );
}
setAttribute(key="statusString" value="$resource{i18nc.status.$attribute{status}} $resource{i18nc.status.image.$attribute{status}}");
/>
</event>
<sun:hyperlink url="#{requestScope.iurl}" text="#{requestScope.instance}" />
"
"<span class="status" data-instancename="#{instance}">
<staticText id="colStopped" value="#{requestScope.statusString}" />
"</span>
"<br />
</foreach>
</if>
</sun:tableColumn>
<sun:tableColumn headerText="$resource{i18n.common.Action}" embeddedActions="#{false}" rowHeader="$boolean{true}" id="col4">
<sun:hyperlink id="pingLink" text="$resource{i18n.button.Ping}" rendered="#{td.value.hasPing}" >
<!command
gf.restRequest(endpoint="#{sessionScope.REST_URL}/nodes/node/#{td.value.name}/#{td.value.cmd}.json"
attrs="#{requestScope.attrMap}"
method="GET"
result="#{requestScope.result}");
if ("#{requestScope.result.data['exit_code']} = SUCCESS") {
prepareAlertMsg(type="success", summary="#{requestScope.result.data.message}");
}
if ("!#{requestScope.result.data['exit_code']} = SUCCESS") {
gf.handleError(detail="#{requestScope.result.data.message}");
}
/>
</sun:hyperlink>
</sun:tableColumn>
</sun:tableRowGroup>
</sun:table>
<sun:hidden id="helpKey" value="$resource{help_cluster.nodes}" />
</sun:form>
#include "/common/shared/changeButtonsJS.inc"
<sun:script>
<f:verbatim>
function fetchStatusesOfInstances(tableIdPrefix) {
const statusCells = document.querySelectorAll("[id='" + tableIdPrefix + "nodesTable'] tr td span.status");
statusCells.forEach(e => {
const instName = e.attributes["data-instancename"].value;
admingui.ajax.get("#{request.contextPath}/shared/instanceStatus.jsf?instanceName=" + instName, "", (req) => {
e.innerHTML = req.responseText;
});
});
}
fetchStatusesOfInstances("propertyForm:");
</f:verbatim>
</sun:script>
</define>
</composition>