Skip to content
Permalink
Browse files
IGNITE-12019 Remember baseBranchForTC on pr.html refresh (#137)
  • Loading branch information
agoncharuk authored and dspavlov committed Jul 26, 2019
1 parent 589bbd2 commit a16325924ef51bb593b091d0b170621fd67a0e01
Showing 1 changed file with 23 additions and 3 deletions.
@@ -21,14 +21,18 @@
var gVue;

function showQueryForm() {
let baseBranchForTc = findGetParameter("baseBranchForTc");

gVue = new Vue({
el: '#vueQueryForm',
data: {
baseBranchSelected: '',
baseBranchSelected: baseBranchForTc == null ? '' : baseBranchForTc,
tcBranchesForSrv: []
},
methods: {
formChanged: function () {
updateHistory();

loadData();
}
}
@@ -43,8 +47,7 @@
gVue.$data.tcBranchesForSrv.push(id);
}

var baseBranchForTc = findGetParameter("baseBranchForTc");
if (baseBranchForTc != null) {
if (baseBranchForTc != null && !Vue.$data.tcBranchesForSrv.contains(baseBranchForTc)) {
gVue.$data.tcBranchesForSrv.push(baseBranchForTc);
gVue.$data.baseBranchSelected = baseBranchForTc;
}
@@ -66,6 +69,23 @@
$.ajax({url: "rest/branches/version", success: showVersionInfo, error: showErrInLoadStatus});
});

function updateHistory() {
if (URL) {
let url = new URL(location);
let searchParams = new URLSearchParams(url.search);
let baseBranchForTc = gVue.$data.baseBranchSelected;

if (baseBranchForTc != null && baseBranchForTc != '' && baseBranchForTc != '<default>')
searchParams.set("baseBranchForTc", baseBranchForTc);
else
searchParams.delete("baseBranchForTc");

url.search = searchParams.toString();

history.replaceState(null, null, url.toString());
}
}

function parmsForRest() {
var curReqParms = "";
var branchForTc = findGetParameter("branchForTc");

0 comments on commit a163259

Please sign in to comment.