-
Notifications
You must be signed in to change notification settings - Fork 5
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
Object creation with dialogues #115
Conversation
c0e9d97
to
ed84d91
Compare
@colin-grant-work I understand the playwright tests will fail because the creation is now going through a dialog. If it takes a lot of time to make it work (>2 hours), I would choose to disable and park these tests till we refactored to using the form on more forgiving grammar setup (which I discussed with @martin-fleck-at this afternoon). We can accept manual testing these interactions for the coming weeks, since the first thing for April will be implementing the new creation flow anyway. |
@harmen-xb, thanks for the pass :-). It looks like only one test was failing, so it was a quick job to fix them, fortunately. |
@colin-grant-work Is this PR ready to be reviewed? |
@harmen-xb, should be, yes. I believe all creation flows are working without validation errors. |
@colin-grant-work @martin-fleck-at I reviewed the changes and this implementation solves issue #81. That's nice, but not the full scope of the story yet. The key problem we had, is that files were created before the name (and thus id) of the object is known. This was the case in the file explorer and the system diagram. The implementation up till now solves it for the file explorer, but not the diagram. For example, when I create an entity in a system diagram the file is immediately created (NewEntity1.entity.cm for example), before I have entered a functional name and pressed enter. So the file name is incorrect from the start. This problem only exists for Entity objects in the system diagram (a.t.m.). From both starting points (file explorer and system diagram) the end-user will fill in the name (and not the id) of the object. That name should be translated into an id (so strip whitespaces and remove special chars) and use the id as the base for the filename (so add extension). Requested changes:
|
Am I right that this is the crux of the matter? Basically, you're happy with the behavior from the file tree entry point, but would like the same behavior when entering the entity creation flow from a diagram?
Happy to switch this, but I want to make sure that I understand correctly, as I don't believe I changed the validation logic. Here it is on main, and here it is before my first PR. But the goal now is to allow users to input names conforming to the grammar for names and then transform them appropriately for the ID field? |
Yes 😄
Alright, I get your point. I wasn't aware this validation was already on the input of creating files before. From now going forward I would rather only ask the name property of modelled objects to the user and derive the id automatically. The filename should then be {id}.{objectype}.cm. For example a user creates a new entity with the name 'Example Entity', the the id should be 'Example_Entity' and the filename 'Example_Entity.entity.cm'. The filename is validated with this validation: crossmodel/extensions/crossmodel-lang/src/language-server/cross-model-validator.ts Lines 101 to 123 in efc3b7d
The above is true for all modelled objects, but I think the data model itself will deviate, because a data model in essence is a npm package (with a package.json file with a name in it). The name property of the data model has different restrictions because of the use of npm (The "name" field contains your package's name and must be lowercase without any spaces. May contain hyphens, dots, and underscores.) The use of id, name and filename can be confusing I think, but hopefully the above helps. |
ed84d91
to
98522cd
Compare
@harmen-xb, I've pushed one commit that addresses the second of your requests and ensures that all the dialogues have a label for the 'Name' part and a second that addresses the first, that we treat the input as a name - very free in its form - and derive the ID from it. I consider the second commit a bit riskier, since I'm less sure about what structure we want to impose on the name. Regarding the third request, to add the same flow to the entity creation from diagrams, I've asked @martin-fleck-at to have a look at it. Things behave differently in the diagram because we currently create the file before we get any user input at all so that the entity exists for the diagram to refer to - otherwise it goes locks up because of an invalid reference. I'm not as familiar with the GLSP side of things, so Martin has a better chance of getting it done in time for you to have a look at it before the demo. |
Unfortunately I don't have much time to look at the diagram creation right now and focused on #116 instead. I think getting the diagram creation in would be a great next step but I don't believe it should prevent this PR from being merged (as soon as the CI is happy), what do you think @harmen-xb? |
fac6bad
to
6bab3c1
Compare
@colin-grant-work Thanks for the update, entering the name feels much more user friendly. I tested creating all object types, and the creation works but there one issue:
For now I can use this branch as base for the demo, I can work around the issue, but before merging I think this should be resolved. |
Hm... that would be an odd condition. The code just queries the server for referenceable entities in scope. It's possible that the scope computation at the top level (i.e. without any subfolders) goes wrong. I'll take a look at that. |
9c5e1e9
to
6bab3c1
Compare
@harmen-xb, it looks like the current scope computation does not recognize that the directory in which a |
90b545b
to
fc45bd6
Compare
Or maybe it doesn't cause issues with the tests - after my first run failed, subsequent runs passed. Could have been a funny state of the build. |
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.
@colin-grant-work Thanks! Now it works as expected.
This PR adjusts the current dialog system to request all required information before creating a file.
It is an intermediate stage between the current custom dialog system and one based around reuse of the form widget to allow users to create new objects without triggering errors that make the form unusable.
To do