microsoft / BotFramework-Composer

Dialog creation and management for Microsoft Bot Framework Applications
https://docs.microsoft.com/en-us/composer/
MIT License
870 stars 372 forks source link

update dialogFactory to seed default dialog data #839

Closed a-b-r-o-w-n closed 5 years ago

a-b-r-o-w-n commented 5 years ago

The recent work with undo/redo exposed an issue where the form was injecting some data after being created in the visual editor resulting in unnecessary entries into the undo/redo stack.

We should, at a minimum, seed new dialogs with the $designer field fully populated (id, createdAt, updatedAt).

We should also explore not having the form set default values defined in the schema. If the runtime requires these properties be set, then the dialog factory should also set those using the jsonschema library.

boydc2014 commented 5 years ago

Hey, @a-b-r-o-w-n ,

Does this item include the initialization of step as well as dialog itself? I image we will have one central place to handle the creation of step, which is shared between form and visual. The expected result of this is when i add a step in a dialog, there is only one change in dialog json with fully inilizated data. Some complicated initialization process like "SendActivity", should already done before insert into dialog json.

By guaranteeing only one change is made to dialog, we will make undo\redo smooth.

Another scenario which really depends on this is copy & paste. Because copying an item also requires a certain level of construction. For example, when copying a SendActivity, we should create a new template maybe, and copying any item, we should not just copy there id, right?

So the copy processing naturally contains a step of "copy construction“ and the best place to do that is also in this centralized place.

a-b-r-o-w-n commented 5 years ago

Yeah, dialog in this sense is any sdk type. @cwhitten mentioned wanting to work on this item.