Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamo UI visual status of issues #11776

Merged
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
87637ff
initial commit
SHKnudsen Jun 10, 2021
a967e58
Update DynamoViewModelDelegates.cs
SHKnudsen Jun 10, 2021
8620d3e
Update Dynamo.All.sln
SHKnudsen Jun 10, 2021
a2e2a13
Merge remote-tracking branch 'upstream/master' into Save-warning-due-…
SHKnudsen Jun 15, 2021
5f4ccb2
update test
SHKnudsen Jun 15, 2021
56d375e
event updates
SHKnudsen Jun 15, 2021
aeee7f4
test update
SHKnudsen Jun 15, 2021
5e03021
initial commit
SHKnudsen Jun 15, 2021
4927fb4
Update DynamoViewModel.cs
SHKnudsen Jun 15, 2021
1887827
Merge branch 'Save-warning-due-to-status-of-issues' into Dynamo-UI-vi…
SHKnudsen Jun 15, 2021
6f45fe1
add open linter view to issue count
SHKnudsen Jun 16, 2021
ac4a38b
Update Resources.en-US.resx
SHKnudsen Jun 16, 2021
46fe076
Merge branch 'Save-warning-due-to-status-of-issues' into Dynamo-UI-vi…
SHKnudsen Jun 16, 2021
9b1b4dc
initial commit
SHKnudsen Jun 15, 2021
d170cb3
initial commit
SHKnudsen Jun 10, 2021
9101016
Update DynamoViewModelDelegates.cs
SHKnudsen Jun 10, 2021
8832170
Update Dynamo.All.sln
SHKnudsen Jun 10, 2021
6a7783e
test update
SHKnudsen Jun 15, 2021
79b866b
add open linter view to issue count
SHKnudsen Jun 16, 2021
c897f14
remove duplicated OnRequestOpenLinterView
SHKnudsen Jun 22, 2021
7256fd5
Merge branch 'Dynamo-UI-visual-status-of-issues' of https://github.co…
SHKnudsen Jun 22, 2021
3763b66
revert assembly info changes
SHKnudsen Jun 22, 2021
3d5d039
LinterManager null checks
SHKnudsen Jun 25, 2021
eb38e37
Merge remote-tracking branch 'upstream/master' into Dynamo-UI-visual-…
SHKnudsen Jun 25, 2021
4e04daa
comment updates
SHKnudsen Jun 28, 2021
eafde72
move linter count converter
SHKnudsen Jun 28, 2021
a1da1d2
Merge remote-tracking branch 'upstream/master' into Dynamo-UI-visual-…
SHKnudsen Jun 28, 2021
722d432
Update NotificationsControl.xaml.cs
SHKnudsen Jun 28, 2021
6b456ee
Update NotificationsControl.xaml.cs
SHKnudsen Jun 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace Dynamo.UI.Controls.Converters
{
/// <summary>
/// Converts an integer (linter issues count) to a visibility state
/// </summary>
[ValueConversion(typeof(int), typeof(Visibility))]
internal class LinterIssueCountToVisibilityConverter : IValueConverter
SHKnudsen marked this conversation as resolved.
Show resolved Hide resolved
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is int issueCount) || issueCount == 0)
{
return Visibility.Collapsed;
}

return Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
42 changes: 39 additions & 3 deletions src/DynamoCoreWpf/Controls/NotificationsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:core="clr-namespace:Dynamo.Wpf.ViewModels.Core"
xmlns:viewmodels="clr-namespace:Dynamo.ViewModels"
xmlns:converters="clr-namespace:Dynamo.UI.Controls.Converters"
xmlns:p="clr-namespace:Dynamo.Wpf.Properties;assembly=DynamoCoreWpf"
d:DataContext="{d:DesignInstance Type=viewmodels:DynamoViewModel}"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">

<UserControl.Resources>
<core:NotificationLevelToColorConverter x:Key="NotificationLevelToColorConverter"></core:NotificationLevelToColorConverter>
<converters:LinterIssueCountToVisibilityConverter x:Key="LinterIssueCountToVisibilityConverter" />
</UserControl.Resources>

<Grid>
<TextBlock

<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock
Text="{Binding Path=HomeSpaceViewModel.CurrentNotificationMessage}"
FontStyle="Italic"
FontSize="12"
Expand Down Expand Up @@ -42,5 +51,32 @@
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
<StackPanel Orientation="Horizontal"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="30,0"
MouseDown="StackPanel_MouseDown"
Visibility="{Binding LinterIssuesCount, Converter={StaticResource LinterIssueCountToVisibilityConverter}}">
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Cursor"
Value="Hand" />
</Trigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<Image Width="20"
Source="/DynamoCoreWpf;component/UI/Images/alert.png" />
<TextBlock Margin="10,0"
Foreground="White">
<Run Text="{Binding LinterIssuesCount, Mode=OneWay}" />
<Run Text="{x:Static p:Resources.PersistentVisualStatusOfLinterIssues}" />
</TextBlock>
</StackPanel>

</Grid>
</UserControl>
6 changes: 6 additions & 0 deletions src/DynamoCoreWpf/Controls/NotificationsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ void window_PreviewMouseDown(object sender, MouseButtonEventArgs e)
// Commented this after MAGN - 8423
// hsvm.ClearWarning();
}

