Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Error Visualizations #1215

Merged
merged 20 commits into from
Feb 23, 2021
Merged

Error Visualizations #1215

merged 20 commits into from
Feb 23, 2021

Conversation

farmaazon
Copy link
Collaborator

@farmaazon farmaazon commented Feb 19, 2021

Pull Request Description

  • Create new visualization for errors
  • The error visualizations are automatically displayed when the error on node is set.
  • When node has an error, the visualization container is blocked and not displayed.

Important Notes

Cannot be merged before new Engine's release 0.2.4!

Checklist

Please include the following checklist in your PR:

  • The CHANGELOG.md was updated with the changes introduced in this PR.
  • The documentation has been updated if necessary.
  • All code conforms to the Rust style guide.
  • All code has automatic tests where possible.
  • All code has been profiled where possible.
  • All code has been manually tested in the IDE.
  • All code has been manually tested in the "debug/interface" scene.
  • All code has been manually tested by the PR owner against our test scenarios.
  • All code has been manually tested by at least one reviewer against our test scenarios.

@farmaazon farmaazon self-assigned this Feb 19, 2021
@farmaazon farmaazon added Category: Controllers The Application layer not bound to visual part Category: GUI The Graphical User Interface Difficulty: Core Contributor Should only be attempted by a core contributor Priority: Highest Should be completed ASAP Type: Enhancement An enhancement to the current state of Enso IDE labels Feb 19, 2021
Comment on lines 209 to 210
dataflow.color = Rgba(1.0,0.647,0.0,0.7), Rgba(1.0,0.647,0.0,0.7);
panic.color = Rgba(1.0,0.27,0.0,0.7) , Rgba(1.0,0.27,0.0,0.7);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using .color anywhere else. This is a thee definition, colors are the most basic setting here. We should skip .color imo

Comment on lines 661 to 664
let endpoint = self.view.graph().frp.set_error_visualization_data.clone_ref();
let preprocessor = graph_editor::builtin::visualization::native::error::PREPROCESSOR;
let preprocessor = Some(graph_editor::data::enso::Code::new(preprocessor));
let metadata = Some(visualization::Metadata {preprocessor});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment

Comment on lines 678 to 682
None |
Some(Value ) => None,
Some(DataflowError { trace }) => Some((Kind::Dataflow, None ,trace)),
Some(Panic { message,trace }) => Some((Kind::Panic , Some(message),trace)),
}?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment

let err = || VisualizationAlreadyAttached(node_id);
(!visualizations_map.contains_key(&node_id)).ok_or_else(err)?;

debug!(self.logger, "Attaching visualization on {node_id}.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is node_id just a number? if so, I'd use here "Attaching visualization on node {node_id}." instead.

Comment on lines 1223 to 1225
, endpoint : frp::Any<(graph_editor::NodeId,visualization::Data)>
, node_id : graph_editor::NodeId
) -> impl FnMut(VisualizationUpdateData) -> futures::future::Ready<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment

Comment on lines 1262 to 1275
let metadata_expression = metadata.and_then(|m| m.preprocessor.as_ref().map(|e| e.to_string()));
let default_expression = crate::constants::SERIALIZE_TO_JSON_EXPRESSION;
let expression = metadata_expression.unwrap_or_else(||default_expression.into());
let ast_id = self.get_controller_node_id(node_id)?;
Ok(Visualization{ast_id,expression,id,visualisation_module})
}

fn detach_visualization
( &self
, node_id : graph_editor::NodeId
, visualizations_map : SharedHashMap<graph_editor::NodeId,VisualizationId>
) -> FallibleResult {
debug!(self.logger,"Node editor wants to detach visualization on {node_id}.");
let err = || NoSuchVisualization(node_id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have 4 lambdas here and they are using or not using space after pipes. This should be unified in the codebase. I'd go with no space. If you agree, please add it to styling docs too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we put space everywhere, and it makes sense to me: consider |foo,x,y|foo.blah(x,y), here separating arguments and body would be helpful


eval frp.set_visualization ((t) model.visualization.frp.set_visualization.emit(t));
visualization_enabled <- bool(&frp.disable_visualization,&frp.enable_visualization);
visualization_visible <- visualization_enabled.all_with(&is_error_set, |l,r| *l && !*r);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use visualization_visible <- visualization_enabled && ! is_error_set; instead :) I'm not sure whether we support ! in macros, but if we don't, add it there please. We support && for sure.

};
style.get_color(path)
} else {
color::Lcha::transparent()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it ean that we color error messages as transparent instead of hiding them using display object functions when errors are not provided? If so, we should hide errors by upsetting parents, so we are rendering less things then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transparent color is for animations. But I added code for hinding when animation is complete.

/// visualization won't work (e.g. in case of panics).
pub message : Rc<Option<String>>,
/// Flag indicating that the error is propagated from another node visible on the scene.
pub propagated : Immutable<bool>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you dont need Imutable here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted it to be clone_ref-able, because this structure is heavily propagated trough the FRP network. And deriving CloneRef requires wrapping in immutable.

@farmaazon farmaazon merged commit 76968f2 into develop Feb 23, 2021
@farmaazon farmaazon deleted the wip/ao/error-vis branch February 23, 2021 17:40
mwu-tow pushed a commit to enso-org/enso that referenced this pull request Oct 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Category: Controllers The Application layer not bound to visual part Category: GUI The Graphical User Interface Difficulty: Core Contributor Should only be attempted by a core contributor Priority: Highest Should be completed ASAP Type: Enhancement An enhancement to the current state of Enso IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants