@metricinsights/pp-dev 1.5.0-beta.33 → 1.5.0-beta.35
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/cjs/auth.provider-6rZUaR33.js +2 -0
- package/dist/cjs/auth.provider-6rZUaR33.js.map +1 -0
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/index-Cc-bAhnE.js +2 -0
- package/dist/cjs/index-Cc-bAhnE.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/internal.middleware-CJSvsYId.js +2 -0
- package/dist/cjs/internal.middleware-CJSvsYId.js.map +1 -0
- package/dist/cjs/{migrate-oVYAMhLH.js → migrate-DDdeB-Fj.js} +2 -2
- package/dist/cjs/{migrate-oVYAMhLH.js.map → migrate-DDdeB-Fj.js.map} +1 -1
- package/dist/cjs/plugin.js +1 -1
- package/dist/cjs/{version-manifest-fusPAO4h.js → version-manifest-DdWlzzZ6.js} +2 -2
- package/dist/cjs/{version-manifest-fusPAO4h.js.map → version-manifest-DdWlzzZ6.js.map} +1 -1
- package/dist/cjs/{version-plugin-B6tVqztE.js → version-plugin-B1Sb07cW.js} +2 -2
- package/dist/cjs/{version-plugin-B6tVqztE.js.map → version-plugin-B1Sb07cW.js.map} +1 -1
- package/dist/client/client.js +93 -39
- 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 +166 -36
- package/dist/client/variables-editor.js.map +1 -1
- package/dist/esm/auth.provider-BFK6x9Df.js +2 -0
- package/dist/esm/auth.provider-BFK6x9Df.js.map +1 -0
- package/dist/esm/cli.js +1 -1
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/index-PvH-M_Io.js +2 -0
- package/dist/esm/index-PvH-M_Io.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal.middleware-Dj2-HlRc.js +2 -0
- package/dist/esm/internal.middleware-Dj2-HlRc.js.map +1 -0
- package/dist/esm/{migrate-BxksV7OV.js → migrate-C1MkJPzS.js} +2 -2
- package/dist/esm/{migrate-BxksV7OV.js.map → migrate-C1MkJPzS.js.map} +1 -1
- package/dist/esm/plugin.js +1 -1
- package/dist/esm/version-manifest-BVgENnKn.js +2 -0
- package/dist/esm/{version-manifest-CGzLQLmu.js.map → version-manifest-BVgENnKn.js.map} +1 -1
- package/dist/esm/{version-plugin-Byv2M38F.js → version-plugin-CA9HNV-6.js} +2 -2
- package/dist/esm/{version-plugin-Byv2M38F.js.map → version-plugin-CA9HNV-6.js.map} +1 -1
- package/package.json +1 -1
- package/dist/cjs/auth.provider-C3O8wdGc.js +0 -2
- package/dist/cjs/auth.provider-C3O8wdGc.js.map +0 -1
- package/dist/cjs/index-DnVkH9ZF.js +0 -2
- package/dist/cjs/index-DnVkH9ZF.js.map +0 -1
- package/dist/cjs/internal.middleware-63EM6Z98.js +0 -2
- package/dist/cjs/internal.middleware-63EM6Z98.js.map +0 -1
- package/dist/esm/auth.provider-sKqGOS5N.js +0 -2
- package/dist/esm/auth.provider-sKqGOS5N.js.map +0 -1
- package/dist/esm/index-DEFt8X6C.js +0 -2
- package/dist/esm/index-DEFt8X6C.js.map +0 -1
- package/dist/esm/internal.middleware-BVjskCUz.js +0 -2
- package/dist/esm/internal.middleware-BVjskCUz.js.map +0 -1
- package/dist/esm/version-manifest-CGzLQLmu.js +0 -2
package/dist/client/client.js
CHANGED
|
@@ -941,15 +941,26 @@ 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() ?? '';
|
|
952
|
+
$form.dataset.submitting = 'true';
|
|
953
|
+
if ($save) {
|
|
954
|
+
$save.disabled = true;
|
|
955
|
+
}
|
|
949
956
|
const response = await request('PATCH', `${USERS_API}/${encodeURIComponent(name)}`, {
|
|
950
957
|
name: newName,
|
|
951
958
|
...(token ? { token } : {}),
|
|
952
959
|
});
|
|
960
|
+
delete $form.dataset.submitting;
|
|
961
|
+
if ($save) {
|
|
962
|
+
$save.disabled = false;
|
|
963
|
+
}
|
|
953
964
|
if (!response) {
|
|
954
965
|
return;
|
|
955
966
|
}
|
|
@@ -1381,6 +1392,86 @@ function initSyncButton(hot, $button, deps) {
|
|
|
1381
1392
|
});
|
|
1382
1393
|
}
|
|
1383
1394
|
|
|
1395
|
+
/**
|
|
1396
|
+
* Wires the dev panel's "Reload variables" action to the dev server, and returns what starts it.
|
|
1397
|
+
*
|
|
1398
|
+
* Like the sync button, it refuses to start while the dev server is not connected: both transports
|
|
1399
|
+
* keep a message until the socket is back, so the "Reloading variables" popup, which stays until
|
|
1400
|
+
* an answer comes, stayed until a reconnect — and the page then reloaded on its own, unasked. A
|
|
1401
|
+
* connection lost while waiting ends the wait the same way.
|
|
1402
|
+
*/
|
|
1403
|
+
function initReloadVariables(hot, deps) {
|
|
1404
|
+
const reload = deps.reload ?? (() => window.location.reload());
|
|
1405
|
+
// As the sync button takes it: Vite's connection is open until reported lost; the `pp-dev next`
|
|
1406
|
+
// transport says itself whether its socket is open.
|
|
1407
|
+
let connected = true;
|
|
1408
|
+
let pending = null;
|
|
1409
|
+
const isConnected = () => connected && (hot.isConnected?.() ?? true);
|
|
1410
|
+
const endWait = () => {
|
|
1411
|
+
pending?.close();
|
|
1412
|
+
pending = null;
|
|
1413
|
+
};
|
|
1414
|
+
hot.on('vite:ws:connect', () => {
|
|
1415
|
+
connected = true;
|
|
1416
|
+
});
|
|
1417
|
+
hot.on('vite:ws:disconnect', () => {
|
|
1418
|
+
connected = false;
|
|
1419
|
+
if (!pending) {
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
endWait();
|
|
1423
|
+
deps.infoPopup({
|
|
1424
|
+
title: 'Reload variables interrupted',
|
|
1425
|
+
content: 'The connection to the dev server was lost. Try again once it is back.',
|
|
1426
|
+
type: 'warning',
|
|
1427
|
+
});
|
|
1428
|
+
});
|
|
1429
|
+
hot.on('page-variables:reload:response', (payload) => {
|
|
1430
|
+
endWait();
|
|
1431
|
+
if ('error' in payload) {
|
|
1432
|
+
deps.infoPopup({
|
|
1433
|
+
title: 'Reload variables error',
|
|
1434
|
+
content: payload.error,
|
|
1435
|
+
type: 'danger',
|
|
1436
|
+
});
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
if (payload.skipped) {
|
|
1440
|
+
deps.infoPopup({
|
|
1441
|
+
title: 'Nothing to reload',
|
|
1442
|
+
content: 'This page has no template variables to refresh.',
|
|
1443
|
+
type: 'warning',
|
|
1444
|
+
});
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
deps.infoPopup({
|
|
1448
|
+
title: 'Variables reloaded',
|
|
1449
|
+
content: `Refetched ${payload.count} variable(s) from MI. Reloading the page…`,
|
|
1450
|
+
type: 'success',
|
|
1451
|
+
duration: 1200,
|
|
1452
|
+
});
|
|
1453
|
+
setTimeout(reload, 600);
|
|
1454
|
+
});
|
|
1455
|
+
return () => {
|
|
1456
|
+
if (!isConnected()) {
|
|
1457
|
+
deps.infoPopup({
|
|
1458
|
+
title: 'No connection',
|
|
1459
|
+
content: 'The dev server is not connected. Check that it is running, then try again.',
|
|
1460
|
+
type: 'warning',
|
|
1461
|
+
});
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
endWait();
|
|
1465
|
+
pending = deps.infoPopup({
|
|
1466
|
+
title: 'Reloading variables',
|
|
1467
|
+
content: 'Refetching live values from MI…',
|
|
1468
|
+
type: 'info',
|
|
1469
|
+
duration: 0,
|
|
1470
|
+
});
|
|
1471
|
+
hot.send('page-variables:reload', {});
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1384
1475
|
/// <reference types="vite/client" />
|
|
1385
1476
|
// Applied unconditionally (even if the panel itself is hidden) — this is what makes the
|
|
1386
1477
|
// override affect the whole injected panel, not just its own markup.
|
|
@@ -1402,7 +1493,6 @@ function teardownConfirmModal(overlay, result) {
|
|
|
1402
1493
|
}
|
|
1403
1494
|
let panelController = null;
|
|
1404
1495
|
let startReloadVariablesFlow = null;
|
|
1405
|
-
let pendingReloadVariablesPopup = null;
|
|
1406
1496
|
function updatePopupPositions() {
|
|
1407
1497
|
const popups = document.querySelectorAll('.pp-dev-info-namespace:not(.pp-dev-info)');
|
|
1408
1498
|
const position = panelController?.getState().position ?? 'bottom-right';
|
|
@@ -1601,42 +1691,6 @@ if (hot) {
|
|
|
1601
1691
|
if ($syncButton) {
|
|
1602
1692
|
initSyncButton(hot, $syncButton, { infoPopup, confirmModal, closeAllConfirmModals });
|
|
1603
1693
|
}
|
|
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
|
-
};
|
|
1694
|
+
startReloadVariablesFlow = initReloadVariables(hot, { infoPopup });
|
|
1641
1695
|
}
|
|
1642
1696
|
//# sourceMappingURL=client.js.map
|