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) {
SplitTestHandler.getAssignment(
req,
@ -1072,7 +1057,6 @@ const ProjectController = {
newSourceEditorAssignment,
pdfjsAssignment,
dictionaryEditorAssignment,
stopOnFirstErrorAssignment,
}
) => {
if (err != null) {
@ -1179,9 +1163,6 @@ const ProjectController = {
!userIsMemberOfGroupSubscription &&
!userHasInstitutionLicence
const showStopOnFirstError =
stopOnFirstErrorAssignment.variant === 'enabled'
const template =
detachRole === 'detached'
? 'project/editor_detached'
@ -1252,7 +1233,6 @@ const ProjectController = {
showSymbolPalette,
galileoEnabled,
galileoFeatures,
showStopOnFirstError,
detachRole,
metadata: { viewport: false },
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-detachRole" data-type="string" content=detachRole)
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}, {})
meta(name="ol-fileActionI18n" data-type="json" content=fileActionI18n)

View file

@ -317,7 +317,6 @@
"latex_help_guide": "",
"layout": "",
"layout_processing": "",
"learn_how_to_make_documents_compile_quickly": "",
"learn_more": "",
"learn_more_about_link_sharing": "",
"leave": "",
@ -346,8 +345,6 @@
"log_entry_description": "",
"log_entry_maximum_entries": "",
"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_title": "",
"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 { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
import PdfCompileButtonInner from './pdf-compile-button-inner'
import getMeta from '../../../utils/meta'
function PdfCompileButton() {
const {
@ -30,7 +29,6 @@ function PdfCompileButton() {
useStopOnFirstError({ eventSource: 'dropdown' })
const { t } = useTranslation()
const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
return (
<ControlledDropdown
@ -95,23 +93,17 @@ function PdfCompileButton() {
{t('ignore_validation_errors')}
</MenuItem>
{showStopOnFirstError && (
<MenuItem header>{t('compile_error_handling')}</MenuItem>
)}
<MenuItem header>{t('compile_error_handling')}</MenuItem>
{showStopOnFirstError && (
<MenuItem onSelect={enableStopOnFirstError}>
<Icon type={stopOnFirstError ? 'check' : ''} fw />
{t('stop_on_first_error')}
</MenuItem>
)}
<MenuItem onSelect={enableStopOnFirstError}>
<Icon type={stopOnFirstError ? 'check' : ''} fw />
{t('stop_on_first_error')}
</MenuItem>
{showStopOnFirstError && (
<MenuItem onSelect={disableStopOnFirstError}>
<Icon type={!stopOnFirstError ? 'check' : ''} fw />
{t('try_to_compile_despite_errors')}
</MenuItem>
)}
<MenuItem onSelect={disableStopOnFirstError}>
<Icon type={!stopOnFirstError ? 'check' : ''} fw />
{t('try_to_compile_despite_errors')}
</MenuItem>
<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 { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge'
import getMeta from '../../../utils/meta'
function PdfPreviewError({ error }) {
const { t } = useTranslation()
@ -181,7 +180,6 @@ function TimedOutLogEntry() {
})
const { startCompile, lastCompileOptions, setAnimateCompileDropdownArrow } =
useCompileContext()
const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
const handleEnableStopOnFirstErrorClick = useCallback(() => {
enableStopOnFirstError()
@ -189,74 +187,56 @@ function TimedOutLogEntry() {
setAnimateCompileDropdownArrow(true)
}, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow])
if (showStopOnFirstError) {
return (
<ErrorLogEntry title={t('timedout')}>
<p>{t('project_timed_out_intro')}</p>
<ul>
<li>
<Trans
i18nKey="project_timed_out_optimize_images"
components={[
// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
<a href="https://www.overleaf.com/learn/how-to/Optimising_very_large_image_files" />,
]}
/>
</li>
<li>
<Trans
i18nKey="project_timed_out_fatal_error"
components={[
// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
<a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F#Fatal_compile_errors_blocking_the_compilation" />,
]}
/>
{!lastCompileOptions.stopOnFirstError && (
<>
{' '}
<Trans
i18nKey="project_timed_out_enable_stop_on_first_error"
components={[
// eslint-disable-next-line react/jsx-key
<Button
bsSize="xs"
bsStyle="info"
onClick={handleEnableStopOnFirstErrorClick}
/>,
]}
/>{' '}
<StopOnFirstErrorBadge placement="bottom" />
</>
)}
</li>
</ul>
<p>
return (
<ErrorLogEntry title={t('timedout')}>
<p>{t('project_timed_out_intro')}</p>
<ul>
<li>
<Trans
i18nKey="project_timed_out_learn_more"
i18nKey="project_timed_out_optimize_images"
components={[
// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
<a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F" />,
<a href="https://www.overleaf.com/learn/how-to/Optimising_very_large_image_files" />,
]}
/>
</p>
</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>
)
}
</li>
<li>
<Trans
i18nKey="project_timed_out_fatal_error"
components={[
// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
<a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F#Fatal_compile_errors_blocking_the_compilation" />,
]}
/>
{!lastCompileOptions.stopOnFirstError && (
<>
{' '}
<Trans
i18nKey="project_timed_out_enable_stop_on_first_error"
components={[
// eslint-disable-next-line react/jsx-key
<Button
bsSize="xs"
bsStyle="info"
onClick={handleEnableStopOnFirstErrorClick}
/>,
]}
/>{' '}
<StopOnFirstErrorBadge placement="bottom" />
</>
)}
</li>
</ul>
<p>
<Trans
i18nKey="project_timed_out_learn_more"
components={[
// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
<a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F" />,
]}
/>
</p>
</ErrorLogEntry>
)
}
TimedOutLogEntry.propTypes = {}

View file

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

View file

@ -4,14 +4,12 @@ import { Trans, useTranslation } from 'react-i18next'
import { Button } from 'react-bootstrap'
import PreviewLogEntryHeader from './preview-log-entry-header'
import Icon from '../../../shared/components/icon'
import getMeta from '../../../utils/meta'
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge'
function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
const { t } = useTranslation()
const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
const { startCompile, stoppedOnFirstError, setAnimateCompileDropdownArrow } =
useCompileContext()
const { enableStopOnFirstError } = useStopOnFirstError({
@ -34,57 +32,39 @@ function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
<PreviewLogEntryHeader level="raw" headerTitle={title} />
<div className="log-entry-content">
<div className="log-entry-formatted-content">
{showStopOnFirstError ? (
hasErrors && !stoppedOnFirstError ? (
<>
<p>
<Icon type="lightbulb-o" />
&nbsp;
<strong>{t('tip')}: </strong>
<Trans
i18nKey="log_entry_maximum_entries_enable_stop_on_first_error"
components={{
button: (
<Button
bsSize="xs"
bsStyle="info"
onClick={handleEnableStopOnFirstErrorClick}
/>
),
'learn-more-link': (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a href="https://www.overleaf.com/learn/latex/Questions/Tips_and_Tricks_for_Troubleshooting_LaTeX" />
),
}}
/>{' '}
<StopOnFirstErrorBadge placement="bottom" />
</p>
<p>{t('log_entry_maximum_entries_see_full_logs')}</p>
</>
) : (
{hasErrors && !stoppedOnFirstError ? (
<>
<p>
<Icon type="lightbulb-o" />
&nbsp;
<strong>{t('tip')}: </strong>
{t('log_entry_maximum_entries_see_full_logs')}
<Trans
i18nKey="log_entry_maximum_entries_enable_stop_on_first_error"
components={{
button: (
<Button
bsSize="xs"
bsStyle="info"
onClick={handleEnableStopOnFirstErrorClick}
/>
),
'learn-more-link': (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a href="https://www.overleaf.com/learn/latex/Questions/Tips_and_Tricks_for_Troubleshooting_LaTeX" />
),
}}
/>{' '}
<StopOnFirstErrorBadge placement="bottom" />
</p>
)
<p>{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
/>
)}
</>
<strong>{t('tip')}: </strong>
{t('log_entry_maximum_entries_see_full_logs')}
</p>
)}
</div>
</div>

View file

@ -41,8 +41,6 @@
"log_entry_description": "Log entry with level: __level__",
"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_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_see_full_logs": "If you need to see the full logs, you can still download them or view the raw logs below.",
"tip": "Tip",
@ -1403,7 +1401,6 @@
"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",
"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",
"cn": "Chinese (Simplified)",
"sync_to_github": "Sync to GitHub",