-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add popup with choice of Accept or Won't Fix #5046
Add popup with choice of Accept or Won't Fix #5046
Conversation
Functional logic will be added in another ticket. |
src/Integration/Integration.csproj
Outdated
@@ -59,11 +59,13 @@ | |||
<None Remove="Connection\UI\OrganizationSelectionWindow.xaml" /> | |||
<None Remove="Notifications\NotificationIndicator.xaml" /> | |||
<None Remove="Progress\ProgressControl.xaml" /> | |||
<None Remove="Muting\MuteWindowDialog.xaml" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should use the term Muting. Transition/Change status should be more appropriate
@@ -0,0 +1,60 @@ | |||
<vsui:DialogWindow x:Class="SonarLint.VisualStudio.Integration.Muting.MuteWindowDialog" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A screenshot would be nice to attach
|
||
<Border BorderBrush="Black" Name="BorderAccept" BorderThickness="1" HorizontalAlignment="Left" Height="75" Margin="25,25,0,0" VerticalAlignment="Top" Width="450" Visibility="{Binding AcceptVisibility}"> | ||
<Grid> | ||
<RadioButton Name="rbAccept" GroupName="Transitions" Content="Accept" VerticalAlignment="Top" Margin="10,16,-10,0" FontWeight="Bold" Grid.ColumnSpan="2" Checked="RadioButton_Checked"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the text of the button, instead of creating hidden buttons is less confusing and more maintainable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree, I believe this way it's more obvious what's happening. We create a logical separation of different transitions. Using the same control for two different conditions would be more confusing IMHO.
<Border BorderBrush="Black" Name="BorderAccept" BorderThickness="1" HorizontalAlignment="Left" Height="75" Margin="25,25,0,0" VerticalAlignment="Top" Width="450" Visibility="{Binding AcceptVisibility}"> | ||
<Grid> | ||
<RadioButton Name="rbAccept" GroupName="Transitions" Content="Accept" VerticalAlignment="Top" Margin="10,16,-10,0" FontWeight="Bold" Grid.ColumnSpan="2" Checked="RadioButton_Checked"/> | ||
<Label Content="The issue is valid but does not need fixing. It represents accepted technical debt." HorizontalAlignment="Left" Margin="10,36,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content should be in the resource file, IMO
<Label Content="The issue is raised unxpectedly on code that should not trigger an issue." HorizontalAlignment="Left" Margin="10,36,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> | ||
</Grid> | ||
</Border> | ||
<Label Content="Add a comment (optional):" HorizontalAlignment="Left" Margin="25,200,0,0" VerticalAlignment="Top"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SLI window had some formatting info in below the text box. We should at least add a ticket for that feature.
|
||
private void NewMethod(bool showAccept) | ||
{ | ||
BorderWontFix.Visibility = showAccept ? Visibility.Hidden : Visibility.Visible; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my point about hidden buttons above
NewMethod(showAccept); | ||
} | ||
|
||
private void NewMethod(bool showAccept) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewMethod
/// Interaction logic for UserControl1.xaml | ||
/// </summary> | ||
[ContentProperty(nameof(MuteWindowDialog))] | ||
[ExcludeFromCodeCoverage] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UI Code not testable
<value>Mark Issue as Resolved on SonarQube</value> | ||
</data> | ||
<data name="MuteWindow_WontFixContent" xml:space="preserve"> | ||
<value>The issue is valid but does not need fixing. It represents accepted technical debt.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same content as Accept 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I'll talk about it with Marco during the meet
|
||
<Border BorderBrush="Black" Name="BorderAccept" BorderThickness="1" HorizontalAlignment="Left" Height="75" Margin="25,25,0,0" VerticalAlignment="Top" Width="450" Visibility="{Binding AcceptVisibility}"> | ||
<Grid> | ||
<RadioButton Name="rbAccept" GroupName="Transitions" Content="{x:Static resx:Strings.MuteWindow_AcceptTitle}" VerticalAlignment="Top" Margin="10,16,-10,0" FontWeight="Bold" Grid.ColumnSpan="2" Checked="RadioButton_Checked"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Radio button stye (and possibly others) is duplicated.
,115,0,0" VerticalAlignment="Top" Width="450"> | ||
<Grid> | ||
<RadioButton x:Name="rbFalsePositive" GroupName="Transitions" Content="{x:Static resx:Strings.MuteWindow_FalsePositiveTitle}" VerticalAlignment="Top" Margin="10,16,-10,0" FontWeight="Bold" Grid.ColumnSpan="2" Checked="RadioButton_Checked"/> | ||
<Label Content="{x:Static resx:Strings.MuteWindow_FalsePositiveContent}" HorizontalAlignment="Left" Margin="10,36,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style duplication
{ | ||
switch (sender) | ||
{ | ||
case var value when value == rbWontFix: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocker: Could be replaced with a dictionary that would look nicer
<Label Content="{x:Static resx:Strings.MuteWindow_CommentLabel}" HorizontalAlignment="Left" Margin="25,200,0,0" VerticalAlignment="Top"/> | ||
<TextBox Name="txtComment" HorizontalAlignment="Center" Height="60" Margin="0,225,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="450"/> | ||
<Button Name="Cancel" Content="{x:Static resx:Strings.MuteWindow_CancelButton}" Padding="5,1" HorizontalAlignment="Left" Margin="300,300,0,0" VerticalAlignment="Top" Click="Cancel_Click"/> | ||
<Button Name="Submit" Content="{x:Static resx:Strings.MuteWindow_SubmitButton}" Padding="5,1" HorizontalAlignment="Left" Margin="360,300,0,0" VerticalAlignment="Top" Click="Submit_Click"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This style is not duplicated, however, it's hard to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, actually it is duplicated from the Cancel button
<TextBox Name="txtComment" HorizontalAlignment="Center" Height="60" Margin="0,225,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="450"/> | ||
<Button Name="Cancel" Content="{x:Static resx:Strings.MuteWindow_CancelButton}" Padding="5,1" HorizontalAlignment="Left" Margin="300,300,0,0" VerticalAlignment="Top" Click="Cancel_Click"/> | ||
<Button Name="Submit" Content="{x:Static resx:Strings.MuteWindow_SubmitButton}" Padding="5,1" HorizontalAlignment="Left" Margin="360,300,0,0" VerticalAlignment="Top" Click="Submit_Click"> | ||
<Button Name="Cancel" Content="{x:Static resx:Strings.MuteWindow_CancelButton}" Style="{StaticResource ButtonStyle}" Margin="300,300,0,0" Click="Cancel_Click"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these margins not part of the style definition? Btw you can also inherit styles and override certain properties in style definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
margins are different in each component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can define style as (I don't remember wpf syntax, so I will explain this with C# objects :-) )
style AcceptButton : GenericButton
{
override Margin Margin = "1, 2, 3, 4"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting a property in a common place for only one component does not make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does. You separate styling from layout. Easier to read, easier to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a property and overriding it later create more noise IMO. Another solution would be creating a common style and child styles for each specific component based on the common one. Which would be an overkill in this situation just makes reading code harder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but now you have styling split between the style resources and the layout elements, which is IMO more confusing and harder to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussing this takes more time than changing and I do not feel strongly about it so done.
<Label Content="{x:Static resx:Strings.MuteWindow_FalsePositiveContent}" Style="{StaticResource TransitionLabelStyle}" /> | ||
</Grid> | ||
</Border> | ||
<Label Content="{x:Static resx:Strings.MuteWindow_CommentLabel}" Style="{StaticResource LabelStyle}" Margin="25,200,0,0"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LabelStyle is only used once, margin can be moved there
</Grid> | ||
</Border> | ||
<Label Content="{x:Static resx:Strings.MuteWindow_CommentLabel}" Style="{StaticResource LabelStyle}" Margin="25,200,0,0"/> | ||
<TextBox Name="txtComment" HorizontalAlignment="Center" Height="60" Margin="0,225,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="450"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Styles in the layout
</Grid> | ||
</Border> | ||
|
||
<Border Name="BorderAccept" Style="{StaticResource BorderStyle}" Margin="25,25,0,0" Visibility="{Binding AcceptVisibility}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This margin value is used twice. There's only one BorderStyle instance with a different Mragin value. You can set this one as the default, and override it once at line 75
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
45a093a
into
feature/mute-server-issues
Fixes #5032