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

ALSO-5603 Add parameter hiding autocomplete options from the UI #13834

Merged
merged 5 commits into from
Mar 29, 2023

Conversation

spodo99
Copy link
Contributor

@spodo99 spodo99 commented Mar 17, 2023

Please Note:

  1. Before submitting the PR, please review How to Contribute to Dynamo
  2. Dynamo Team will meet 1x a month to review PRs found on Github (Issues will be handled separately)
  3. PRs will be reviewed from oldest to newest
  4. If a reviewed PR requires changes by the owner, the owner of the PR has 30 days to respond. If the PR has seen no activity by the next session, it will be either closed by the team or depending on its utility will be taken over by someone on the team
  5. PRs should use either Dynamo's default PR template or one of these other template options in order to be considered for review.
  6. PRs that do not have one of the Dynamo PR templates completely filled out with all declarations satisfied will not be reviewed by the Dynamo team.
  7. PRs made to the DynamoRevit repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after a LGTM label is added to the PR.

Purpose

The new flag is added to the setting to hide new autocomplete method options, if it will be requested by the users. Per conversation at https://autodesk.slack.com/archives/C1866AFQB/p1679067914031959

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated

Release Notes

(FILL ME IN) Brief description of the fix / enhancement. Mandatory section

Reviewers

(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)

(FILL ME IN, optional) Any additional notes to reviewers or testers.

FYIs

(FILL ME IN, Optional) Names of anyone else you wish to be notified of

