@trops/dash-core 0.1.680 → 0.1.681
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/index.esm.js +29 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +29 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53171,6 +53171,11 @@ var BotDetail = function BotDetail(_ref) {
|
|
|
53171
53171
|
_useState54 = _slicedToArray(_useState53, 2),
|
|
53172
53172
|
error = _useState54[0],
|
|
53173
53173
|
setError = _useState54[1];
|
|
53174
|
+
// "Saved" shows after a successful save until the next edit.
|
|
53175
|
+
var _useState55 = React.useState(false),
|
|
53176
|
+
_useState56 = _slicedToArray(_useState55, 2),
|
|
53177
|
+
justSaved = _useState56[0],
|
|
53178
|
+
setJustSaved = _useState56[1];
|
|
53174
53179
|
|
|
53175
53180
|
// Unsaved changes: the editable fields now vs. when the form opened (or
|
|
53176
53181
|
// last saved).
|
|
@@ -53193,11 +53198,14 @@ var BotDetail = function BotDetail(_ref) {
|
|
|
53193
53198
|
subscriptions: subscriptions,
|
|
53194
53199
|
team: team
|
|
53195
53200
|
});
|
|
53196
|
-
var
|
|
53197
|
-
|
|
53198
|
-
baseline =
|
|
53199
|
-
setBaseline =
|
|
53201
|
+
var _useState57 = React.useState(snapshot),
|
|
53202
|
+
_useState58 = _slicedToArray(_useState57, 2),
|
|
53203
|
+
baseline = _useState58[0],
|
|
53204
|
+
setBaseline = _useState58[1];
|
|
53200
53205
|
var dirty = snapshot !== baseline;
|
|
53206
|
+
React.useEffect(function () {
|
|
53207
|
+
if (dirty) setJustSaved(false);
|
|
53208
|
+
}, [dirty]);
|
|
53201
53209
|
React.useEffect(function () {
|
|
53202
53210
|
if (typeof onDirtyChange === "function") onDirtyChange(dirty);
|
|
53203
53211
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -53390,7 +53398,10 @@ var BotDetail = function BotDetail(_ref) {
|
|
|
53390
53398
|
});
|
|
53391
53399
|
});
|
|
53392
53400
|
};
|
|
53393
|
-
|
|
53401
|
+
|
|
53402
|
+
// An existing bot saves only when something changed, so Save visibly does
|
|
53403
|
+
// something; a new bot can always be created once it has a name.
|
|
53404
|
+
var canSave = name.trim() && instructions.trim() && !saving && (isCreating || dirty);
|
|
53394
53405
|
var handleSave = /*#__PURE__*/function () {
|
|
53395
53406
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
53396
53407
|
var cron, schedules, definition, _t2;
|
|
@@ -53398,6 +53409,7 @@ var BotDetail = function BotDetail(_ref) {
|
|
|
53398
53409
|
while (1) switch (_context2.prev = _context2.next) {
|
|
53399
53410
|
case 0:
|
|
53400
53411
|
setError(null);
|
|
53412
|
+
setJustSaved(false);
|
|
53401
53413
|
cron = advanced ? advancedCron.trim() : buildCron({
|
|
53402
53414
|
frequency: frequency,
|
|
53403
53415
|
time: time,
|
|
@@ -53434,6 +53446,7 @@ var BotDetail = function BotDetail(_ref) {
|
|
|
53434
53446
|
return onSave(definition);
|
|
53435
53447
|
case 2:
|
|
53436
53448
|
setBaseline(snapshot);
|
|
53449
|
+
setJustSaved(true);
|
|
53437
53450
|
_context2.next = 4;
|
|
53438
53451
|
break;
|
|
53439
53452
|
case 3:
|
|
@@ -53829,11 +53842,9 @@ var BotDetail = function BotDetail(_ref) {
|
|
|
53829
53842
|
className: "text-xs opacity-50",
|
|
53830
53843
|
children: "The bot runs automatically when one of these events fires."
|
|
53831
53844
|
})]
|
|
53832
|
-
})
|
|
53833
|
-
className: "text-sm text-red-400",
|
|
53834
|
-
children: error
|
|
53835
|
-
}) : null]
|
|
53845
|
+
})]
|
|
53836
53846
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
53847
|
+
"data-testid": "bot-detail-footer",
|
|
53837
53848
|
className: "flex-shrink-0 flex flex-row justify-between gap-2 px-6 py-4 border-t ".concat(hairline),
|
|
53838
53849
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
53839
53850
|
children: !isCreating && onDelete ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
@@ -53842,8 +53853,14 @@ var BotDetail = function BotDetail(_ref) {
|
|
|
53842
53853
|
size: "sm"
|
|
53843
53854
|
}) : null
|
|
53844
53855
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
53845
|
-
className: "flex flex-row gap-2",
|
|
53846
|
-
children: [
|
|
53856
|
+
className: "flex flex-row items-center gap-2",
|
|
53857
|
+
children: [error ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
53858
|
+
className: "text-sm text-red-400",
|
|
53859
|
+
children: error
|
|
53860
|
+
}) : justSaved ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
53861
|
+
className: "text-sm opacity-70",
|
|
53862
|
+
children: "Saved"
|
|
53863
|
+
}) : null, isCreating && onCancel ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
53847
53864
|
title: "Cancel",
|
|
53848
53865
|
onClick: onCancel,
|
|
53849
53866
|
size: "sm"
|
|
@@ -53853,7 +53870,7 @@ var BotDetail = function BotDetail(_ref) {
|
|
|
53853
53870
|
size: "sm",
|
|
53854
53871
|
disabled: !dirty || saving
|
|
53855
53872
|
}) : null, /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
53856
|
-
title: isCreating ? "Create" : "Save",
|
|
53873
|
+
title: saving ? "Saving…" : isCreating ? "Create" : "Save",
|
|
53857
53874
|
onClick: handleSave,
|
|
53858
53875
|
size: "sm",
|
|
53859
53876
|
disabled: !canSave
|