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

CLDR-15649 Dashboard using filters, fix checkbox performance #3662

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tools/cldr-apps/js/src/views/DashboardWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,13 @@ export default {
},

catCheckmarkChanged(event, category) {
this.catIsHidden[category] = !event.target.checked;
// setTimeout solves a weakness in the Vue implementation: if the number of
// notifications is large, the checkbox in the header can take a second or more
// to change its visible state in response to the user's click, during which time
// the user may click again thinking the first click wasn't recognized. Postponing
// the DOM update of thousands of rows ensures that the header checkbox updates
// without delay.
setTimeout(() => (this.catIsHidden[category] = !event.target.checked), 0);
},

canBeHidden(cats) {
Expand Down
15 changes: 12 additions & 3 deletions tools/cldr-apps/js/test/TestCldrDash.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ describe("cldrDash.updatePath", function () {
assert.strictEqual(countEntriesForPath(data1, "710b6e70773e5764"), 1);
assert.strictEqual(countEntriesForPath(data1, "64a8a83fbacdf836"), 1);
// the entry for 710b6e70773e5764 should have 3 notifications
assert.strictEqual(countNotificationsForEntry(data1, "710b6e70773e5764"), 3);
assert.strictEqual(
countNotificationsForEntry(data1, "710b6e70773e5764"),
3
);
// the entry for 64a8a83fbacdf836 should have 1 notification
assert.strictEqual(countNotificationsForEntry(data1, "64a8a83fbacdf836"), 1);
assert.strictEqual(
countNotificationsForEntry(data1, "64a8a83fbacdf836"),
1
);
});

it("should remove entries", function () {
Expand All @@ -61,7 +67,10 @@ describe("cldrDash.updatePath", function () {
assert.strictEqual(countEntriesForPath(data2, "710b6e70773e5764"), 0);
assert.strictEqual(countEntriesForPath(data2, "64a8a83fbacdf836"), 1);
// the entry for 64a8a83fbacdf836 should have 1 notification
assert.strictEqual(countNotificationsForEntry(data2, "64a8a83fbacdf836"), 1);
assert.strictEqual(
countNotificationsForEntry(data2, "64a8a83fbacdf836"),
1
);
});
});

Expand Down
Loading