Skip to content

Commit

Permalink
Fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
Procrat committed Apr 25, 2023
1 parent b5c1432 commit 5b6ffe8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 23 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
- [File associations are created on Windows and macOS][6077]. This allows
opening Enso files by double-clicking them in the file explorer.
- [Feedback when renaming a project][6366]. When the user tries to rename the
project to an invalid name, a helpful error message is shown and the name is
reverted.
project to an invalid name, a helpful error message is shown and the text
field stays the same as to give the user the opportunity to fix the mistake.

[6366]: https://github.com/enso-org/enso/pull/6366

Expand Down
3 changes: 3 additions & 0 deletions app/gui/controller/engine-protocol/src/common/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ pub mod code {

/// Signals that requested project is already under version control.
pub const VCS_ALREADY_EXISTS: i64 = 1005;

/// Signals that project name is invalid.
pub const PROJECT_NAME_INVALID: i64 = 4001;
}
11 changes: 1 addition & 10 deletions app/gui/src/model/project/synchronized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ use parser::Parser;



// =================
// === Constants ===
// =================

const ERROR_CODE_PROJECT_NAME_INVALID: i64 = 4001;



// =================
// === Profiling ===
// =================
Expand Down Expand Up @@ -725,8 +717,7 @@ impl model::project::API for Project {
let project_name = ProjectName::new_unchecked(name);
project_manager.rename_project(&project_id, &project_name).await.map_err(|error| {
match error {
RpcError::RemoteError(cause)
if cause.code == ERROR_CODE_PROJECT_NAME_INVALID =>
RpcError::RemoteError(cause) if cause.code == code::PROJECT_NAME_INVALID =>
failure::Error::from(ProjectNameInvalid { cause: cause.message }),
error => error.into(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl ProjectNameModel {
let parser = Parser::new();
match parser.parse_line_ast(name).map(|ast| ast.shape().clone()) {
Ok(ast::Shape::Cons(_)) => Ok(()),
_ => Err("The project name should be in Upper_Snake_Case.".to_owned()),
_ => Err("The project name should use the 'Upper_Snake' case.".to_owned()),
}
}

Expand Down
13 changes: 3 additions & 10 deletions app/gui/view/src/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ ensogl::define_endpoints! {
// ============

/// A temporary text message on top of the screen.
#[derive(Debug, Clone, CloneRef)]
#[derive(Debug, Clone, CloneRef, Deref)]
pub struct View {
#[deref]
frp: Frp,
model: Model,
}
Expand All @@ -107,7 +108,7 @@ impl View {
frp::extend! { network
init <- source_();
let scene_shape = app.display.default_scene.shape();
_eval <- all_with(scene_shape, &init, f!([model] (scene_shape, _init)
_eval <- all_with(scene_shape, &init, f!((scene_shape, _init)
model.set_label_position(scene_shape.height);
));

Expand All @@ -134,11 +135,3 @@ impl display::Object for View {
self.model.label.display_object()
}
}

impl Deref for View {
type Target = Frp;

fn deref(&self) -> &Self::Target {
&self.frp
}
}

0 comments on commit 5b6ffe8

Please sign in to comment.