From 2ee0c8c228a09f88e3ba222c289f8bd00b532233 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 20 Feb 2018 14:27:47 -0800 Subject: [PATCH] Use relative urls when retriving flow history --- editor/js/ui/diff.js | 71 +++----------------------------------------- 1 file changed, 4 insertions(+), 67 deletions(-) diff --git a/editor/js/ui/diff.js b/editor/js/ui/diff.js index b64c7ba91..cfcb60ceb 100644 --- a/editor/js/ui/diff.js +++ b/editor/js/ui/diff.js @@ -1721,80 +1721,17 @@ RED.diff = (function() { if (commitOptions.unmerged) { $('').appendTo(content); } - // var tools = $('').appendTo(content); - // $('').appendTo(tools).click(function(e) { - // e.preventDefault(); - // e.stopPropagation(); - // var projectName = commitOptions.project.name; - // var filename = commitOptions.project.files.flow; - // var commonVersionUrl = "/projects/"+projectName+"/files/"+commitOptions.commonRev+"/"+filename; - // var oldVersionUrl = "/projects/"+projectName+"/files/"+commitOptions.oldRev+"/"+filename; - // var newVersionUrl = "/projects/"+projectName+"/files/"+commitOptions.newRev+"/"+filename; - // var promises = []; - // if (commitOptions.commonRev) { - // var commonVersionUrl = "/projects/"+projectName+"/files/"+commitOptions.commonRev+"/"+filename; - // promises.push($.getJSON(commonVersionUrl)); - // } else { - // promises.push($.when(null)); - // } - // promises.push($.getJSON(oldVersionUrl)); - // promises.push($.getJSON(newVersionUrl)); - // $.when.apply($,promises).done(function(commonVersion, oldVersion,newVersion) { - // var commonFlow; - // var oldFlow; - // var newFlow; - // if (commonVersion) { - // try { - // commonFlow = JSON.parse(commonVersion[0].content||"[]"); - // } catch(err) { - // console.log("Common Version doesn't contain valid JSON:",commonVersionUrl); - // console.log(err); - // return; - // } - // } - // try { - // oldFlow = JSON.parse(oldVersion[0].content||"[]"); - // } catch(err) { - // console.log("Old Version doesn't contain valid JSON:",oldVersionUrl); - // console.log(err); - // return; - // } - // if (!commonFlow) { - // commonFlow = oldFlow; - // } - // try { - // newFlow = JSON.parse(newVersion[0].content||"[]"); - // } catch(err) { - // console.log("New Version doesn't contain valid JSON:",newFlow); - // console.log(err); - // return; - // } - // var localDiff = generateDiff(commonFlow,oldFlow); - // var remoteDiff = generateDiff(commonFlow,newFlow); - // var diff = resolveDiffs(localDiff,remoteDiff); - // showDiff(diff,{ - // title: filename, - // mode: commitOptions.commonRev?'merge':'view', - // oldRevTitle: commitOptions.oldRevTitle, - // newRevTitle: commitOptions.newRevTitle - // }); - // // var flowDiffRow = $("").insertAfter(diffRow); - // // var content = $('').appendTo(flowDiffRow); - // // currentDiff = diff; - // // var diffTable = buildDiffPanel(content,diff,{mode:"view"}).finish(); - // }); - // }) var diffRow = $('').appendTo(codeBody); var flowDiffContent = $('').appendTo(diffRow); var projectName = commitOptions.project.name; var filename = commitOptions.project.files.flow; - var commonVersionUrl = "/projects/"+projectName+"/files/"+commitOptions.commonRev+"/"+filename; - var oldVersionUrl = "/projects/"+projectName+"/files/"+commitOptions.oldRev+"/"+filename; - var newVersionUrl = "/projects/"+projectName+"/files/"+commitOptions.newRev+"/"+filename; + var commonVersionUrl = "projects/"+projectName+"/files/"+commitOptions.commonRev+"/"+filename; + var oldVersionUrl = "projects/"+projectName+"/files/"+commitOptions.oldRev+"/"+filename; + var newVersionUrl = "projects/"+projectName+"/files/"+commitOptions.newRev+"/"+filename; var promises = [$.Deferred(),$.Deferred(),$.Deferred()]; if (commitOptions.commonRev) { - var commonVersionUrl = "/projects/"+projectName+"/files/"+commitOptions.commonRev+"/"+filename; + var commonVersionUrl = "projects/"+projectName+"/files/"+commitOptions.commonRev+"/"+filename; $.ajax({dataType: "json",url: commonVersionUrl}).then(function(data) { promises[0].resolve(data); }).fail(function() { promises[0].resolve(null);}) } else { promises[0].resolve(null);