You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2018/10/05 20:26:42 UTC
[ignite-teamcity-bot] branch ignite-9800 updated: IGNITE-9800: UI
improved
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch ignite-9800
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/ignite-9800 by this push:
new 598f713 IGNITE-9800: UI improved
598f713 is described below
commit 598f713bb0be438a2c7435c4cc743a6a611ebe98
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Fri Oct 5 23:26:42 2018 +0300
IGNITE-9800: UI improved
---
.../ignite/ci/github/GitHubConnectionImpl.java | 39 +++++++++++++++++++++-
.../org/apache/ignite/ci/github/PullRequest.java | 2 ++
ignite-tc-helper-web/src/main/webapp/prs.html | 29 ++++++++++------
3 files changed, 58 insertions(+), 12 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubConnectionImpl.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubConnectionImpl.java
index 9de9c0f..8339ee2 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubConnectionImpl.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubConnectionImpl.java
@@ -17,20 +17,38 @@
package org.apache.ignite.ci.github;
import com.google.common.base.Preconditions;
+import com.google.common.base.Throwables;
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.function.BiFunction;
+import javax.annotation.Nullable;
+import javax.ws.rs.BadRequestException;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.ci.HelperConfig;
+import org.apache.ignite.ci.analysis.Expirable;
+import org.apache.ignite.ci.analysis.SuiteInBranch;
import org.apache.ignite.ci.di.AutoProfiling;
+import org.apache.ignite.ci.tcmodel.hist.BuildRef;
+import org.apache.ignite.ci.util.ExceptionUtil;
import org.apache.ignite.ci.util.HttpUtil;
+import org.apache.ignite.ci.util.ObjectInterner;
+import org.apache.ignite.internal.util.typedef.T2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -115,7 +133,7 @@ class GitHubConnectionImpl implements IGitHubConnection {
/** {@inheritDoc} */
@AutoProfiling
- @Override public List<PullRequest> getPullRequests() {
+ public List<PullRequest> getGithubPullRequests() {
Preconditions.checkState( !isNullOrEmpty(gitApiUrl) , "Git API URL is not configured for this server.");
String s = gitApiUrl + "pulls?sort=updated&direction=desc";
@@ -133,4 +151,23 @@ class GitHubConnectionImpl implements IGitHubConnection {
throw new UncheckedIOException(e);
}
}
+ /** Data loaded. */
+ private final Cache<String, List<PullRequest>> prListCache
+ = CacheBuilder.newBuilder()
+ .maximumSize(100)
+ .expireAfterWrite(5, TimeUnit.MINUTES)
+ .softValues()
+ .build();
+
+
+ /** {@inheritDoc} */
+ @AutoProfiling
+ @Override public List<PullRequest> getPullRequests() {
+ try {
+ return prListCache.get("", this::getGithubPullRequests);
+ }
+ catch (ExecutionException e) {
+ throw ExceptionUtil.propagateException(e);
+ }
+ }
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
index 50d1e7e..b49aee9 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
@@ -35,6 +35,8 @@ public class PullRequest {
@SerializedName("html_url") private String htmlUrl;
+ @SerializedName("updated_at") private String updatedAt;
+
/** Pull Request statuses URL. */
@SerializedName("statuses_url") private String statusesUrl;
diff --git a/ignite-tc-helper-web/src/main/webapp/prs.html b/ignite-tc-helper-web/src/main/webapp/prs.html
index 2bce451..904d6db 100644
--- a/ignite-tc-helper-web/src/main/webapp/prs.html
+++ b/ignite-tc-helper-web/src/main/webapp/prs.html
@@ -22,16 +22,26 @@
</style>
<script>
+ function updateAccordionSize() {
+ let height = $(window).height();
+ let number = (height - 120);
+ if (number > 100)
+ $("#mainaccordion").css('height', number + 'px');
+ // update accordion height
+ //$("#mainaccordion").accordion("resize");
+ }
+
$(document).ready(function() {
$.getScript("js/common-1.6.js", function(data, textStatus, jqxhr){ });
$( document ).tooltip();
- $( "#accordion" ).accordion({
- heightStyle: "fill"
+ updateAccordionSize();
+ $( "#mainaccordion" ).accordion({
+ heightStyle: "fill",
+ //heightStyle: "content"
});
- $(window).resize(function(){
- // update accordion height
- $( ".accordion" ).accordion( "resize" )
+ $(window).resize(function () {
+ updateAccordionSize();
});
loadData();
@@ -92,7 +102,7 @@
tableForSrv.DataTable({
data: result,
- //"iDisplayLength": 100,
+ "iDisplayLength": 100, //rows to be shown by default
//"dom": '<lf<t>ip>',
//"dom": '<"wrapper"flipt>',
columns: [
@@ -268,7 +278,7 @@
<div id="loadStatus"></div>
-<div id="accordion" style="height: 500px">
+<div id="mainaccordion" style="height: 500px">
<h3>Select PR</h3>
<div id="contributionsToCheck">
<table id="serverContributions-apache" class="ui-widget ui-widget-content">
@@ -278,16 +288,13 @@
<th>Loading</th>
<th>...</th>
<th>.</th>
- <!--
- <th>Login</th>
- <th>Password</th>-->
</tr>
</thead>
</table>
</div>
- <h3>I can enter branch data</h3>
+ <h3>I'll enter branch data</h3>
<div>
<div class="formgroup">
Trigger new TeamCity Run All for a PR/Branch: <br>