Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SRE-22160] Fix ordering of script group insert #195

Merged
merged 1 commit into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,10 @@ public void setCurrentScriptGroup(ScriptGroup currentScriptGroup) {
public void initCurrentGroup() {
currentScriptGroup = new ScriptGroup();
currentScriptGroup.setLoop(1);
this.insertIndex = -1;
Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String param = params.get("insertIndex");
if (param != null && NumberUtils.isCreatable(param)) {
insertIndex = Integer.parseInt(param);
}
}

public void setInsertIndex(int rowIndex) {
this.insertIndex = rowIndex;
}

/**
Expand Down Expand Up @@ -152,7 +150,7 @@ public void addScriptGroup() {
if ("<Script Group Name>".equalsIgnoreCase(currentScriptGroup.getName())) {
messages.error("Please give the Script Group a name.");
} else {
currentTestPlan.addScriptGroupAt(currentScriptGroup, insertIndex);
currentTestPlan.addScriptGroupAt(currentScriptGroup, this.insertIndex);
}
}

Expand Down
5 changes: 3 additions & 2 deletions web/web_ui/src/main/webapp/projects/workloadScripts.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<div class="float-left">
<p:commandButton ajax="true" value="Insert Script Group" update=":scriptGroupPopupID" immediate="true"
action="#{workloadScripts.initCurrentGroup}" oncomplete="PF('scriptGroupPopup').show();"
actionListener="#{workloadScripts.setInsertIndex(-1)}"
icon="ui-icon-document" style="margin: 0 0 0 10px; border-radius:5px"
styleClass="icon-button h-space" />
</div>
Expand Down Expand Up @@ -118,9 +119,9 @@
</p:commandLink>

<p:commandLink update=":scriptGroupPopupID" ajax="true"
action="#{workloadScripts.initCurrentGroup(testPlan)}" immediate="true"
action="#{workloadScripts.initCurrentGroup()}" immediate="true"
actionListener="#{workloadScripts.setInsertIndex(rowIndex)}"
oncomplete="PF('scriptGroupPopup').show();">
<f:param name="insertIndex" value="#{rowIndex}" />
<h:graphicImage library="gfx" name="16/application_add.png" width="16px" height="16px"
style="padding: 2px;" title="Insert Script Group before #{group.name}." />
</p:commandLink>
Expand Down