From fa211d605de279a9b507904bd585c4aa54d4d9e9 Mon Sep 17 00:00:00 2001 From: tznind Date: Sun, 14 Apr 2024 19:26:22 +0100 Subject: [PATCH] Fix for sub dictionaries --- nfirestore-cli/TableFromCollection.cs | 25 ++++++++++++++++++++----- nfirestore-cli/TabsPane.Designer.cs | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/nfirestore-cli/TableFromCollection.cs b/nfirestore-cli/TableFromCollection.cs index 15bdd60..190f0e3 100644 --- a/nfirestore-cli/TableFromCollection.cs +++ b/nfirestore-cli/TableFromCollection.cs @@ -1,4 +1,6 @@ using Google.Cloud.Firestore; +using Newtonsoft.Json; +using System.Collections; using Terminal.Gui; namespace nfirestore_cli @@ -15,7 +17,9 @@ public TableFromCollection(CollectionReference cr, IEnumerable k, d => d.GetSnapshotAsync().Result.ToDictionary()).ToList(); - _columns = _snaps.SelectMany(k=>k.Value.Keys).ToArray(); + var cols = _snaps.SelectMany(k=>k.Value.Keys).Distinct().Order().ToList(); + cols.Insert(0, "Id"); + _columns = cols.ToArray(); } public int Rows => _snaps.Count; @@ -26,11 +30,22 @@ public TableFromCollection(CollectionReference cr, IEnumerable