@metricinsights/pp-dev 1.5.0-beta.34 → 1.5.0-beta.36
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/README.md +17 -9
- package/dist/cjs/auth.provider-D5AI-ujG.js +2 -0
- package/dist/cjs/auth.provider-D5AI-ujG.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/plugin.js +1 -1
- package/dist/cjs/plugin.js.map +1 -1
- package/dist/cjs/{version-manifest-DdWlzzZ6.js → version-manifest-DuXhzqGr.js} +2 -2
- package/dist/cjs/{version-manifest-DdWlzzZ6.js.map → version-manifest-DuXhzqGr.js.map} +1 -1
- package/dist/cjs/version-plugin-DrG2-mQf.js +2 -0
- package/dist/cjs/{version-plugin-B1Sb07cW.js.map → version-plugin-DrG2-mQf.js.map} +1 -1
- package/dist/client/client.js +113 -53
- package/dist/client/client.js.map +1 -1
- package/dist/client/request-inspector.js +12 -1
- package/dist/client/request-inspector.js.map +1 -1
- package/dist/client/variables-editor.js +169 -36
- package/dist/client/variables-editor.js.map +1 -1
- package/dist/esm/cli.js +1 -1
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/{internal.middleware-CC20He9L.js → internal.middleware-wi0Mb4oZ.js} +2 -2
- package/dist/esm/internal.middleware-wi0Mb4oZ.js.map +1 -0
- package/dist/esm/plugin.js +1 -1
- package/package.json +6 -8
- package/dist/cjs/auth.provider-6rZUaR33.js +0 -2
- package/dist/cjs/auth.provider-6rZUaR33.js.map +0 -1
- package/dist/cjs/cli.js +0 -2
- package/dist/cjs/cli.js.map +0 -1
- package/dist/cjs/index-Cc-bAhnE.js +0 -2
- package/dist/cjs/index-Cc-bAhnE.js.map +0 -1
- package/dist/cjs/internal.middleware-BlM7gqkq.js +0 -2
- package/dist/cjs/internal.middleware-BlM7gqkq.js.map +0 -1
- package/dist/cjs/migrate-DDdeB-Fj.js +0 -2
- package/dist/cjs/migrate-DDdeB-Fj.js.map +0 -1
- package/dist/cjs/version-plugin-B1Sb07cW.js +0 -2
- package/dist/esm/internal.middleware-CC20He9L.js.map +0 -1
package/dist/client/client.js
CHANGED
|
@@ -941,27 +941,44 @@ function initUsersPanel($panel, hooks) {
|
|
|
941
941
|
ev.preventDefault();
|
|
942
942
|
const name = editing;
|
|
943
943
|
const $form = ev.currentTarget;
|
|
944
|
-
|
|
944
|
+
const $save = $form.querySelector('button[type="submit"]');
|
|
945
|
+
// One request at a time, as the Add form does: Enter twice sent a second PATCH, which a
|
|
946
|
+
// rename answered with 404, shown as "not found" although the rename had gone through.
|
|
947
|
+
if (!name || $form.dataset.submitting === 'true') {
|
|
945
948
|
return;
|
|
946
949
|
}
|
|
947
950
|
const newName = $form.querySelector('.pp-dev-info__users-edit-name')?.value.trim() ?? '';
|
|
948
951
|
const token = $form.querySelector('.pp-dev-info__users-edit-token')?.value.trim() ?? '';
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
});
|
|
953
|
-
if (!response) {
|
|
954
|
-
return;
|
|
952
|
+
$form.dataset.submitting = 'true';
|
|
953
|
+
if ($save) {
|
|
954
|
+
$save.disabled = true;
|
|
955
955
|
}
|
|
956
|
-
|
|
957
|
-
//
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
956
|
+
// Held until the answer is read and the list refreshed: released when the headers came, a
|
|
957
|
+
// second Enter while a rename's body was on its way sent a PATCH to the old name (404).
|
|
958
|
+
try {
|
|
959
|
+
const response = await request('PATCH', `${USERS_API}/${encodeURIComponent(name)}`, {
|
|
960
|
+
name: newName,
|
|
961
|
+
...(token ? { token } : {}),
|
|
962
|
+
});
|
|
963
|
+
if (!response) {
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
const { user } = (await response.json());
|
|
967
|
+
// This tab's own user got a new host: go on there (the old one would only send it on).
|
|
968
|
+
if (tabUser === name && user.name !== name) {
|
|
969
|
+
window.location.href = samePageOn(user.origin);
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
editing = null;
|
|
973
|
+
renderedData = '';
|
|
974
|
+
await refresh();
|
|
975
|
+
}
|
|
976
|
+
finally {
|
|
977
|
+
delete $form.dataset.submitting;
|
|
978
|
+
if ($save) {
|
|
979
|
+
$save.disabled = false;
|
|
980
|
+
}
|
|
961
981
|
}
|
|
962
|
-
editing = null;
|
|
963
|
-
renderedData = '';
|
|
964
|
-
await refresh();
|
|
965
982
|
});
|
|
966
983
|
$list.querySelectorAll('[data-remove]').forEach(($remove) => {
|
|
967
984
|
$remove.addEventListener('click', async (ev) => {
|
|
@@ -1381,6 +1398,86 @@ function initSyncButton(hot, $button, deps) {
|
|
|
1381
1398
|
});
|
|
1382
1399
|
}
|
|
1383
1400
|
|
|
1401
|
+
/**
|
|
1402
|
+
* Wires the dev panel's "Reload variables" action to the dev server, and returns what starts it.
|
|
1403
|
+
*
|
|
1404
|
+
* Like the sync button, it refuses to start while the dev server is not connected: both transports
|
|
1405
|
+
* keep a message until the socket is back, so the "Reloading variables" popup, which stays until
|
|
1406
|
+
* an answer comes, stayed until a reconnect — and the page then reloaded on its own, unasked. A
|
|
1407
|
+
* connection lost while waiting ends the wait the same way.
|
|
1408
|
+
*/
|
|
1409
|
+
function initReloadVariables(hot, deps) {
|
|
1410
|
+
const reload = deps.reload ?? (() => window.location.reload());
|
|
1411
|
+
// As the sync button takes it: Vite's connection is open until reported lost; the `pp-dev next`
|
|
1412
|
+
// transport says itself whether its socket is open.
|
|
1413
|
+
let connected = true;
|
|
1414
|
+
let pending = null;
|
|
1415
|
+
const isConnected = () => connected && (hot.isConnected?.() ?? true);
|
|
1416
|
+
const endWait = () => {
|
|
1417
|
+
pending?.close();
|
|
1418
|
+
pending = null;
|
|
1419
|
+
};
|
|
1420
|
+
hot.on('vite:ws:connect', () => {
|
|
1421
|
+
connected = true;
|
|
1422
|
+
});
|
|
1423
|
+
hot.on('vite:ws:disconnect', () => {
|
|
1424
|
+
connected = false;
|
|
1425
|
+
if (!pending) {
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
endWait();
|
|
1429
|
+
deps.infoPopup({
|
|
1430
|
+
title: 'Reload variables interrupted',
|
|
1431
|
+
content: 'The connection to the dev server was lost. Try again once it is back.',
|
|
1432
|
+
type: 'warning',
|
|
1433
|
+
});
|
|
1434
|
+
});
|
|
1435
|
+
hot.on('page-variables:reload:response', (payload) => {
|
|
1436
|
+
endWait();
|
|
1437
|
+
if ('error' in payload) {
|
|
1438
|
+
deps.infoPopup({
|
|
1439
|
+
title: 'Reload variables error',
|
|
1440
|
+
content: payload.error,
|
|
1441
|
+
type: 'danger',
|
|
1442
|
+
});
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
if (payload.skipped) {
|
|
1446
|
+
deps.infoPopup({
|
|
1447
|
+
title: 'Nothing to reload',
|
|
1448
|
+
content: 'This page has no template variables to refresh.',
|
|
1449
|
+
type: 'warning',
|
|
1450
|
+
});
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
deps.infoPopup({
|
|
1454
|
+
title: 'Variables reloaded',
|
|
1455
|
+
content: `Refetched ${payload.count} variable(s) from MI. Reloading the page…`,
|
|
1456
|
+
type: 'success',
|
|
1457
|
+
duration: 1200,
|
|
1458
|
+
});
|
|
1459
|
+
setTimeout(reload, 600);
|
|
1460
|
+
});
|
|
1461
|
+
return () => {
|
|
1462
|
+
if (!isConnected()) {
|
|
1463
|
+
deps.infoPopup({
|
|
1464
|
+
title: 'No connection',
|
|
1465
|
+
content: 'The dev server is not connected. Check that it is running, then try again.',
|
|
1466
|
+
type: 'warning',
|
|
1467
|
+
});
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
endWait();
|
|
1471
|
+
pending = deps.infoPopup({
|
|
1472
|
+
title: 'Reloading variables',
|
|
1473
|
+
content: 'Refetching live values from MI…',
|
|
1474
|
+
type: 'info',
|
|
1475
|
+
duration: 0,
|
|
1476
|
+
});
|
|
1477
|
+
hot.send('page-variables:reload', {});
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1384
1481
|
/// <reference types="vite/client" />
|
|
1385
1482
|
// Applied unconditionally (even if the panel itself is hidden) — this is what makes the
|
|
1386
1483
|
// override affect the whole injected panel, not just its own markup.
|
|
@@ -1402,7 +1499,6 @@ function teardownConfirmModal(overlay, result) {
|
|
|
1402
1499
|
}
|
|
1403
1500
|
let panelController = null;
|
|
1404
1501
|
let startReloadVariablesFlow = null;
|
|
1405
|
-
let pendingReloadVariablesPopup = null;
|
|
1406
1502
|
function updatePopupPositions() {
|
|
1407
1503
|
const popups = document.querySelectorAll('.pp-dev-info-namespace:not(.pp-dev-info)');
|
|
1408
1504
|
const position = panelController?.getState().position ?? 'bottom-right';
|
|
@@ -1601,42 +1697,6 @@ if (hot) {
|
|
|
1601
1697
|
if ($syncButton) {
|
|
1602
1698
|
initSyncButton(hot, $syncButton, { infoPopup, confirmModal, closeAllConfirmModals });
|
|
1603
1699
|
}
|
|
1604
|
-
hot
|
|
1605
|
-
pendingReloadVariablesPopup?.close();
|
|
1606
|
-
pendingReloadVariablesPopup = null;
|
|
1607
|
-
if ('error' in payload) {
|
|
1608
|
-
infoPopup({
|
|
1609
|
-
title: 'Reload variables error',
|
|
1610
|
-
content: payload.error,
|
|
1611
|
-
type: 'danger',
|
|
1612
|
-
});
|
|
1613
|
-
return;
|
|
1614
|
-
}
|
|
1615
|
-
if (payload.skipped) {
|
|
1616
|
-
infoPopup({
|
|
1617
|
-
title: 'Nothing to reload',
|
|
1618
|
-
content: 'This page has no template variables to refresh.',
|
|
1619
|
-
type: 'warning',
|
|
1620
|
-
});
|
|
1621
|
-
return;
|
|
1622
|
-
}
|
|
1623
|
-
infoPopup({
|
|
1624
|
-
title: 'Variables reloaded',
|
|
1625
|
-
content: `Refetched ${payload.count} variable(s) from MI. Reloading the page…`,
|
|
1626
|
-
type: 'success',
|
|
1627
|
-
duration: 1200,
|
|
1628
|
-
});
|
|
1629
|
-
setTimeout(() => window.location.reload(), 600);
|
|
1630
|
-
});
|
|
1631
|
-
startReloadVariablesFlow = () => {
|
|
1632
|
-
pendingReloadVariablesPopup?.close();
|
|
1633
|
-
pendingReloadVariablesPopup = infoPopup({
|
|
1634
|
-
title: 'Reloading variables',
|
|
1635
|
-
content: 'Refetching live values from MI…',
|
|
1636
|
-
type: 'info',
|
|
1637
|
-
duration: 0,
|
|
1638
|
-
});
|
|
1639
|
-
hot.send('page-variables:reload', {});
|
|
1640
|
-
};
|
|
1700
|
+
startReloadVariablesFlow = initReloadVariables(hot, { infoPopup });
|
|
1641
1701
|
}
|
|
1642
1702
|
//# sourceMappingURL=client.js.map
|