-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added refresh button, auto annotations, fixed bugs with regex parsing
- Loading branch information
Tobias Kiertscher
committed
Apr 26, 2018
1 parent
d073ecf
commit 421b248
Showing
15 changed files
with
609 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mastersign.DashOps.Model | ||
{ | ||
partial class ActionMatcher | ||
{ | ||
private bool MatchString(string value) | ||
=> !string.IsNullOrWhiteSpace(value) && | ||
(Regex != null | ||
? System.Text.RegularExpressions.Regex.IsMatch(value, Regex) | ||
: string.Equals(value, Value)); | ||
|
||
private string NormalizedFacette | ||
{ | ||
get | ||
{ | ||
if (string.Equals( | ||
Facette, nameof(CommandAction.Verb), | ||
StringComparison.InvariantCultureIgnoreCase)) | ||
{ | ||
return nameof(CommandAction.Verb); | ||
} | ||
if (string.Equals( | ||
Facette, nameof(CommandAction.Service), | ||
StringComparison.InvariantCultureIgnoreCase)) | ||
{ | ||
return nameof(CommandAction.Service); | ||
} | ||
if (string.Equals( | ||
Facette, nameof(CommandAction.Host), | ||
StringComparison.InvariantCultureIgnoreCase)) | ||
{ | ||
return nameof(CommandAction.Host); | ||
} | ||
return Facette; | ||
} | ||
} | ||
|
||
public bool Match(ActionView actionView) | ||
{ | ||
switch (Mode) | ||
{ | ||
case ActionMatchMode.Description: | ||
return MatchString(actionView.Description); | ||
case ActionMatchMode.Command: | ||
return MatchString(actionView.ExpandedCommand); | ||
case ActionMatchMode.Facette: | ||
return MatchString(actionView.GetFacetteValue(NormalizedFacette)); | ||
case ActionMatchMode.Tag: | ||
return actionView.Tags.Any(MatchString); | ||
default: | ||
throw new ArgumentOutOfRangeException(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mastersign.DashOps.Model | ||
{ | ||
partial class AutoAnnotation | ||
{ | ||
public bool Match(ActionView action) | ||
{ | ||
if (Include != null && Include.Any(m => !m.Match(action))) return false; | ||
if (Exclude != null && Exclude.Any(m => m.Match(action))) return false; | ||
return true; | ||
} | ||
|
||
public void Apply(ActionView action) | ||
{ | ||
if (Tags != null) | ||
{ | ||
action.Tags = action.Tags | ||
.Union(Tags) | ||
.ToArray(); | ||
} | ||
|
||
if (Facettes != null) | ||
{ | ||
foreach (var facetteName in Facettes.Keys) | ||
{ | ||
if (!action.Facettes.ContainsKey(facetteName)) | ||
{ | ||
action.Facettes[facetteName] = Facettes[facetteName]; | ||
} | ||
} | ||
} | ||
|
||
action.Reassure = action.Reassure || Reassure; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
<Viewbox x:Key="IconRefresh" | ||
Width="16" Height="16"> | ||
<Rectangle Width="16" Height="16"> | ||
<Rectangle.Fill> | ||
<DrawingBrush> | ||
<DrawingBrush.Drawing> | ||
<DrawingGroup> | ||
<DrawingGroup.Children> | ||
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> | ||
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M16,8C16,12.411 12.411,16 8,16 3.589,16 0,12.411 0,8 0,6.597 0.384,5.212 1.088,4L0,4 0,0 8,0 8,8 4,8C4,10.206 5.794,12 8,12 10.206,12 12,10.206 12,8 12,6.656 11.331,5.41 10.21,4.666L9.377,4.112 11.592,0.78 12.425,1.333C14.663,2.822,16,5.314,16,8" /> | ||
<GeometryDrawing Brush="#FF00529C" Geometry="F1M15,8C15,11.859 11.859,15 8,15 4.14,15 1,11.859 1,8 1,6.076 1.801,4.292 3.121,3L1,3 1,1 7,1 7,7 5,7 5,4.002C3.766,4.931 3,6.401 3,8 3,10.757 5.243,13 8,13 10.757,13 13,10.757 13,8 13,6.321 12.164,4.763 10.764,3.833L11.871,2.167C13.83,3.469,15,5.649,15,8" /> | ||
</DrawingGroup.Children> | ||
</DrawingGroup> | ||
</DrawingBrush.Drawing> | ||
</DrawingBrush> | ||
</Rectangle.Fill> | ||
</Rectangle> | ||
</Viewbox> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.