renciso218 / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

Request: Warning icon to indicate a problem with a block #55

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

This is a feature request, for a warning and error icon similar to the comment 
icon when a block has a comment. Essentially we keep finding the need to 
indicate to the user that there is an issue with one of the blocks, and we 
don't have a good way to do this. 

Thanks,

Dave

Original issue reported on code.google.com by dtyre...@gmail.com on 10 Jul 2012 at 8:34

GoogleCodeExporter commented 8 years ago
This has always been something I've been intending to add.  The funny thing is 
that every time I think we need this, it turns out that I'm designing something 
badly.  To date I've not encountered a situation where a warning icon is 
actually needed.

Blockly's design philosophy is that everything is legal.  There are no syntax 
errors.  If something is wrong, Blockly should fix it.  For example, Blockly 
simply won't let you plug "Hello" into the square root block.  There's no "type 
mismatch" warning, it just won't happen.  Another example, Blockly will quietly 
delete all function calls when a function definition is deleted.  There's no 
"unknown function" warning, it just won't happen.

I've seen enough of these issues appear, and been resolved without a warning, 
that I'm reluctant to add this warning icon.  Making Blockly always legal does 
take more work, but I think it's worth it.  Tell me what your circumstances 
are.  Can you think of an always legal way to structure your issue?

BTW, Blockly's warning icon would be a blue triangle with an exclamation mark 
in it.  Right next to the circular comment icon and the square edit icon.

Original comment by neil.fra...@gmail.com on 11 Jul 2012 at 12:40

GoogleCodeExporter commented 8 years ago

Original comment by neil.fra...@gmail.com on 18 Jul 2012 at 9:02

GoogleCodeExporter commented 8 years ago
Hi, sorry for the delayed response ... 

I do generally agree with you, that a warning icon shouldn't be required. 

Our issue is around a fairly painful use case. We have wrapped Blockly around a 
DSL for building out virtual servers. The problem is that Blockly is part of a 
much bigger system, and sometimes we can't easily verify that an issue exists 
until we run the associated logic, or that we have inter-dependencies between 
various UI interfaces.

Here are the two scenarios:

Scenario 1:

So the scenario where we want warning icon is because of a dependency between 
Blockly and another component. Essentially we are building an interface to help 
setup virtual servers. And as part of doing this the user has the option of 
uploading files to a virtual server after its been built. The user can upload 
files to our website and switch to another tab on the webpage to build the 
Blockly related script.  The Blockly block for what file to upload is a drop 
down which is populated based on certain criteria for the specific virtual 
server. 

We've done our best to make Blockly stay consistent with the list of uploaded 
files, but we've found that if a user moves the file upload block around to a 
different server or there are no files uploaded we end up in an inconsistent 
state where a file can't be specified. We don't want to require the user to 
upload a file before placing a file upload block, but we also want the user to 
know there is an issue, in a gentle way, if no file has been specified. 

Scenario 2:

We've partially implemented a debug interface for our capability to build out 
virtual servers, so that a user can step through the build out process to see 
what is happening. But if something goes wrong, we'd like to highlight the 
specific block where the issue exists, and provide the user with some insight 
as to how to fix the issue. Our current method is to have a pop-up dialog box 
which follows along as the user steps through the process.

Original comment by dtyre...@gmail.com on 19 Jul 2012 at 2:37

GoogleCodeExporter commented 8 years ago
Point taken.  Reopening bug.

Original comment by neil.fra...@gmail.com on 20 Jul 2012 at 6:27

GoogleCodeExporter commented 8 years ago
Done (r373).  Just call block.setWarningText('Ahhh!') to create a warning, or 
pass null to remove the warning (same as comments).  See the break/continue 
block for an example; a warning appears if it is not nested in a loop.

Original comment by neil.fra...@gmail.com on 28 Jul 2012 at 6:54

GoogleCodeExporter commented 8 years ago
Thanks! That is awesome!

Original comment by dtyre...@gmail.com on 28 Jul 2012 at 4:32