[jira] [Commented] (IGNITE-9697) [TC Bot] Autocomplete branch for TC field

2018-10-03 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-9697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16637178#comment-16637178
 ] 

ASF GitHub Bot commented on IGNITE-9697:


asfgit closed pull request #24: IGNITE-9697 Autocomplete branch for TC field
URL: https://github.com/apache/ignite-teamcity-bot/pull/24
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/HelperConfig.java 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/HelperConfig.java
index 67be102..c39fd1e 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/HelperConfig.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/HelperConfig.java
@@ -54,6 +54,12 @@
 /** JIRA authorization token property name. */
 public static final String JIRA_AUTH_TOKEN = "jira.auth_token";
 
+/** JIRA authorization token property name. */
+public static final String GIT_API_URL = "git.api_url";
+
+/** JIRA authorization token property name. */
+public static final String JIRA_API_URL = "jira.api_url";
+
 /** Slack authorization token property name. */
 public static final String SLACK_AUTH_TOKEN = "slack.auth_token";
 public static final String SLACK_CHANNEL = "slack.channel";
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
index 3193ea8..8f58657 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
@@ -319,6 +319,25 @@ default SingleBuildRunCtx loadTestsAndProblems(@Nonnull 
Build build, @Deprecated
  */
 boolean sendJiraComment(String ticket, String comment);
 
+/**
+ * @param url URL for git integration.
+ */
+void setGitApiUrl(String url);
+
+/**
+ * @return URL for git integration.
+ */
+String getGitApiUrl();
+
+/**
+ * @param url URL for JIRA integration.
+ */
+void setJiraApiUrl(String url);
+
+/**
+ * @return URL for JIRA integration.
+ */
+String getJiraApiUrl();
 
 default void setAuthData(String user, String password) {
 setAuthToken(
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
index ec53d9b..2e9f873 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
@@ -1168,6 +1168,26 @@ public void setExecutor(ExecutorService executor) {
 return teamcity.sendJiraComment(ticket, comment);
 }
 
+/** {@inheritDoc} */
+@Override public void setGitApiUrl(String url) {
+teamcity.setGitApiUrl(url);
+}
+
+/** {@inheritDoc} */
+@Override public String getGitApiUrl() {
+return teamcity.getGitApiUrl();
+}
+
+/** {@inheritDoc} */
+@Override public void setJiraApiUrl(String url) {
+teamcity.setJiraApiUrl(url);
+}
+
+/** {@inheritDoc} */
+@Override public String getJiraApiUrl() {
+return teamcity.getJiraApiUrl();
+}
+
 /** {@inheritDoc} */
 @Override public PullRequest getPullRequest(String branchForTc) {
 return teamcity.getPullRequest(branchForTc);
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
index 6b63f1b..3d68ccb 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
@@ -104,6 +104,12 @@
 /**  JIRA authorization token. */
 private String jiraBasicAuthTok;
 
+/** URL for git integration. */
+private String gitApiUrl;
+
+/** URL for JIRA integration. */
+private String jiraApiUrl;
+
 private String configName; //main properties file name
 private String tcName;
 
@@ -130,8 +136,10 @@ public void init(@Nullable String tcName) {
 }
 
 setGitToken(HelperConfig.prepareGithubHttpAuthToken(props));
+setGitApiUrl(props.getProperty(HelperConfig.GIT_API_URL));
 
 setJiraToken(HelperConfig.prepareJiraHttpAuthToken(props));
+setJiraApiUrl(props.getProperty(HelperConfig.JIRA_API_URL));
 
 final File logsDirFile = HelperConfig.resolveLogs(workDir, props);
 
@@ -173,8 +181,14 @@ public void init(@Nullable 

[jira] [Commented] (IGNITE-9697) [TC Bot] Autocomplete branch for TC field

2018-10-02 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-9697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16635280#comment-16635280
 ] 

ASF GitHub Bot commented on IGNITE-9697:


SomeFire opened a new pull request #24: IGNITE-9697 Autocomplete branch for TC 
field
URL: https://github.com/apache/ignite-teamcity-bot/pull/24
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [TC Bot] Autocomplete branch for TC field
> -
>
> Key: IGNITE-9697
> URL: https://issues.apache.org/jira/browse/IGNITE-9697
> Project: Ignite
>  Issue Type: Bug
>Reporter: Ryabov Dmitrii
>Assignee: Ryabov Dmitrii
>Priority: Minor
>
> Get last updated PRs from GitHub and use them to autocomplete branch for TC 
> fields.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (IGNITE-9697) [TC Bot] Autocomplete branch for TC field

2018-09-27 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-9697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16630593#comment-16630593
 ] 

ASF GitHub Bot commented on IGNITE-9697:


SomeFire closed pull request #22: IGNITE-9697 [TC Bot] Autocomplete branch for 
TC field
URL: https://github.com/apache/ignite-teamcity-bot/pull/22
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/conf/ChainAtServer.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/conf/ChainAtServer.java
index fc61c75..325327f 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/conf/ChainAtServer.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/conf/ChainAtServer.java
@@ -32,6 +32,12 @@
 /** Suite identifier by teamcity identification for root chain. */
 @Nonnull public String suiteId;
 
+/** URL for git integration. */
+@Nullable public String gitApiUrl;
+
+/** URL for JIRA integration. */
+@Nullable public String jiraApiUrl;
+
 public ChainAtServer() {
 
 }
@@ -39,6 +45,8 @@ public ChainAtServer() {
 public ChainAtServer(ChainAtServer o) {
 this.serverId = o.serverId;
 this.suiteId = o.suiteId;
+this.gitApiUrl = o.gitApiUrl;
+this.jiraApiUrl = o.jiraApiUrl;
 }
 
 /** {@inheritDoc} */
@@ -52,12 +60,14 @@ public ChainAtServer(ChainAtServer o) {
 ChainAtServer srv = (ChainAtServer)o;
 
 return Objects.equals(serverId, srv.serverId) &&
-Objects.equals(suiteId, srv.suiteId);
+Objects.equals(suiteId, srv.suiteId)&&
+Objects.equals(gitApiUrl, srv.gitApiUrl)&&
+Objects.equals(jiraApiUrl, srv.jiraApiUrl);
 }
 
 /** {@inheritDoc} */
 @Override public int hashCode() {
-return Objects.hash(serverId, suiteId);
+return Objects.hash(serverId, suiteId, gitApiUrl, jiraApiUrl);
 }
 
 /**
diff --git a/ignite-tc-helper-web/src/main/webapp/index.html 
b/ignite-tc-helper-web/src/main/webapp/index.html
index 1dc6eba..73cfb07 100644
--- a/ignite-tc-helper-web/src/main/webapp/index.html
+++ b/ignite-tc-helper-web/src/main/webapp/index.html
@@ -78,23 +78,29 @@
 
 function showSuitesForPrCheckData(result) {
 var res = "";
+
 for (var i = 0; i < result.length; i++) {
 var chainAtServer = result[i];
 //res+="Check
 PR";
 
+gitUrls.set(chainAtServer.serverId, chainAtServer.gitApiUrl);
+
 res += "";
 res += "Server: ";
 res += "Chain: ";
 res += "Base branch:  ";
-res += "Branch:  ";
+res += "Branch:  ";
 res += "";
 // res+="";
 res += "";
 res += "";
 }
+
 $("#suitesForPrCheck").html(res);
-}
 
+sendRequestsToFillAutocompleteLists();
+}
 
 function showBuildsOnServers(result) {
 var res = "";
diff --git a/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js 
b/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
index 6ef59d0..7487c2f 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
@@ -202,3 +202,95 @@ function tcHelperLogout() {
 } catch (e) {
 }
 }
+
+/**
+ * Change autocomplete filter to show results only when they starts from 
written text.
+ */
+$.ui.autocomplete.filter = function (array, term) {
+var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(term), "i");
+
+return $.grep(array, function (value) {
+return matcher.test(value.label || value.value || value);
+});
+};
+
+var callbackRegistry = {};
+
+/**
+ * Send request to another site.
+ *
+ * @param url URL.
+ * @param onSuccess Function for success response.
+ * @param onError Function for fail response.
+ */
+function scriptRequest(url, onSuccess, onError) {
+var scriptOk = false;
+
+var callbackName = 'cb' + String(Math.random()).slice(-6);
+
+url += ~url.indexOf('?') ? '&' : '?';
+url += 'callback=callbackRegistry.' + callbackName;
+
+callbackRegistry[callbackName] = function(data) {
+scriptOk = true;
+
+delete callbackRegistry[callbackName];
+
+onSuccess(data);
+};
+
+function checkCallback() {
+if (scriptOk)
+return;
+
+delete callbackRegistry[callbackName];
+
+onError(url);
+}
+
+var script = document.createElement('script');
+
+script.onload = script.onerror = checkCallback;
+script.src = url;
+
+document.body.appendChild(script);
+}
+
+/**
+ * Key - server id.
+ * Value - url to git api.
+ *
+ * @type {Map}
+ */
+var gitUrls = new Map();
+
+/**
+ * Send requests

[jira] [Commented] (IGNITE-9697) [TC Bot] Autocomplete branch for TC field

2018-09-27 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-9697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16630346#comment-16630346
 ] 

ASF GitHub Bot commented on IGNITE-9697:


SomeFire opened a new pull request #22: IGNITE-9697 [TC Bot] Autocomplete 
branch for TC field
URL: https://github.com/apache/ignite-teamcity-bot/pull/22
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [TC Bot] Autocomplete branch for TC field
> -
>
> Key: IGNITE-9697
> URL: https://issues.apache.org/jira/browse/IGNITE-9697
> Project: Ignite
>  Issue Type: Bug
>Reporter: Ryabov Dmitrii
>Assignee: Ryabov Dmitrii
>Priority: Minor
>
> Get last updated PRs from GitHub and use them to autocomplete branch for TC 
> fields.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)