mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
pass clsiServerId to the client and use it as query stirng for requests
This commit is contained in:
parent
b0baea5073
commit
dba8d96d11
6 changed files with 33 additions and 13 deletions
|
@ -25,8 +25,7 @@ module.exports = ClsiManager =
|
|||
logger.err err:err, project_id:project_id, "error getting server id"
|
||||
return callback(err)
|
||||
outputFiles = ClsiManager._parseOutputFiles(project_id, response?.compile?.outputFiles, clsiServerId)
|
||||
console.log outputFiles
|
||||
callback(null, response?.compile?.status, outputFiles)
|
||||
callback(null, response?.compile?.status, outputFiles, clsiServerId)
|
||||
|
||||
deleteAuxFiles: (project_id, options, callback = (error) ->) ->
|
||||
compilerUrl = @_getCompilerUrl(options?.compileGroup)
|
||||
|
@ -83,8 +82,6 @@ module.exports = ClsiManager =
|
|||
console.log path
|
||||
path = url.parse(file.url).path
|
||||
path = path.replace("/project/#{project_id}/output/", "")
|
||||
if clsiServer?
|
||||
path = "#{path}?clsiserver=#{clsiServer}"
|
||||
outputFiles.push
|
||||
path: path
|
||||
type: file.type
|
||||
|
|
|
@ -30,13 +30,14 @@ module.exports = CompileController =
|
|||
if req.body?.draft
|
||||
options.draft = req.body.draft
|
||||
logger.log {options, project_id}, "got compile request"
|
||||
CompileManager.compile project_id, user_id, options, (error, status, outputFiles, output, limits) ->
|
||||
CompileManager.compile project_id, user_id, options, (error, status, outputFiles, clsiServerId, limits) ->
|
||||
return next(error) if error?
|
||||
res.contentType("application/json")
|
||||
res.status(200).send JSON.stringify {
|
||||
status: status
|
||||
outputFiles: outputFiles
|
||||
compileGroup: limits?.compileGroup
|
||||
clsiServerId:clsiServerId
|
||||
}
|
||||
|
||||
downloadPdf: (req, res, next = (error) ->)->
|
||||
|
|
|
@ -37,10 +37,10 @@ module.exports = CompileManager =
|
|||
return callback(error) if error?
|
||||
for key, value of limits
|
||||
options[key] = value
|
||||
ClsiManager.sendRequest project_id, options, (error, status, outputFiles, output) ->
|
||||
ClsiManager.sendRequest project_id, options, (error, status, outputFiles, clsiServerId) ->
|
||||
return callback(error) if error?
|
||||
logger.log files: outputFiles, "output files"
|
||||
callback(null, status, outputFiles, output, limits)
|
||||
callback(null, status, outputFiles, clsiServerId, limits)
|
||||
|
||||
deleteAuxFiles: (project_id, callback = (error) ->) ->
|
||||
CompileManager.getProjectCompileLimits project_id, (error, limits) ->
|
||||
|
|
|
@ -121,7 +121,7 @@ div.full-size.pdf(ng-controller="PdfController")
|
|||
ul.dropdown-menu.dropdown-menu-right
|
||||
li(ng-repeat="file in pdf.outputFiles")
|
||||
a(
|
||||
href="/project/{{project_id}}/output/{{file.path}}"
|
||||
href="{{file.url}}"
|
||||
target="_blank"
|
||||
) {{ file.name }}
|
||||
a.btn.btn-info.btn-sm(href, ng-click="toggleRawLog()")
|
||||
|
|
|
@ -37,6 +37,9 @@ define [
|
|||
}
|
||||
|
||||
parseCompileResponse = (response) ->
|
||||
if response.clsiServerId? and response.clsiServerId != $scope.pdf.clsiServerId
|
||||
ide.clsiServerId = response.clsiServerId
|
||||
|
||||
# Reset everything
|
||||
$scope.pdf.error = false
|
||||
$scope.pdf.timedout = false
|
||||
|
@ -76,6 +79,8 @@ define [
|
|||
if response.compileGroup?
|
||||
$scope.pdf.compileGroup = response.compileGroup
|
||||
$scope.pdf.url = $scope.pdf.url + "&compileGroup=#{$scope.pdf.compileGroup}"
|
||||
if response.clsiServerId?
|
||||
$scope.pdf.url = $scope.pdf.url + "&clsiserverid=#{response.clsiServerId}"
|
||||
# make a cache to look up files by name
|
||||
fileByPath = {}
|
||||
for file in response.outputFiles
|
||||
|
@ -99,11 +104,19 @@ define [
|
|||
file.name = "#{file.path.replace(/^output\./, "")} file"
|
||||
else
|
||||
file.name = file.path
|
||||
file.url = "/project/#{project_id}/output/#{file.path}"
|
||||
if response.clsiServerId?
|
||||
file.url = file.url + "?clsiserverid=#{response.clsiServerId}"
|
||||
$scope.pdf.outputFiles.push file
|
||||
|
||||
fetchLogs = (outputFile) ->
|
||||
qs = if outputFile?.build? then "?build=#{outputFile.build}" else ""
|
||||
$http.get "/project/#{$scope.project_id}/output/output.log" + qs
|
||||
opts =
|
||||
method:"GET"
|
||||
url:"/project/#{$scope.project_id}/output/output.log"
|
||||
params:
|
||||
build:outputFile.build
|
||||
clsiserverid:ide.clsiServerId
|
||||
$http opts
|
||||
.success (log) ->
|
||||
#console.log ">>", log
|
||||
$scope.pdf.rawLog = log
|
||||
|
@ -126,7 +139,8 @@ define [
|
|||
text: entry.message
|
||||
}
|
||||
# Get the biber log and parse it too
|
||||
$http.get "/project/#{$scope.project_id}/output/output.blg" + qs
|
||||
opts.url = "/project/#{$scope.project_id}/output/output.blg"
|
||||
$http opts
|
||||
.success (log) ->
|
||||
window._s = $scope
|
||||
biberLogEntries = BibLogParser.parse(log, {})
|
||||
|
@ -189,6 +203,8 @@ define [
|
|||
$http {
|
||||
url: "/project/#{$scope.project_id}/output"
|
||||
method: "DELETE"
|
||||
params:
|
||||
clsiserverid:ide.clsiServerId
|
||||
headers:
|
||||
"X-Csrf-Token": window.csrfToken
|
||||
}
|
||||
|
@ -271,6 +287,7 @@ define [
|
|||
file: path
|
||||
line: row + 1
|
||||
column: column
|
||||
clsiserverid:ide.clsiServerId
|
||||
}
|
||||
})
|
||||
.success (data) ->
|
||||
|
@ -298,6 +315,7 @@ define [
|
|||
page: position.page + 1
|
||||
h: position.offset.left.toFixed(2)
|
||||
v: position.offset.top.toFixed(2)
|
||||
clsiserverid:ide.clsiServerId
|
||||
}
|
||||
})
|
||||
.success (data) ->
|
||||
|
|
|
@ -5,11 +5,15 @@ define [
|
|||
$scope.status =
|
||||
loading:true
|
||||
|
||||
$http.get("/project/#{ide.project_id}/wordcount")
|
||||
opts =
|
||||
url:"/project/#{ide.project_id}/wordcount"
|
||||
method:"GET"
|
||||
params:
|
||||
clsiserverid:ide.clsiServerId
|
||||
$http opts
|
||||
.success (data) ->
|
||||
$scope.status.loading = false
|
||||
$scope.data = data.texcount
|
||||
console.log $scope.data
|
||||
.error () ->
|
||||
$scope.status.error = true
|
||||
|
||||
|
|
Loading…
Reference in a new issue