mirror of
https://github.com/codex-storage/cs-codex-dist-tests.git
synced 2025-02-02 15:23:29 +00:00
Adds emoji icons to chain events log
This commit is contained in:
parent
5313f8a7ac
commit
9573814574
@ -5,6 +5,16 @@
|
|||||||
private static readonly Random random = new Random();
|
private static readonly Random random = new Random();
|
||||||
private static readonly object @lock = new object();
|
private static readonly object @lock = new object();
|
||||||
|
|
||||||
|
public static T GetOneRandom<T>(this T[] items)
|
||||||
|
{
|
||||||
|
lock (@lock)
|
||||||
|
{
|
||||||
|
var i = random.Next(0, items.Length);
|
||||||
|
var result = items[i];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static T PickOneRandom<T>(this List<T> remainingItems)
|
public static T PickOneRandom<T>(this List<T> remainingItems)
|
||||||
{
|
{
|
||||||
lock (@lock)
|
lock (@lock)
|
||||||
|
53
Tools/TestNetRewarder/EmojiMaps.cs
Normal file
53
Tools/TestNetRewarder/EmojiMaps.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using Utils;
|
||||||
|
|
||||||
|
namespace TestNetRewarder
|
||||||
|
{
|
||||||
|
public class EmojiMaps
|
||||||
|
{
|
||||||
|
private readonly string[] create = new[]
|
||||||
|
{
|
||||||
|
"🐟",
|
||||||
|
"🔵",
|
||||||
|
"🟦" // blue square
|
||||||
|
};
|
||||||
|
private readonly string[] positive = new[]
|
||||||
|
{
|
||||||
|
"🟢", // green circle
|
||||||
|
"🟩" // green square
|
||||||
|
};
|
||||||
|
private readonly string[] surprise = new[]
|
||||||
|
{
|
||||||
|
"🧐",
|
||||||
|
"🤨",
|
||||||
|
"🟡", // yellow circle
|
||||||
|
"🟨" // yellow square
|
||||||
|
};
|
||||||
|
private readonly string[] negative = new[]
|
||||||
|
{
|
||||||
|
"⛔",
|
||||||
|
"🚫",
|
||||||
|
"🔴",
|
||||||
|
"🟥" // red square
|
||||||
|
};
|
||||||
|
|
||||||
|
public string GetCreate()
|
||||||
|
{
|
||||||
|
return RandomUtils.GetOneRandom(create);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetPositive()
|
||||||
|
{
|
||||||
|
return RandomUtils.GetOneRandom(positive);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetSurprise()
|
||||||
|
{
|
||||||
|
return RandomUtils.GetOneRandom(surprise);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetNegative()
|
||||||
|
{
|
||||||
|
return RandomUtils.GetOneRandom(negative);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ namespace TestNetRewarder
|
|||||||
{
|
{
|
||||||
private static readonly string nl = Environment.NewLine;
|
private static readonly string nl = Environment.NewLine;
|
||||||
private readonly List<string> events = new List<string>();
|
private readonly List<string> events = new List<string>();
|
||||||
|
private readonly EmojiMaps emojiMaps = new EmojiMaps();
|
||||||
|
|
||||||
public string[] GetEvents()
|
public string[] GetEvents()
|
||||||
{
|
{
|
||||||
@ -27,7 +28,7 @@ namespace TestNetRewarder
|
|||||||
public void OnNewRequest(RequestEvent requestEvent)
|
public void OnNewRequest(RequestEvent requestEvent)
|
||||||
{
|
{
|
||||||
var request = requestEvent.Request;
|
var request = requestEvent.Request;
|
||||||
AddRequestBlock(requestEvent, "New Request",
|
AddRequestBlock(requestEvent, $"{C} New Request",
|
||||||
$"Client: {request.Client}",
|
$"Client: {request.Client}",
|
||||||
$"Content: {request.Request.Content.Cid}",
|
$"Content: {request.Request.Content.Cid}",
|
||||||
$"Duration: {BigIntToDuration(request.Request.Ask.Duration)}",
|
$"Duration: {BigIntToDuration(request.Request.Ask.Duration)}",
|
||||||
@ -42,27 +43,27 @@ namespace TestNetRewarder
|
|||||||
|
|
||||||
public void OnRequestCancelled(RequestEvent requestEvent)
|
public void OnRequestCancelled(RequestEvent requestEvent)
|
||||||
{
|
{
|
||||||
AddRequestBlock(requestEvent, "Cancelled");
|
AddRequestBlock(requestEvent, $"{N} Cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRequestFailed(RequestEvent requestEvent)
|
public void OnRequestFailed(RequestEvent requestEvent)
|
||||||
{
|
{
|
||||||
AddRequestBlock(requestEvent, "Failed");
|
AddRequestBlock(requestEvent, $"{N} Failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRequestFinished(RequestEvent requestEvent)
|
public void OnRequestFinished(RequestEvent requestEvent)
|
||||||
{
|
{
|
||||||
AddRequestBlock(requestEvent, "Finished");
|
AddRequestBlock(requestEvent, $"{P} Finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRequestFulfilled(RequestEvent requestEvent)
|
public void OnRequestFulfilled(RequestEvent requestEvent)
|
||||||
{
|
{
|
||||||
AddRequestBlock(requestEvent, "Started");
|
AddRequestBlock(requestEvent, $"{P} Started");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSlotFilled(RequestEvent requestEvent, EthAddress host, BigInteger slotIndex)
|
public void OnSlotFilled(RequestEvent requestEvent, EthAddress host, BigInteger slotIndex)
|
||||||
{
|
{
|
||||||
AddRequestBlock(requestEvent, "Slot Filled",
|
AddRequestBlock(requestEvent, $"{P} Slot Filled",
|
||||||
$"Host: {host}",
|
$"Host: {host}",
|
||||||
$"Slot Index: {slotIndex}"
|
$"Slot Index: {slotIndex}"
|
||||||
);
|
);
|
||||||
@ -70,14 +71,14 @@ namespace TestNetRewarder
|
|||||||
|
|
||||||
public void OnSlotFreed(RequestEvent requestEvent, BigInteger slotIndex)
|
public void OnSlotFreed(RequestEvent requestEvent, BigInteger slotIndex)
|
||||||
{
|
{
|
||||||
AddRequestBlock(requestEvent, "Slot Freed",
|
AddRequestBlock(requestEvent, $"{S} Slot Freed",
|
||||||
$"Slot Index: {slotIndex}"
|
$"Slot Index: {slotIndex}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSlotReservationsFull(RequestEvent requestEvent, BigInteger slotIndex)
|
public void OnSlotReservationsFull(RequestEvent requestEvent, BigInteger slotIndex)
|
||||||
{
|
{
|
||||||
AddRequestBlock(requestEvent, "Slot Reservations Full",
|
AddRequestBlock(requestEvent, $"{P} Slot Reservations Full",
|
||||||
$"Slot Index: {slotIndex}"
|
$"Slot Index: {slotIndex}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -137,5 +138,10 @@ namespace TestNetRewarder
|
|||||||
var tt = new TestToken(big);
|
var tt = new TestToken(big);
|
||||||
return tt.ToString();
|
return tt.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string C => emojiMaps.GetCreate();
|
||||||
|
private string P => emojiMaps.GetPositive();
|
||||||
|
private string S => emojiMaps.GetSurprise();
|
||||||
|
private string N => emojiMaps.GetNegative();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user