Skip to content

Commit

Permalink
Updating Localization
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigue10 committed Oct 28, 2021
1 parent 4c7b300 commit 3478983
Show file tree
Hide file tree
Showing 39 changed files with 5,527 additions and 204 deletions.
44 changes: 34 additions & 10 deletions SignumExplorer/Data/SignumDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -951,21 +951,41 @@ public async Task<IEnumerable<ITransaction>> GetFilteredSortedPagedAccountMultiO
public async Task<IEnumerable<IAccount>> GetFilteredSortedPagedAccounts(string searchString, string? sortLabel, int page = 0, int pageSize = 50, int sortOrder = 0)

{

List<IAccount> accounts = new List<IAccount>();
//Try to convert to account id
var accountSuccess = ulong.TryParse(searchString, out ulong accountString);


//Search for name or Exact ID

using (var context = _contextFactory.CreateDbContext())
{
IQueryable<IAccount>? query;



if (!string.IsNullOrWhiteSpace(searchString))
{
query = context.Accounts.AsQueryable<IAccount>().Where(element => element.Latest.Value && (
//element.CreationHeight.ToString().ToLower().Contains(searchString.ToLower())
//|| element.AccountId.ToString().ToLower().Contains(searchString.ToLower())
//||
element.Name.ToString().ToLower().Contains(searchString.ToLower())
//|| element.Description.ToString().ToLower().Contains(searchString.ToLower())
))
.AsQueryable();
//Search for exact account ID and add to the result list
if (accountSuccess)
{
var result = await context.Accounts.Where(m => m.Latest.Value && m.Id == (long)accountString).FirstOrDefaultAsync<IAccount>();
if(result != null) accounts.Add(result);

}

//search on other text fields base on text even if numbers


query = context.Accounts.AsQueryable<IAccount>().Where(element => element.Latest.Value
&& (element.Name.Contains(searchString)
|| element.Description.Contains(searchString)))
.AsQueryable();


}
//Grab everything available
else
{
query = context.Accounts.Where(element => element.Latest.Value).AsQueryable<IAccount>();
Expand All @@ -990,9 +1010,13 @@ public async Task<IEnumerable<IAccount>> GetFilteredSortedPagedAccounts(string s
{
query = query.OrderByDescending(m => m.CreationHeight);
}
return await query.Skip(page * pageSize).Take(pageSize).ToListAsync();


var secondResult = await query.Skip(page * pageSize).Take(pageSize).ToListAsync();


return accounts.Concat(secondResult);

}

}
Expand Down Expand Up @@ -1252,7 +1276,7 @@ public async Task<IEnumerable<IAlias>> GetFilteredSortedPagedAliases(string sear
{
query = context.Aliases.AsQueryable<IAlias>().Where(element => element.Latest.Value && (

element.AliasNameLower.ToString().ToLower().Contains(searchString.ToLower())
element.AliasNameLower.Contains(searchString.ToLower())

))
.AsQueryable();
Expand Down
2 changes: 1 addition & 1 deletion SignumExplorer/NodeAPI/Models/BlockChainStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SignumExplorer.Models
{

public class BlockChainStatus
public class BlockChainStatus : IBlockChainStatus
{
[JsonPropertyName("application")]
public string Application { get; set; }
Expand Down
36 changes: 36 additions & 0 deletions SignumExplorer/NodeAPI/Models/IBlockChainStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;

namespace SignumExplorer.Models
{
public interface IBlockChainStatus
{

public string Application { get; }

public string Version { get; }

public int Time { get; }

public DateTime DateAndTime => new DateTime(2014, 8, 11, 2, 0, 0, DateTimeKind.Utc).AddSeconds(Time);


public string LastBlock { get; }

public int LastBlockTimestamp { get; }


public string CumulativeDifficulty { get; }

public long AverageCommitmentNQT { get; }

public double AverageCommitmentSigna => AverageCommitmentNQT / 100000000.0;

public int NumberOfBlocks { get; }

public string LastBlockchainFeeder { get; }
public int LastBlockchainFeederHeight { get; }

public bool IsScanning { get; }
public int RequestProcessingTime { get; }
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,82 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace SignumExplorer.Models
{
public class UnconfirmedTransAPI


public interface IGetUnconfirmedTransaction
{

public int Type { get; }
public int Subtype { get; }

public string TransactionType => TransactionTypes.TransactionDescription(Type,Subtype);

public int Timestamp { get; }

public DateTime Time => new DateTime(2014, 8, 11, 2, 0, 0, DateTimeKind.Utc).AddSeconds(Timestamp);

public int Deadline { get; }
public string SenderPublicKey { get; }

public string AmountNQT { get; }
public double AmountSigna => ulong.Parse(AmountNQT) / 100000000.0;

public string FeeNQT { get; }
public double FeeSigna => ulong.Parse(FeeNQT) / 100000000.0;

public string Signature { get; }
public string SignatureHash { get; }
public string FullHash { get; }
public string Transaction { get; }
public string Sender { get; }
public ulong SenderId => ulong.Parse(Sender);
public string SenderRS { get; }
public int Height { get; }
public int Version { get; }
public string EcBlockId { get; }
public int EcBlockHeight { get; }
public string Recipient { get; }
public ulong RecipientId
{
get
{
return ulong.TryParse(Recipient, out var recipientId) ? recipientId : ulong.MinValue;
}
}
public string RecipientRS { get; }


}
public interface IUnconfirmedTransAPI
{

public List<IGetUnconfirmedTransaction> UnconfirmedTransactions { get; }
public int RequestProcessingTime { get; }

}




public class UnconfirmedTransAPI : IUnconfirmedTransAPI
{

[JsonPropertyName("unconfirmedTransactions")]
public List<GetUnconfirmedTransaction> UnconfirmedTransactions {get; set;}

[JsonPropertyName("requestProcessingTime")]
public int RequestProcessingTime { get; set; }

List<IGetUnconfirmedTransaction> IUnconfirmedTransAPI.UnconfirmedTransactions => new List<IGetUnconfirmedTransaction>(UnconfirmedTransactions);
}

// Root myDeserializedClass = JsonSerializer.Deserialize<Root>(myJsonResponse);


public class GetUnconfirmedTransaction
public class GetUnconfirmedTransaction : IGetUnconfirmedTransaction
{
[JsonPropertyName("type")]
public int Type { get; set; }
Expand Down
5 changes: 3 additions & 2 deletions SignumExplorer/Pages/ATs/Ats.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@page "/ats"

@inject ISignumDataService SignumService
@inject IStringLocalizer<App> L

<MudContainer Class="mt-16 px-8" MaxWidth="MaxWidth.False">

Expand All @@ -15,10 +16,10 @@ else

<MudGrid>
<MudItem xs="12">
<MudTable RowsPerPage="50" ServerData="@(new Func<TableState, Task<TableData<IAt>>>(ServerReload))"
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" RowsPerPage="50" ServerData="@(new Func<TableState, Task<TableData<IAt>>>(ServerReload))"
@ref="table" FixedHeader="true" Dense="true" Hover="true" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h3">Smart Contracts</MudText>
<MudText Typo="Typo.h6">Smart Contracts</MudText>
<MudSpacer />
<MudTextField T="string" ValueChanged="@(s=>OnSearch(s))" Placeholder="Search: Id or Name" Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
Expand Down
2 changes: 1 addition & 1 deletion SignumExplorer/Pages/ATs/AtsDetails.razor
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
{
<MudTd DataLabel="Sender"><MudText Typo="Typo.caption">(Contract)</MudText></MudTd>
<MudTd> <MudIcon Size="Size.Small" Icon="@Icons.Material.Filled.ArrowForward" Color="Color.Error" /></MudTd>
<MudTd DataLabel="Recipient"><MudLink Typo="Typo.caption" Underline="Underline.None" Href=@($"/accounts/{context.RecipientId}")>@ReedSolomon.encode(context.RecipientId.Value)</MudLink></MudTd>
<MudTd DataLabel="Recipient"><MudLink Typo="Typo.caption" Underline="Underline.None" Href=@($"/accounts/{context.RecipientId}")>@ReedSolomon.encode(context.RecipientId)</MudLink></MudTd>

}
else
Expand Down
24 changes: 12 additions & 12 deletions SignumExplorer/Pages/Accounts/AccountDetails.razor
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ else

<MudGrid>
<MudItem xs="12">
<MudTable RowsPerPage="20" ServerData="@(new Func<TableState, Task<TableData<ITransaction>>>(ServerReload))"
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" RowsPerPage="20" ServerData="@(new Func<TableState, Task<TableData<ITransaction>>>(ServerReload))"
@ref="table" FixedHeader="true" Dense="true" Hover="true" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Transactions</MudText>
Expand Down Expand Up @@ -117,8 +117,8 @@ else
{
<MudTd DataLabel="Sender"><MudText Typo="Typo.caption">(Account)</MudText></MudTd>
<MudTd> <MudIcon Size="Size.Small" Icon="@Icons.Material.Filled.ArrowForward" Color="Color.Error" /></MudTd>
if(context.RecipientId != null && context.RecipientId.Value != 0 ){
<MudTd DataLabel="Recipient"><MudLink Typo="Typo.caption" Underline="Underline.None" Href=@($"/accounts/{context.RecipientId}")>@ReedSolomon.encode(context.RecipientId.Value)</MudLink></MudTd>
if(context.RecipientId != null && context.RecipientId != 0 ){
<MudTd DataLabel="Recipient"><MudLink Typo="Typo.caption" Underline="Underline.None" Href=@($"/accounts/{context.RecipientId}")>@ReedSolomon.encode(context.RecipientId)</MudLink></MudTd>
}
else
{
Expand Down Expand Up @@ -186,7 +186,7 @@ else

<MudGrid>
<MudItem xs="12">
<MudTable RowsPerPage="20" ServerData="@(new Func<TableState, Task<TableData<ITransaction>>>(ServerReloadMulti))"
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" RowsPerPage="20" ServerData="@(new Func<TableState, Task<TableData<ITransaction>>>(ServerReloadMulti))"
@ref="multitable" FixedHeader="true" Dense="true" Hover="true" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Transactions</MudText>
Expand Down Expand Up @@ -290,7 +290,7 @@ else


<MudItem xs="12">
<MudTable RowsPerPage="50" Items="@AccountAssets" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" RowsPerPage="50" Items="@AccountAssets" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Asset Holdings</MudText>

Expand Down Expand Up @@ -336,7 +336,7 @@ else


<MudItem xs="12">
<MudTable RowsPerPage="50" Items="@AccountTrades" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" RowsPerPage="50" Items="@AccountTrades" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Asset Trades</MudText>

Expand Down Expand Up @@ -386,7 +386,7 @@ else


<MudItem xs="12">
<MudTable RowsPerPage="50" Items="@AccountAssetTransfers" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" RowsPerPage="50" Items="@AccountAssetTransfers" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Asset Transfers</MudText>

Expand Down Expand Up @@ -453,7 +453,7 @@ else

<MudItem xs="12" sm="6">

<MudTable Items="@AccountAsks" FixedHeader="true" Dense="true" Height="350px" Hover="true" Bordered="false" Striped="true">
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" Items="@AccountAsks" FixedHeader="true" Dense="true" Height="350px" Hover="true" Bordered="false" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Ask Orders (@AccountAsks.Count())</MudText>

Expand Down Expand Up @@ -501,7 +501,7 @@ else
{
<MudItem xs="12" sm="6">

<MudTable Items="@AccountBids" FixedHeader="true" Height="350px" Dense="true" Hover="true" Bordered="false" Striped="true">
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" Items="@AccountBids" FixedHeader="true" Height="350px" Dense="true" Hover="true" Bordered="false" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Bid Orders (@AccountBids.Count())</MudText>

Expand Down Expand Up @@ -561,7 +561,7 @@ else


<MudItem xs="12">
<MudTable RowsPerPage="50" Items="@AccountAliases" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" RowsPerPage="50" Items="@AccountAliases" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Asset Trades</MudText>

Expand Down Expand Up @@ -609,7 +609,7 @@ else
{
<MudGrid>
<MudItem xs="12">
<MudTable Items="@poolMembers" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" Items="@poolMembers" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Pool Members</MudText>
</ToolBarContent>
Expand Down Expand Up @@ -646,7 +646,7 @@ else
{
<MudGrid>
<MudItem xs="12">
<MudTable Items="@AccountAts" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<MudTable HorizontalScrollbar="true" Breakpoint="Breakpoint.None" Items="@AccountAts" FixedHeader="true" Dense="true" Hover="true" Bordered="false" Striped="true">
<ToolBarContent>
<MudText Typo="Typo.h6">Pool Members</MudText>
</ToolBarContent>
Expand Down
Loading

0 comments on commit 3478983

Please sign in to comment.