Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow details panels auto collapse in the Dashboard #491

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading