Skip to content

Commit

Permalink
update render warning to shadowDOM
Browse files Browse the repository at this point in the history
  • Loading branch information
sc1f committed Oct 27, 2018
1 parent 48b16c2 commit 7d52a18
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 23 deletions.
18 changes: 12 additions & 6 deletions packages/perspective-viewer-highcharts/test/js/bar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ utils.with_server({}, () => {
await utils.invoke_tooltip(bar, page);
});
});

describe.page("stresstest.html", () => {
describe("render warning", () => {
test.capture("render warnings should show over size limit");
});
});
});

/*describe.page("render_warning.html", () => {
test.capture(
"render warning should show when size limit is reached.",
async page => {
console.log(page);
},
100000,
null,
100000
);
});*/
});
21 changes: 10 additions & 11 deletions packages/perspective-viewer/src/js/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ async function loadTable(table, computed = false) {
}
});
}
this._debounce_update({redraw: true, ignore_size_check: false});
this._debounce_update({ignore_size_check: false});
return;
}
}
Expand Down Expand Up @@ -502,7 +502,7 @@ async function loadTable(table, computed = false) {
this.shadowRoot.querySelector("#side_panel__actions").style.visibility = "visible";

this.filters = this.getAttribute("filters");
await this._debounce_update({redraw: redraw, ignore_size_check: false});
await this._debounce_update({ignore_size_check: false});
}

function new_row(name, type, aggregate, filter, sort, computed) {
Expand Down Expand Up @@ -600,7 +600,7 @@ class CancelTask {
}
}

async function update(redraw = true, ignore_size_check = false) {
async function update(ignore_size_check = false) {
this._plugin_information.classList.add("hidden");
if (!this._table) return;
let row_pivots = this._view_columns("#row_pivots perspective-row");
Expand Down Expand Up @@ -632,7 +632,6 @@ async function update(redraw = true, ignore_size_check = false) {
const num_columns = await this._view.num_columns();
const num_rows = await this._view.num_rows();
const count = num_columns * num_rows;
console.log(count);
if (count >= this._plugin.max_size) {
this._plugin_information.classList.remove("hidden");
return;
Expand Down Expand Up @@ -954,16 +953,16 @@ class ViewPrivate extends HTMLElement {
this._add_computed_column = this.shadowRoot.querySelector("#add-computed-column");
this._computed_column = this.shadowRoot.querySelector("perspective-computed-column");
this._computed_column_inputs = this._computed_column.querySelector("#psp-cc-computation-inputs");
this._plugin_information = this.querySelector(".plugin_information");
this._plugin_information_action = this.querySelector(".plugin_information__action");
this._plugin_information_dismiss = this.querySelector(".plugin_information__action--dismiss");
this._inner_drop_target = this.shadowRoot.querySelector("#drop_target_inner");
this._drop_target = this.shadowRoot.querySelector("#drop_target");
this._config_button = this.shadowRoot.querySelector("#config_button");
this._side_panel = this.shadowRoot.querySelector("#side_panel");
this._top_panel = this.shadowRoot.querySelector("#top_panel");
this._sort = this.shadowRoot.querySelector("#sort");
this._transpose_button = this.shadowRoot.querySelector("#transpose_button");
this._plugin_information = this.shadowRoot.querySelector(".plugin_information");
this._plugin_information_action = this.shadowRoot.querySelector(".plugin_information__action");
this._plugin_information_dismiss = this.shadowRoot.querySelector(".plugin_information__action--dismiss");
}

_register_callbacks() {
Expand Down Expand Up @@ -1021,14 +1020,14 @@ class ViewPrivate extends HTMLElement {
}

_register_debounce_instance() {
const _update = _.debounce((redraw, resolve, ignore_size_check) => {
const _update = _.debounce((resolve, ignore_size_check) => {
update
.bind(this)(redraw, ignore_size_check)
.bind(this)(ignore_size_check)
.then(resolve);
}, 10);
this._debounce_update = async ({redraw = undefined, ignore_size_check = false} = {}) => {
this._debounce_update = async ({ignore_size_check = false} = {}) => {
this.setAttribute("updating", true);
await new Promise(resolve => _update(redraw, resolve, ignore_size_check));
await new Promise(resolve => _update(resolve, ignore_size_check));
};
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/perspective-viewer/src/less/default.less
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@
display: flex;
flex-direction: row;
justify-content: flex-start;
padding: 0.25rem 0.5rem;
padding: 0.5rem;
width: 100%;
z-index: 1;

&.hidden {
display: none !important;
Expand Down
10 changes: 5 additions & 5 deletions packages/perspective-viewer/test/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ test.run = function run(name, body, viewport = null) {
});
};

test.capture = function capture(name, body, timeout = 60000, viewport = null) {
test.capture = function capture(name, body, timeout = 60000, viewport = null, update_timeout = 30000) {
let _url = url;
test(
name,
Expand All @@ -184,12 +184,12 @@ test.capture = function capture(name, body, timeout = 60000, viewport = null) {

await new Promise(setTimeout);
await page.goto(`http://127.0.0.1:${__PORT__}/${_url}`);
await page.waitForSelector("perspective-viewer:not([updating])");
await page.waitForSelector("perspective-viewer:not([updating])", {timeout: update_timeout});

await body(page);

// let animation run;
await page.waitForSelector("perspective-viewer:not([updating])");
await page.waitForSelector("perspective-viewer:not([updating])", {timeout: update_timeout});

const screenshot = await page.screenshot();
// await page.close();
Expand Down Expand Up @@ -264,7 +264,7 @@ exports.invoke_tooltip = async function invoke_tooltip(svg_selector, page) {
};

exports.trigger_render_warning = async function trigger_render_warning(page, col_name) {
await page.click("#config_button");
const viewer = await page.$("perspective-viewer");
await page.evaluate(element => element.setAttribute("columns", `[""${col_name}]`), viewer);
await page.evaluate(element => element.shadowRoot.querySelector("#config_button").click(), viewer);
await page.evaluate(element => element.setAttribute("columns", `["${col_name}"]`), viewer);
};

0 comments on commit 7d52a18

Please sign in to comment.