Merge pull request #9792 from overleaf/ds-jpa-remove-stoponfirsterror-split-test

Split Test removal - removed stop-on-first-error split test code

GitOrigin-RevId: 4a5663397d0a967e0fa957453b36d466aa530630
This commit is contained in:
Tim Down 2022-10-03 16:22:13 +01:00 committed by Copybot
parent 188e8c99a7
commit de7eb43f51
8 changed files with 82 additions and 158 deletions

View file

@ -932,21 +932,6 @@ const ProjectController = {
} }
) )
}, },
stopOnFirstErrorAssignment(cb) {
SplitTestHandler.getAssignment(
req,
res,
'stop-on-first-error',
(error, assignment) => {
// do not fail editor load if assignment fails
if (error) {
cb(null, { variant: 'default' })
} else {
cb(null, assignment)
}
}
)
},
interstitialPaymentFromPaywallAssignment(cb) { interstitialPaymentFromPaywallAssignment(cb) {
SplitTestHandler.getAssignment( SplitTestHandler.getAssignment(
req, req,
@ -1072,7 +1057,6 @@ const ProjectController = {
newSourceEditorAssignment, newSourceEditorAssignment,
pdfjsAssignment, pdfjsAssignment,
dictionaryEditorAssignment, dictionaryEditorAssignment,
stopOnFirstErrorAssignment,
} }
) => { ) => {
if (err != null) { if (err != null) {
@ -1179,9 +1163,6 @@ const ProjectController = {
!userIsMemberOfGroupSubscription && !userIsMemberOfGroupSubscription &&
!userHasInstitutionLicence !userHasInstitutionLicence
const showStopOnFirstError =
stopOnFirstErrorAssignment.variant === 'enabled'
const template = const template =
detachRole === 'detached' detachRole === 'detached'
? 'project/editor_detached' ? 'project/editor_detached'
@ -1252,7 +1233,6 @@ const ProjectController = {
showSymbolPalette, showSymbolPalette,
galileoEnabled, galileoEnabled,
galileoFeatures, galileoFeatures,
showStopOnFirstError,
detachRole, detachRole,
metadata: { viewport: false }, metadata: { viewport: false },
showUpgradePrompt, showUpgradePrompt,

View file

@ -26,7 +26,6 @@ meta(name="ol-galileoEnabled" data-type="string" content=galileoEnabled)
meta(name="ol-galileoFeatures" data-type="json" content=galileoFeatures) meta(name="ol-galileoFeatures" data-type="json" content=galileoFeatures)
meta(name="ol-detachRole" data-type="string" content=detachRole) meta(name="ol-detachRole" data-type="string" content=detachRole)
meta(name="ol-showUpgradePrompt" data-type="boolean" content=showUpgradePrompt) meta(name="ol-showUpgradePrompt" data-type="boolean" content=showUpgradePrompt)
meta(name="ol-showStopOnFirstError" data-type="boolean" content=showStopOnFirstError)
- var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {}) - var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
meta(name="ol-fileActionI18n" data-type="json" content=fileActionI18n) meta(name="ol-fileActionI18n" data-type="json" content=fileActionI18n)

View file

@ -317,7 +317,6 @@
"latex_help_guide": "", "latex_help_guide": "",
"layout": "", "layout": "",
"layout_processing": "", "layout_processing": "",
"learn_how_to_make_documents_compile_quickly": "",
"learn_more": "", "learn_more": "",
"learn_more_about_link_sharing": "", "learn_more_about_link_sharing": "",
"leave": "", "leave": "",
@ -346,8 +345,6 @@
"log_entry_description": "", "log_entry_description": "",
"log_entry_maximum_entries": "", "log_entry_maximum_entries": "",
"log_entry_maximum_entries_enable_stop_on_first_error": "", "log_entry_maximum_entries_enable_stop_on_first_error": "",
"log_entry_maximum_entries_message": "",
"log_entry_maximum_entries_message_no_errors": "",
"log_entry_maximum_entries_see_full_logs": "", "log_entry_maximum_entries_see_full_logs": "",
"log_entry_maximum_entries_title": "", "log_entry_maximum_entries_title": "",
"log_hint_extra_info": "", "log_hint_extra_info": "",

View file

@ -7,7 +7,6 @@ import classnames from 'classnames'
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context' import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error' import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
import PdfCompileButtonInner from './pdf-compile-button-inner' import PdfCompileButtonInner from './pdf-compile-button-inner'
import getMeta from '../../../utils/meta'
function PdfCompileButton() { function PdfCompileButton() {
const { const {
@ -30,7 +29,6 @@ function PdfCompileButton() {
useStopOnFirstError({ eventSource: 'dropdown' }) useStopOnFirstError({ eventSource: 'dropdown' })
const { t } = useTranslation() const { t } = useTranslation()
const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
return ( return (
<ControlledDropdown <ControlledDropdown
@ -95,23 +93,17 @@ function PdfCompileButton() {
{t('ignore_validation_errors')} {t('ignore_validation_errors')}
</MenuItem> </MenuItem>
{showStopOnFirstError && (
<MenuItem header>{t('compile_error_handling')}</MenuItem> <MenuItem header>{t('compile_error_handling')}</MenuItem>
)}
{showStopOnFirstError && (
<MenuItem onSelect={enableStopOnFirstError}> <MenuItem onSelect={enableStopOnFirstError}>
<Icon type={stopOnFirstError ? 'check' : ''} fw /> <Icon type={stopOnFirstError ? 'check' : ''} fw />
{t('stop_on_first_error')} {t('stop_on_first_error')}
</MenuItem> </MenuItem>
)}
{showStopOnFirstError && (
<MenuItem onSelect={disableStopOnFirstError}> <MenuItem onSelect={disableStopOnFirstError}>
<Icon type={!stopOnFirstError ? 'check' : ''} fw /> <Icon type={!stopOnFirstError ? 'check' : ''} fw />
{t('try_to_compile_despite_errors')} {t('try_to_compile_despite_errors')}
</MenuItem> </MenuItem>
)}
<MenuItem divider /> <MenuItem divider />

View file

@ -6,7 +6,6 @@ import PdfLogEntry from './pdf-log-entry'
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context' import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error' import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge' import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge'
import getMeta from '../../../utils/meta'
function PdfPreviewError({ error }) { function PdfPreviewError({ error }) {
const { t } = useTranslation() const { t } = useTranslation()
@ -181,7 +180,6 @@ function TimedOutLogEntry() {
}) })
const { startCompile, lastCompileOptions, setAnimateCompileDropdownArrow } = const { startCompile, lastCompileOptions, setAnimateCompileDropdownArrow } =
useCompileContext() useCompileContext()
const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
const handleEnableStopOnFirstErrorClick = useCallback(() => { const handleEnableStopOnFirstErrorClick = useCallback(() => {
enableStopOnFirstError() enableStopOnFirstError()
@ -189,7 +187,6 @@ function TimedOutLogEntry() {
setAnimateCompileDropdownArrow(true) setAnimateCompileDropdownArrow(true)
}, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow]) }, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow])
if (showStopOnFirstError) {
return ( return (
<ErrorLogEntry title={t('timedout')}> <ErrorLogEntry title={t('timedout')}>
<p>{t('project_timed_out_intro')}</p> <p>{t('project_timed_out_intro')}</p>
@ -241,22 +238,5 @@ function TimedOutLogEntry() {
</p> </p>
</ErrorLogEntry> </ErrorLogEntry>
) )
} else {
return (
<ErrorLogEntry title={t('timedout')}>
{t('proj_timed_out_reason')}
<div>
<a
href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F"
target="_blank"
rel="noopener"
>
{t('learn_how_to_make_documents_compile_quickly')}
</a>
</div>
</ErrorLogEntry>
)
}
} }
TimedOutLogEntry.propTypes = {} TimedOutLogEntry.propTypes = {}

View file

@ -98,10 +98,9 @@ export default class DocumentCompiler {
// use incremental compile for all users but revert to a full compile // use incremental compile for all users but revert to a full compile
// if there was previously a server error // if there was previously a server error
incrementalCompilesEnabled: !this.error, incrementalCompilesEnabled: !this.error,
stopOnFirstError: options.stopOnFirstError,
} }
if (getMeta('ol-showStopOnFirstError')) {
body.stopOnFirstError = options.stopOnFirstError
}
const data = await postJSON( const data = await postJSON(
`/project/${this.projectId}/compile?${params}`, `/project/${this.projectId}/compile?${params}`,
{ body, signal: this.signal } { body, signal: this.signal }

View file

@ -4,14 +4,12 @@ import { Trans, useTranslation } from 'react-i18next'
import { Button } from 'react-bootstrap' import { Button } from 'react-bootstrap'
import PreviewLogEntryHeader from './preview-log-entry-header' import PreviewLogEntryHeader from './preview-log-entry-header'
import Icon from '../../../shared/components/icon' import Icon from '../../../shared/components/icon'
import getMeta from '../../../utils/meta'
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context' import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error' import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge' import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge'
function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) { function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
const { t } = useTranslation() const { t } = useTranslation()
const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
const { startCompile, stoppedOnFirstError, setAnimateCompileDropdownArrow } = const { startCompile, stoppedOnFirstError, setAnimateCompileDropdownArrow } =
useCompileContext() useCompileContext()
const { enableStopOnFirstError } = useStopOnFirstError({ const { enableStopOnFirstError } = useStopOnFirstError({
@ -34,8 +32,7 @@ function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
<PreviewLogEntryHeader level="raw" headerTitle={title} /> <PreviewLogEntryHeader level="raw" headerTitle={title} />
<div className="log-entry-content"> <div className="log-entry-content">
<div className="log-entry-formatted-content"> <div className="log-entry-formatted-content">
{showStopOnFirstError ? ( {hasErrors && !stoppedOnFirstError ? (
hasErrors && !stoppedOnFirstError ? (
<> <>
<p> <p>
<Icon type="lightbulb-o" /> <Icon type="lightbulb-o" />
@ -68,23 +65,6 @@ function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
<strong>{t('tip')}: </strong> <strong>{t('tip')}: </strong>
{t('log_entry_maximum_entries_see_full_logs')} {t('log_entry_maximum_entries_see_full_logs')}
</p> </p>
)
) : (
<>
<Icon type="lightbulb-o" />
&nbsp;
{hasErrors ? (
<Trans
i18nKey="log_entry_maximum_entries_message"
components={[<b />, <p />]} // eslint-disable-line react/jsx-key
/>
) : (
<Trans
i18nKey="log_entry_maximum_entries_message_no_errors"
components={[<b />]} // eslint-disable-line react/jsx-key
/>
)}
</>
)} )}
</div> </div>
</div> </div>

View file

@ -41,8 +41,6 @@
"log_entry_description": "Log entry with level: __level__", "log_entry_description": "Log entry with level: __level__",
"log_entry_maximum_entries": "Maximum log entries limit hit", "log_entry_maximum_entries": "Maximum log entries limit hit",
"log_entry_maximum_entries_title": "__total__ log messages total. Showing the first __displayed__", "log_entry_maximum_entries_title": "__total__ log messages total. Showing the first __displayed__",
"log_entry_maximum_entries_message": "<0>Tip</0>: Try to fix the first error and recompile. Often one error causes many later error messages.<1>If you need to see the full logs, you can still download them or view the raw logs below.</1>",
"log_entry_maximum_entries_message_no_errors": "<0>Tip</0>: If you need to see the full logs, you can still download them or view the raw logs below.",
"log_entry_maximum_entries_enable_stop_on_first_error": "Try to fix the first error and recompile. Often one error causes many later error messages. You can <button>Enable “Stop on first error”</button> to focus on fixing errors. We recommend fixing errors as soon as possible; letting them accumulate may lead to hard-to-debug and fatal errors. <learn-more-link>Learn more</learn-more-link>", "log_entry_maximum_entries_enable_stop_on_first_error": "Try to fix the first error and recompile. Often one error causes many later error messages. You can <button>Enable “Stop on first error”</button> to focus on fixing errors. We recommend fixing errors as soon as possible; letting them accumulate may lead to hard-to-debug and fatal errors. <learn-more-link>Learn more</learn-more-link>",
"log_entry_maximum_entries_see_full_logs": "If you need to see the full logs, you can still download them or view the raw logs below.", "log_entry_maximum_entries_see_full_logs": "If you need to see the full logs, you can still download them or view the raw logs below.",
"tip": "Tip", "tip": "Tip",
@ -1403,7 +1401,6 @@
"importing_and_merging_changes_in_github": "Importing and merging changes in GitHub", "importing_and_merging_changes_in_github": "Importing and merging changes in GitHub",
"upgrade_for_faster_compiles": "Upgrade for faster compiles and to increase your timeout limit", "upgrade_for_faster_compiles": "Upgrade for faster compiles and to increase your timeout limit",
"free_accounts_have_timeout_upgrade_to_increase": "Free accounts have a one minute timeout, whereas upgraded accounts have a timeout of four minutes.", "free_accounts_have_timeout_upgrade_to_increase": "Free accounts have a one minute timeout, whereas upgraded accounts have a timeout of four minutes.",
"learn_how_to_make_documents_compile_quickly": "Learn how to fix compile timeouts",
"zh-CN": "Chinese", "zh-CN": "Chinese",
"cn": "Chinese (Simplified)", "cn": "Chinese (Simplified)",
"sync_to_github": "Sync to GitHub", "sync_to_github": "Sync to GitHub",