Unfold workflow when opening via URL (#3106)

Closes #2938
This commit is contained in:
Lukas 2024-01-03 01:33:46 +01:00 committed by GitHub
parent d815b20c54
commit 857db91634
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View file

@ -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),
}),
{},
)

View file

@ -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,
);