Skip to content

Commit

Permalink
Added action and handler list
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed Sep 17, 2024
1 parent 56c59e2 commit 1c43ec5
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 37 deletions.
28 changes: 1 addition & 27 deletions src/aoWebWallet/Pages/ProcessPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,7 @@


<MudItem xs="12" md="6">
<MudPaper Elevation="2" Class="pa-4">
<MudText>List of common actions for this process:</MudText>

@if(isLoading)
{
<MudText>Loading...</MudText>
}
else
{
if(actions.Any())
{
<MudList T="string">
@foreach (var action in actions)
{
<MudListItem OnClick="@(() => NavigateToActionBuilder(action.Name))">
@action.Name
</MudListItem>
}
</MudList>
}
else
{
<MudText>No previous calls to process found</MudText>
}
}

</MudPaper>
<ActionList ProcessId="@ProcessId" />
</MudItem>


Expand Down
27 changes: 19 additions & 8 deletions src/aoWebWallet/Pages/WalletDetail.razor
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@
}
</MudMenuItem>
<MudMenuItem>
<MudButton StartIcon="@Icons.Material.Filled.Refresh" aria-label="refresh transactions" OnClick="RefreshBalances"></MudButton>
<MudButton StartIcon="@Icons.Material.Filled.Refresh" aria-label="refresh transactions" OnClick="RefreshBalances"></MudButton>
</MudMenuItem>
<MudMenuItem>
@if (BindingContext.SelectedWallet?.Wallet.Source == WalletTypes.Explorer)
{
<MudButton StartIcon="@Icons.Material.Outlined.Star" aria-label="add to wallets" OnClick="BindingContext.SaveExplorerWallet"></MudButton>
}
else if(BindingContext.SelectedWallet?.Wallet != null)
{
<MudButton StartIcon="@Icons.Material.Outlined.Edit" aria-label="edit wallet" OnClick="() => EditWallet(BindingContext.SelectedWallet.Wallet)"></MudButton>
}
{
<MudButton StartIcon="@Icons.Material.Outlined.Star" aria-label="add to wallets" OnClick="BindingContext.SaveExplorerWallet"></MudButton>
}
else if (BindingContext.SelectedWallet?.Wallet != null)
{
<MudButton StartIcon="@Icons.Material.Outlined.Edit" aria-label="edit wallet" OnClick="() => EditWallet(BindingContext.SelectedWallet.Wallet)"></MudButton>
}
</MudMenuItem>
</MudMenu>
</MudStack>
Expand Down Expand Up @@ -208,6 +208,17 @@
}
</MudTabPanel>
<MudTabPanel Text="Action Builder">
<MudGrid Spacing="2">
<MudItem xs="12" sm="6">
<ActionList ProcessId="@Address" />
</MudItem>
<MudItem xs="12" sm="6">
@if (BindingContext.SelectedWallet?.Wallet.OwnerAddress != null)
{
<HandlerList ProcessId="@Address" OwnerId="@BindingContext.SelectedWallet?.Wallet.OwnerAddress" />
}
</MudItem>
</MudGrid>
</MudTabPanel>
</MudTabs>
</MudGrid>
Expand Down
51 changes: 51 additions & 0 deletions src/aoWebWallet/Shared/Components/ActionList.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@using aoww.Services
@inject GraphqlClient GraphqlClient
@inject NavigationManager NavigationManager

<MudPaper Elevation="2" Class="pa-4">
<MudText Typo="Typo.h6">Actions</MudText>
<MudText>List of common actions for this process:</MudText>

@if (actions == null)
{
<MudProgressCircular Color="Color.Default" Indeterminate="true" />
}
else if (actions.Count == 0)
{
<MudText>No actions found.</MudText>
}
else
{
<MudList T="string">
@foreach (var action in actions)
{
<MudListItem OnClick="@(() => NavigateToActionBuilder(action.Name))">
@action.Name
</MudListItem>
}
</MudList>
}
</MudPaper>

@code {
[Parameter]
public required string ProcessId { get; set; }

private List<AoActionInfo>? actions;

protected override async Task OnParametersSetAsync()
{
actions = null;
actions = await GraphqlClient.GetActionsForProcess(ProcessId);
StateHasChanged();
}

private void NavigateToActionBuilder(string? actionName = null)
{
string? action = actionName;
if (!string.IsNullOrEmpty(action))
{
NavigationManager.NavigateTo($"/action-builder?processId={ProcessId}&actionName={Uri.EscapeDataString(action)}");
}
}
}
40 changes: 40 additions & 0 deletions src/aoWebWallet/Shared/Components/HandlerList.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@using ArweaveAO.Models
@inject AODataClient aoDataClient

<MudPaper Class="pa-4">
<MudText Typo="Typo.h6">Handlers</MudText>
@if (handlers == null)
{
<MudProgressCircular Color="Color.Default" Indeterminate="true" />
}
else if (handlers.Count == 0)
{
<MudText>No handlers found.</MudText>
}
else
{
<MudList T="string">
@foreach (var handler in handlers)
{
<MudListItem>@handler</MudListItem>
}
</MudList>
}
</MudPaper>

@code {
[Parameter]
public required string ProcessId { get; set; }

[Parameter]
public required string OwnerId { get; set; }

private List<string>? handlers;

protected override async Task OnParametersSetAsync()
{
handlers = null;
handlers = await aoDataClient.GetHandlers(ProcessId, OwnerId);
StateHasChanged();
}
}
2 changes: 1 addition & 1 deletion src/aoWebWallet/aoWebWallet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<ItemGroup>
<PackageReference Include="Append.Blazor.WebShare" Version="7.0.0" />
<PackageReference Include="ArweaveAO" Version="0.1.1" />
<PackageReference Include="ArweaveAO" Version="0.1.2" />
<PackageReference Include="ArweaveBlazor" Version="0.0.11" />
<PackageReference Include="ClipLazor" Version="2.1.1" />
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="7.0.1" />
Expand Down
2 changes: 1 addition & 1 deletion src/aoww.ProcesModels/aoww.ProcesModels.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ArweaveAO" Version="0.1.1" />
<PackageReference Include="ArweaveAO" Version="0.1.2" />
</ItemGroup>

</Project>

0 comments on commit 1c43ec5

Please sign in to comment.