diff --git a/web/src/components/Console/Console.tsx b/web/src/components/Console/Console.tsx index 70815347a..2caf96d42 100644 --- a/web/src/components/Console/Console.tsx +++ b/web/src/components/Console/Console.tsx @@ -6,7 +6,7 @@ import type { CODEProps } from 'RouteDefinitions' import type { TypesStage } from 'services/code' import ConsoleStep from 'components/ConsoleStep/ConsoleStep' import { timeDistance } from 'utils/Utils' -// import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata' +import { useStrings } from 'framework/strings' import css from './Console.module.scss' interface ConsoleProps { @@ -16,6 +16,7 @@ interface ConsoleProps { const Console: FC = ({ stage, repoPath }) => { const { pipeline, execution: executionNum } = useParams() + const { getString } = useStrings() return (
@@ -26,7 +27,7 @@ const Console: FC = ({ stage, repoPath }) => { {stage?.started && stage?.stopped && ( - {`completed ${timeDistance(stage?.stopped, Date.now())} ago`} + {getString('executions.completedTime', { timeString: timeDistance(stage?.stopped, Date.now()) })} )} diff --git a/web/src/components/ConsoleStep/ConsoleStep.tsx b/web/src/components/ConsoleStep/ConsoleStep.tsx index 900f29a33..71c8b9724 100644 --- a/web/src/components/ConsoleStep/ConsoleStep.tsx +++ b/web/src/components/ConsoleStep/ConsoleStep.tsx @@ -7,6 +7,7 @@ import type { LivelogLine, TypesStep } from 'services/code' import { timeDistance } from 'utils/Utils' import ConsoleLogs from 'components/ConsoleLogs/ConsoleLogs' import { useStrings } from 'framework/strings' +import { ExecutionState } from 'components/ExecutionStatus/ExecutionStatus' import css from './ConsoleStep.module.scss' interface ConsoleStepProps { @@ -24,8 +25,8 @@ const ConsoleStep: FC = ({ step, stageNumber, repoPath, pipeli const [streamingLogs, setStreamingLogs] = useState([]) const eventSourceRef = useRef(null) - const shouldUseGet = step?.status !== 'running' && step?.status !== 'pending' - const isPending = step?.status === 'pending' + const shouldUseGet = step?.status !== ExecutionState.RUNNING && step?.status !== ExecutionState.PENDING + const isPending = step?.status === ExecutionState.PENDING const { data, error, loading, refetch } = useGet({ path: `/api/v1/repos/${repoPath}/+/pipelines/${pipelineName}/executions/${executionNumber}/logs/${String( @@ -39,7 +40,7 @@ const ConsoleStep: FC = ({ step, stageNumber, repoPath, pipeli }, [stageNumber]) useEffect(() => { - if (step?.status === 'running') { + if (step?.status === ExecutionState.RUNNING) { if (eventSourceRef.current) { eventSourceRef.current.close() setStreamingLogs([]) @@ -62,11 +63,11 @@ const ConsoleStep: FC = ({ step, stageNumber, repoPath, pipeli }, [executionNumber, pipelineName, repoPath, stageNumber, step?.number, step?.status]) let icon - if (step?.status === 'success') { + if (step?.status === ExecutionState.SUCCESS) { icon = } else if (isPending) { icon = - } else if (step?.status === 'running') { + } else if (step?.status === ExecutionState.RUNNING) { icon = } else { icon = // Default icon in case of other statuses or unknown status @@ -75,7 +76,7 @@ const ConsoleStep: FC = ({ step, stageNumber, repoPath, pipeli let content if (loading) { content =
{getString('loading')}
- } else if (error && step?.status !== 'running') { + } else if (error && step?.status !== ExecutionState.RUNNING) { content =
Error: {error.message}
} else if (streamingLogs.length) { content =