Skip to content

Commit bf22a34

Browse files
authored
Merge pull request #225 from mreishman/4.1.2
4.1.2
2 parents 8f8fb33 + 5edfc95 commit bf22a34

File tree

8 files changed

+115
-16
lines changed

8 files changed

+115
-16
lines changed

core/html/changelog.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
<ul>
2+
<li>
3+
Version 4.1.2
4+
<ul>
5+
<li>
6+
Features
7+
<ul>
8+
<li>
9+
Added option for auto get repo name from poll requests (Only works with poll type 2)
10+
</li>
11+
<li>
12+
Added option for auto get repo type from poll requests (Only works with poll type 2)
13+
</li>
14+
<li>
15+
Added issue links / branch link into seperate dropdown
16+
</li>
17+
</ul>
18+
</li>
19+
<li>
20+
Bug Fixes
21+
<ul>
22+
<li>
23+
Fixed bug with url not linking properly when loading from cache
24+
</li>
25+
</ul>
26+
</li>
27+
</ul>
28+
</li>
229
<li>
330
Version 4.1.1
431
<ul>

core/js/main.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ function pollFailureInner(xhr, error, noSpaceName, nameForBackground)
592592
groupInfo: "",
593593
location: null,
594594
WebsiteBase: null,
595+
website: null,
595596
urlHit: ""
596597
};
597598
}
@@ -614,6 +615,10 @@ function pollFailureInner(xhr, error, noSpaceName, nameForBackground)
614615
{
615616
arrayOfWatchFilters[noSpaceName]["WebsiteBase"] = null;
616617
}
618+
if(!("Website" in arrayOfWatchFilters[noSpaceName]))
619+
{
620+
arrayOfWatchFilters[noSpaceName]["website"] = null;
621+
}
617622
if(!("urlHit" in arrayOfWatchFilters[noSpaceName]))
618623
{
619624
arrayOfWatchFilters[noSpaceName]["urlHit"] = "";
@@ -861,6 +866,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
861866
addGroup(dataInner["groupInfo"]);
862867
if(dataInner['branch'] && dataInner['branch'] != 'Location var is too long.')
863868
{
869+
var linkList = "";
864870
switchToColorLed(noSpaceName, "green");
865871
document.getElementById(noSpaceName+'errorMessageLink').style.display = "none";
866872
document.getElementById(noSpaceName+'noticeMessageLink').style.display = "none";
@@ -902,6 +908,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
902908
if(repoDataPresent)
903909
{
904910
dataBranchForFile += '<a style="color: black;" target="_blank" href="https://'+baseRepoUrl+'/'+repoName+'/tree/'+dataInner['branch']+'">';
911+
linkList += '<a style="color: black;" target="_blank" href="https://'+baseRepoUrl+'/'+repoName+'/tree/'+dataInner['branch']+'">Branch</a>';
905912
}
906913
dataBranchForFile += dataInner['branch'];
907914
if(repoDataPresent)
@@ -945,6 +952,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
945952
{
946953
link = '<a target="_blank" style="color: black;" href="https://'+baseRepoUrl+'/'+repoName+'/issues/'+num+'">'+dataBranchForFileStats[i]+num+'</a>';
947954
dataBranchForFile += " "+link;
955+
linkList += " "+link;
948956
linksFromCommitMessage.push(num.toString());
949957
dataBranchForFileStats = dataBranchForFileStats.replace(dataBranchForFileStats[i]+num,link);
950958
len = dataBranchForFileStats.length;
@@ -974,6 +982,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
974982
{
975983
link = '<a target="_blank" style="color: black;" href="https://'+baseRepoUrl+'/'+repoName+'/issues/'+numForStart+'">#'+numForStart+'</a>';
976984
dataBranchForFile += " "+link;
985+
linkList += " "+link;
977986
}
978987
}
979988

@@ -995,6 +1004,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
9951004
{
9961005
link = '<a target="_blank" style="color: black;" href="https://'+baseRepoUrl+'/'+repoName+'/issues/'+numForEnd+'">#'+numForEnd+'</a>';
9971006
dataBranchForFile += " "+link;
1007+
linkList += " "+link;
9981008
}
9991009
}
10001010

@@ -1020,6 +1030,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
10201030
{
10211031
link = '<a target="_blank" style="color: black;" href="https://'+baseRepoUrl+'/'+repoName+'/issues/'+numForLinkIssue+'">#'+numForLinkIssue+'</a>';
10221032
dataBranchForFile += " "+link;
1033+
linkList += " "+link;
10231034
}
10241035
branchNameTMP = branchNameTMP.substring(numForcalc);
10251036
}
@@ -1067,6 +1078,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
10671078
groupInfo: groupNames,
10681079
location: "location" in dataInner ? dataInner["location"] : null,
10691080
WebsiteBase: "WebsiteBase" in dataInner ? dataInner["WebsiteBase"] : null,
1081+
website: "website" in dataInner ? dataInner["website"] : null,
10701082
branchList: branchList,
10711083
urlHit: urlHit
10721084
};
@@ -1089,14 +1101,15 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
10891101
arrayOfWatchFilters[noSpaceName]["groupInfo"] = groupNames;
10901102
arrayOfWatchFilters[noSpaceName]["location"] = "location" in dataInner ? dataInner["location"] : null;
10911103
arrayOfWatchFilters[noSpaceName]["WebsiteBase"] = "WebsiteBase" in dataInner ? dataInner["WebsiteBase"] : null;
1104+
arrayOfWatchFilters[noSpaceName]["website"] = "website" in dataInner ? dataInner["website"] : null;
10921105
arrayOfWatchFilters[noSpaceName]["branchList"] = branchList;
10931106
arrayOfWatchFilters[noSpaceName]["urlHit"] = urlHit;
10941107
}
10951108

