Skip to content

Commit

Permalink
Merge pull request #491 from serverlessworkflow/fix-455-dashboard-pan…
Browse files Browse the repository at this point in the history
…els-auto-collapse

Workflow details panels auto collapse in the Dashboard
  • Loading branch information
cdavernas authored Jan 31, 2025
2 parents b451093 + f6c8fe1 commit 19a61fa
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{
<Icon Name="IconName.CaretDown"></Icon>
}
</span>
</span>
<span class="label">@Label</span>
@if (OnClose.HasDelegate)
{
Expand Down Expand Up @@ -57,6 +57,24 @@
await base.OnParametersSetAsync();
}

public async Task HideAsync()
{
isCollapsed = true;
if (OnHidden.HasDelegate)
{
await OnHidden.InvokeAsync();
}
}

public async Task ShowAsync()
{
isCollapsed = false;
if (OnShown.HasDelegate)
{
await OnShown.InvokeAsync();
}
}

async Task OnToggleAsync()
{
isCollapsed = !isCollapsed;
Expand Down
26 changes: 20 additions & 6 deletions src/dashboard/Synapse.Dashboard/Pages/Workflows/Details/View.razor
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<ApplicationTitle>Workflow @($"{Name}.{@namespace}:{version}")</ApplicationTitle>

<div class="d-flex flex-grow mh-100">
<HorizontalCollapsible class="collapsible-instances">
<HorizontalCollapsible @ref="instancesListPanel" class="collapsible-instances">
<Label>Instances</Label>
<Content>
<WorkflowInstancesList class="h-100"
Expand All @@ -51,7 +51,7 @@
</Button>
</Content>
</HorizontalCollapsible>
<HorizontalCollapsible class="user-select-none position-relative">
<HorizontalCollapsible @ref="graphPanel" class="user-select-none position-relative">
<Label>Graph</Label>
<Content>
@if (workflowDefinition == null)
Expand All @@ -70,7 +70,7 @@
}
</Content>
</HorizontalCollapsible>
<HorizontalCollapsible>
<HorizontalCollapsible @ref="definitionPanel">
<Label>Definition</Label>
<Content>
@if (workflowDefinition == null)
Expand Down Expand Up @@ -106,7 +106,7 @@
</HorizontalCollapsible>
@if (workflowInstance != null)
{
<HorizontalCollapsible OnClose="OnCloseWorkflowInstance">
<HorizontalCollapsible OnClose="async() => await OnCloseWorkflowInstanceAsync()">
<Label>Instance</Label>
<Content>
<div class="d-flex flex-column h-100 mh-100">
Expand Down Expand Up @@ -152,6 +152,9 @@
WorkflowDefinition workflowDefinition = null!;
WorkflowInstance? workflowInstance;
ProblemDetails? problemDetails;
HorizontalCollapsible instancesListPanel = null!;
HorizontalCollapsible graphPanel = null!;
HorizontalCollapsible definitionPanel = null!;
readonly IEnumerable<string> columns =
[
"Name",
Expand Down Expand Up @@ -189,8 +192,9 @@
await base.OnInitializedAsync().ConfigureAwait(false);
}


/// <inheritdoc/>
protected override void OnParametersSet()
protected override async Task OnParametersSetAsync()
{
if (Version != version)
{
Expand All @@ -199,7 +203,14 @@
if (InstanceName != instanceName)
{
Store.SetWorkflowInstanceName(InstanceName);
if (!string.IsNullOrWhiteSpace(InstanceName))
{
await instancesListPanel.HideAsync();
await graphPanel.HideAsync();
await definitionPanel.HideAsync();
}
}
await base.OnParametersSetAsync();
}

/// <summary>
Expand Down Expand Up @@ -263,8 +274,11 @@

void OnShowInstanceDetails(WorkflowInstance instance) => NavigationManager.NavigateTo($"/workflows/details/{@namespace}/{Name}/{version}/{instance.GetName()}");

void OnCloseWorkflowInstance()
async Task OnCloseWorkflowInstanceAsync()
{
await instancesListPanel.ShowAsync();
await graphPanel.ShowAsync();
await definitionPanel.ShowAsync();
NavigationManager.NavigateTo($"/workflows/details/{@namespace}/{Name}/{version}");
StateHasChanged();
}
Expand Down

0 comments on commit 19a61fa

Please sign in to comment.