|
|
@@ -36,11 +36,11 @@ define [
|
|
|
$scope.logHintsNegFeedbackValues = logHintsFeedback.feedbackOpts
|
|
|
|
|
|
$scope.trackLogHintsLearnMore = () ->
|
|
|
- event_tracking.sendCountly "logs-hints-learn-more"
|
|
|
+ event_tracking.sendMB "logs-hints-learn-more"
|
|
|
|
|
|
trackLogHintsFeedback = (isPositive, hintId) ->
|
|
|
event_tracking.send "log-hints", (if isPositive then "feedback-positive" else "feedback-negative"), hintId
|
|
|
- event_tracking.sendCountly (if isPositive then "log-hints-feedback-positive" else "log-hints-feedback-negative"), { hintId }
|
|
|
+ event_tracking.sendMB (if isPositive then "log-hints-feedback-positive" else "log-hints-feedback-negative"), { hintId }
|
|
|
|
|
|
$scope.trackLogHintsNegFeedbackDetails = (hintId, feedbackOpt, feedbackOtherVal) ->
|
|
|
logHintsFeedback.submitFeedback hintId, feedbackOpt, feedbackOtherVal
|
|
|
@@ -86,11 +86,15 @@ define [
|
|
|
return $http.post url, {
|
|
|
rootDoc_id: options.rootDocOverride_id or null
|
|
|
draft: $scope.draft
|
|
|
+ check: if options.check then "validate" else null
|
|
|
_csrf: window.csrfToken
|
|
|
}, {params: params}
|
|
|
|
|
|
parseCompileResponse = (response) ->
|
|
|
|
|
|
+ # keep last url
|
|
|
+ last_pdf_url = $scope.pdf.url
|
|
|
+
|
|
|
# Reset everything
|
|
|
$scope.pdf.error = false
|
|
|
$scope.pdf.timedout = false
|
|
|
@@ -120,11 +124,23 @@ define [
|
|
|
if response.status == "timedout"
|
|
|
$scope.pdf.view = 'errors'
|
|
|
$scope.pdf.timedout = true
|
|
|
- fetchLogs(fileByPath['output.log'], fileByPath['output.blg'])
|
|
|
+ fetchLogs(fileByPath)
|
|
|
else if response.status == "terminated"
|
|
|
$scope.pdf.view = 'errors'
|
|
|
$scope.pdf.compileTerminated = true
|
|
|
- fetchLogs(fileByPath['output.log'], fileByPath['output.blg'])
|
|
|
+ fetchLogs(fileByPath)
|
|
|
+ else if response.status in ["validation-fail", "validation-pass"]
|
|
|
+ $scope.pdf.view = 'pdf'
|
|
|
+ $scope.pdf.compileExited = true
|
|
|
+ $scope.pdf.url = last_pdf_url
|
|
|
+ $scope.shouldShowLogs = true
|
|
|
+ fetchLogs(fileByPath, { validation: true })
|
|
|
+ else if response.status == "exited"
|
|
|
+ $scope.pdf.view = 'pdf'
|
|
|
+ $scope.pdf.compileExited = true
|
|
|
+ $scope.pdf.url = last_pdf_url
|
|
|
+ $scope.shouldShowLogs = true
|
|
|
+ fetchLogs(fileByPath)
|
|
|
else if response.status == "autocompile-backoff"
|
|
|
$scope.pdf.view = 'uncompiled'
|
|
|
else if response.status == "project-too-large"
|
|
|
@@ -134,7 +150,7 @@ define [
|
|
|
$scope.pdf.view = 'errors'
|
|
|
$scope.pdf.failure = true
|
|
|
$scope.shouldShowLogs = true
|
|
|
- fetchLogs(fileByPath['output.log'], fileByPath['output.blg'])
|
|
|
+ fetchLogs(fileByPath)
|
|
|
else if response.status == 'clsi-maintenance'
|
|
|
$scope.pdf.view = 'errors'
|
|
|
$scope.pdf.clsiMaintenance = true
|
|
|
@@ -165,7 +181,7 @@ define [
|
|
|
qs.popupDownload = true
|
|
|
$scope.pdf.downloadUrl = "/project/#{$scope.project_id}/output/output.pdf" + createQueryString(qs)
|
|
|
|
|
|
- fetchLogs(fileByPath['output.log'], fileByPath['output.blg'])
|
|
|
+ fetchLogs(fileByPath)
|
|
|
|
|
|
IGNORE_FILES = ["output.fls", "output.fdb_latexmk"]
|
|
|
$scope.pdf.outputFiles = []
|
|
|
@@ -186,7 +202,13 @@ define [
|
|
|
}
|
|
|
|
|
|
|
|
|
- fetchLogs = (logFile, blgFile) ->
|
|
|
+ fetchLogs = (fileByPath, options) ->
|
|
|
+
|
|
|
+ if options?.validation
|
|
|
+ chktexFile = fileByPath['output.chktex']
|
|
|
+ else
|
|
|
+ logFile = fileByPath['output.log']
|
|
|
+ blgFile = fileByPath['output.blg']
|
|
|
|
|
|
getFile = (name, file) ->
|
|
|
opts =
|
|
|
@@ -213,6 +235,8 @@ define [
|
|
|
|
|
|
accumulateResults = (newEntries) ->
|
|
|
for key in ['all', 'errors', 'warnings']
|
|
|
+ if newEntries.type?
|
|
|
+ entry.type = newEntries.type for entry in newEntries[key]
|
|
|
logEntries[key] = logEntries[key].concat newEntries[key]
|
|
|
|
|
|
# use the parsers for each file type
|
|
|
@@ -222,10 +246,24 @@ define [
|
|
|
all = [].concat errors, warnings, typesetting
|
|
|
accumulateResults {all, errors, warnings}
|
|
|
|
|
|
+ processChkTex = (log) ->
|
|
|
+ errors = []
|
|
|
+ warnings = []
|
|
|
+ for line in log.split("\n")
|
|
|
+ if m = line.match /^(\S+):(\d+):(\d+): (Error|Warning): (.*)/
|
|
|
+ result = { file:m[1], line:m[2], column:m[3], level:m[4].toLowerCase(), message: "#{m[4]}: #{m[5]}"}
|
|
|
+ if result.level is 'error'
|
|
|
+ errors.push result
|
|
|
+ else
|
|
|
+ warnings.push result
|
|
|
+ all = [].concat errors, warnings
|
|
|
+ logHints = HumanReadableLogs.parse {type: "Validation", all, errors, warnings}
|
|
|
+ accumulateResults logHints
|
|
|
+
|
|
|
processBiber = (log) ->
|
|
|
{errors, warnings} = BibLogParser.parse(log, {})
|
|
|
all = [].concat errors, warnings
|
|
|
- accumulateResults {all, errors, warnings}
|
|
|
+ accumulateResults {type: "BibTeX", all, errors, warnings}
|
|
|
|
|
|
# output the results
|
|
|
handleError = () ->
|
|
|
@@ -248,19 +286,35 @@ define [
|
|
|
}
|
|
|
|
|
|
# retrieve the logfile and process it
|
|
|
- response = getFile('output.log', logFile)
|
|
|
- .success processLog
|
|
|
- .error handleError
|
|
|
-
|
|
|
- if blgFile? # retrieve the blg file if present
|
|
|
- response.success () ->
|
|
|
- getFile('output.blg', blgFile)
|
|
|
- # ignore errors in biber file
|
|
|
- .success processBiber
|
|
|
- # display the combined result
|
|
|
- .then annotateFiles
|
|
|
- else # otherwise just display the result
|
|
|
- response.success annotateFiles
|
|
|
+ if logFile?
|
|
|
+ response = getFile('output.log', logFile)
|
|
|
+ .then (response) -> processLog(response.data)
|
|
|
+
|
|
|
+ if blgFile? # retrieve the blg file if present
|
|
|
+ response = response.then () ->
|
|
|
+ getFile('output.blg', blgFile)
|
|
|
+ .then(
|
|
|
+ (response) -> processBiber(response.data),
|
|
|
+ () -> true # ignore errors in biber file
|
|
|
+ )
|
|
|
+
|
|
|
+ if response?
|
|
|
+ response.catch handleError
|
|
|
+ else
|
|
|
+ handleError()
|
|
|
+
|
|
|
+ if chktexFile?
|
|
|
+ getChkTex = () ->
|
|
|
+ getFile('output.chktex', chktexFile)
|
|
|
+ .then (response) -> processChkTex(response.data)
|
|
|
+ # always retrieve the chktex file if present
|
|
|
+ if response?
|
|
|
+ response = response.then getChkTex, getChkTex
|
|
|
+ else
|
|
|
+ response = getChkTex()
|
|
|
+
|
|
|
+ # display the combined result
|
|
|
+ response.finally annotateFiles
|
|
|
|
|
|
getRootDocOverride_id = () ->
|
|
|
doc = ide.editorManager.getCurrentDocValue()
|
|
|
@@ -284,7 +338,7 @@ define [
|
|
|
$scope.recompile = (options = {}) ->
|
|
|
return if $scope.pdf.compiling
|
|
|
|
|
|
- event_tracking.sendCountlySampled "editor-recompile-sampled", options
|
|
|
+ event_tracking.sendMBSampled "editor-recompile-sampled", options
|
|
|
|
|
|
$scope.pdf.compiling = true
|
|
|
|
|
|
@@ -333,7 +387,7 @@ define [
|
|
|
|
|
|
$scope.toggleLogs = () ->
|
|
|
$scope.shouldShowLogs = !$scope.shouldShowLogs
|
|
|
- event_tracking.sendCountlyOnce "ide-open-logs-once" if $scope.shouldShowLogs
|
|
|
+ event_tracking.sendMBOnce "ide-open-logs-once" if $scope.shouldShowLogs
|
|
|
|
|
|
$scope.showPdf = () ->
|
|
|
$scope.pdf.view = "pdf"
|
|
|
@@ -341,7 +395,7 @@ define [
|
|
|
|
|
|
$scope.toggleRawLog = () ->
|
|
|
$scope.pdf.showRawLog = !$scope.pdf.showRawLog
|
|
|
- event_tracking.sendCountly "logs-view-raw" if $scope.pdf.showRawLog
|
|
|
+ event_tracking.sendMB "logs-view-raw" if $scope.pdf.showRawLog
|
|
|
|
|
|
$scope.openClearCacheModal = () ->
|
|
|
modalInstance = $modal.open(
|
|
|
@@ -376,7 +430,7 @@ define [
|
|
|
$scope.startFreeTrial = (source) ->
|
|
|
ga?('send', 'event', 'subscription-funnel', 'compile-timeout', source)
|
|
|
|
|
|
- event_tracking.sendCountly "subscription-start-trial", { source }
|
|
|
+ event_tracking.sendMB "subscription-start-trial", { source }
|
|
|
|
|
|
window.open("/user/subscription/new?planCode=student_free_trial_7_days")
|
|
|
$scope.startedFreeTrial = true
|
|
|
@@ -499,12 +553,14 @@ define [
|
|
|
|
|
|
App.controller "PdfLogEntryController", ["$scope", "ide", "event_tracking", ($scope, ide, event_tracking) ->
|
|
|
$scope.openInEditor = (entry) ->
|
|
|
- event_tracking.sendCountlyOnce "logs-jump-to-location-once"
|
|
|
+ event_tracking.sendMBOnce "logs-jump-to-location-once"
|
|
|
entity = ide.fileTreeManager.findEntityByPath(entry.file)
|
|
|
return if !entity? or entity.type != "doc"
|
|
|
if entry.line?
|
|
|
line = entry.line
|
|
|
- ide.editorManager.openDoc(entity, gotoLine: line)
|
|
|
+ if entry.column?
|
|
|
+ column = entry.column
|
|
|
+ ide.editorManager.openDoc(entity, gotoLine: line, gotoColumn: column)
|
|
|
]
|
|
|
|
|
|
App.controller 'ClearCacheModalController', ["$scope", "$modalInstance", ($scope, $modalInstance) ->
|