|
@@ -69,20 +69,28 @@ define [
|
|
|
else if response.status == "success"
|
|
else if response.status == "success"
|
|
|
$scope.pdf.view = 'pdf'
|
|
$scope.pdf.view = 'pdf'
|
|
|
$scope.shouldShowLogs = false
|
|
$scope.shouldShowLogs = false
|
|
|
- # define the base url
|
|
|
|
|
- $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?
|
|
|
|
|
- $scope.pdf.compileGroup = response.compileGroup
|
|
|
|
|
- $scope.pdf.url = $scope.pdf.url + "&compileGroup=#{$scope.pdf.compileGroup}"
|
|
|
|
|
# make a cache to look up files by name
|
|
# 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
|
|
|
|
|
|
|
+ # prepare query string
|
|
|
|
|
+ qs = {}
|
|
|
|
|
+ # define the base url. if the pdf file has a build number, pass it to the clsi in the url
|
|
|
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 = "/project/#{$scope.project_id}/build/#{build}/output/output.pdf"
|
|
|
|
|
+ # no need to bust cache, build id is unique
|
|
|
|
|
+ else
|
|
|
|
|
+ $scope.pdf.url = "/project/#{$scope.project_id}/output/output.pdf"
|
|
|
|
|
+ qs = { cache_bust : "#{Date.now()}" }
|
|
|
|
|
+ # add a query string parameter for the compile group
|
|
|
|
|
+ if response.compileGroup?
|
|
|
|
|
+ $scope.pdf.compileGroup = response.compileGroup
|
|
|
|
|
+ qs.compileGroup = "#{$scope.pdf.compileGroup}"
|
|
|
|
|
+ # convert the qs hash into a query string and append it
|
|
|
|
|
+ qs_args = ("#{k}=#{v}" for k, v of qs)
|
|
|
|
|
+ $scope.pdf.qs = if qs_args.length then "?" + qs_args.join("&") else ""
|
|
|
|
|
+ $scope.pdf.url += $scope.pdf.qs
|
|
|
|
|
|
|
|
fetchLogs(fileByPath['output.log'])
|
|
fetchLogs(fileByPath['output.log'])
|
|
|
|
|
|
|
@@ -101,8 +109,11 @@ define [
|
|
|
$scope.pdf.outputFiles.push file
|
|
$scope.pdf.outputFiles.push file
|
|
|
|
|
|
|
|
fetchLogs = (outputFile) ->
|
|
fetchLogs = (outputFile) ->
|
|
|
- qs = if outputFile?.build? then "?build=#{outputFile.build}" else ""
|
|
|
|
|
- $http.get "/project/#{$scope.project_id}/output/output.log" + qs
|
|
|
|
|
|
|
+ if outputFile?.build?
|
|
|
|
|
+ logUrl = "/project/#{$scope.project_id}/build/#{outputFile.build}/output/output.log"
|
|
|
|
|
+ else
|
|
|
|
|
+ logUrl = "/project/#{$scope.project_id}/output/output.log"
|
|
|
|
|
+ $http.get logUrl
|
|
|
.success (log) ->
|
|
.success (log) ->
|
|
|
#console.log ">>", log
|
|
#console.log ">>", log
|
|
|
$scope.pdf.rawLog = log
|
|
$scope.pdf.rawLog = log
|
|
@@ -124,8 +135,12 @@ define [
|
|
|
type: if entry.level == "error" then "error" else "warning"
|
|
type: if entry.level == "error" then "error" else "warning"
|
|
|
text: entry.message
|
|
text: entry.message
|
|
|
}
|
|
}
|
|
|
- # Get the biber log and parse it too
|
|
|
|
|
- $http.get "/project/#{$scope.project_id}/output/output.blg" + qs
|
|
|
|
|
|
|
+ # Get the biber log and parse it
|
|
|
|
|
+ if outputFile?.build?
|
|
|
|
|
+ biberLogUrl = "/project/#{$scope.project_id}/build/#{outputFile.build}/output/output.blg"
|
|
|
|
|
+ else
|
|
|
|
|
+ biberLogUrl = "/project/#{$scope.project_id}/output/output.blg"
|
|
|
|
|
+ $http.get biberLogUrl
|
|
|
.success (log) ->
|
|
.success (log) ->
|
|
|
window._s = $scope
|
|
window._s = $scope
|
|
|
biberLogEntries = BibLogParser.parse(log, {})
|
|
biberLogEntries = BibLogParser.parse(log, {})
|