/// <summary>
/// If true, autocomplete method options are hidden from UI
/// </summary>
public bool HideAutocompleteMethodOptions { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pinzart @mjkkirschner Is this allowed to add new params in this class?

Copy link
Contributor

@pinzart90 pinzart90 Mar 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://learn.microsoft.com/en-us/dotnet/core/compatibility/library-change-rules
looks at DISALLOWED: Adding an instance field to a struct that has no nonpublic fields

If a struct has only public fields or has no fields at all...
Adding any new fields - public or nonpublic - to such a struct is a source breaking change for these callers, as the compiler will now require the additional fields to be initialized.

@mjkkirschner
Copy link
Member

mjkkirschner commented Mar 18, 2023 via email

@pinzart90
Copy link
Contributor

pinzart90 commented Mar 19, 2023

But doesn’t a bool have a default value ?

It does, but that is not the issue. Try this code in c#:

using System;
				
public struct Test {
	
	public int a; // Was added in version 1.0.0
	public double b; // Was added version 1.0.0
	public bool c;// Was added in version 1.0.1 (breakin change)
}

public class Program
{
	public static void Main()
	{
		Test m;
		
		m.a = 3;
		m.b = 0.4;
		Console.WriteLine(m); // Compilation error (line 18, col 21): Use of unassigned local variable 'm'
	}
}

If you remove the breaking change, you will see that the code compiles

@spodo99
Copy link
Contributor Author

spodo99 commented Mar 20, 2023

@pinzart90 Got it, sorry, in C++ it would fail only if you use initializer list...
How would be better to pass this parameter then? Using new argument to DynamoViewModel::Start() function and DynamoViewModel constructor?

@pinzart90
Copy link
Contributor

pinzart90 commented Mar 20, 2023

@pinzart90 Got it, sorry, in C++ it would fail only if you use initializer list... How would be better to pass this parameter then? Using new argument to DynamoViewModel::Start() function and DynamoViewModel constructor?

I don't know strict we've been in the past about this case. I think we've done this before without knowing it is a breaking change.
The way we've extended startup params is to add a new Interface to the Preferences class. There are quite a few now, looke at the interfaces here https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoCore/Configuration/IPreferences.cs

@spodo99 spodo99 requested review from pinzart90 and QilongTang and removed request for pinzart90 and QilongTang March 20, 2023 15:15
/// Temporary interface to avoid breaking changes.
/// TODO: Merge with StartupConfiguration for 3.0 (DYN-1699)
/// </summary>
internal interface IHideAutocompleteMethodOptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@QilongTang if there are plans to introduce new options like this one, maybe we can put it in the same place before the next release.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pinzart90 I don't think we do currently, we intend to use Launchdarkly to control beta features and UI aspects in general.

@pinzart90 pinzart90 requested a review from mjkkirschner March 22, 2023 01:22
@pinzart90
Copy link
Contributor

@mjkkirschner any other ideas besides yet another interface ?

@mjkkirschner
Copy link
Member

@mjkkirschner any other ideas besides yet another interface ?

no better ideas, except perhaps just modifying the concrete type.

@mjkkirschner
Copy link
Member

@QilongTang
Copy link
Contributor

QilongTang commented Mar 22, 2023

@mjkkirschner any other ideas besides yet another interface ?

@pinzart @mjkkirschner I think startup params should also work for them right? See https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoSandbox/DynamoCoreSetup.cs#L40, I guess when Alias launching DynamoSandbox, they can pass in param to modify certain feature sets. Essentially, this might just be similar to the existing approach anyway

@mjkkirschner
Copy link
Member

mjkkirschner commented Mar 22, 2023

Do you mean a startup configuration param? (which is a struct - and had the issue Tibi identified) ? or did you mean a new CLI argument? Or both?

I think that like Tibi said, it's an API break, but it's unclear to me who would be affected.

IMO The new preference is safer, the startup config option seems more idiomatic in our repo at the cost of integrators potentially having runtime or compile time failures. (unlikely I guess).

Perhaps we should add a constructor for these structs - @pinzart90 would that avoid this issue in the future?

@spodo99
Copy link
Contributor Author

spodo99 commented Mar 22, 2023

@mjkkirschner Added missing option to the new setting file

@mjkkirschner
Copy link
Member

mjkkirschner commented Mar 29, 2023

Hi @spodo99 it looks good to me. I guess ideally it would be good to add a test that asserts the UI is actually hidden or that the preferences file actually modifies the view model ? I know UI tests are sometimes painful to write in wpf.

Perhaps because of the time constraints here you could merge this and send a followup for a UI test if it's straightforward enough to write - maybe something like this test:
https://github.com/DynamoDS/Dynamo/blob/master/test/DynamoCoreWpfTests/CoreUITests.cs#L760

Copy link
Member

@mjkkirschner mjkkirschner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test failure is a flaky ui test.

@QilongTang QilongTang added this to the 2.18.0 milestone Mar 29, 2023
@QilongTang QilongTang merged commit 1167f83 into DynamoDS:master Mar 29, 2023
@QilongTang
Copy link
Contributor

QilongTang commented Mar 29, 2023

As communicated internally, we will make a 2.17.2 release for this, so this needs to be cherry-picked to https://github.com/DynamoDS/Dynamo/tree/RC2.17.2_master

@spodo99
Copy link
Contributor Author

spodo99 commented Mar 30, 2023

@mjkkirschner , @avidit found that I missed several option controls in the Preferences menu. I created a PR #13859 fixing this. I control visibility of the entire StackPanel containing all ML controls now. Could you please merge it with 2.17.2 as well, if it's ok?
I will create unit tests later as it was proposed...

sm6srw pushed a commit to sm6srw/Dynamo that referenced this pull request Mar 31, 2023
…moDS#13834)

* ALSO-5603 Add parameter hiding autocomplete options from the UI

* ALSO-5603 Use IPreferences for hide autocomplete option

This needs to avoid breaking compatibility

* ALSO-5603 Add hide autocomplete option to the settings

* ALSO-5603 Fix unit test
@sm6srw sm6srw mentioned this pull request Mar 31, 2023
8 tasks
QilongTang pushed a commit that referenced this pull request Mar 31, 2023
* ALSO-5603 Add parameter hiding autocomplete options from the UI (#13834)

* ALSO-5603 Add parameter hiding autocomplete options from the UI

* ALSO-5603 Use IPreferences for hide autocomplete option

This needs to avoid breaking compatibility

* ALSO-5603 Add hide autocomplete option to the settings

* ALSO-5603 Fix unit test

* ALSO-5603 Hide missing ML complete controls if hiding option is set (#13859)

---------

Co-authored-by: spodo99 <[email protected]>
sm6srw pushed a commit that referenced this pull request Apr 5, 2023
* ALSO-5603 Add parameter hiding autocomplete options from the UI

* ALSO-5603 Use IPreferences for hide autocomplete option

This needs to avoid breaking compatibility

* ALSO-5603 Add hide autocomplete option to the settings

* ALSO-5603 Fix unit test
@spodo99 spodo99 deleted the spodo/ALSO-5603 branch April 25, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants