-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3066 from MeroRai/PAYARA-2871-payara4
PAYARA-2871 Improve listing batch jobs memory usage in admin console - Payara4
- Loading branch information
Showing
17 changed files
with
1,113 additions
and
282 deletions.
There are no files selected for viewing
163 changes: 163 additions & 0 deletions
163
appserver/admingui/full/src/main/java/fish/payara/full/admingui/handlers/BatchHandlers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
/* | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
* | ||
* Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. | ||
* | ||
* The contents of this file are subject to the terms of either the GNU | ||
* General Public License Version 2 only ("GPL") or the Common Development | ||
* and Distribution License("CDDL") (collectively, the "License"). You | ||
* may not use this file except in compliance with the License. You can | ||
* obtain a copy of the License at | ||
* https://github.com/payara/Payara/blob/master/LICENSE.txt | ||
* See the License for the specific | ||
* language governing permissions and limitations under the License. | ||
* | ||
* When distributing the software, include this License Header Notice in each | ||
* file and include the License file at glassfish/legal/LICENSE.txt. | ||
* | ||
* GPL Classpath Exception: | ||
* The Payara Foundation designates this particular file as subject to the "Classpath" | ||
* exception as provided by the Payara Foundation in the GPL Version 2 section of the License | ||
* file that accompanied this code. | ||
* | ||
* Modifications: | ||
* If applicable, add the following below the License Header, with the fields | ||
* enclosed by brackets [] replaced by your own identifying information: | ||
* "Portions Copyright [year] [name of copyright owner]" | ||
* | ||
* Contributor(s): | ||
* If you wish your version of this file to be governed by only the CDDL or | ||
* only the GPL Version 2, indicate your decision by adding "[Contributor] | ||
* elects to include this software in this distribution under the [CDDL or GPL | ||
* Version 2] license." If you don't indicate a single choice of license, a | ||
* recipient has the option to distribute your version of this file under | ||
* either the CDDL, the GPL Version 2 or to extend the choice of license to | ||
* its licensees as provided above. However, if you add GPL Version 2 code | ||
* and therefore, elected the GPL Version 2 license, then the option applies | ||
* only if the new code is made subject to such option by the copyright | ||
* holder. | ||
*/ | ||
package fish.payara.full.admingui.handlers; | ||
|
||
import com.sun.jsftemplating.annotation.Handler; | ||
import com.sun.jsftemplating.annotation.HandlerInput; | ||
import com.sun.jsftemplating.annotation.HandlerOutput; | ||
import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext; | ||
import org.glassfish.admingui.common.util.GuiUtil; | ||
|
||
/** | ||
* | ||
* @author Susan Rai | ||
*/ | ||
public class BatchHandlers { | ||
|
||
private static final int DEFAULT_OFFSET_INCREMENT = 20; | ||
|
||
@Handler(id = "py.addToOffSetValue", | ||
input = { | ||
@HandlerInput(name = "offset", type = String.class)}, | ||
output = { | ||
@HandlerOutput(name = "result", type = String.class)}) | ||
public static void addToOffSetValue(HandlerContext handlerCtx) { | ||
|
||
String offsetValue = (String) handlerCtx.getInputValue("offset"); | ||
int result = 0; | ||
|
||
try { | ||
result = Integer.parseInt(offsetValue) + DEFAULT_OFFSET_INCREMENT; | ||
} catch (NumberFormatException ex) { | ||
GuiUtil.getLogger().info("Value isn't a valid integer " + ex); | ||
} | ||
|
||
handlerCtx.setOutputValue("result", result); | ||
} | ||
|
||
@Handler(id = "py.subtractFromOffSetValue", | ||
input = { | ||
@HandlerInput(name = "offset", type = String.class)}, | ||
output = { | ||
@HandlerOutput(name = "result", type = String.class)}) | ||
public static void subtractFromOffSetValue(HandlerContext handlerCtx) { | ||
|
||
String offsetValue = (String) handlerCtx.getInputValue("offset"); | ||
int result = 0; | ||
|
||
try { | ||
result = Integer.parseInt(offsetValue); | ||
if (result >= DEFAULT_OFFSET_INCREMENT) { | ||
result = result - DEFAULT_OFFSET_INCREMENT; | ||
} else { | ||
result = 0; | ||
} | ||
} catch (NumberFormatException ex) { | ||
GuiUtil.getLogger().info("Value isn't a valid integer " + ex); | ||
} | ||
|
||
handlerCtx.setOutputValue("result", result); | ||
} | ||
|
||
@Handler(id = "py.getPageNumber", | ||
input = { | ||
@HandlerInput(name = "offset", type = String.class)}, | ||
output = { | ||
@HandlerOutput(name = "result", type = String.class)}) | ||
public static void getPageNumber(HandlerContext handlerCtx) { | ||
|
||
String offsetValue = (String) handlerCtx.getInputValue("offset"); | ||
int result = 0; | ||
|
||
try { | ||
int offSet = Integer.parseInt(offsetValue); | ||
result = (offSet + DEFAULT_OFFSET_INCREMENT) / DEFAULT_OFFSET_INCREMENT; | ||
} catch (NumberFormatException ex) { | ||
GuiUtil.getLogger().info("Value isn't a valid integer " + ex); | ||
} | ||
|
||
handlerCtx.setOutputValue("result", result); | ||
} | ||
|
||
@Handler(id = "py.getSpecifiedPageNumber", | ||
input = { | ||
@HandlerInput(name = "pageNumber", type = String.class)}, | ||
output = { | ||
@HandlerOutput(name = "result", type = String.class)}) | ||
public static void getSpecifiedPageNumber(HandlerContext handlerCtx) { | ||
|
||
String pageNumberValue = (String) handlerCtx.getInputValue("pageNumber"); | ||
int result = 0; | ||
|
||
try { | ||
int pageNumber = Integer.parseInt(pageNumberValue); | ||
if (pageNumber > 0) { | ||
result = (pageNumber * DEFAULT_OFFSET_INCREMENT) - DEFAULT_OFFSET_INCREMENT; | ||
} | ||
} catch (NumberFormatException ex) { | ||
GuiUtil.getLogger().info("Value isn't a valid integer " + ex); | ||
} | ||
|
||
handlerCtx.setOutputValue("result", result); | ||
} | ||
|
||
@Handler(id = "py.getPageCount", | ||
input = { | ||
@HandlerInput(name = "jobCount", type = String.class)}, | ||
output = { | ||
@HandlerOutput(name = "result", type = String.class)}) | ||
public static void getPageCount(HandlerContext handlerCtx) { | ||
|
||
String jobCountValue = (String) handlerCtx.getInputValue("jobCount"); | ||
int result = 1; | ||
|
||
try { | ||
int jobCount = Integer.parseInt(jobCountValue); | ||
if (jobCount > 0) { | ||
result = (jobCount + DEFAULT_OFFSET_INCREMENT - 1) / DEFAULT_OFFSET_INCREMENT; | ||
} | ||
} catch (NumberFormatException ex) { | ||
GuiUtil.getLogger().info("Value isn't a valid integer " + ex); | ||
} | ||
|
||
handlerCtx.setOutputValue("result", result); | ||
} | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
appserver/admingui/full/src/main/resources/batch/assets/js/batch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
* | ||
* Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. | ||
* | ||
* The contents of this file are subject to the terms of either the GNU | ||
* General Public License Version 2 only ("GPL") or the Common Development | ||
* and Distribution License("CDDL") (collectively, the "License"). You | ||
* may not use this file except in compliance with the License. You can | ||
* obtain a copy of the License at | ||
* https://github.com/payara/Payara/blob/master/LICENSE.txt | ||
* See the License for the specific | ||
* language governing permissions and limitations under the License. | ||
* | ||
* When distributing the software, include this License Header Notice in each | ||
* file and include the License file at glassfish/legal/LICENSE.txt. | ||
* | ||
* GPL Classpath Exception: | ||
* The Payara Foundation designates this particular file as subject to the "Classpath" | ||
* exception as provided by the Payara Foundation in the GPL Version 2 section of the License | ||
* file that accompanied this code. | ||
* | ||
* Modifications: | ||
* If applicable, add the following below the License Header, with the fields | ||
* enclosed by brackets [] replaced by your own identifying information: | ||
* "Portions Copyright [year] [name of copyright owner]" | ||
* | ||
* Contributor(s): | ||
* If you wish your version of this file to be governed by only the CDDL or | ||
* only the GPL Version 2, indicate your decision by adding "[Contributor] | ||
* elects to include this software in this distribution under the [CDDL or GPL | ||
* Version 2] license." If you don't indicate a single choice of license, a | ||
* recipient has the option to distribute your version of this file under | ||
* either the CDDL, the GPL Version 2 or to extend the choice of license to | ||
* its licensees as provided above. However, if you add GPL Version 2 code | ||
* and therefore, elected the GPL Version 2 license, then the option applies | ||
* only if the new code is made subject to such option by the copyright | ||
* holder. | ||
*/ | ||
|
||
<f:verbatim> | ||
<script type="text/javascript"> | ||
addCSS('/resource/batch/assets/skins/payara_theme/batch-styles.css'); | ||
function addCSS(filename){ | ||
var head = document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('link'); | ||
style.href = filename; | ||
style.type = 'text/css'; | ||
style.rel = 'stylesheet'; | ||
head.appendChild(style); | ||
} | ||
</script> | ||
</f:verbatim> |
104 changes: 104 additions & 0 deletions
104
appserver/admingui/full/src/main/resources/batch/assets/skins/payara_theme/batch-styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
* | ||
* Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. | ||
* | ||
* The contents of this file are subject to the terms of either the GNU | ||
* General Public License Version 2 only ("GPL") or the Common Development | ||
* and Distribution License("CDDL") (collectively, the "License"). You | ||
* may not use this file except in compliance with the License. You can | ||
* obtain a copy of the License at | ||
* https://github.com/payara/Payara/blob/master/LICENSE.txt | ||
* See the License for the specific | ||
* language governing permissions and limitations under the License. | ||
* | ||
* When distributing the software, include this License Header Notice in each | ||
* file and include the License file at glassfish/legal/LICENSE.txt. | ||
* | ||
* GPL Classpath Exception: | ||
* The Payara Foundation designates this particular file as subject to the "Classpath" | ||
* exception as provided by the Payara Foundation in the GPL Version 2 section of the License | ||
* file that accompanied this code. | ||
* | ||
* Modifications: | ||
* If applicable, add the following below the License Header, with the fields | ||
* enclosed by brackets [] replaced by your own identifying information: | ||
* "Portions Copyright [year] [name of copyright owner]" | ||
* | ||
* Contributor(s): | ||
* If you wish your version of this file to be governed by only the CDDL or | ||
* only the GPL Version 2, indicate your decision by adding "[Contributor] | ||
* elects to include this software in this distribution under the [CDDL or GPL | ||
* Version 2] license." If you don't indicate a single choice of license, a | ||
* recipient has the option to distribute your version of this file under | ||
* either the CDDL, the GPL Version 2 or to extend the choice of license to | ||
* its licensees as provided above. However, if you add GPL Version 2 code | ||
* and therefore, elected the GPL Version 2 license, then the option applies | ||
* only if the new code is made subject to such option by the copyright | ||
* holder. | ||
*/ | ||
/* | ||
Created on : Jul 13, 2018, 5:51:48 PM | ||
Author : Susan Rai | ||
*/ | ||
|
||
input[id$="previousJobsButton"], input[id$="nextJobsButton"] { | ||
width: 100px; | ||
height: 30px; | ||
padding: 0px; | ||
color:#000000; | ||
font-weight: bold; | ||
background-color: transparent; | ||
} | ||
|
||
input:hover[id$="previousJobsButton"], | ||
input:hover[id$="nextJobsButton"], | ||
input:hover[id$="goButton"]{ | ||
background-color: #cbced0 !important; | ||
} | ||
|
||
span[id$=":paginationButtons"] { | ||
background-color: #eeeeee; | ||
border-radius: 5px; | ||
padding: 10px; | ||
display:block; | ||
width : 350px; | ||
margin: 0 0 20px 23%; | ||
} | ||
|
||
input[id$="nextJobsButton"] { | ||
float: right; | ||
} | ||
|
||
input[id$="pageNumber"]{ | ||
float: left; | ||
margin: -25px 0 0 135px; | ||
width: 30px; | ||
text-align: center; | ||
} | ||
|
||
label[id$="totalNumberOfPages_label"] { | ||
color: #333333; | ||
float: right; | ||
width: 60px; | ||
font-weight:100; | ||
margin: -22px 110px 0 0; | ||
} | ||
label[for$="pageNumber"] { | ||
color: #333333; | ||
font-weight:100; | ||
float: left; | ||
width: 35px; | ||
margin: -22px 0 0 100px; | ||
} | ||
|
||
input[id$="goButton"]{ | ||
width: 35px; | ||
height: 25px; | ||
padding: 0px; | ||
color: #333333; | ||
font-weight: bold; | ||
background-color: transparent; | ||
float: right; | ||
margin: -27px 95px 0 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.