fsanyoto commited on
Commit
1fa5ae7
Β·
verified Β·
1 Parent(s): 5527857

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "6b8421a",
3
  "releases": [
4
  {
5
  "version": "v13",
 
1
  {
2
+ "current": "6a66e94",
3
  "releases": [
4
  {
5
  "version": "v13",
VERSION CHANGED
@@ -1 +1 @@
1
- 6b8421a
 
1
+ 6a66e94
web/src/customer-grid/CustomerGrid.tsx CHANGED
@@ -96,7 +96,8 @@ import type { AnchorRect } from "./OverlaySurface";
96
  import { StarIcon } from "./Stars";
97
  import { ALL_VIEW_ID, MAX_CALENDAR_METRICS, allViewName,
98
  MAX_FROZEN, choiceOptions, clampFrozenCount, cleanDisplay, formulaOf, topicForScope,
99
- isDateFamilyType, isFilterGroup, isGroupableField, isMachineOwned, isNumericFieldType,
 
100
  isPickType, mayEditField,
101
  isModeFrozen, isUndeletableView, mayEditView, mayToggleViewLock,
102
  measureColumnIndex, ratingMax, ruleColumnKeys,
@@ -560,6 +561,16 @@ function CustomerGrid({ scope = "customer" }: { scope?: SurfaceScope } = {}) {
560
  /** Owner item 4 / C-ADDROW β€” the pid the trailing "+" just created, so the cursor can land on
561
  * it once the re-read actually brings it back (the row does not exist locally before that). */
562
  const [newRowPid, setNewRowPid] = useState<number | null>(null);
 
 
 
 
 
 
 
 
 
 
563
  /** Wave-2 item 2c β€” cohort mode: the active cohort and the "+ Add customers" picker. Picks
564
  * ACCUMULATE across searches (search, tick, search again, confirm once). */
565
  const [activeCohortId, setActiveCohortId] = useState<string | null>(null);
@@ -1526,6 +1537,38 @@ function CustomerGrid({ scope = "customer" }: { scope?: SurfaceScope } = {}) {
1526
  return false;
1527
  }
1528
  if (!captured.length) return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1529
  // SEQUENTIAL, matching the restore path: the store is one document and ten concurrent
1530
  // read-modify-writes against it is how a delete silently misses a row.
1531
  const gone: UndoRow[] = [];
@@ -1564,7 +1607,7 @@ function CustomerGrid({ scope = "customer" }: { scope?: SurfaceScope } = {}) {
1564
  );
1565
  return true;
1566
  },
1567
- [isUserTable, displayRows, fields, scope, clearSelection]
1568
  );
1569
 
1570
  const onGridDelete = useCallback(
@@ -4475,11 +4518,20 @@ function CustomerGrid({ scope = "customer" }: { scope?: SurfaceScope } = {}) {
4475
  {isUserTable && (
4476
  <button
4477
  type="button"
4478
- className="cg-btn cg-btn--danger cg-selbar-del"
 
 
 
 
 
 
 
4479
  style={ONE_LINE}
4480
  onClick={() => void deleteRecords([...selectedPids])}
4481
  >
4482
- Delete {selectedPids.size === 1 ? "record" : "records"}
 
 
4483
  </button>
4484
  )}
4485
  {cohortMode ? (
 
96
  import { StarIcon } from "./Stars";
97
  import { ALL_VIEW_ID, MAX_CALENDAR_METRICS, allViewName,
98
  MAX_FROZEN, choiceOptions, clampFrozenCount, cleanDisplay, formulaOf, topicForScope,
99
+ isDateFamilyType, isFilterGroup, isGroupableField, isMachineOwned, isMachineWritten,
100
+ isNumericFieldType,
101
  isPickType, mayEditField,
102
  isModeFrozen, isUndeletableView, mayEditView, mayToggleViewLock,
103
  measureColumnIndex, ratingMax, ruleColumnKeys,
 
561
  /** Owner item 4 / C-ADDROW β€” the pid the trailing "+" just created, so the cursor can land on
562
  * it once the re-read actually brings it back (the row does not exist locally before that). */
563
  const [newRowPid, setNewRowPid] = useState<number | null>(null);
564
+ /**
565
+ * ⭐ WARN-THEN-ALLOW on delete (owner, 2026-08-06) β€” the SIGNATURE of the selection currently
566
+ * armed, or `""`.
567
+ *
568
+ * A signature and not a boolean, deliberately: it is the pid list itself, so changing the
569
+ * selection DISARMS automatically. A boolean would stay true while you re-selected, and the
570
+ * second Delete would then destroy a set nobody had been warned about β€” which is worse than no
571
+ * warning at all, because the warning is what made it feel checked.
572
+ */
573
+ const [delArmed, setDelArmed] = useState("");
574
  /** Wave-2 item 2c β€” cohort mode: the active cohort and the "+ Add customers" picker. Picks
575
  * ACCUMULATE across searches (search, tick, search again, confirm once). */
576
  const [activeCohortId, setActiveCohortId] = useState<string | null>(null);
 
1537
  return false;
1538
  }
1539
  if (!captured.length) return false;
1540
+
1541
+ /*
1542
+ * ⭐ WARN THEN ALLOW (owner ruling, 2026-08-06) β€” the arm fires ONLY where something is
1543
+ * actually at stake, so deleting your own scratch rows stays one keypress.
1544
+ *
1545
+ * β›” THE PREDICATE IS "WHAT WOULD BE LOST", NOT "WHO CREATED THIS". There is no stored
1546
+ * creator on a row, and deriving one from a stage column would flip meaning as the
1547
+ * automation runs. But the question the warning answers is a different and answerable one:
1548
+ * *has an automation written to this row* β€” because that is exactly what a re-find cannot
1549
+ * give back. MEASURED in `run_discover_instagram`: the seen-before test reads the rows
1550
+ * CURRENTLY IN THE TABLE, so a deleted candidate returns as NEW β€” `found_count` back to 1,
1551
+ * `first_found` re-stamped, and its stage reset to Review. Deleting a Declined candidate
1552
+ * un-declines it.
1553
+ */
1554
+ const machineKeys = fields
1555
+ .filter((f) => isMachineWritten(f) || f.automation?.stageField)
1556
+ .map((f) => f.key);
1557
+ // `captured` holds only NON-EMPTY values, so a key being present IS "a machine wrote here".
1558
+ const risky = captured.filter((r) => machineKeys.some((k) => r.values[k] !== undefined));
1559
+ const sig = captured.map((r) => r.rid).join(",");
1560
+ if (risky.length && delArmed !== sig) {
1561
+ setDelArmed(sig);
1562
+ signal(
1563
+ TOAST_EVENT,
1564
+ `${risky.length} of these ${risky.length === 1 ? "records was" : "records were"} ` +
1565
+ `written by an automation. Deleting ${risky.length === 1 ? "it" : "them"} resets ` +
1566
+ `first-found and times-found, and puts the stage back to Review β€” so a Declined ` +
1567
+ `card would come back undecided. Press Delete again (or click again) to confirm.`
1568
+ );
1569
+ return false;
1570
+ }
1571
+ setDelArmed("");
1572
  // SEQUENTIAL, matching the restore path: the store is one document and ten concurrent
1573
  // read-modify-writes against it is how a delete silently misses a row.
1574
  const gone: UndoRow[] = [];
 
1607
  );
1608
  return true;
1609
  },
1610
+ [isUserTable, displayRows, fields, scope, clearSelection, delArmed]
1611
  );
1612
 
1613
  const onGridDelete = useCallback(
 
4518
  {isUserTable && (
4519
  <button
4520
  type="button"
4521
+ /* ARMED is a VISIBLE state, not just a changed handler: the button that is
4522
+ about to do something irreversible-feeling has to look different from the
4523
+ one that merely offered. Same `is-armed` idiom the column menu, the docs
4524
+ list and the views rail already use for their deletes. */
4525
+ className={
4526
+ "cg-btn cg-btn--danger cg-selbar-del" +
4527
+ (delArmed && delArmed === [...selectedPids].join(",") ? " is-armed" : "")
4528
+ }
4529
  style={ONE_LINE}
4530
  onClick={() => void deleteRecords([...selectedPids])}
4531
  >
4532
+ {delArmed && delArmed === [...selectedPids].join(",")
4533
+ ? "Delete anyway?"
4534
+ : `Delete ${selectedPids.size === 1 ? "record" : "records"}`}
4535
  </button>
4536
  )}
4537
  {cohortMode ? (
web/src/index.css CHANGED
@@ -2534,6 +2534,17 @@ body {
2534
  .cg-btn--danger:hover:not(:disabled) {
2535
  background: rgba(139, 26, 20, 0.06);
2536
  }
 
 
 
 
 
 
 
 
 
 
 
2537
 
2538
  /* Item 8c β€” the Period row of a measure-carrying column. */
2539
  .cg-column-period {
 
2534
  .cg-btn--danger:hover:not(:disabled) {
2535
  background: rgba(139, 26, 20, 0.06);
2536
  }
2537
+ /* ⭐ THE ARMED DELETE (owner's warn-then-allow, 2026-08-06). The same `is-armed` idiom the column
2538
+ menu, the documents list and the views rail already use: the second press is the one that
2539
+ fires, so the button has to LOOK like a different button while it waits. Filled rather than
2540
+ outlined β€” an armed control that only changes its words is one a hurried eye reads as the
2541
+ control it was a moment ago. */
2542
+ .cg-selbar-del.is-armed {
2543
+ color: var(--lp-red-deep);
2544
+ background: var(--lp-red-tint);
2545
+ border-color: var(--lp-red);
2546
+ font-weight: 600;
2547
+ }
2548
 
2549
  /* Item 8c β€” the Period row of a measure-carrying column. */
2550
  .cg-column-period {