Force newDashboard default on the CI-built packages. (#6680)

This commit is contained in:
Michał Wawrzyniec Urbańczyk 2023-05-15 04:03:09 +02:00 committed by GitHub
parent 41bb52c901
commit 7748289873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 7 deletions

View File

@ -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;
@ -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;

View File

@ -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()`].

View File

@ -18,6 +18,9 @@
lib/:
client/:
content/:
content-config/:
src/:
config.json:
icons/:
project-manager/:
build/:

View File

@ -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;
@ -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 =

View File

@ -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::*;