Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 17 additions & 11 deletions cmf-cli/Commands/new/iot/GenerateTaskCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,23 @@ private TaskValues HandleTask(TaskValues task)
string[] taskLibraryDependsOnProtocols = taskLibraryPkgJson.criticalManufacturing.tasksLibrary.dependsOnProtocol.ToObject<string[]>();
string[] taskLibraryDependsOnScope = taskLibraryPkgJson.criticalManufacturing.tasksLibrary.dependsOnScope.ToObject<string[]>();

task.DependsOnProtocol = AnsiConsole.Prompt(
new MultiSelectionPrompt<string>()
.Title("Is this task specific for any protocol?")
.NotRequired()
.AddChoices(taskLibraryDependsOnProtocols));

task.DependsOnScope = AnsiConsole.Prompt(
new MultiSelectionPrompt<string>()
.Title("On which scopes this library can be used")
.NotRequired()
.AddChoices(taskLibraryDependsOnScope));
if (taskLibraryDependsOnProtocols.Length > 0)
{
task.DependsOnProtocol = AnsiConsole.Prompt(
new MultiSelectionPrompt<string>()
.Title("Is this task specific for any protocol?")
.NotRequired()
.AddChoices(taskLibraryDependsOnProtocols));
}

if (taskLibraryDependsOnScope.Length > 0)
{
task.DependsOnScope = AnsiConsole.Prompt(
new MultiSelectionPrompt<string>()
.Title("On which scopes this library can be used")
.NotRequired()
.AddChoices(taskLibraryDependsOnScope));
}

if (ExecutionContext.Instance.ProjectConfig.MESVersion.Major >= 12)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Specs/New.cs
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ public void IoTTask(string mesVersion, string taskBaseClass)
consoleTask.Input.PushTextWithEnter(""); // icon class name (default)
consoleTask.Input.PushTextWithEnter(""); // isProtocol: No (default false)
consoleTask.Input.PushTextWithEnter(""); // lifecycle: Productive (first selection prompt option)
consoleTask.Input.PushTextWithEnter(""); // dependsOnProtocol (MultiSelect)
consoleTask.Input.PushTextWithEnter(""); // dependsOnScope (MultiSelect, 1 choice "ConnectIoT"): no selection + confirm
// dependsOnProtocol is skipped: task library has no protocols (empty list from library setup)
consoleTask.Input.PushTextWithEnter(""); // dependsOnScope MultiSelect (library has ["ConnectIoT"]): no selection + confirm

if (isMesV12)
{
Expand Down
Loading