Skip to content

Commit

Permalink
Merge pull request #1529 from finos/fix-settings-persist
Browse files Browse the repository at this point in the history
Fix `settings` key to trigger redraw + container redraw
  • Loading branch information
texodus authored Sep 2, 2021
2 parents 5ad08ca + 9a38104 commit 9a0427a
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 36 deletions.
38 changes: 19 additions & 19 deletions packages/perspective-viewer-d3fc/test/results/results.json
Original file line number Diff line number Diff line change
@@ -1,117 +1,117 @@
{
"__GIT_COMMIT__": "14600c626fbe5c1f7f70386df086f1c95c58b106",
"area_shows_a_grid_without_any_settings_applied": "c66b1b3ceba016bdd7725333201386ef",
"__GIT_COMMIT__": "2abea4a4d77d180c586f60b1c94ea999bca25e20",
"area_shows_a_grid_without_any_settings_applied": "3852532b8ee6abba3373a10d41bb4df2",
"area_displays_visible_columns_": "919cc6f6c2a2f2ec13b90dfb60e1b7ef",
"area_pivot_by_a_row": "7495976cfed69cfe9db2b3fdc6ef4707",
"area_pivot_by_two_rows": "f6f853f3c8aa95b1f0e31900ca6927f8",
"area_pivot_by_a_column": "fdfcee89619d25e503d3efd4d42581c6",
"area_pivot_by_a_row_and_a_column": "804a5bc6a963a961a49ba17631810829",
"area_pivot_by_two_rows_and_two_columns": "7855afa72948ab119f0e5803f9dfb203",
"area_sort_by_a_hidden_column": "d6c9b55cbc5a3932c9992bea6b52b69d",
"area_sort_by_a_hidden_column": "28fd50b76dec63cdcb752845e55c0daf",
"area_sort_by_a_numeric_column": "2fb124a9a32e73fda897a4abe65d2eb4",
"area_sort_by_an_alpha_column": "ba6b0e3c8cf2432419ace85031646c6e",
"area_filters_filters_by_a_numeric_column": "7dff92c06a31d11f8fc340bcfb5fffcd",
"area_filters_filters_by_an_alpha_column": "a45bdbf8ed5240a2e3aa8beb74c43be5",
"area_filters_filters_with__in__comparator": "f4531a4d7a9a981e55391c347bed3e6c",
"bar_shows_a_grid_without_any_settings_applied": "ce89a225aadb50b9f804ebb47a5aaa9d",
"bar_shows_a_grid_without_any_settings_applied": "67433692b144ca07b3171c0f74333afb",
"bar_displays_visible_columns_": "02feeb84263524f1acbaff015d369f55",
"bar_pivot_by_a_row": "0b35d45ec490bcc56a519afc9ed87d67",
"bar_pivot_by_two_rows": "642b4a4c45fef0cc5719a682b661a00d",
"bar_pivot_by_a_column": "a07dc459cf178d767fda55f45c87979b",
"bar_pivot_by_a_row_and_a_column": "8b419bde5e7e23a5902cd2961c198002",
"bar_pivot_by_two_rows_and_two_columns": "d318e63c94cf518665b25522a0ace02a",
"bar_sort_by_a_hidden_column": "a206bc1afb00dee7c3cf9fc910b6af52",
"bar_sort_by_a_hidden_column": "31d8cfb3e1243ad1b322ad0437b2271e",
"bar_sort_by_a_numeric_column": "cf348b1ab0de8f2aa51a7c7bf734ef9d",
"bar_sort_by_an_alpha_column": "827ad95a12fc1a4aea2256aaac308c98",
"bar_filters_filters_by_a_numeric_column": "3a0a6628e8ae24ae602b322ee007a3a8",
"bar_filters_filters_by_an_alpha_column": "742c4a14b33989a9d644445c253a7b60",
"bar_filters_filters_with__in__comparator": "a9b4dbeb4910b7f6cd8481ac0e1eb4a8",
"bar-x_shows_a_grid_without_any_settings_applied": "ee4854bb24b6fea0e8c96ba45ee8b021",
"bar-x_shows_a_grid_without_any_settings_applied": "94aa945b63686cd82c3ef6313ddb4a19",
"bar-x_displays_visible_columns_": "67882a2c76ce9eaa83a7ba364d434974",
"bar-x_pivot_by_a_row": "501875ed4e61cedfb49011b78b12b849",
"bar-x_pivot_by_two_rows": "a796f113b6cf7bc5ec10a60e7b0896f4",
"bar-x_pivot_by_a_column": "52a9b8211c6b263958460f4539401249",
"bar-x_pivot_by_a_row_and_a_column": "f4d5a2729da84676a68aef34fdaf0260",
"bar-x_pivot_by_two_rows_and_two_columns": "6ae8ee1cf77fc59333069f7c9a840c4a",
"bar-x_sort_by_a_hidden_column": "82ce8efea70b512b3ac7fefcb9b1bbb0",
"bar-x_sort_by_a_hidden_column": "ca8fe5a0d7513076028d0f8f590d0020",
"bar-x_sort_by_a_numeric_column": "b3a46f3536eb9d58e738f2825e370370",
"bar-x_sort_by_an_alpha_column": "e562dbae536932a00728f546f78238a5",
"bar-x_filters_filters_by_a_numeric_column": "4004fe31281d735cec230a82d51fec90",
"bar-x_filters_filters_by_an_alpha_column": "d59401b3bd9f84a147418805cdac94f4",
"bar-x_filters_filters_with__in__comparator": "20c666c449ed4353e0b3747d0df2e174",
"bar-themed_shows_a_grid_without_any_settings_applied": "ce89a225aadb50b9f804ebb47a5aaa9d",
"bar-themed_shows_a_grid_without_any_settings_applied": "67433692b144ca07b3171c0f74333afb",
"bar-themed_displays_visible_columns_": "02feeb84263524f1acbaff015d369f55",
"bar-themed_pivot_by_a_row": "0b35d45ec490bcc56a519afc9ed87d67",
"bar-themed_pivot_by_two_rows": "642b4a4c45fef0cc5719a682b661a00d",
"bar-themed_pivot_by_a_column": "a07dc459cf178d767fda55f45c87979b",
"bar-themed_pivot_by_a_row_and_a_column": "8b419bde5e7e23a5902cd2961c198002",
"bar-themed_pivot_by_two_rows_and_two_columns": "d318e63c94cf518665b25522a0ace02a",
"bar-themed_sort_by_a_hidden_column": "a206bc1afb00dee7c3cf9fc910b6af52",
"bar-themed_sort_by_a_hidden_column": "31d8cfb3e1243ad1b322ad0437b2271e",
"bar-themed_sort_by_a_numeric_column": "cf348b1ab0de8f2aa51a7c7bf734ef9d",
"bar-themed_sort_by_an_alpha_column": "827ad95a12fc1a4aea2256aaac308c98",
"bar-themed_filters_filters_by_a_numeric_column": "3a0a6628e8ae24ae602b322ee007a3a8",
"bar-themed_filters_filters_by_an_alpha_column": "742c4a14b33989a9d644445c253a7b60",
"bar-themed_filters_filters_with__in__comparator": "a9b4dbeb4910b7f6cd8481ac0e1eb4a8",
"xyline_shows_a_grid_without_any_settings_applied": "01a9f77fe320b1951553a674b1723a82",
"xyline_shows_a_grid_without_any_settings_applied": "2b30ef59f2b1df2cc9ff27e0b9b07558",
"xyline_displays_visible_columns_": "6da62c5a90dfbdb82da818440e32b3c1",
"xyline_pivot_by_a_row": "c7fbd266e0d14b04e9cc9640e1798acc",
"xyline_pivot_by_two_rows": "c29d414b1a3ec51ae851af64a777f076",
"xyline_pivot_by_a_column": "534394a05cf424b3f4c22b678fe59d1f",
"xyline_pivot_by_a_row_and_a_column": "041dcc94e0b3b6c11837adf80dcd796d",
"xyline_pivot_by_two_rows_and_two_columns": "f88ca02caa1bbb72144fc4e369cd962f",
"xyline_sort_by_a_hidden_column": "97033b7afc476ba9c82ea15da07dcb43",
"xyline_sort_by_a_numeric_column": "478f5a1b8565b31083ba2bc133ef9daf",
"xyline_sort_by_a_numeric_column": "7edb0df1388705c48679a22509191940",
"xyline_sort_by_an_alpha_column": "6bd12f1984008d8a6c46336970d4734d",
"xyline_filters_filters_by_a_numeric_column": "f547b3bc5a6daf4950e2d66599a88b2f",
"xyline_filters_filters_by_an_alpha_column": "1510e8bf12ffdf3f2438ec71e992539d",
"xyline_filters_filters_with__in__comparator": "a5f7431c7eb52dd7ea107d6e064eaf0a",
"line_shows_a_grid_without_any_settings_applied": "4679844d27b79b9c8f5b1e01fcdf2577",
"line_shows_a_grid_without_any_settings_applied": "fbdfe4b2fc5d6a4241ff1ef4643f8b0e",
"line_displays_visible_columns_": "84ef83bb2b11c3dfdfb7ae2d713f8369",
"line_pivot_by_a_row": "d3cd0c19b45b70a17e1b879e7a71ec3a",
"line_pivot_by_two_rows": "f0f0d56f6e88a74392eda2c5fd725ba3",
"line_pivot_by_a_column": "539d8bbda61c73fa905b40d7fe6a410c",
"line_pivot_by_a_row_and_a_column": "ffca8d830a77996548d180b977acc137",
"line_pivot_by_two_rows_and_two_columns": "019d7e1eab317c09512c7a2a37efb373",
"line_sort_by_a_hidden_column": "ba57a48c7539ec709e274494fbdd9d2b",
"line_sort_by_a_hidden_column": "364491f026436ce28be465df22b93896",
"line_sort_by_a_numeric_column": "740d5c07360571f7f97d0ef64cd62999",
"line_sort_by_an_alpha_column": "9b5a6be4e8962de4f4236d9924b332a6",
"line_filters_filters_by_a_numeric_column": "e12b0735f99a033df48a2e22638f57d5",
"line_filters_filters_by_an_alpha_column": "a81b2615bd5adbea4139278e5c67a4cd",
"line_filters_filters_with__in__comparator": "85da1c4539ba34fe943436bc87015b18",
"heatmap_shows_a_grid_without_any_settings_applied": "a8afbd6ee05ee6c62693aa72ca96c35a",
"heatmap_shows_a_grid_without_any_settings_applied": "8caaf87605df8657b88b6117269afb2e",
"heatmap_displays_visible_columns_": "fa784ac2d2e47dadf0f181e4ecdc9beb",
"heatmap_pivot_by_a_row": "2e9ec1b56091ef496dcb26d75aea04a8",
"heatmap_pivot_by_two_rows": "b4e6648239c76912b6f02f00a001a780",
"heatmap_pivot_by_a_column": "b0d022ca6fc6aee155043d4c4f0b5792",
"heatmap_pivot_by_a_row_and_a_column": "d65245f2ee37464fe4d7b1b394006500",
"heatmap_pivot_by_two_rows_and_two_columns": "3683fa65d300b764e314347cc5f0f3e2",
"heatmap_sort_by_a_hidden_column": "0a865ff0268647a39bb676bdc30e9661",
"heatmap_sort_by_a_hidden_column": "49d051ea76ec4c3982c6253eeb343606",
"heatmap_sort_by_a_numeric_column": "971f68d13622caf063b586388a82cb25",
"heatmap_sort_by_an_alpha_column": "2a719fa8f2c3a65c12e640890c5b456b",
"heatmap_filters_filters_by_a_numeric_column": "16a47ac61c27514b0f456e3fd8e0138e",
"heatmap_filters_filters_by_an_alpha_column": "411ed0713ed1b13b16ae88d161233c77",
"heatmap_filters_filters_with__in__comparator": "3aec1e6a17554afe353e0915709ef3d0",
"scatter_shows_a_grid_without_any_settings_applied": "0519cc65006ebd80de93362817a7ce4f",
"scatter_shows_a_grid_without_any_settings_applied": "cf64a7ffdc6f150d1f535cf08679f052",
"scatter_displays_visible_columns_": "0519cc65006ebd80de93362817a7ce4f",
"scatter_pivot_by_a_row": "cf64a7ffdc6f150d1f535cf08679f052",
"scatter_pivot_by_two_rows": "cf64a7ffdc6f150d1f535cf08679f052",
"scatter_pivot_by_a_column": "cf64a7ffdc6f150d1f535cf08679f052",
"scatter_pivot_by_a_row_and_a_column": "cf64a7ffdc6f150d1f535cf08679f052",
"scatter_pivot_by_two_rows_and_two_columns": "cf64a7ffdc6f150d1f535cf08679f052",
"scatter_sort_by_a_hidden_column": "cf64a7ffdc6f150d1f535cf08679f052",
"scatter_sort_by_a_numeric_column": "0519cc65006ebd80de93362817a7ce4f",
"scatter_sort_by_a_numeric_column": "cf64a7ffdc6f150d1f535cf08679f052",
"scatter_sort_by_an_alpha_column": "ba957c960198a41a538d3f3b89083786",
"scatter_filters_filters_by_a_numeric_column": "6de89fad9c22f6524a4587d685c6524d",
"scatter_filters_filters_by_an_alpha_column": "7ae6af961f32ba670348d1ee430dd2e8",
"scatter_filters_filters_with__in__comparator": "36ac5f78331b2f3294afeedd72bafbe9",
"yscatter_shows_a_grid_without_any_settings_applied": "d91578899c568000c64da429b6a59c8f",
"yscatter_shows_a_grid_without_any_settings_applied": "006aa96e87e006a01a0349f0c20ea27a",
"yscatter_displays_visible_columns_": "0bff95a36d9f0a0029599bb7adcc6af8",
"yscatter_pivot_by_a_row": "fb6504a26b1b859619a180b27d35f73b",
"yscatter_pivot_by_two_rows": "5173f9cbe568ecf12105a7ac7ae8783b",
"yscatter_pivot_by_a_column": "452f21d737749a8d4d8de30e505b992a",
"yscatter_pivot_by_a_row_and_a_column": "0f4b71330c78fa47dbf7ede24c352d78",
"yscatter_pivot_by_two_rows_and_two_columns": "7125665243ecb449df59fff0a007f81b",
"yscatter_sort_by_a_hidden_column": "777872d17ff3e81fc6e5d847f7c09283",
"yscatter_sort_by_a_hidden_column": "433cd2e4c9ed23da12834d63059ebd15",
"yscatter_sort_by_a_numeric_column": "8cbfb125c87e447aa9ca02987525d138",
"yscatter_sort_by_an_alpha_column": "4a772843628dd8f3fab9ecf4d8e47988",
"yscatter_filters_filters_by_a_numeric_column": "4f1463e95dbecd493fa4040a6d957447",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"superstore_displays_visible_columns_": "d7cfabd1879d62859ce4fa057ed0a9d1",
"superstore_resets_viewable_area_when_the_logical_size_expands_": "e9dd1d275f46f6a0857e0168835d0b38",
"superstore_resets_viewable_area_when_the_physical_size_expands_": "e469597235cc032619bc095a76f9ad6f",
"__GIT_COMMIT__": "101af7e0b20dc38abbcca11bee824c44ea3a1467",
"superstore_shows_a_grid_without_any_settings_applied": "06fb19ee26c2e0a8fde33538b09b36e3",
"__GIT_COMMIT__": "b279269baf54c6088d84d5ec1fc3b4664b22519d",
"superstore_shows_a_grid_without_any_settings_applied": "9ba7d100dc0f3e91a61668ac2f2ddabb",
"superstore_pivot_by_a_row": "9fdd64446ba41da3c7bd85191e20f946",
"superstore_pivot_by_two_rows": "2191bbeac5fd5fd5b53593e877561b14",
"superstore_pivot_by_a_column": "72448dcee7942e8a294db0b9465d4d2f",
Expand Down
21 changes: 11 additions & 10 deletions rust/perspective-viewer/src/rust/components/active_column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,13 @@ impl Component for ActiveColumn {
ActiveColumnState::Required(label) => (label.clone(), None),
};

match name {
(label, None) => {
let col_type = name
.1
.as_ref()
.and_then(|x| self.props.session.metadata().get_column_table_type(x));

match (name, col_type) {
((label, None), _) => {
classes.push("empty-named");
html! {
<div
Expand All @@ -190,14 +195,7 @@ impl Component for ActiveColumn {
</div>
}
}
(label, Some(name)) => {
let col_type = self
.props
.session
.metadata()
.get_column_table_type(&name)
.expect("Unknown column");

((label, Some(name)), Some(col_type)) => {
let min_cols = self
.props
.renderer
Expand Down Expand Up @@ -309,6 +307,9 @@ impl Component for ActiveColumn {
</div>
}
}
_ => {
html! {}
}
}
}
}
4 changes: 2 additions & 2 deletions rust/perspective-viewer/src/rust/components/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use crate::utils::*;

use futures::channel::oneshot::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::future_to_promise;
use yew::prelude::*;

pub static CSS: &str = include_str!("../../../dist/css/viewer.css");
Expand Down Expand Up @@ -112,7 +111,8 @@ impl Component for PerspectiveViewer {
.toggle_attribute_with_force("settings", self.settings_open)
.unwrap();

false
dispatch_settings_event(&self.props.elem, self.settings_open).unwrap();
true
}
Msg::ToggleSettings(force, resolve) => {
match force {
Expand Down
1 change: 0 additions & 1 deletion rust/perspective-viewer/src/rust/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use std::ops::Deref;
use std::rc::Rc;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_futures::future_to_promise;
use web_sys::*;
use yew::prelude::*;

Expand Down
47 changes: 47 additions & 0 deletions rust/perspective-viewer/test/js/settings.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/

const utils = require("@finos/perspective-test");

const path = require("path");

async function get_contents(page) {
return await page.evaluate(async () => {
const viewer = document.querySelector("perspective-viewer").shadowRoot.querySelector("#app_panel");
return viewer ? viewer.innerHTML : "MISSING";
});
}

utils.with_server({}, () => {
describe.page(
"superstore.html",
() => {
test.capture("opens settings when field is set to true", async page => {
await page.evaluate(async () => {
const viewer = document.querySelector("perspective-viewer");
await viewer.getTable();
await viewer.restore({settings: true});
});

return await get_contents(page);
});

test.capture("opens settings when field is set to false", async page => {
await page.evaluate(async () => {
const viewer = document.querySelector("perspective-viewer");
await viewer.getTable();
await viewer.restore({settings: false});
});

return await get_contents(page);
});
},
{root: path.join(__dirname, "..", "..")}
);
});
6 changes: 4 additions & 2 deletions rust/perspective-viewer/test/results/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"superstore.html/doesn't leak elements.": "d0fd18b3d4d7c183c5ed155b4bf37972",
"superstore.html/doesn't leak views when setting row pivots.": "54daaa4bbbe59f6ed4acc301ba871bab",
"superstore.html/doesn't leak views when setting filters.": "6dfc1e505f1428424c3265f0236f22fc",
"__GIT_COMMIT__": "96f424a6351e30477229e70590d4ecb120e21982",
"__GIT_COMMIT__": "a3256b28c3261b64d89ddc993298a8d049c39886",
"blank.html/Handles reloading with a schema.": "e58c62f6e0ff16dc4d753f99e0fc39c3",
"superstore_shows_a_grid_without_any_settings_applied_": "ae1c4690d978598ca14c8669244ce604",
"superstore_Responsive_Layout_shows_horizontal_columns_on_small_vertical_viewports_": "57ba3ad341cf8a0e4df6ab96715ff2a0",
Expand Down Expand Up @@ -56,5 +56,7 @@
"superstore_doesn_t_leak_views_when_setting_row_pivots_": "4908fc388aa779cd238d1b05ab1ddafe",
"superstore_doesn_t_leak_elements": "551e6c02fe92e26270379c59612b145f",
"superstore_doesn_t_leak_views_when_setting_row_pivots": "deab7074572ff5b98fd876f8a34bd97e",
"superstore_doesn_t_leak_views_when_setting_filters": "4e40181b71c5a1588589e4c7bc2dc57a"
"superstore_doesn_t_leak_views_when_setting_filters": "4e40181b71c5a1588589e4c7bc2dc57a",
"superstore_opens_settings_when_field_is_set_to_true": "731b9a3bd47f4e36ef78a86474d22695",
"superstore_opens_settings_when_field_is_set_to_false": "10d1208b485425756fcc932229386b02"
}

0 comments on commit 9a0427a

Please sign in to comment.