@trops/dash-core 0.1.286 → 0.1.288
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/electron/index.js +120 -4
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +55 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +55 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,7 +22,6 @@ var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstru
|
|
|
22
22
|
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
23
23
|
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
24
24
|
var colors = require('tailwindcss/colors');
|
|
25
|
-
var _readOnlyError = require('@babel/runtime/helpers/readOnlyError');
|
|
26
25
|
var ReactDOM = require('react-dom');
|
|
27
26
|
var algoliasearch = require('algoliasearch');
|
|
28
27
|
var reactInstantsearchHooksWeb = require('react-instantsearch-hooks-web');
|
|
@@ -45478,7 +45477,7 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45478
45477
|
*
|
|
45479
45478
|
* @param {Array} installedWidgets - Widgets from useInstalledWidgets()
|
|
45480
45479
|
* @param {Function} onUpdated - Callback after a successful update (e.g. refresh)
|
|
45481
|
-
* @returns {{ updates: Map, isChecking: boolean, updateWidget: Function, isUpdating: string|null }}
|
|
45480
|
+
* @returns {{ updates: Map, isChecking: boolean, updateWidget: Function, isUpdating: string|null, needsAuth: boolean, clearNeedsAuth: Function, updateError: string|null }}
|
|
45482
45481
|
*/
|
|
45483
45482
|
function useWidgetUpdates() {
|
|
45484
45483
|
var installedWidgets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -45495,6 +45494,14 @@ function useWidgetUpdates() {
|
|
|
45495
45494
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
45496
45495
|
isUpdating = _useState6[0],
|
|
45497
45496
|
setIsUpdating = _useState6[1];
|
|
45497
|
+
var _useState7 = React.useState(false),
|
|
45498
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
45499
|
+
needsAuth = _useState8[0],
|
|
45500
|
+
setNeedsAuth = _useState8[1];
|
|
45501
|
+
var _useState9 = React.useState(null),
|
|
45502
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
45503
|
+
updateError = _useState0[0],
|
|
45504
|
+
setUpdateError = _useState0[1];
|
|
45498
45505
|
var checkedRef = React.useRef(false);
|
|
45499
45506
|
|
|
45500
45507
|
// Check for updates once when installed widgets are available
|
|
@@ -45545,7 +45552,7 @@ function useWidgetUpdates() {
|
|
|
45545
45552
|
// Update a single widget by downloading the latest version
|
|
45546
45553
|
var updateWidget = React.useCallback(/*#__PURE__*/function () {
|
|
45547
45554
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(name) {
|
|
45548
|
-
var info, widget, packageId, resolvedUrl;
|
|
45555
|
+
var info, widget, packageId, _window$mainApi2, status, resolvedUrl, _t;
|
|
45549
45556
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
45550
45557
|
while (1) switch (_context.prev = _context.next) {
|
|
45551
45558
|
case 0:
|
|
@@ -45562,11 +45569,23 @@ function useWidgetUpdates() {
|
|
|
45562
45569
|
});
|
|
45563
45570
|
packageId = (widget === null || widget === void 0 ? void 0 : widget.packageId) || info.name || name;
|
|
45564
45571
|
setIsUpdating(name);
|
|
45572
|
+
setUpdateError(null);
|
|
45565
45573
|
_context.prev = 2;
|
|
45566
|
-
resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g, packageId);
|
|
45567
45574
|
_context.next = 3;
|
|
45568
|
-
return window.mainApi.
|
|
45575
|
+
return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.registryAuth) === null || _window$mainApi2 === void 0 ? void 0 : _window$mainApi2.getStatus();
|
|
45569
45576
|
case 3:
|
|
45577
|
+
status = _context.sent;
|
|
45578
|
+
if (status !== null && status !== void 0 && status.authenticated) {
|
|
45579
|
+
_context.next = 4;
|
|
45580
|
+
break;
|
|
45581
|
+
}
|
|
45582
|
+
setNeedsAuth(true);
|
|
45583
|
+
return _context.abrupt("return");
|
|
45584
|
+
case 4:
|
|
45585
|
+
resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g, packageId);
|
|
45586
|
+
_context.next = 5;
|
|
45587
|
+
return window.mainApi.widgets.install(packageId, resolvedUrl);
|
|
45588
|
+
case 5:
|
|
45570
45589
|
// Remove from updates map on success
|
|
45571
45590
|
setUpdates(function (prev) {
|
|
45572
45591
|
var next = new Map(prev);
|
|
@@ -45574,30 +45593,37 @@ function useWidgetUpdates() {
|
|
|
45574
45593
|
return next;
|
|
45575
45594
|
});
|
|
45576
45595
|
if (onUpdated) onUpdated();
|
|
45577
|
-
_context.next =
|
|
45596
|
+
_context.next = 7;
|
|
45578
45597
|
break;
|
|
45579
|
-
case 4:
|
|
45580
|
-
_context.prev = 4;
|
|
45581
|
-
_context["catch"](2);
|
|
45582
|
-
case 5:
|
|
45583
|
-
_context.prev = 5;
|
|
45584
|
-
setIsUpdating(null);
|
|
45585
|
-
return _context.finish(5);
|
|
45586
45598
|
case 6:
|
|
45599
|
+
_context.prev = 6;
|
|
45600
|
+
_t = _context["catch"](2);
|
|
45601
|
+
setUpdateError(_t.message || "Update failed");
|
|
45602
|
+
case 7:
|
|
45603
|
+
_context.prev = 7;
|
|
45604
|
+
setIsUpdating(null);
|
|
45605
|
+
return _context.finish(7);
|
|
45606
|
+
case 8:
|
|
45587
45607
|
case "end":
|
|
45588
45608
|
return _context.stop();
|
|
45589
45609
|
}
|
|
45590
|
-
}, _callee, null, [[2,
|
|
45610
|
+
}, _callee, null, [[2, 6, 7, 8]]);
|
|
45591
45611
|
}));
|
|
45592
45612
|
return function (_x) {
|
|
45593
45613
|
return _ref.apply(this, arguments);
|
|
45594
45614
|
};
|
|
45595
45615
|
}(), [updates, onUpdated, installedWidgets]);
|
|
45616
|
+
var clearNeedsAuth = React.useCallback(function () {
|
|
45617
|
+
return setNeedsAuth(false);
|
|
45618
|
+
}, []);
|
|
45596
45619
|
return {
|
|
45597
45620
|
updates: updates,
|
|
45598
45621
|
isChecking: isChecking,
|
|
45599
45622
|
updateWidget: updateWidget,
|
|
45600
|
-
isUpdating: isUpdating
|
|
45623
|
+
isUpdating: isUpdating,
|
|
45624
|
+
needsAuth: needsAuth,
|
|
45625
|
+
clearNeedsAuth: clearNeedsAuth,
|
|
45626
|
+
updateError: updateError
|
|
45601
45627
|
};
|
|
45602
45628
|
}
|
|
45603
45629
|
|
|
@@ -45625,7 +45651,9 @@ var WidgetsSection = function WidgetsSection(_ref) {
|
|
|
45625
45651
|
var _useWidgetUpdates = useWidgetUpdates(widgets, refresh),
|
|
45626
45652
|
updates = _useWidgetUpdates.updates,
|
|
45627
45653
|
updateWidget = _useWidgetUpdates.updateWidget,
|
|
45628
|
-
isUpdating = _useWidgetUpdates.isUpdating
|
|
45654
|
+
isUpdating = _useWidgetUpdates.isUpdating,
|
|
45655
|
+
needsAuth = _useWidgetUpdates.needsAuth,
|
|
45656
|
+
clearNeedsAuth = _useWidgetUpdates.clearNeedsAuth;
|
|
45629
45657
|
var _useState = React.useState(null),
|
|
45630
45658
|
_useState2 = _slicedToArray(_useState, 2),
|
|
45631
45659
|
selectedWidgetName = _useState2[0],
|
|
@@ -46349,7 +46377,16 @@ var WidgetsSection = function WidgetsSection(_ref) {
|
|
|
46349
46377
|
})]
|
|
46350
46378
|
})]
|
|
46351
46379
|
})
|
|
46352
|
-
}))
|
|
46380
|
+
})), /*#__PURE__*/jsxRuntime.jsx(RegistryAuthModal, {
|
|
46381
|
+
isOpen: needsAuth,
|
|
46382
|
+
setIsOpen: function setIsOpen(open) {
|
|
46383
|
+
if (!open) clearNeedsAuth();
|
|
46384
|
+
},
|
|
46385
|
+
onAuthenticated: function onAuthenticated() {
|
|
46386
|
+
clearNeedsAuth();
|
|
46387
|
+
if (selectedWidget !== null && selectedWidget !== void 0 && selectedWidget.name) updateWidget(selectedWidget.name);
|
|
46388
|
+
}
|
|
46389
|
+
})]
|
|
46353
46390
|
});
|
|
46354
46391
|
};
|
|
46355
46392
|
|
|
@@ -50435,7 +50472,7 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
|
|
|
50435
50472
|
// Clean orphaned layout items and stale listener references before save
|
|
50436
50473
|
var dashboardForCleanup = new DashboardModel(workspaceToSave);
|
|
50437
50474
|
dashboardForCleanup.cleanOrphanedItems();
|
|
50438
|
-
dashboardForCleanup.workspace()
|
|
50475
|
+
workspaceToSave = dashboardForCleanup.workspace();
|
|
50439
50476
|
|
|
50440
50477
|
// lets set a version so that we can compare...
|
|
50441
50478
|
workspaceToSave["version"] = Date.now();
|