Skip to content

Commit

Permalink
Filter on Entity node properties! #964
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Apr 20, 2024
1 parent 0f3c4ca commit f43245e
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 38 deletions.
100 changes: 85 additions & 15 deletions FetchXmlBuilder/Controls/entityControl.Designer.cs

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

37 changes: 31 additions & 6 deletions FetchXmlBuilder/Controls/entityControl.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Xrm.Sdk.Metadata;
using Rappen.XRM.Helpers.Extensions;
using Rappen.XRM.Helpers.FetchXML;
using Rappen.XTB.FetchXmlBuilder.DockControls;
using Rappen.XTB.FetchXmlBuilder.Views;
Expand All @@ -11,6 +12,8 @@ namespace Rappen.XTB.FetchXmlBuilder.Controls
{
public partial class entityControl : FetchXmlElementControlBase
{
private List<EntityMetadata> allentities;

public entityControl() : this(new Dictionary<string, string>(), null, null)
{
}
Expand All @@ -25,12 +28,8 @@ public entityControl(Dictionary<string, string> collection, FetchXmlBuilder fetc

protected override void PopulateControls()
{
cmbEntity.Items.Clear();
var entities = fxb.GetDisplayEntities();
if (entities != null)
{
cmbEntity.Items.AddRange(entities.Select(e => new EntityMetadataItem(e, fxb.settings.UseFriendlyNames, fxb.settings.UseFriendlyAndRawEntities)).ToArray());
}
allentities = fxb.GetDisplayEntities();
FilterEntities();
}

protected override ControlValidationResult ValidateControl(Control control)
Expand Down Expand Up @@ -103,5 +102,31 @@ private void SetIncLogName()
PopulateControls();
ReFillControl(cmbEntity);
}

private void picFilter_Click(object sender, System.EventArgs e)
{
panFilter.Visible = !panFilter.Visible;
FilterEntities();
}

private void txtFilter_TextChanged(object sender, System.EventArgs e)
{
FilterEntities();
}

private void FilterEntities()
{
cmbEntity.Items.Clear();
var text = panFilter.Visible ? txtFilter.Text.ToLowerInvariant() : string.Empty;
var entities = allentities?.Where(e =>
string.IsNullOrWhiteSpace(text) ||
e.LogicalName.ToLowerInvariant().Contains(text) ||
e.ToDisplayName().ToLowerInvariant().Contains(text));
cmbEntity.Items.AddRange(entities.Select(e => new EntityMetadataItem(e, fxb.settings.UseFriendlyNames, fxb.settings.UseFriendlyAndRawEntities)).ToArray());
if (IsInitialized)
{
ReFillControl(cmbEntity);
}
}
}
}
3 changes: 3 additions & 0 deletions FetchXmlBuilder/FetchXmlBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,9 @@
<ItemGroup>
<None Include="Resources\Microsoft_logo.32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\view.png" />
</ItemGroup>
<Import Project="..\MarkMpn.FetchXmlToWebAPI\MarkMpn.FetchXmlToWebAPI\MarkMpn.FetchXmlToWebAPI.projitems" Label="Shared" />
<Import Project="..\FXBEditorUtils\FXBEditorUtils.projitems" Label="Shared" />
<Import Project="..\MarkMpn.XmlSchemaAutocomplete\MarkMpn.XmlSchemaAutoComplete\MarkMpn.XmlSchemaAutoComplete.projitems" Label="Shared" />
Expand Down
10 changes: 10 additions & 0 deletions FetchXmlBuilder/Properties/Resources.Designer.cs

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

37 changes: 20 additions & 17 deletions FetchXmlBuilder/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="icon-reset" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-available-updates-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-options" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-adjust-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-stop" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-stop-sign-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down Expand Up @@ -151,23 +157,14 @@
<data name="icon-javascript" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-javascript-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-new" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-create-order-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-sql" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-sql-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bmc-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bmc-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-convert" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-meat-grinder-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-views" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-view-headline-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-powerplatformdeveloper" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Power Platform Developer icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icon-new" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-create-order-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-undo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-undo-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
Expand All @@ -178,6 +175,12 @@
<data name="icon-flow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\PowerAutomate_scalable gray bg 32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-powerplatformdeveloper" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Power Platform Developer icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Microsoft_logo.32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Microsoft_logo.32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-dataverse" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Dataverse_scalable gray bg 32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand All @@ -187,8 +190,8 @@
<data name="BDU-2019-032-tsp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BDU-2019-032-tsp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-reset" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-available-updates-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="bmc-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bmc-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-xml" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-placeholder-thumbnail-xml-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
Expand All @@ -211,10 +214,10 @@
<data name="icon-saveas" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-save-as-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-options" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-adjust-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icon-convert" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-meat-grinder-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Microsoft_logo.32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Microsoft_logo.32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icon-search-16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\view.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file added FetchXmlBuilder/Resources/view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f43245e

Please sign in to comment.