diff --git a/services/web/app/coffee/Features/Compile/ClsiManager.coffee b/services/web/app/coffee/Features/Compile/ClsiManager.coffee index df7b5749cf..3285026cfa 100755 --- a/services/web/app/coffee/Features/Compile/ClsiManager.coffee +++ b/services/web/app/coffee/Features/Compile/ClsiManager.coffee @@ -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 diff --git a/services/web/app/coffee/Features/Compile/CompileController.coffee b/services/web/app/coffee/Features/Compile/CompileController.coffee index 6ffca6affe..66f98c5974 100755 --- a/services/web/app/coffee/Features/Compile/CompileController.coffee +++ b/services/web/app/coffee/Features/Compile/CompileController.coffee @@ -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) ->)-> diff --git a/services/web/app/coffee/Features/Compile/CompileManager.coffee b/services/web/app/coffee/Features/Compile/CompileManager.coffee index 8249352e5d..0d8d480b7b 100755 --- a/services/web/app/coffee/Features/Compile/CompileManager.coffee +++ b/services/web/app/coffee/Features/Compile/CompileManager.coffee @@ -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) -> diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index f633060aaf..186391893f 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -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()") diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 5847b58e3e..82be226d42 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -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) -> diff --git a/services/web/public/coffee/ide/wordcount/controllers/WordCountModalController.coffee b/services/web/public/coffee/ide/wordcount/controllers/WordCountModalController.coffee index 3c69d3e276..e880a25eef 100644 --- a/services/web/public/coffee/ide/wordcount/controllers/WordCountModalController.coffee +++ b/services/web/public/coffee/ide/wordcount/controllers/WordCountModalController.coffee @@ -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