Hide error message on execution success (#7268)

Closes #7003

Hides annoying "Execution failed" message when the execution is fixed (when we receive ExecutionComplete message)

Also renamed `ExecutionFinished` notification to `ExecutionComplete`, to better reflect the new behavior.


https://github.com/enso-org/enso/assets/6566674/156e19f8-3cdd-4b60-98fb-565746650343
This commit is contained in:
Ilya Bogdanov 2023-07-14 19:35:07 +03:00 committed by GitHub
parent 383514ee97
commit 3273ab654d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 21 deletions

View File

@ -180,8 +180,8 @@ pub enum Notification {
ConnectionLost(BackendConnection), ConnectionLost(BackendConnection),
/// Indicates that the project VCS status has changed. /// Indicates that the project VCS status has changed.
VcsStatusChanged(VcsStatus), VcsStatusChanged(VcsStatus),
/// Indicates that the project has finished execution. /// Indicates that the project has finished execution sucessfully.
ExecutionFinished, ExecutionComplete,
/// Indicates failure of the project execution. /// Indicates failure of the project execution.
ExecutionFailed, ExecutionFailed,
} }

View File

@ -576,7 +576,7 @@ impl Project {
Event::Notification(Notification::ExecutionStatus(_)) => {} Event::Notification(Notification::ExecutionStatus(_)) => {}
Event::Notification(Notification::ExecutionComplete { context_id }) => { Event::Notification(Notification::ExecutionComplete { context_id }) => {
execution_update_handler(context_id, ExecutionUpdate::Completed); execution_update_handler(context_id, ExecutionUpdate::Completed);
publisher.notify(model::project::Notification::ExecutionFinished); publisher.notify(model::project::Notification::ExecutionComplete);
} }
Event::Notification(Notification::ExpressionValuesComputed(_)) => { Event::Notification(Notification::ExpressionValuesComputed(_)) => {
// the notification is superseded by `ExpressionUpdates`. // the notification is superseded by `ExpressionUpdates`.

View File

@ -40,17 +40,18 @@ const OPEN_PROJECT_SPINNER_PROGRESS: f32 = 0.8;
#[allow(unused)] #[allow(unused)]
#[derive(Debug)] #[derive(Debug)]
struct Model { struct Model {
controller: controller::Project, controller: controller::Project,
module_model: model::Module, module_model: model::Module,
graph_controller: controller::ExecutedGraph, graph_controller: controller::ExecutedGraph,
ide_controller: controller::Ide, ide_controller: controller::Ide,
view: view::project::View, view: view::project::View,
status_bar: view::status_bar::View, status_bar: view::status_bar::View,
graph: presenter::Graph, graph: presenter::Graph,
code: presenter::Code, code: presenter::Code,
searcher: RefCell<Option<Box<dyn SearcherPresenter>>>, searcher: RefCell<Option<Box<dyn SearcherPresenter>>>,
available_projects: Rc<RefCell<Vec<(ImString, Uuid)>>>, available_projects: Rc<RefCell<Vec<(ImString, Uuid)>>>,
shortcut_transaction: RefCell<Option<Rc<model::undo_redo::Transaction>>>, shortcut_transaction: RefCell<Option<Rc<model::undo_redo::Transaction>>>,
execution_failed_process_id: Rc<Cell<Option<view::status_bar::process::Id>>>,
} }
impl Model { impl Model {
@ -74,6 +75,7 @@ impl Model {
let searcher = default(); let searcher = default();
let available_projects = default(); let available_projects = default();
let shortcut_transaction = default(); let shortcut_transaction = default();
let execution_failed_process_id = default();
Model { Model {
controller, controller,
module_model, module_model,
@ -86,6 +88,7 @@ impl Model {
searcher, searcher,
available_projects, available_projects,
shortcut_transaction, shortcut_transaction,
execution_failed_process_id,
} }
} }
@ -240,15 +243,20 @@ impl Model {
self.view.graph().model.breadcrumbs.set_project_changed(changed); self.view.graph().model.breadcrumbs.set_project_changed(changed);
} }
fn execution_finished(&self) { fn execution_complete(&self) {
self.view.graph().frp.set_read_only(false); self.view.graph().frp.set_read_only(false);
self.view.graph().frp.execution_finished.emit(()); self.view.graph().frp.execution_complete.emit(());
if let Some(id) = self.execution_failed_process_id.get() {
self.status_bar.finish_process(id);
}
} }
fn execution_failed(&self) { fn execution_failed(&self) {
let message = crate::EXECUTION_FAILED_MESSAGE; let message = crate::EXECUTION_FAILED_MESSAGE;
let message = view::status_bar::event::Label::from(message); let message = view::status_bar::process::Label::from(message);
self.status_bar.add_event(message); self.status_bar.add_process(message);
let id = self.status_bar.last_process.value();
self.execution_failed_process_id.set(Some(id));
} }
fn execution_context_interrupt(&self) { fn execution_context_interrupt(&self) {
@ -511,8 +519,8 @@ impl Project {
Notification::VcsStatusChanged(VcsStatus::Clean) => { Notification::VcsStatusChanged(VcsStatus::Clean) => {
model.set_project_changed(false); model.set_project_changed(false);
} }
Notification::ExecutionFinished => { Notification::ExecutionComplete => {
model.execution_finished(); model.execution_complete();
} }
Notification::ExecutionFailed => { Notification::ExecutionFailed => {
model.execution_failed(); model.execution_failed();

View File

@ -36,7 +36,7 @@ pub fn init_frp(frp: &Frp, model: &Rc<GraphEditorModel>) {
frp.set_read_only <+ selector.play_press.constant(true); frp.set_read_only <+ selector.play_press.constant(true);
// === Play Button === // === Play Button ===
selector.reset_play_button_state <+ frp.execution_finished; selector.reset_play_button_state <+ frp.execution_complete;
// === Layout === // === Layout ===

View File

@ -600,7 +600,7 @@ ensogl::define_endpoints_2! {
set_available_execution_environments (Rc<Vec<ExecutionEnvironment>>), set_available_execution_environments (Rc<Vec<ExecutionEnvironment>>),
switch_to_design_execution_environment(), switch_to_design_execution_environment(),
switch_to_live_execution_environment(), switch_to_live_execution_environment(),
execution_finished(), execution_complete(),
// === Debug === // === Debug ===