Răsfoiți Sursa

Update log error ordering and wording on tips (#5873)

* Show bibtex errors with compile errors
* Update wording on error log tips

GitOrigin-RevId: 0e25a05418b241526958016f1b525334d33ad741
Miguel Serrano 4 ani în urmă
părinte
comite
7de1e6f979

+ 1 - 0
services/web/frontend/extracted-translations.json

@@ -185,6 +185,7 @@
   "log_entry_description": "",
   "log_entry_maximum_entries": "",
   "log_entry_maximum_entries_message": "",
+  "log_entry_maximum_entries_message_no_errors": "",
   "log_entry_maximum_entries_title": "",
   "log_hint_extra_info": "",
   "log_viewer_error": "",

+ 3 - 1
services/web/frontend/js/features/pdf-preview/components/pdf-logs-entries.js

@@ -7,7 +7,7 @@ import { useIdeContext } from '../../../shared/context/ide-context'
 
 const LOG_PREVIEW_LIMIT = 100
 
-function PdfLogsEntries({ entries }) {
+function PdfLogsEntries({ entries, hasErrors }) {
   const { t } = useTranslation()
 
   const ide = useIdeContext()
@@ -34,6 +34,7 @@ function PdfLogsEntries({ entries }) {
         <PreviewLogsPaneMaxEntries
           totalEntries={entries.length}
           entriesShown={LOG_PREVIEW_LIMIT}
+          hasErrors={hasErrors}
         />
       )}
       {logEntries.map(logEntry => (
@@ -61,6 +62,7 @@ function PdfLogsEntries({ entries }) {
 }
 PdfLogsEntries.propTypes = {
   entries: PropTypes.arrayOf(PropTypes.object),
+  hasErrors: PropTypes.bool,
 }
 
 export default memo(PdfLogsEntries)

+ 6 - 1
services/web/frontend/js/features/pdf-preview/components/pdf-logs-viewer.js

@@ -42,7 +42,12 @@ function PdfLogsViewer() {
             <PdfValidationIssue key={name} name={name} issue={issue} />
           ))}
 
-        {logEntries?.all && <PdfLogsEntries entries={logEntries.all} />}
+        {logEntries?.all && (
+          <PdfLogsEntries
+            entries={logEntries.all}
+            hasErrors={logEntries.errors.length > 0}
+          />
+        )}
 
         {rawLog && (
           <PdfLogEntry

+ 6 - 2
services/web/frontend/js/features/pdf-preview/util/output-files.js

@@ -53,7 +53,6 @@ export const handleOutputFiles = async (projectId, data) => {
   }
 
   result.logEntries = {
-    all: [],
     errors: [],
     warnings: [],
     typesetting: [],
@@ -72,7 +71,6 @@ export const handleOutputFiles = async (projectId, data) => {
           entry.key = `${entry.file}:${entry.line}:${entry.column}:${entry.message}`
         }
         result.logEntries[key].push(...newEntries[key])
-        result.logEntries.all.push(...newEntries[key])
       }
     }
   }
@@ -114,6 +112,12 @@ export const handleOutputFiles = async (projectId, data) => {
 
   result.fileList = buildFileList(outputFiles, data.clsiServerId)
 
+  result.logEntries.all = [
+    ...result.logEntries.errors,
+    ...result.logEntries.warnings,
+    ...result.logEntries.typesetting,
+  ]
+
   return result
 }
 

+ 13 - 5
services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.js

@@ -3,7 +3,7 @@ import { Trans, useTranslation } from 'react-i18next'
 import PreviewLogEntryHeader from './preview-log-entry-header'
 import Icon from '../../../shared/components/icon'
 
-function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown }) {
+function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
   const { t } = useTranslation()
 
   const title = t('log_entry_maximum_entries_title', {
@@ -16,10 +16,17 @@ function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown }) {
       <PreviewLogEntryHeader level="raw" headerTitle={title} />
       <div className="log-entry-content">
         <Icon type="lightbulb-o" />{' '}
-        <Trans
-          i18nKey="log_entry_maximum_entries_message"
-          components={[<b key="bold-1" />]}
-        />
+        {hasErrors ? (
+          <Trans
+            i18nKey="log_entry_maximum_entries_message"
+            components={[<b key="bold-1" />, <p />]} // eslint-disable-line react/jsx-key
+          />
+        ) : (
+          <Trans
+            i18nKey="log_entry_maximum_entries_message_no_errors"
+            components={[<b key="bold-1" />]}
+          />
+        )}
       </div>
     </div>
   )
@@ -28,6 +35,7 @@ function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown }) {
 PreviewLogsPaneMaxEntries.propTypes = {
   totalEntries: PropTypes.number,
   entriesShown: PropTypes.number,
+  hasErrors: PropTypes.bool,
 }
 
 export default PreviewLogsPaneMaxEntries

+ 3 - 2
services/web/locales/en.json

@@ -28,8 +28,9 @@
   "view_error_plural": "View all errors",
   "log_entry_description": "Log entry with level: __level__",
   "log_entry_maximum_entries": "Maximum log entries limit hit",
-  "log_entry_maximum_entries_title": "__total__ issues 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",
+  "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.",
   "navigate_log_source": "Navigate to log position in source code: __location__",
   "other_output_files": "Download other output files",
   "refresh": "Refresh",