Skip to content

Commit

Permalink
Unfold workflow when opening via URL (woodpecker-ci#3106)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukashass authored and fernandrone committed Feb 1, 2024
1 parent 9b92628 commit e5f9254
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 6 additions & 3 deletions web/src/components/repo/pipeline/PipelineStepList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,17 @@ defineEmits<{
}>();
const pipeline = toRef(props, 'pipeline');
const selectedStepId = toRef(props, 'selectedStepId');
const { prettyRef } = usePipeline(pipeline);
const workflowsCollapsed = ref<Record<PipelineStep['id'], boolean>>(
props.pipeline.workflows && props.pipeline.workflows.length > 1
? (props.pipeline.workflows || []).reduce(
pipeline.value.workflows && pipeline.value.workflows.length > 1
? (pipeline.value.workflows || []).reduce(
(collapsed, workflow) => ({
...collapsed,
[workflow.id]: ['success', 'skipped', 'blocked'].includes(workflow.state),
[workflow.id]:
['success', 'skipped', 'blocked'].includes(workflow.state) &&
!workflow.children.some((child) => child.pid === selectedStepId.value),
}),
{},
)
Expand Down
8 changes: 7 additions & 1 deletion web/src/views/repo/pipeline/Pipeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ const selectedStepId = computed({
get() {
if (stepId.value !== '' && stepId.value !== null && stepId.value !== undefined) {
const id = parseInt(stepId.value, 10);
const step = pipeline.value?.workflows?.reduce(
let step = pipeline.value.workflows?.find((workflow) => workflow.pid === id)?.children[0];
if (step) {
return step.pid;
}
step = pipeline.value?.workflows?.reduce(
(prev, p) => prev || p.children?.find((c) => c.pid === id),
undefined as PipelineStep | undefined,
);
Expand Down

0 comments on commit e5f9254

Please sign in to comment.