Skip to content

Commit

Permalink
Force newDashboard default on the CI-built packages. (#6680)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwu-tow authored May 15, 2023
1 parent 41bb52c commit 7748289
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/gui/view/documentation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,27 @@
//!
//! [`Tailwind CSS`]: https://tailwindcss.com/
#![recursion_limit = "1024"]
// === Features ===
#![feature(drain_filter)]
#![feature(option_result_contains)]
// === Standard Linter Configuration ===
#![deny(non_ascii_idents)]
#![warn(unsafe_code)]
#![allow(clippy::bool_to_int_with_if)]
#![allow(clippy::let_and_return)]
// === Non-Standard Linter Configuration ===
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
#![warn(trivial_casts)]
#![warn(trivial_numeric_casts)]
#![warn(unsafe_code)]
#![warn(unused_import_braces)]
#![warn(unused_qualifications)]
#![recursion_limit = "1024"]

use ensogl::prelude::*;
use ensogl::system::web::traits::*;

use graph_editor::component::visualization;
use ide_view_graph_editor as graph_editor;

use enso_frp as frp;
use enso_suggestion_database::documentation_ir::EntryDocumentation;
use ensogl::animation::physics::inertia::Spring;
Expand All @@ -55,16 +53,18 @@ use ensogl::Animation;
use ensogl_component::shadow;
use ensogl_derive_theme::FromTheme;
use ensogl_hardcoded_theme::application::component_browser::documentation as theme;
use graph_editor::component::visualization;
use ide_view_graph_editor as graph_editor;
use web::HtmlElement;
use web::JsCast;

pub mod html;


// ==============
// === Export ===
// ==============

pub mod html;

pub use visualization::container::overlay;


Expand Down
8 changes: 8 additions & 0 deletions build/base/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ pub fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result {
wrappers::write(&path, &contents)
}

/// Read the file file, deserializing JSON text into the data.
#[context("Failed to deserialize JSON from path: {}", path.as_ref().display())]
pub fn read_json<T: DeserializeOwned>(path: impl AsRef<Path>) -> Result<T> {
let contents = read_to_string(&path)?;
serde_json::from_str(&contents)
.with_context(|| format!("Failed to parse JSON from {}", path.as_ref().display()))
}

/// Serialize the data to JSON text and write it to the file.
///
/// See [`write()`].
Expand Down
3 changes: 3 additions & 0 deletions build/build/paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
lib/:
client/:
content/:
content-config/:
src/:
config.json:
icons/:
project-manager/:
build/:
Expand Down
31 changes: 31 additions & 0 deletions build/build/src/project/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ impl IsWatcher<Gui> for Watcher {
}
}

/// Override the default value of `newDashboard` in `config.json` to `true`.
///
/// This is a temporary workaround. We want to enable the new dashboard by default in the CI-built
/// IDE, but we don't want to enable it by default in the IDE built locally by developers.
pub fn override_default_for_authentication(
path: &crate::paths::generated::RepoRootAppIdeDesktopLibContentConfigSrcConfigJson,
) -> Result {
let json_path = ["groups", "featurePreview", "options", "newDashboard", "value"];
let mut json = ide_ci::fs::read_json::<serde_json::Value>(path)?;
let mut current =
json.as_object_mut().ok_or_else(|| anyhow!("Failed to find object in {:?}", path))?;
for key in &json_path[..json_path.len() - 1] {
current = current
.get_mut(*key)
.with_context(|| format!("Failed to find {key:?} in {path:?}"))?
.as_object_mut()
.with_context(|| format!("Failed to find object at {key:?} in {path:?}"))?;
}
current.insert(json_path.last().unwrap().to_string(), serde_json::Value::Bool(true));
ide_ci::fs::write_json(path, &json)?;
Ok(())
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Gui;
Expand All @@ -109,6 +131,15 @@ impl IsTarget for Gui {
) -> BoxFuture<'static, Result<Self::Artifact>> {
let WithDestination { inner, destination } = job;
async move {
// TODO: [mwu]
// This is a temporary workaround until https://github.com/enso-org/enso/issues/6662
// is resolved.
if ide_ci::actions::workflow::is_in_env() {
let path = &context.repo_root.app.ide_desktop.lib.content_config.src.config_json;
warn!("Overriding default for authentication in {}", path.display());
override_default_for_authentication(path)?;
}

let ide = ide_desktop_from_context(&context);
let wasm = Wasm.get(context, inner.wasm);
let content_env =
Expand Down
6 changes: 6 additions & 0 deletions lib/rust/ensogl/component/spinner/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
//! An animated spinner component that can be used to indicate that a process
//! is running.
// === Standard Linter Configuration ===
#![deny(non_ascii_idents)]
#![warn(unsafe_code)]
#![allow(clippy::bool_to_int_with_if)]
#![allow(clippy::let_and_return)]

use ensogl_core::display::shape::*;
use ensogl_core::prelude::*;

Expand Down

0 comments on commit 7748289

Please sign in to comment.