Skip to content

Commit

Permalink
D495028 | Jenkins: limit number of application versions returned - re…
Browse files Browse the repository at this point in the history
…placing dropdown with search following PM discussion
  • Loading branch information
akaryakina committed Dec 7, 2021
1 parent efabfaf commit 48639dd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,10 @@ public List<Project> getApplications(String query, int limit) throws ApiExceptio
List<Project> appList = new ArrayList<Project>();
ProjectControllerApi projectControllerApi = new ProjectControllerApi(apiClient);

ApiResultListProject apiResultListProject = projectControllerApi.listProject("name,id", Integer.valueOf(0), Integer.valueOf(limit), null, false, "name");
boolean hasQuery = !StringUtils.isEmpty(query);
boolean found = false;
String partialQuery = StringUtils.isEmpty(query) ? null : "name:\"*" + query + "*\"";
ApiResultListProject apiResultListProject = projectControllerApi.listProject("name,id", Integer.valueOf(0), Integer.valueOf(limit), partialQuery, false, "name");
for (Project app : apiResultListProject.getData()) {
appList.add(app);
if (hasQuery) {
if (query.equals(app.getName())) {
found = true;
}
}
}
if (hasQuery && !found) {
appList.clear();
String partialQuery = "name:\"*" + query + "*\"";
apiResultListProject = projectControllerApi.listProject("name,id", Integer.valueOf(0), Integer.valueOf(limit), partialQuery, false, "name");
for (Project app : apiResultListProject.getData()) {
appList.add(app);
}
}
return appList;
}
Expand All @@ -138,26 +124,11 @@ public List<ProjectVersion> getAllApplicationVersions(String query, int limit) t
List<ProjectVersion> appVersionList = new ArrayList<ProjectVersion>();
ProjectVersionControllerApi projectVersionControllerApi = new ProjectVersionControllerApi(apiClient);

