add per-user compilation in client

enabled only when query string includes isolated=true
This commit is contained in:
Brian Gough 2016-05-31 16:20:46 +01:00
parent 9d7f129b61
commit 272625fbcc

View file

@ -5,6 +5,8 @@ define [
], (App, LogParser, BibLogParser) -> ], (App, LogParser, BibLogParser) ->
App.controller "PdfController", ($scope, $http, ide, $modal, synctex, event_tracking, localStorage) -> App.controller "PdfController", ($scope, $http, ide, $modal, synctex, event_tracking, localStorage) ->
# enable per-user containers if querystring includes isolated=true
perUserCompile = window.location?.search?.match(/isolated=true/)? or undefined
autoCompile = true autoCompile = true
# pdf.view = uncompiled | pdf | errors # pdf.view = uncompiled | pdf | errors
@ -28,13 +30,16 @@ define [
sendCompileRequest = (options = {}) -> sendCompileRequest = (options = {}) ->
url = "/project/#{$scope.project_id}/compile" url = "/project/#{$scope.project_id}/compile"
params = {}
if options.isAutoCompile if options.isAutoCompile
url += "?auto_compile=true" params["auto_compile"]=true
if perUserCompile # send ?isolated=true for per-user compiles
params["isolated"] = true
return $http.post url, { return $http.post url, {
rootDoc_id: options.rootDocOverride_id or null rootDoc_id: options.rootDocOverride_id or null
draft: $scope.draft draft: $scope.draft
_csrf: window.csrfToken _csrf: window.csrfToken
} }, {params: params}
parseCompileResponse = (response) -> parseCompileResponse = (response) ->
@ -241,6 +246,7 @@ define [
method: "DELETE" method: "DELETE"
params: params:
clsiserverid:ide.clsiServerId clsiserverid:ide.clsiServerId
isolated: perUserCompile
headers: headers:
"X-Csrf-Token": window.csrfToken "X-Csrf-Token": window.csrfToken
} }
@ -324,6 +330,7 @@ define [
line: row + 1 line: row + 1
column: column column: column
clsiserverid:ide.clsiServerId clsiserverid:ide.clsiServerId
isolated: perUserCompile
} }
}) })
.success (data) -> .success (data) ->
@ -352,6 +359,7 @@ define [
h: position.offset.left.toFixed(2) h: position.offset.left.toFixed(2)
v: position.offset.top.toFixed(2) v: position.offset.top.toFixed(2)
clsiserverid:ide.clsiServerId clsiserverid:ide.clsiServerId
isolated: perUserCompile
} }
}) })
.success (data) -> .success (data) ->