private void StackPanel_MouseDown(object sender, MouseButtonEventArgs e)
{
var viewModel = this.DataContext as DynamoViewModel;
viewModel.OnRequestOpenLinterView();
}
}
}
2 changes: 2 additions & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\Converters\LinterIssueCountToVisibilityConverter.cs" />
<Compile Include="Controls\NodeAutoCompleteSearchControl.xaml.cs">
<DependentUpon>NodeAutoCompleteSearchControl.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -1304,6 +1305,7 @@
<Resource Include="UI\Images\profile_normal.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="UI\Images\alert.png" />
<Resource Include="UI\Images\PackageManager\close_16_16.png" />
<Resource Include="UI\Images\PackageManager\down_16_16.png" />
<Resource Include="UI\Images\PackageManager\folder_16_16.png" />
Expand Down
9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2437,4 +2437,7 @@ Uninstall the following packages: {0}?</value>
<data name="PreferencesViewShowRunPreviewTooltip" xml:space="preserve">
<value>Switchable only when the current workspace is in Manual run mode.</value>
</data>
<data name="PersistentVisualStatusOfLinterIssues" xml:space="preserve">
<value>Issues found</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2437,4 +2437,7 @@ Uninstall the following packages: {0}?</value>
<data name="PreferencesViewShowRunPreviewTooltip" xml:space="preserve">
<value>Switchable only when the current workspace is in Manual run mode.</value>
</data>
<data name="PersistentVisualStatusOfLinterIssues" xml:space="preserve">
<value>Issues found</value>
</data>
</root>
Binary file added src/DynamoCoreWpf/UI/Images/alert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ public WorkspaceModel CurrentSpace
get { return model.CurrentWorkspace; }
}

/// <summary>
/// Count of unresolved issues on the linter manager.
/// This is used for binding in the NotificationsControl
/// </summary>
public int LinterIssuesCount
{
get => Model.LinterManager?.RuleEvaluationResults.Count ?? 0;
}

public double WorkspaceActualHeight { get; set; }
public double WorkspaceActualWidth { get; set; }

Expand Down Expand Up @@ -656,6 +665,10 @@ protected DynamoViewModel(StartConfiguration startConfiguration)

model.WorkspaceAdded += WorkspaceAdded;
model.WorkspaceRemoved += WorkspaceRemoved;
if (model.LinterManager != null)
{
model.LinterManager.RuleEvaluationResults.CollectionChanged += OnRuleEvaluationResultsCollectionChanged;
}

SubscribeModelCleaningUpEvent();
SubscribeModelUiEvents();
Expand Down Expand Up @@ -774,6 +787,11 @@ protected virtual void UnsubscribeAllEvents()

model.WorkspaceAdded -= WorkspaceAdded;
model.WorkspaceRemoved -= WorkspaceRemoved;
if (model.LinterManager != null)
{
model.LinterManager.RuleEvaluationResults.CollectionChanged -= OnRuleEvaluationResultsCollectionChanged;
}

DynamoSelection.Instance.Selection.CollectionChanged -= SelectionOnCollectionChanged;
UsageReportingManager.Instance.PropertyChanged -= CollectInfoManager_PropertyChanged;
}
Expand Down Expand Up @@ -1287,6 +1305,11 @@ private void WorkspaceRemoved(WorkspaceModel item)
workspaces.Remove(viewModel);
}

private void OnRuleEvaluationResultsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
RaisePropertyChanged(nameof(LinterIssuesCount));
}

internal void AddToRecentFiles(string path)
{
if (path == null) return;
Expand Down
40 changes: 18 additions & 22 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1694,23 +1694,22 @@
</Grid>

<!--Bottom Panel including RunMode etc-->
<WrapPanel Orientation="Horizontal"
Grid.Row="5"
Grid.Column="0"
Grid.RowSpan="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Grid.ColumnSpan="5">

<WrapPanel.Background>
<Grid
Grid.Row="5"
Grid.Column="0"
Grid.RowSpan="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Grid.ColumnSpan="5">
<Grid.Background>
<LinearGradientBrush StartPoint="0.5,0"
EndPoint="0.5,1">
<GradientStop Color="#222"
Offset="0.0" />
<GradientStop Color="#111"
Offset="1.0" />
</LinearGradientBrush>
</WrapPanel.Background>
</Grid.Background>

<Grid Name="bottomBarGrid"
Grid.Row="4"
Expand All @@ -1720,30 +1719,27 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>

<WrapPanel Orientation="Horizontal"
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
VerticalAlignment="Stretch"
Visibility="{Binding IsAbleToGoHome, Converter={StaticResource InverseBoolToVisibilityConverter}}">

<controls1:RunSettingsControl x:Name="RunSettingsControl"
Margin="2.5,5,5,5"
VerticalAlignment="Stretch"
DataContext="{Binding Path=HomeSpaceViewModel.RunSettingsViewModel}"/>
<controls1:RunSettingsControl x:Name="RunSettingsControl"
Margin="2.5,5,5,5"
VerticalAlignment="Stretch"
DataContext="{Binding Path=HomeSpaceViewModel.RunSettingsViewModel}" />
</WrapPanel>

<!--NotificationControl for showing run-time notifications-->
<controls1:NotificationsControl Grid.Column="1"/>

<controls1:NotificationsControl Grid.Column="1" />
</Grid>

</WrapPanel>

</Grid>

<!--Split Between Console and Canvas-->
<GridSplitter ResizeDirection="Rows"
Expand Down