load output files from cached build when known

This commit is contained in:
Brian Gough 2015-02-26 16:47:47 +00:00
parent a64b8724bd
commit caed778117

View file

@ -41,18 +41,22 @@ define [
$scope.pdf.failure = true $scope.pdf.failure = true
fetchLogs() fetchLogs()
else if response.status == "success" else if response.status == "success"
# define the base url
$scope.pdf.url = "/project/#{$scope.project_id}/output/output.pdf?cache_bust=#{Date.now()}" $scope.pdf.url = "/project/#{$scope.project_id}/output/output.pdf?cache_bust=#{Date.now()}"
# add a query string parameter for the compile group
if response.compileGroup? if response.compileGroup?
$scope.pdf.compileGroup = response.compileGroup $scope.pdf.compileGroup = response.compileGroup
$scope.pdf.url = $scope.pdf.url + "&compileGroup=#{$scope.pdf.compileGroup}" $scope.pdf.url = $scope.pdf.url + "&compileGroup=#{$scope.pdf.compileGroup}"
# make a cache to look up files by name
fileByPath = {} fileByPath = {}
for file in response.outputFiles for file in response.outputFiles
fileByPath[file.path] = file fileByPath[file.path] = file
# if the pdf file has a build number, pass it to the clsi
if fileByPath['output.pdf']?.build? if fileByPath['output.pdf']?.build?
build = fileByPath['output.pdf'].build build = fileByPath['output.pdf'].build
$scope.pdf.url = $scope.pdf.url + "&build=#{build}" $scope.pdf.url = $scope.pdf.url + "&build=#{build}"
fetchLogs() fetchLogs(fileByPath['output.log'])
IGNORE_FILES = ["output.fls", "output.fdb_latexmk"] IGNORE_FILES = ["output.fls", "output.fdb_latexmk"]
$scope.pdf.outputFiles = [] $scope.pdf.outputFiles = []
@ -65,8 +69,9 @@ define [
file.name = file.path file.name = file.path
$scope.pdf.outputFiles.push file $scope.pdf.outputFiles.push file
fetchLogs = () -> fetchLogs = (outputFile) ->
$http.get "/project/#{$scope.project_id}/output/output.log" qs = if outputFile?.build? then "?build=#{outputFile.build}" else ""
$http.get "/project/#{$scope.project_id}/output/output.log" + qs
.success (log) -> .success (log) ->
$scope.pdf.rawLog = log $scope.pdf.rawLog = log
logEntries = LogParser.parse(log, ignoreDuplicates: true) logEntries = LogParser.parse(log, ignoreDuplicates: true)
@ -156,7 +161,8 @@ define [
$scope.pdf.showRawLog = !$scope.pdf.showRawLog $scope.pdf.showRawLog = !$scope.pdf.showRawLog
$scope.openOutputFile = (file) -> $scope.openOutputFile = (file) ->
window.open("/project/#{$scope.project_id}/output/#{file.path}") qs = if file.build? then "?build=#{file.build}" else ""
window.open("/project/#{$scope.project_id}/output/#{file.path}#{qs}")
$scope.openClearCacheModal = () -> $scope.openClearCacheModal = () ->
modalInstance = $modal.open( modalInstance = $modal.open(