10961109
filterBGColor(dataToFilterBy, nameForBackground, 1);
10971110
arrayOfWatchFilters[noSpaceName]["backgroundColor"] = document.getElementById(nameForBackground).style.backgroundColor;
10981111
//custom message stuff
1099-
(Object.values(dataInner).indexOf('messageTextEnabled') > -1)
1112+
if(Object.values(dataInner).indexOf('messageTextEnabled') > -1)
11001113
{
11011114

11021115
var dateForEnd = dataInner['datePicker'];
@@ -1172,6 +1185,12 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
11721185
}
11731186
}
11741187

1188+
1189+
if(linkList !== "" && linkList !== document.getElementById(noSpaceName+"extraLinks").innerHTML)
1190+
{
1191+
document.getElementById(noSpaceName+"extraLinks").innerHTML = linkList;
1192+
}
1193+
11751194
if(setFadeBool)
11761195
{
11771196
setFade(noSpaceName);
@@ -1207,6 +1226,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
12071226
groupInfo: "",
12081227
location: null,
12091228
WebsiteBase: null,
1229+
website: null,
12101230
branchList: false
12111231
};
12121232
}
@@ -1230,6 +1250,10 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
12301250
{
12311251
arrayOfWatchFilters[noSpaceName]["WebsiteBase"] = null;
12321252
}
1253+
if(!("website" in arrayOfWatchFilters[noSpaceName]))
1254+
{
1255+
arrayOfWatchFilters[noSpaceName]["website"] = null;
1256+
}
12331257
}
12341258
}
12351259
displayDataFromPoll(noSpaceName,dataBranchForFile,dataBranchForFileUpdateTime,dataBranchForFileStats);

core/php/configStatic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?php
33

