mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Move the compile assistant into individual log entries (#18168)
GitOrigin-RevId: 391fd9f31e637bf27f81ebee0dd33fcdfba5f22b
This commit is contained in:
@@ -903,7 +903,7 @@ module.exports = {
|
|||||||
editorToolbarButtons: [],
|
editorToolbarButtons: [],
|
||||||
sourceEditorExtensions: [],
|
sourceEditorExtensions: [],
|
||||||
sourceEditorComponents: [],
|
sourceEditorComponents: [],
|
||||||
pdfLogsComponents: [],
|
pdfLogEntryComponents: [],
|
||||||
sourceEditorCompletionSources: [],
|
sourceEditorCompletionSources: [],
|
||||||
sourceEditorSymbolPalette: [],
|
sourceEditorSymbolPalette: [],
|
||||||
sourceEditorToolbarComponents: [],
|
sourceEditorToolbarComponents: [],
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import PdfLogEntryRawContent from './pdf-log-entry-raw-content'
|
import PdfLogEntryRawContent from './pdf-log-entry-raw-content'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
||||||
|
|
||||||
|
const pdfLogEntryComponents = importOverleafModules('pdfLogEntryComponents')
|
||||||
|
|
||||||
export default function PdfLogEntryContent({
|
export default function PdfLogEntryContent({
|
||||||
rawContent,
|
rawContent,
|
||||||
formattedContent,
|
formattedContent,
|
||||||
extraInfoURL,
|
extraInfoURL,
|
||||||
|
index,
|
||||||
|
logEntry,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
@@ -23,6 +28,13 @@ export default function PdfLogEntryContent({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{logEntry &&
|
||||||
|
pdfLogEntryComponents.map(
|
||||||
|
({ import: { default: Component }, path }) => (
|
||||||
|
<Component key={path} index={index} logEntry={logEntry} />
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
|
||||||
{rawContent && (
|
{rawContent && (
|
||||||
<PdfLogEntryRawContent rawContent={rawContent} collapsedSize={150} />
|
<PdfLogEntryRawContent rawContent={rawContent} collapsedSize={150} />
|
||||||
)}
|
)}
|
||||||
@@ -34,4 +46,6 @@ PdfLogEntryContent.propTypes = {
|
|||||||
rawContent: PropTypes.string,
|
rawContent: PropTypes.string,
|
||||||
formattedContent: PropTypes.node,
|
formattedContent: PropTypes.node,
|
||||||
extraInfoURL: PropTypes.string,
|
extraInfoURL: PropTypes.string,
|
||||||
|
index: PropTypes.number,
|
||||||
|
logEntry: PropTypes.any,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ function PdfLogEntry({
|
|||||||
contentDetails,
|
contentDetails,
|
||||||
onSourceLocationClick,
|
onSourceLocationClick,
|
||||||
onClose,
|
onClose,
|
||||||
|
index,
|
||||||
|
logEntry,
|
||||||
}) {
|
}) {
|
||||||
if (ruleId && HumanReadableLogsHints[ruleId]) {
|
if (ruleId && HumanReadableLogsHints[ruleId]) {
|
||||||
const hint = HumanReadableLogsHints[ruleId]
|
const hint = HumanReadableLogsHints[ruleId]
|
||||||
@@ -59,11 +61,14 @@ function PdfLogEntry({
|
|||||||
showCloseButton={showCloseButton}
|
showCloseButton={showCloseButton}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{(rawContent || formattedContent) && (
|
{(rawContent || formattedContent) && (
|
||||||
<PdfLogEntryContent
|
<PdfLogEntryContent
|
||||||
rawContent={rawContent}
|
rawContent={rawContent}
|
||||||
formattedContent={formattedContent}
|
formattedContent={formattedContent}
|
||||||
extraInfoURL={extraInfoURL}
|
extraInfoURL={extraInfoURL}
|
||||||
|
index={index}
|
||||||
|
logEntry={logEntry}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -94,6 +99,8 @@ PdfLogEntry.propTypes = {
|
|||||||
contentDetails: PropTypes.arrayOf(PropTypes.string),
|
contentDetails: PropTypes.arrayOf(PropTypes.string),
|
||||||
onSourceLocationClick: PropTypes.func,
|
onSourceLocationClick: PropTypes.func,
|
||||||
onClose: PropTypes.func,
|
onClose: PropTypes.func,
|
||||||
|
index: PropTypes.number,
|
||||||
|
logEntry: PropTypes.any,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(PdfLogEntry)
|
export default memo(PdfLogEntry)
|
||||||
|
|||||||
@@ -4,12 +4,9 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import PreviewLogsPaneMaxEntries from '../../preview/components/preview-logs-pane-max-entries'
|
import PreviewLogsPaneMaxEntries from '../../preview/components/preview-logs-pane-max-entries'
|
||||||
import PdfLogEntry from './pdf-log-entry'
|
import PdfLogEntry from './pdf-log-entry'
|
||||||
import { useDetachCompileContext } from '../../../shared/context/detach-compile-context'
|
import { useDetachCompileContext } from '../../../shared/context/detach-compile-context'
|
||||||
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
|
||||||
|
|
||||||
const LOG_PREVIEW_LIMIT = 100
|
const LOG_PREVIEW_LIMIT = 100
|
||||||
|
|
||||||
const pdfLogsComponents = importOverleafModules('pdfLogsComponents')
|
|
||||||
|
|
||||||
function PdfLogsEntries({ entries, hasErrors }) {
|
function PdfLogsEntries({ entries, hasErrors }) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { syncToEntry } = useDetachCompileContext()
|
const { syncToEntry } = useDetachCompileContext()
|
||||||
@@ -25,13 +22,11 @@ function PdfLogsEntries({ entries, hasErrors }) {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{pdfLogsComponents.map(({ import: { default: Component }, path }) => (
|
{logEntries.map((logEntry, index) => (
|
||||||
<Component key={path} entries={entries} />
|
|
||||||
))}
|
|
||||||
|
|
||||||
{logEntries.map(logEntry => (
|
|
||||||
<PdfLogEntry
|
<PdfLogEntry
|
||||||
key={logEntry.key}
|
key={logEntry.key}
|
||||||
|
index={index}
|
||||||
|
logEntry={logEntry}
|
||||||
ruleId={logEntry.ruleId}
|
ruleId={logEntry.ruleId}
|
||||||
headerTitle={logEntry.messageComponent ?? logEntry.message}
|
headerTitle={logEntry.messageComponent ?? logEntry.message}
|
||||||
rawContent={logEntry.content}
|
rawContent={logEntry.content}
|
||||||
|
|||||||
Reference in New Issue
Block a user