Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<perspective-viewer> UI cleanup #905

Merged
merged 10 commits into from
Feb 5, 2020
Prev Previous commit
Next Next commit
Fixed perspective-viewer computed column UX overdraw
  • Loading branch information
texodus committed Feb 4, 2020
commit b8015e9c9c7a640bf056656b7f577debe7e4a5e5
23 changes: 15 additions & 8 deletions packages/perspective-viewer/src/js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,27 @@ class PerspectiveViewer extends ActionElement {
computed_columns = [];
}
const resolve = this._set_updating();
this._computed_column._close_computed_column();

(async () => {
if (this._table) {
const computed_schema = await this._table.computed_schema();
this._computed_column._close_computed_column();
for (let col of computed_columns) {
await this._create_computed_column({
detail: {
column_name: col.name,
input_columns: col.inputs.map(x => ({name: x})),
computation: COMPUTATIONS[col.func]
}
});
if (!computed_schema[col.name]) {
await this._create_computed_column({
detail: {
column_name: col.name,
input_columns: col.inputs.map(x => ({name: x})),
computation: COMPUTATIONS[col.func]
}
});
}
}

await this._debounce_update();
resolve();
} else {
this._computed_column._close_computed_column();
}
this.dispatchEvent(new Event("perspective-config-update"));
this.dispatchEvent(new Event("perspective-computed-column-update"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export class ActionElement extends DomElement {
const cols = await this._table.columns();
// edit overwrites last column, otherwise avoid name collision
if (cols.includes(computed_column_name)) {
console.log(computed_column_name);
computed_column_name += ` ${Math.round(Math.random() * 100)}`;
}

Expand Down