@remit/ui 0.0.72 → 0.0.73

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.72",
3
+ "version": "0.0.73",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -582,6 +582,25 @@ describe("RunStepBody", () => {
582
582
  assert.match(html, /Nothing has changed\./);
583
583
  });
584
584
 
585
+ // A poll that could not be read is not a run that never started (#526): the
586
+ // screen keeps the counts it has and says what it cannot see.
587
+ it("keeps a run that is going when its progress could not be read", () => {
588
+ const html = renderToString(
589
+ createElement(RunStepBody, {
590
+ ...runProps,
591
+ state: "statusUnknown",
592
+ scope: "once",
593
+ matched: 1284,
594
+ applied: 40,
595
+ }),
596
+ );
597
+ assert.match(html, /progress unknown/);
598
+ assert.match(html, /carries on either way/);
599
+ assert.match(html, /role="progressbar"/);
600
+ assert.doesNotMatch(html, /Nothing has changed/);
601
+ assert.doesNotMatch(html, /never started/);
602
+ });
603
+
585
604
  it("says a filter saved with nothing to back-apply is live", () => {
586
605
  const html = renderToString(
587
606
  createElement(RunStepBody, {
@@ -620,6 +639,18 @@ describe("RunFooter", () => {
620
639
  assert.match(html, /Not now/);
621
640
  });
622
641
 
642
+ it("offers another look, not another run, when the progress could not be read", () => {
643
+ const html = renderToString(
644
+ createElement(RunFooter, {
645
+ ...runProps,
646
+ state: "statusUnknown",
647
+ scope: "once",
648
+ }),
649
+ );
650
+ assert.match(html, /Check again/);
651
+ assert.match(html, /Close/);
652
+ });
653
+
623
654
  it("offers only a way out once there is nothing outstanding", () => {
624
655
  const html = renderToString(createElement(RunFooter, runProps));
625
656
  assert.match(html, /Done/);
@@ -477,6 +477,7 @@ describe("runCopy", () => {
477
477
  "backApplyComplete",
478
478
  "backApplyFailed",
479
479
  "backApplyStartFailed",
480
+ "statusUnknown",
480
481
  "filterSaved",
481
482
  "runStopped",
482
483
  "commitFailed",
@@ -539,6 +540,25 @@ describe("runCopy", () => {
539
540
  assert.equal(started.showProgress, false);
540
541
  });
541
542
 
543
+ it("keeps a run that is going when its progress could not be read", () => {
544
+ // A poll that failed says nothing about the job behind it (#526), so the
545
+ // screen never claims the action never started, and the way out of it is a
546
+ // second look rather than a second run.
547
+ const once = outcome("statusUnknown", "once");
548
+ assert.equal(once.title, "Moving — progress unknown");
549
+ assert.match(once.detail, /carries on either way/);
550
+ assert.doesNotMatch(once.detail, /Nothing has changed/);
551
+ assert.equal(once.tone, "warning");
552
+ assert.equal(once.retryLabel, "Check again");
553
+ assert.equal(once.screenTitle, "Move");
554
+
555
+ const standing = outcome("statusUnknown", "standing");
556
+ assert.match(standing.title, /Rule saved/);
557
+ assert.doesNotMatch(standing.detail, /never started/);
558
+ assert.match(standing.detail, /keeps working on new mail/);
559
+ assert.equal(standing.retryLabel, "Check again");
560
+ });
561
+
542
562
  it("says a filter saved with nothing to back-apply is still live", () => {
543
563
  const saved = outcome("filterSaved", "standing");
544
564
  assert.equal(saved.title, "Filter saved");
@@ -559,6 +579,8 @@ describe("runCopy", () => {
559
579
  assert.equal(outcome("backApplyRunning", "standing").showProgress, true);
560
580
  assert.equal(outcome("backApplyComplete", "once").showProgress, true);
561
581
  assert.equal(outcome("backApplyFailed", "once").showProgress, true);
582
+ // The last counts read are still the last counts read.
583
+ assert.equal(outcome("statusUnknown", "once").showProgress, true);
562
584
  });
563
585
 
564
586
  it("names the failure list in the verb's own past tense", () => {
@@ -301,6 +301,7 @@ export type RunState =
301
301
  | "backApplyComplete"
302
302
  | "backApplyFailed"
303
303
  | "backApplyStartFailed"
304
+ | "statusUnknown"
304
305
  | "filterSaved"
305
306
  | "runStopped"
306
307
  | "commitFailed";
@@ -374,7 +375,10 @@ export const runCopy = ({
374
375
  const { label, present, past } = verbCopy(verb);
375
376
  const done = past.toLowerCase();
376
377
  const standing = scope === "standing" || scope === "until";
377
- const inFlight = state === "saving" || state === "backApplyRunning";
378
+ const inFlight =
379
+ state === "saving" ||
380
+ state === "backApplyRunning" ||
381
+ state === "statusUnknown";
378
382
  const shared = {
379
383
  // A create that failed did not finish, so the header does not say it did.
380
384
  screenTitle: inFlight || state === "commitFailed" ? label : "Done",
@@ -382,6 +386,7 @@ export const runCopy = ({
382
386
  state === "backApplyRunning" ||
383
387
  state === "backApplyComplete" ||
384
388
  state === "backApplyFailed" ||
389
+ state === "statusUnknown" ||
385
390
  state === "runStopped",
386
391
  failureListLabel: `Not ${done}`,
387
392
  };
@@ -407,6 +412,20 @@ export const runCopy = ({
407
412
  cancelLabel: "Stop the run",
408
413
  };
409
414
  }
415
+ if (state === "statusUnknown") {
416
+ return {
417
+ ...shared,
418
+ title: standing
419
+ ? "Rule saved. Its progress over your existing mail is unknown"
420
+ : `${present} — progress unknown`,
421
+ detail: standing
422
+ ? "The connection dropped, so the bar shows the last that was read. The pass runs on the mail server, and the rule keeps working on new mail either way. This keeps checking."
423
+ : "The connection dropped, so the bar shows the last that was read. The run is on the mail server and carries on either way. This keeps checking.",
424
+ tone: "warning",
425
+ dismissLabel: "Close",
426
+ retryLabel: "Check again",
427
+ };
428
+ }
410
429
  if (state === "backApplyComplete") {
411
430
  return {
412
431
  ...shared,