Skip to content

Commit

Permalink
List Schemas and More (#83)
Browse files Browse the repository at this point in the history
Features:
* New Command - Detect and list the schemas of up to 100 files
* New Setting - KQL Type detection modes
* Structured Query allows choosing between _Has Row Header_, _Has No Row Header_ and _Auto Detect_ 
* Text View can show up to 1MB (previously 32KB)
  • Loading branch information
yogilad authored Nov 4, 2023
1 parent 851aca3 commit d79f859
Show file tree
Hide file tree
Showing 12 changed files with 390 additions and 63 deletions.
1 change: 1 addition & 0 deletions Src/App/Klipboard/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private static List<WorkerUxConfig> CreateWorkers(ISettings settings, INotificat
workers.Add(new WorkerUxConfig(new StreamIngestWorkerUx(settings, notificationHelper), WorkerCategory.Actions));
workers.Add(new WorkerUxConfig(new DirectIngestWorkerUx(settings, notificationHelper), WorkerCategory.Actions, Icon: ResourceLoader.DevModeIcon));
workers.Add(new WorkerUxConfig(new InspectDataUxWorker(settings, notificationHelper), WorkerCategory.Actions));
workers.Add(new WorkerUxConfig(new InspectSchemaWorker(settings, notificationHelper), WorkerCategory.Actions, Icon: ResourceLoader.DevModeIcon));

// Management
workers.Add(new WorkerUxConfig(new NewVersionWorker(settings, notificationHelper), WorkerCategory.Management, Icon: ResourceLoader.DownloadIcon));
Expand Down
1 change: 1 addition & 0 deletions Src/App/Klipboard/Ux/TextView/TextViewForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Src/App/Klipboard/Ux/TextView/TextViewForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Klipboard
{
public partial class TextViewForm : Form
{
private static string TruncationMessage = $"...{Environment.NewLine}{Environment.NewLine}( Remaining Content Truncated )";
private static string TruncationMessage = $"..{Environment.NewLine}{Environment.NewLine}( Remaining Content Truncated )";

public TextViewForm(string title, string status, string content, bool wordWrap = false)
{
Expand Down
35 changes: 29 additions & 6 deletions Src/App/Klipboard/WorkersUx/SettingsUx/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions Src/App/Klipboard/WorkersUx/SettingsUx/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private ConfiguredTaskAwaitable<bool> SaveSettings(AppConfig? config = null)

private void DataToUx()
{
// Clusters
lstClusters.Items.Clear();
foreach (var cluster in m_config.KustoConnectionStrings)
{
Expand All @@ -70,13 +71,23 @@ private void DataToUx()
lstClusters.Items[m_config.DefaultClusterIndex].Selected = true;
}

// Auto Start
var success = AutoStartHelper.TryGetAutoStartEnabled(out var autoStratEnabled);

chkAutoStart.Checked = success && autoStratEnabled;

// Query Target
cmbApp.Items.Clear();
string[] strings = Enum.GetNames(typeof(QueryApp));
cmbApp.Items.AddRange(strings);
cmbApp.SelectedIndex = (int)m_config.DefaultQueryApp;

// Detection Mode
typeDetectionCombo.Items.Clear();
strings = Enum.GetNames(typeof(KqlTypeDetectionMode));
typeDetectionCombo.Items.AddRange(strings);
typeDetectionCombo.SelectedIndex = (int)m_config.KqlTypeDetectionMode;

// Free Text KQL
txtQuery.Text = m_config.PrependFreeTextQueriesWithKql;
}

Expand All @@ -88,6 +99,7 @@ private AppConfig UxToData()
var defaultClusterIndex = lstClusters.SelectedItems.Count > 0 ? lstClusters.SelectedItems[0].Index : 0;
var startAutomatically = chkAutoStart.Checked;
var defaultQueryApp = (QueryApp)cmbApp.SelectedIndex;
var detectionMode = (KqlTypeDetectionMode)typeDetectionCombo.SelectedIndex;
var prependFreeTextQueriesWithKql = txtQuery.Text;

if (AutoStartHelper.TryGetAutoStartEnabled(out var autoStratEnabled) && autoStratEnabled != startAutomatically)
Expand All @@ -98,7 +110,7 @@ private AppConfig UxToData()
}
}

return new AppConfig(clusters, defaultClusterIndex, defaultQueryApp, prependFreeTextQueriesWithKql);
return new AppConfig(clusters, defaultClusterIndex, defaultQueryApp, detectionMode, prependFreeTextQueriesWithKql);
}

#region Events
Expand Down
1 change: 1 addition & 0 deletions Src/App/Utils/Common/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public record AppConfig(
List<Cluster> KustoConnectionStrings,
int DefaultClusterIndex = 0,
QueryApp DefaultQueryApp = QueryApp.Web,
KqlTypeDetectionMode KqlTypeDetectionMode = KqlTypeDetectionMode.StringsAndNumbers,
string? PrependFreeTextQueriesWithKql = null
)
{
Expand Down
Loading

0 comments on commit d79f859

Please sign in to comment.