From 61f4c6a54097a82a3cbdc2ceee2131ab2cc0d011 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Thu, 25 Jul 2024 23:25:55 +0200 Subject: [PATCH] Show logs if step has error (#3979) --- web/src/assets/locales/en.json | 1 + web/src/components/repo/pipeline/PipelineLog.vue | 13 +++++++------ web/src/views/repo/pipeline/Pipeline.vue | 15 +-------------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/web/src/assets/locales/en.json b/web/src/assets/locales/en.json index 244771d10..a009b1997 100644 --- a/web/src/assets/locales/en.json +++ b/web/src/assets/locales/en.json @@ -191,6 +191,7 @@ "pipelines_for_pr": "Pipelines for pull request #{index}", "exit_code": "Exit Code {exitCode}", "loading": "Loading…", + "no_logs": "No logs", "pipeline": "Pipeline #{pipelineId}", "log_title": "Step Logs", "log_download_error": "There was an error while downloading the log file", diff --git a/web/src/components/repo/pipeline/PipelineLog.vue b/web/src/components/repo/pipeline/PipelineLog.vue index f296c5eff..3a9bca987 100644 --- a/web/src/components/repo/pipeline/PipelineLog.vue +++ b/web/src/components/repo/pipeline/PipelineLog.vue @@ -13,7 +13,7 @@
@@ -88,10 +88,10 @@
- {{ step.error }} - {{ $t('repo.pipeline.actions.canceled') }} + {{ $t('repo.pipeline.actions.canceled') }} {{ $t('repo.pipeline.step_not_started') }}
{{ $t('repo.pipeline.loading') }}
+
{{ $t('repo.pipeline.no_logs') }}
- {{ $t('repo.pipeline.exit_code', { exitCode: step.exit_code }) }} + {{ step.error }} + {{ $t('repo.pipeline.exit_code', { exitCode: step.exit_code }) }}
@@ -160,7 +161,7 @@ const loadedLogs = computed(() => !!log.value); const hasLogs = computed( () => // we do not have logs for skipped steps - repo?.value && pipeline.value && step.value && step.value.state !== 'skipped' && step.value.state !== 'killed', + repo?.value && pipeline.value && step.value && step.value.state !== 'skipped', ); const autoScroll = useStorage('log-auto-scroll', false); const showActions = ref(false); diff --git a/web/src/views/repo/pipeline/Pipeline.vue b/web/src/views/repo/pipeline/Pipeline.vue index f1fe10961..c7e734a3e 100644 --- a/web/src/views/repo/pipeline/Pipeline.vue +++ b/web/src/views/repo/pipeline/Pipeline.vue @@ -8,17 +8,7 @@ />
- - -
- - {{ $t('repo.pipeline.we_got_some_errors') }} - {{ selectedStep?.error }} -
-
-
- - +
@@ -86,7 +76,6 @@ import useApiClient from '~/compositions/useApiClient'; import { useAsyncAction } from '~/compositions/useAsyncAction'; import useNotifications from '~/compositions/useNotifications'; import type { Pipeline, PipelineStep, Repo, RepoPermissions } from '~/lib/api/types'; -import { findStep } from '~/utils/helpers'; const props = defineProps<{ stepId?: string | null; @@ -148,8 +137,6 @@ const selectedStepId = computed({ }, }); -const selectedStep = computed(() => findStep(pipeline.value.workflows || [], selectedStepId.value || -1)); - const { doSubmit: approvePipeline, isLoading: isApprovingPipeline } = useAsyncAction(async () => { if (!repo) { throw new Error('Unexpected: Repo is undefined');