@remit/ui 0.0.82 → 0.0.83

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.82",
3
+ "version": "0.0.83",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -582,6 +582,26 @@ describe("RunStepBody", () => {
582
582
  assert.match(html, /Nothing has changed\./);
583
583
  });
584
584
 
585
+ // A retry that could not be started is not a pass that never ran (#552): the
586
+ // pass that did run keeps its counts and its bar.
587
+ it("keeps a finished pass's counts when its retry could not be started", () => {
588
+ const html = renderToString(
589
+ createElement(RunStepBody, {
590
+ ...runProps,
591
+ state: "backApplyRestartFailed",
592
+ scope: "standing",
593
+ matched: 1284,
594
+ applied: 1200,
595
+ failedCount: 84,
596
+ }),
597
+ );
598
+ assert.match(html, /1200 of 1284 moved/);
599
+ assert.match(html, /rejected 84/);
600
+ assert.match(html, /role="progressbar"/);
601
+ assert.doesNotMatch(html, /Nothing has changed/);
602
+ assert.doesNotMatch(html, /never started/);
603
+ });
604
+
585
605
  // A poll that could not be read is not a run that never started (#526): the
586
606
  // screen keeps the counts it has and says what it cannot see.
587
607
  it("keeps a run that is going when its progress could not be read", () => {
@@ -477,6 +477,7 @@ describe("runCopy", () => {
477
477
  "backApplyComplete",
478
478
  "backApplyFailed",
479
479
  "backApplyStartFailed",
480
+ "backApplyRestartFailed",
480
481
  "statusUnknown",
481
482
  "filterSaved",
482
483
  "runStopped",
@@ -540,6 +541,26 @@ describe("runCopy", () => {
540
541
  assert.equal(started.showProgress, false);
541
542
  });
542
543
 
544
+ it("keeps the counts of the pass that ran when its retry could not be started", () => {
545
+ // #552: the retry is a second pass over the same mail, so a retry that
546
+ // failed leaves the first pass's ending exactly where it was.
547
+ const once = outcome("backApplyRestartFailed", "once");
548
+ assert.equal(once.title, "The retry didn't start");
549
+ assert.match(once.detail, /10 of 12 moved/);
550
+ assert.match(once.detail, /rejected 2/);
551
+ assert.match(once.detail, /Check your connection/);
552
+ assert.doesNotMatch(once.detail, /Nothing has changed/);
553
+ assert.equal(once.tone, "warning");
554
+ assert.equal(once.retryLabel, "Retry 2");
555
+ assert.equal(once.showProgress, true);
556
+
557
+ const standing = outcome("backApplyRestartFailed", "standing");
558
+ assert.match(standing.title, /Rule saved/);
559
+ assert.doesNotMatch(standing.detail, /never started/);
560
+ assert.match(standing.detail, /keeps working on new mail/);
561
+ assert.equal(standing.retryLabel, "Retry 2");
562
+ });
563
+
543
564
  it("keeps a run that is going when its progress could not be read", () => {
544
565
  // A poll that failed says nothing about the job behind it (#526), so the
545
566
  // screen never claims the action never started, and the way out of it is a
@@ -301,6 +301,7 @@ export type RunState =
301
301
  | "backApplyComplete"
302
302
  | "backApplyFailed"
303
303
  | "backApplyStartFailed"
304
+ | "backApplyRestartFailed"
304
305
  | "statusUnknown"
305
306
  | "filterSaved"
306
307
  | "runStopped"
@@ -386,6 +387,7 @@ export const runCopy = ({
386
387
  state === "backApplyRunning" ||
387
388
  state === "backApplyComplete" ||
388
389
  state === "backApplyFailed" ||
390
+ state === "backApplyRestartFailed" ||
389
391
  state === "statusUnknown" ||
390
392
  state === "runStopped",
391
393
  failureListLabel: `Not ${done}`,
@@ -463,6 +465,22 @@ export const runCopy = ({
463
465
  retryLabel: `Retry ${failed}`,
464
466
  };
465
467
  }
468
+ if (state === "backApplyRestartFailed") {
469
+ return {
470
+ ...shared,
471
+ title: standing
472
+ ? "Rule saved — the retry didn't start"
473
+ : "The retry didn't start",
474
+ detail: `${applied} of ${matched} ${done} · the mail server rejected ${failed}, which are still where they were.${
475
+ standing
476
+ ? " The rule itself is saved and keeps working on new mail."
477
+ : ""
478
+ } Check your connection and try again.`,
479
+ tone: "warning",
480
+ dismissLabel: "Close",
481
+ retryLabel: `Retry ${failed}`,
482
+ };
483
+ }
466
484
  if (state === "backApplyStartFailed") {
467
485
  return {
468
486
  ...shared,