typedb / typedb-studio

TypeDB Studio (IDE)
https://typedb.com
Mozilla Public License 2.0
191 stars 44 forks source link

Prompt user when running file with schema/data writes that aren't allowed in the current configuration #587

Open gitvge opened 2 years ago

gitvge commented 2 years ago

Please replace every line in curly brackets ( { like this } ) with appropriate answers, and remove this line.

Problem to Solve

The user has to manually select the transaction

Current Workaround

Manually select

Proposed Solution

System checks the top declared operation in the active tab and propses the transaction, e.g. match --> data read insert --> data write define --> schema write

Additional Information

no

alexjpwalker commented 2 years ago

Thanks for the report. Yeah, I think this UX can be improved. Currently it just gives you an error when your session and transaction type are wrong, and actually it even connects to the server to retrieve that error.

We should pop up a simple confirmation dialog that says, if the file contains a define or undefine query:

This file contains a define query, which requires a schema session and a write transaction.

If the file contains an insert, delete or update query:

This file contains an insert query, which requires a write transaction.

(obviously, the confirmation dialog should say the correct query type that was actually found in the file.)

This confirmation dialog won't offer to change the session/transaction type itself because we can not predict the precise configuration desired by the user - it will simply have an "OK" button (the default, and only, button in the confirmation dialog).