microsoft-performance-toolkit-sdk icon indicating copy to clipboard operation
microsoft-performance-toolkit-sdk copied to clipboard

Add support for specifying if a table command can be executed

Open mslukebo opened this issue 2 years ago • 0 comments

Is your feature request an entirely new concept? Yes - I am proposing adding a method for table authors to supply logic for if a table command can be executed.

Is your feature request related to an existing component? Yes - it is related to the already existing ITableBuilder.AddTableCommand method.

Is your feature request related to a problem? Please describe. Yes. Currently, table authors cannot provide hints on if a table command can successfully execute. For example, a table command may only make sense if certain rows are passed in.

Describe the solution you'd like Add a new method to ITableBuilder:

ITableBuilder AddTableCommand(string commandName, TableCommandCallback callback, Predicate<IReadOnlyList<int>> canExecute);

Calling the regular AddTableCommand(string commandName, TableCommandCallback callback) would implicitly call AddTableCommand(string commandName, TableCommandCallback callback, (IReadOnlyList<int>> _) => true) in existing implementations.

(Alternatively, instead of using the Predicate definition, there can be a new TableCommandCanExecute delegate to follow the existing pattern).

mslukebo avatar Apr 14 '22 15:04 mslukebo