String partialQuery = StringUtils.isEmpty(query) ? null : "name:\"*" + query + "*\"";
ApiResultListProjectVersion apiResultListProjectVersion = projectVersionControllerApi.listProjectVersion("name,id,project",
Integer.valueOf(0), Integer.valueOf(limit), null, false, "name", false, false, false);
boolean hasQuery = !StringUtils.isEmpty(query);
boolean found = false;
Integer.valueOf(0), Integer.valueOf(limit), partialQuery, false, "name", false, false, false);
for (ProjectVersion appVersion : apiResultListProjectVersion.getData()) {
appVersionList.add(appVersion);
if (hasQuery) {
if (query.equals(appVersion.getName())) {
found = true;
}
}
}
if (hasQuery && !found) {
appVersionList.clear();
String partialQuery = "name:\"*" + query + "*\"";
apiResultListProjectVersion = projectVersionControllerApi.listProjectVersion("name,id,project",
Integer.valueOf(0), Integer.valueOf(limit), partialQuery, false, "name", false, false, false);
for (ProjectVersion appVersion : apiResultListProjectVersion.getData()) {
appVersionList.add(appVersion);
}
}
return appVersionList;
}
Expand All @@ -171,8 +142,10 @@ public List<ProjectVersion> getAllApplicationVersions(String query, int limit) t
public List<ProjectVersion> getApplicationVersionsFor(long applicationId, String query, int limit) throws ApiException {
List<ProjectVersion> appVersionList = new ArrayList<ProjectVersion>();
ProjectVersionOfProjectControllerApi appVerApi = new ProjectVersionOfProjectControllerApi(apiClient);

String partialQuery = StringUtils.isEmpty(query) ? null : "name:\"*" + query + "*\"";
ApiResultListProjectVersion apiResultListProjectVersion = appVerApi.listProjectVersionOfProject(applicationId,
"name,id", Integer.valueOf(0), Integer.valueOf(limit), null, false, "name", false, false);
"name,id", Integer.valueOf(0), Integer.valueOf(limit), partialQuery, false, "name", false, false);
for (ProjectVersion appVersion : apiResultListProjectVersion.getData()) {
appVersionList.add(appVersion);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<f:editableComboBox id="projectName1" field="appName" clazz="setting-input project-name read-only" items="${descriptor.appNameItems}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjButton1" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjButton1" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)" />
</div>
<div style="display:none;" id="refreshSpinner" >
<img src="${imagesURL}/spinner.gif" /> ${progress}
Expand All @@ -102,7 +102,7 @@
<f:editableComboBox id="projectVersion1" field="appVersion" clazz="setting-input project-version read-only" items="${descriptor.appVersionItems(appName)}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjVerButton1" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjVerButton1" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
</div>
<div style="display:none;" id="refreshSpinnerVer" >
<img src="${imagesURL}/spinner.gif" />
Expand Down Expand Up @@ -190,7 +190,7 @@
<f:editableComboBox id="projectName2" field="appName" clazz="setting-input project-name read-only" items="${descriptor.appNameItems}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjButton2" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjButton2" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)" />
</div>
<div style="display:none;" id="refreshSpinner" >
<img src="${imagesURL}/spinner.gif" /> ${progress}
Expand All @@ -202,7 +202,7 @@
<f:editableComboBox id="projectVersion2" field="appVersion" clazz="setting-input project-version read-only" items="${descriptor.appVersionItems(appName)}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjVerButton2" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjVerButton2" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
</div>
<div style="clear:both" />
</f:entry>
Expand Down Expand Up @@ -294,7 +294,7 @@
<f:editableComboBox id="projectName3" field="appName" clazz="setting-input project-name" items="${descriptor.appNameItems}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjButton3" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjButton3" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)" />
</div>
<div style="display:none;" id="refreshSpinner" >
<img src="${imagesURL}/spinner.gif" /> ${progress}
Expand All @@ -306,7 +306,7 @@
<f:editableComboBox id="projectVersion3" field="appVersion" clazz="setting-input project-version" items="${descriptor.appVersionItems(appName)}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjVerButton3" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjVerButton3" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
</div>
<div style="clear:both" />
</f:entry>
Expand Down Expand Up @@ -343,7 +343,7 @@
<f:editableComboBox id="projectName4" field="appName" clazz="setting-input project-name" items="${descriptor.appNameItems}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjButton4" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjButton4" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)" />
</div>
<div style="display:none;" >
<img src="${imagesURL}/spinner.gif" /> ${progress}
Expand All @@ -355,7 +355,7 @@
<f:editableComboBox id="projectVersion4" field="appVersion" clazz="setting-input project-version" items="${descriptor.appVersionItems(appName)}" />
</div>
<div style="float:left;">
<input value="" type="button" id="refreshPrjVerButton4" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjVerButton4" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
</div>
<div style="clear:both" />
</f:entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
clazz="setting-input project-name read-only" items="${descriptor.appNameItems}"/>
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjButton"
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjButton"
onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)"/>
</div>
<div style="display:none;" id="refreshSpinner">
Expand All @@ -88,7 +88,7 @@
items="${descriptor.appVersionItems(appName)}"/>
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjVerButton"
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjVerButton"
onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)"/>
</div>
<div style="clear:both" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
clazz="setting-input project-name read-only" items="${descriptor.appNameItems}"/>
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjButton"
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjButton"
onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshProjects', this)"/>
</div>
<div style="display:none;" id="refreshSpinner">
Expand All @@ -83,7 +83,7 @@
items="${descriptor.appVersionItems(appName)}"/>
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjVerButton"
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjVerButton"
onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)"/>
</div>
<div style="clear:both" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<f:editableComboBox id="projectName" name="appName" field="appName" clazz="setting-input project-name" items="${descriptor.applicationNameItems}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjButton" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshApplications', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjButton" onclick="refreshProjectNames('${rootURL}/descriptor/${descriptor.clazz.name}/refreshApplications', this)" />
</div>
<div style="display:none;" id="refreshSpinner" >
<img src="${imagesURL}/spinner.gif" /> ${progress}
Expand All @@ -35,7 +35,7 @@
<f:editableComboBox id="projectVersion" name="appVersion" field="appVersion" clazz="setting-input project-version" items="${descriptor.applicationVersionItems(appName)}" />
</div>
<div style="float:left">
<input value="" type="button" id="refreshPrjVerButton" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
<input value="&#x1F50E;&#xFE0E;" type="button" id="refreshPrjVerButton" onclick="refreshProjectVersions('${rootURL}/descriptor/${descriptor.clazz.name}/refreshVersions', this)" />
</div>
<div style="clear:both" />
</f:entry>
Expand Down

0 comments on commit 48639dd

Please sign in to comment.