44
$configStatic = array(
5-
'version' => '4.1.1',
5+
'version' => '4.1.2',
66
'lastCheck' => '12-14-2018',
77
'newestVersion' => '3.3.4',
88
'versionList' => array(

core/php/functions/gitBranchName.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,31 @@ function getBranchStats($location)
186186
return substr($branchStats, 0, strpos($branchStats, "}"));
187187
}
188188

189+
function getRepo($location)
190+
{
191+
$function = "git --git-dir=".escapeshellarg($location).".git config --get remote.origin.url";
192+
$repoName = trim(shell_exec($function));
193+
$secondHalf = basename($repoName, ".git");
194+
$repoName = implode("", explode($secondHalf.".git", $repoName));
195+
$firstHalf = basename($repoName);
196+
return $firstHalf."/".$secondHalf;
197+
}
198+
199+
function getGitType($location)
200+
{
201+
$function = "git --git-dir=".escapeshellarg($location).".git config --get remote.origin.url";
202+
$gitType = trim(shell_exec($function));
203+
if(strpos($gitType, "github.com"))
204+
{
205+
return "github";
206+
}
207+
elseif(strpos($gitType, "gitlab"))
208+
{
209+
return "gitlab";
210+
}
211+
return false;
212+
}
213+
189214
$pollType = null;
190215
if(isset($_POST['pollType']))
191216
{
@@ -280,6 +305,14 @@ function getBranchStats($location)
280305
{
281306
$websiteBase = str_replace("gitBranchName.php", "", $value["urlHit"]);
282307
}
308+
if($value["githubRepo"] === "auto")
309+
{
310+
$value["githubRepo"] = getRepo($value["Folder"]);
311+
}
312+
if($value["gitType"] === "auto")
313+
{
314+
$value["gitType"] = getGitType($value["Folder"]);
315+
}
283316
$response["info"][$key] = array(
284317
'isHere' => true,
285318
'branch' => getBranchName($value['Folder']),

core/php/functions/indexFunctions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ function generateWindow($data = array(), $pollType)
179179
$blockHTML .= " <div id=\"".$keyNoSpace."SearchOuter\" style=\"display: none; cursor: pointer; width: 100%;\" >";
180180
$blockHTML .= " <a id=\"".$keyNoSpace."SearchInner\" style=\"color: black;\" target=\"_blank\" href=\"#\">Search</a>";
181181
$blockHTML .= " </div>";
182+
$blockHTML .= " <p style=\"border-bottom: 1px solid black;\" ></p>";
183+
$blockHTML .= " <a style=\"color: black;\" target=\"_blank\" href=\"https://".$website."\">Website</a>";
184+
$blockHTML .= " <div id=\"".$keyNoSpace."extraLinks\"></div> ";
182185
$blockHTML .= " <a id=\"".$keyNoSpace."errorMessageLink\" style=\"cursor: pointer; display: none;\">Error</a> ";
183186
$blockHTML .= " <a id=\"".$keyNoSpace."noticeMessageLink\" style=\"cursor: pointer; display: none;\">Notice</a> ";
184187
$blockHTML .= " </div>";

core/php/functions/watchlistFunctions.php

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,24 @@ function generateWatchlistBlock($defaultArray, $arrayKeys, $key = "{{key}}", $it
103103
if(!empty($item))
104104
{
105105
$stringToReturn .= "
106-
<option value=\"github\" ";
107-
if($varValue === "github")
108-
{
109-
$stringToReturn .= " selected ";
110-
}
111-
$stringToReturn .= " >GitHub</option>
112-
<option value=\"gitlab\" ";
113-
if($varValue === "gitlab")
114-
{
115-
$stringToReturn .= "selected";
116-
}
117-
$stringToReturn .= ">GitLab</option>";
106+
<option value=\"auto\" ";
107+
if($varValue === "auto")
108+
{
109+
$stringToReturn .= " selected ";
110+
}
111+
$stringToReturn .= " >Auto (v2 Only)</option>
112+
<option value=\"github\" ";
113+
if($varValue === "github")
114+
{
115+
$stringToReturn .= " selected ";
116+
}
117+
$stringToReturn .= " >GitHub</option>
118+
<option value=\"gitlab\" ";
119+
if($varValue === "gitlab")
120+
{
121+
$stringToReturn .= "selected";
122+
}
123+
$stringToReturn .= ">GitLab</option>";
118124
}
119125
else
120126
{

core/php/templateFiles/watchListServer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@
3030
</div>
3131
<span class="leftSpacingserverNames" > Git Repo:</span> <input disabled="true" class='inputWidth300' type='text' value='Name of your github repo: username/repo'>
3232
<br>
33+
<span>Put "auto" to automatically get the repo config on poll</span>
34+
<br>
3335
<span class="leftSpacingserverNames" > Branch List:</span> <input disabled="true" class='inputWidth300' type='text' value='Compare branches list example: master , develop'>
3436
<br>
3537
<span class="leftSpacingserverNames" > Git Type:</span>
3638
<select disabled="true" class='inputWidth300' >
37-
<option value="local" >github</option>
38-
<option value="external" >gitlab</option>
39+
<option value="github" >github</option>
40+
<option value="gitlab" >gitlab</option>
3941
</select>
4042
<br>
4143
<span class="leftSpacingserverNames" > Custom Git:</span> <input disabled="true" class='inputWidth300' type='text' value='Custom url for git. Empty = default'>

index.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@
221221
{
222222
$website = $value["Website"];
223223
}
224+
if(isset($value['website']))
225+
{
226+
$website = $value["website"];
227+
}
224228

225229
if($showTopBarOfGroups && $defaultGroupViewOnLoad !== "All" && strpos($groupInfo, $defaultGroupViewOnLoad) > -1)
226230
{

0 commit comments

Comments
 (0)