flexdesk 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/widgets.js +12 -0
- package/dist/widgets.js.map +2 -2
- package/package.json +1 -1
- package/src/ui/components/alerts_pane.js +16 -0
package/package.json
CHANGED
|
@@ -22,12 +22,20 @@
|
|
|
22
22
|
* button is down inside the pane a repaint waits, and runs once it is up.
|
|
23
23
|
* The bar (chips, the filter, the buttons) is built once and updated in
|
|
24
24
|
* place, so typing in the filter never loses the caret either.
|
|
25
|
+
*
|
|
26
|
+
* OLDER ENTRIES LOAD AS YOU SCROLL (Tables STORY-0293): when the list is
|
|
27
|
+
* scrolled to within :data:`MORE_WITHIN_PX` of its end and the source has
|
|
28
|
+
* more, the next page is asked for — once at a time. *Load older* stays at the
|
|
29
|
+
* end, for a list too short to scroll and for the keyboard.
|
|
25
30
|
*/
|
|
26
31
|
|
|
27
32
|
import { ALERT_LEVELS, ago, dayLabel, normalizeLevel } from './alert_log.js';
|
|
28
33
|
|
|
29
34
|
const CHIPS = [['all', 'All'], ['alert', 'Alert'], ['warning', 'Warning'], ['info', 'Info']];
|
|
30
35
|
|
|
36
|
+
/** How near the end of the list a scroll asks for the next page. */
|
|
37
|
+
export const MORE_WITHIN_PX = 48;
|
|
38
|
+
|
|
31
39
|
/**
|
|
32
40
|
* @param {HTMLElement} host
|
|
33
41
|
* @param {object} opts
|
|
@@ -271,6 +279,14 @@ export function mountAlertsPane(host, {
|
|
|
271
279
|
});
|
|
272
280
|
input.addEventListener('input', () => { q = input.value; paint(); });
|
|
273
281
|
|
|
282
|
+
let loadingMore = false;
|
|
283
|
+
list.addEventListener('scroll', () => {
|
|
284
|
+
if (loadingMore || !log.hasMore()) return;
|
|
285
|
+
if (list.scrollTop + list.clientHeight < list.scrollHeight - MORE_WITHIN_PX) return;
|
|
286
|
+
loadingMore = true;
|
|
287
|
+
Promise.resolve(log.loadMore()).catch(() => {}).finally(() => { loadingMore = false; });
|
|
288
|
+
});
|
|
289
|
+
|
|
274
290
|
const unsubscribe = log.subscribe(() => paint());
|
|
275
291
|
// "5 min ago" moves on its own.
|
|
276
292
|
const timer = setInterval(paint, 60000);
|