Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_products.py +14 -1
- platform/aios_grid.py +16 -6
- platform/aios_grid_fields.json +14 -9
- platform/core/grid_events.py +47 -0
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v53",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "90057bc",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v53",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
90057bc
|
api/routes_products.py
CHANGED
|
@@ -400,9 +400,22 @@ def product_assembly(session: Session, scope: str = "product", storage_key: str
|
|
| 400 |
# after a refresh and for collaborators, while canonical JSON choices retain their order.
|
| 401 |
fields = aios_grid.apply_choice_overrides(fields, shared_defs)
|
| 402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
have = {field.get("key") for field in fields if isinstance(field, dict)}
|
| 404 |
projected = []
|
| 405 |
-
from core import shares
|
| 406 |
for key, field in shared_defs.items():
|
| 407 |
if key in have:
|
| 408 |
continue
|
|
|
|
| 400 |
# after a refresh and for collaborators, while canonical JSON choices retain their order.
|
| 401 |
fields = aios_grid.apply_choice_overrides(fields, shared_defs)
|
| 402 |
|
| 403 |
+
from core import shares
|
| 404 |
+
# Shared contract fields stay in ``fields`` rather than the projected
|
| 405 |
+
# created-field tail below. They still need the same per-viewer role stamp:
|
| 406 |
+
# once an Administrator creates and shares a spreadsheet field, every
|
| 407 |
+
# ordinary collaborator must receive the normal edit door too.
|
| 408 |
+
for item in fields:
|
| 409 |
+
if not isinstance(item, dict) or not item.get("shared"):
|
| 410 |
+
continue
|
| 411 |
+
role = shares.role_for(
|
| 412 |
+
"field", shares.field_oid("product_data", item.get("key")), session.uname,
|
| 413 |
+
is_admin=session.admin, st=session.runtime)
|
| 414 |
+
if role:
|
| 415 |
+
item["sharedRole"] = role
|
| 416 |
+
|
| 417 |
have = {field.get("key") for field in fields if isinstance(field, dict)}
|
| 418 |
projected = []
|
|
|
|
| 419 |
for key, field in shared_defs.items():
|
| 420 |
if key in have:
|
| 421 |
continue
|
platform/aios_grid.py
CHANGED
|
@@ -301,12 +301,14 @@ def hydrate_choice_options_from_rows(fields, rows, ignored_by_field=None):
|
|
| 301 |
|
| 302 |
|
| 303 |
def apply_choice_overrides(fields, overrides):
|
| 304 |
-
"""Return field copies with durable select-family
|
| 305 |
|
| 306 |
`overrides` is deliberately only a field-key map, so a product route can use the tenant-wide
|
| 307 |
shared schema and a normal table workspace can use its personal source-column annotations.
|
| 308 |
It never changes a non-choice field, and it never replaces canonical choices with a stale
|
| 309 |
-
annotation: both vocabularies are merged through the one cleaner above.
|
|
|
|
|
|
|
| 310 |
"""
|
| 311 |
saved = overrides if isinstance(overrides, dict) else {}
|
| 312 |
out = []
|
|
@@ -316,12 +318,20 @@ def apply_choice_overrides(fields, overrides):
|
|
| 316 |
out.append(field)
|
| 317 |
continue
|
| 318 |
extra = saved.get(field.get("key"))
|
| 319 |
-
if not isinstance(extra, dict)
|
| 320 |
out.append(field)
|
| 321 |
continue
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
out.append(field)
|
| 326 |
return out
|
| 327 |
|
|
|
|
| 301 |
|
| 302 |
|
| 303 |
def apply_choice_overrides(fields, overrides):
|
| 304 |
+
"""Return field copies with durable select-family definition overrides applied.
|
| 305 |
|
| 306 |
`overrides` is deliberately only a field-key map, so a product route can use the tenant-wide
|
| 307 |
shared schema and a normal table workspace can use its personal source-column annotations.
|
| 308 |
It never changes a non-choice field, and it never replaces canonical choices with a stale
|
| 309 |
+
annotation: both vocabularies are merged through the one cleaner above. Product's shared
|
| 310 |
+
spreadsheet columns also carry their Administrator-authored label and note here, so a
|
| 311 |
+
definition save is visible on the same field projection that supplies the picker.
|
| 312 |
"""
|
| 313 |
saved = overrides if isinstance(overrides, dict) else {}
|
| 314 |
out = []
|
|
|
|
| 318 |
out.append(field)
|
| 319 |
continue
|
| 320 |
extra = saved.get(field.get("key"))
|
| 321 |
+
if not isinstance(extra, dict):
|
| 322 |
out.append(field)
|
| 323 |
continue
|
| 324 |
+
if isinstance(extra.get("label"), str) and extra["label"].strip():
|
| 325 |
+
field["label"] = extra["label"].strip()[:120]
|
| 326 |
+
if isinstance(extra.get("note"), str):
|
| 327 |
+
field["note"] = extra["note"][:2000]
|
| 328 |
+
fmt = _clean_format(extra.get("format"), field.get("type"))
|
| 329 |
+
if fmt:
|
| 330 |
+
field["format"] = fmt
|
| 331 |
+
if "options" in extra:
|
| 332 |
+
options = merge_choice_options(field.get("options"), extra.get("options"))
|
| 333 |
+
field["options"] = options
|
| 334 |
+
field.update(_choice_appearance(extra, options))
|
| 335 |
out.append(field)
|
| 336 |
return out
|
| 337 |
|
platform/aios_grid_fields.json
CHANGED
|
@@ -358,6 +358,7 @@
|
|
| 358 |
"label": "Supplier",
|
| 359 |
"type": "multiselect",
|
| 360 |
"source": "overlay",
|
|
|
|
| 361 |
"default": true,
|
| 362 |
"description": "Supplier or manufacturer for this product.",
|
| 363 |
"shared": true
|
|
@@ -727,6 +728,7 @@
|
|
| 727 |
"label": "Needs pricing",
|
| 728 |
"type": "select",
|
| 729 |
"source": "overlay",
|
|
|
|
| 730 |
"default": false,
|
| 731 |
"options": [
|
| 732 |
"Yes"
|
|
@@ -739,6 +741,7 @@
|
|
| 739 |
"label": "March pricelist",
|
| 740 |
"type": "select",
|
| 741 |
"source": "overlay",
|
|
|
|
| 742 |
"default": false,
|
| 743 |
"options": [
|
| 744 |
"Yes"
|
|
@@ -751,6 +754,7 @@
|
|
| 751 |
"label": "Price changes",
|
| 752 |
"type": "select",
|
| 753 |
"source": "overlay",
|
|
|
|
| 754 |
"default": false,
|
| 755 |
"options": [
|
| 756 |
"Yes"
|
|
@@ -763,6 +767,7 @@
|
|
| 763 |
"label": "Closeouts",
|
| 764 |
"type": "select",
|
| 765 |
"source": "overlay",
|
|
|
|
| 766 |
"default": false,
|
| 767 |
"options": [
|
| 768 |
"Yes"
|
|
@@ -784,10 +789,10 @@
|
|
| 784 |
"label": "Sub-Category",
|
| 785 |
"type": "select",
|
| 786 |
"source": "overlay",
|
|
|
|
| 787 |
"default": false,
|
| 788 |
"preset": false,
|
| 789 |
"shared": true,
|
| 790 |
-
"createdBy": "admin",
|
| 791 |
"permissions": {
|
| 792 |
"edit": "collaborative"
|
| 793 |
},
|
|
@@ -798,10 +803,10 @@
|
|
| 798 |
"label": "Main Category",
|
| 799 |
"type": "select",
|
| 800 |
"source": "overlay",
|
|
|
|
| 801 |
"default": false,
|
| 802 |
"preset": false,
|
| 803 |
"shared": true,
|
| 804 |
-
"createdBy": "admin",
|
| 805 |
"permissions": {
|
| 806 |
"edit": "collaborative"
|
| 807 |
},
|
|
@@ -812,10 +817,10 @@
|
|
| 812 |
"label": "Color",
|
| 813 |
"type": "multiselect",
|
| 814 |
"source": "overlay",
|
|
|
|
| 815 |
"default": false,
|
| 816 |
"preset": false,
|
| 817 |
"shared": true,
|
| 818 |
-
"createdBy": "admin",
|
| 819 |
"permissions": {
|
| 820 |
"edit": "collaborative"
|
| 821 |
},
|
|
@@ -826,10 +831,10 @@
|
|
| 826 |
"label": "Shape/Style",
|
| 827 |
"type": "select",
|
| 828 |
"source": "overlay",
|
|
|
|
| 829 |
"default": false,
|
| 830 |
"preset": false,
|
| 831 |
"shared": true,
|
| 832 |
-
"createdBy": "admin",
|
| 833 |
"permissions": {
|
| 834 |
"edit": "collaborative"
|
| 835 |
},
|
|
@@ -840,10 +845,10 @@
|
|
| 840 |
"label": "Material",
|
| 841 |
"type": "select",
|
| 842 |
"source": "overlay",
|
|
|
|
| 843 |
"default": false,
|
| 844 |
"preset": false,
|
| 845 |
"shared": true,
|
| 846 |
-
"createdBy": "admin",
|
| 847 |
"permissions": {
|
| 848 |
"edit": "collaborative"
|
| 849 |
},
|
|
@@ -854,10 +859,10 @@
|
|
| 854 |
"label": "Finish",
|
| 855 |
"type": "select",
|
| 856 |
"source": "overlay",
|
|
|
|
| 857 |
"default": false,
|
| 858 |
"preset": false,
|
| 859 |
"shared": true,
|
| 860 |
-
"createdBy": "admin",
|
| 861 |
"permissions": {
|
| 862 |
"edit": "collaborative"
|
| 863 |
},
|
|
@@ -868,10 +873,10 @@
|
|
| 868 |
"label": "Occassion",
|
| 869 |
"type": "multiselect",
|
| 870 |
"source": "overlay",
|
|
|
|
| 871 |
"default": false,
|
| 872 |
"preset": false,
|
| 873 |
"shared": true,
|
| 874 |
-
"createdBy": "admin",
|
| 875 |
"permissions": {
|
| 876 |
"edit": "collaborative"
|
| 877 |
},
|
|
@@ -882,10 +887,10 @@
|
|
| 882 |
"label": "Collection",
|
| 883 |
"type": "select",
|
| 884 |
"source": "overlay",
|
|
|
|
| 885 |
"default": false,
|
| 886 |
"preset": false,
|
| 887 |
"shared": true,
|
| 888 |
-
"createdBy": "admin",
|
| 889 |
"permissions": {
|
| 890 |
"edit": "collaborative"
|
| 891 |
},
|
|
@@ -896,10 +901,10 @@
|
|
| 896 |
"label": "Size",
|
| 897 |
"type": "select",
|
| 898 |
"source": "overlay",
|
|
|
|
| 899 |
"default": false,
|
| 900 |
"preset": false,
|
| 901 |
"shared": true,
|
| 902 |
-
"createdBy": "admin",
|
| 903 |
"permissions": {
|
| 904 |
"edit": "collaborative"
|
| 905 |
},
|
|
|
|
| 358 |
"label": "Supplier",
|
| 359 |
"type": "multiselect",
|
| 360 |
"source": "overlay",
|
| 361 |
+
"custom": true,
|
| 362 |
"default": true,
|
| 363 |
"description": "Supplier or manufacturer for this product.",
|
| 364 |
"shared": true
|
|
|
|
| 728 |
"label": "Needs pricing",
|
| 729 |
"type": "select",
|
| 730 |
"source": "overlay",
|
| 731 |
+
"custom": true,
|
| 732 |
"default": false,
|
| 733 |
"options": [
|
| 734 |
"Yes"
|
|
|
|
| 741 |
"label": "March pricelist",
|
| 742 |
"type": "select",
|
| 743 |
"source": "overlay",
|
| 744 |
+
"custom": true,
|
| 745 |
"default": false,
|
| 746 |
"options": [
|
| 747 |
"Yes"
|
|
|
|
| 754 |
"label": "Price changes",
|
| 755 |
"type": "select",
|
| 756 |
"source": "overlay",
|
| 757 |
+
"custom": true,
|
| 758 |
"default": false,
|
| 759 |
"options": [
|
| 760 |
"Yes"
|
|
|
|
| 767 |
"label": "Closeouts",
|
| 768 |
"type": "select",
|
| 769 |
"source": "overlay",
|
| 770 |
+
"custom": true,
|
| 771 |
"default": false,
|
| 772 |
"options": [
|
| 773 |
"Yes"
|
|
|
|
| 789 |
"label": "Sub-Category",
|
| 790 |
"type": "select",
|
| 791 |
"source": "overlay",
|
| 792 |
+
"custom": true,
|
| 793 |
"default": false,
|
| 794 |
"preset": false,
|
| 795 |
"shared": true,
|
|
|
|
| 796 |
"permissions": {
|
| 797 |
"edit": "collaborative"
|
| 798 |
},
|
|
|
|
| 803 |
"label": "Main Category",
|
| 804 |
"type": "select",
|
| 805 |
"source": "overlay",
|
| 806 |
+
"custom": true,
|
| 807 |
"default": false,
|
| 808 |
"preset": false,
|
| 809 |
"shared": true,
|
|
|
|
| 810 |
"permissions": {
|
| 811 |
"edit": "collaborative"
|
| 812 |
},
|
|
|
|
| 817 |
"label": "Color",
|
| 818 |
"type": "multiselect",
|
| 819 |
"source": "overlay",
|
| 820 |
+
"custom": true,
|
| 821 |
"default": false,
|
| 822 |
"preset": false,
|
| 823 |
"shared": true,
|
|
|
|
| 824 |
"permissions": {
|
| 825 |
"edit": "collaborative"
|
| 826 |
},
|
|
|
|
| 831 |
"label": "Shape/Style",
|
| 832 |
"type": "select",
|
| 833 |
"source": "overlay",
|
| 834 |
+
"custom": true,
|
| 835 |
"default": false,
|
| 836 |
"preset": false,
|
| 837 |
"shared": true,
|
|
|
|
| 838 |
"permissions": {
|
| 839 |
"edit": "collaborative"
|
| 840 |
},
|
|
|
|
| 845 |
"label": "Material",
|
| 846 |
"type": "select",
|
| 847 |
"source": "overlay",
|
| 848 |
+
"custom": true,
|
| 849 |
"default": false,
|
| 850 |
"preset": false,
|
| 851 |
"shared": true,
|
|
|
|
| 852 |
"permissions": {
|
| 853 |
"edit": "collaborative"
|
| 854 |
},
|
|
|
|
| 859 |
"label": "Finish",
|
| 860 |
"type": "select",
|
| 861 |
"source": "overlay",
|
| 862 |
+
"custom": true,
|
| 863 |
"default": false,
|
| 864 |
"preset": false,
|
| 865 |
"shared": true,
|
|
|
|
| 866 |
"permissions": {
|
| 867 |
"edit": "collaborative"
|
| 868 |
},
|
|
|
|
| 873 |
"label": "Occassion",
|
| 874 |
"type": "multiselect",
|
| 875 |
"source": "overlay",
|
| 876 |
+
"custom": true,
|
| 877 |
"default": false,
|
| 878 |
"preset": false,
|
| 879 |
"shared": true,
|
|
|
|
| 880 |
"permissions": {
|
| 881 |
"edit": "collaborative"
|
| 882 |
},
|
|
|
|
| 887 |
"label": "Collection",
|
| 888 |
"type": "select",
|
| 889 |
"source": "overlay",
|
| 890 |
+
"custom": true,
|
| 891 |
"default": false,
|
| 892 |
"preset": false,
|
| 893 |
"shared": true,
|
|
|
|
| 894 |
"permissions": {
|
| 895 |
"edit": "collaborative"
|
| 896 |
},
|
|
|
|
| 901 |
"label": "Size",
|
| 902 |
"type": "select",
|
| 903 |
"source": "overlay",
|
| 904 |
+
"custom": true,
|
| 905 |
"default": false,
|
| 906 |
"preset": false,
|
| 907 |
"shared": true,
|
|
|
|
| 908 |
"permissions": {
|
| 909 |
"edit": "collaborative"
|
| 910 |
},
|
platform/core/grid_events.py
CHANGED
|
@@ -1730,6 +1730,7 @@ def handle_one(event, ctx):
|
|
| 1730 |
shared_field = False
|
| 1731 |
shared_storage_key = None
|
| 1732 |
grant_topic = None
|
|
|
|
| 1733 |
if ctx.table is not None:
|
| 1734 |
try:
|
| 1735 |
import core.shared_overlay as _shared_overlay
|
|
@@ -1741,6 +1742,28 @@ def handle_one(event, ctx):
|
|
| 1741 |
and shared_prior.get('custom'))
|
| 1742 |
except Exception:
|
| 1743 |
shared_prior = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1744 |
if shared_field:
|
| 1745 |
if not _may_edit_field_definition(ctx, key, shared_prior):
|
| 1746 |
return _refuse(
|
|
@@ -1759,6 +1782,22 @@ def handle_one(event, ctx):
|
|
| 1759 |
field['format'] = fmt
|
| 1760 |
else:
|
| 1761 |
field.pop('format', None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1762 |
elif key.startswith(_ag2.MEASURE_FIELD_PREFIX):
|
| 1763 |
# A FORMULA-MEASURE column (owner item 7). Validated against THIS caller's measure
|
| 1764 |
# offer — the same admission the condition builder uses — so a field can only name a
|
|
@@ -2021,6 +2060,14 @@ def handle_one(event, ctx):
|
|
| 2021 |
_shares.set_grants('field', _shares.field_oid(grant_topic, key),
|
| 2022 |
_fp.grant_entries(field.get('permissions')),
|
| 2023 |
owner=field.get('createdBy') or uname, st=ctx.table.st)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2024 |
elif _store_of(ctx).available():
|
| 2025 |
field = (_tops(ctx).save_field(
|
| 2026 |
uname, field, reserved_names=_reserved_field_names,
|
|
|
|
| 1730 |
shared_field = False
|
| 1731 |
shared_storage_key = None
|
| 1732 |
grant_topic = None
|
| 1733 |
+
spreadsheet_choice_created = False
|
| 1734 |
if ctx.table is not None:
|
| 1735 |
try:
|
| 1736 |
import core.shared_overlay as _shared_overlay
|
|
|
|
| 1742 |
and shared_prior.get('custom'))
|
| 1743 |
except Exception:
|
| 1744 |
shared_prior = None
|
| 1745 |
+
# Product's spreadsheet-backed choice columns are ordinary tenant-shared
|
| 1746 |
+
# definitions, created by the person who saves them (normally the
|
| 1747 |
+
# Administrator account), rather than source API presets.
|
| 1748 |
+
# A prior W43 value edit may already have created a bare ``{key,
|
| 1749 |
+
# options}`` shared entry, so merge that vocabulary over the canonical
|
| 1750 |
+
# definition before opening the definition door.
|
| 1751 |
+
base_field = field_by_key.get(key)
|
| 1752 |
+
spreadsheet_choice = (
|
| 1753 |
+
scope_key == 'product'
|
| 1754 |
+
and isinstance(base_field, dict)
|
| 1755 |
+
and base_field.get('source') == 'overlay'
|
| 1756 |
+
and base_field.get('shared') is True
|
| 1757 |
+
and base_field.get('custom') is True
|
| 1758 |
+
and base_field.get('type') in ('select', 'multiselect')
|
| 1759 |
+
)
|
| 1760 |
+
if spreadsheet_choice:
|
| 1761 |
+
stored_choice = shared_prior if isinstance(shared_prior, dict) else {}
|
| 1762 |
+
spreadsheet_choice_created = not bool(stored_choice.get('custom'))
|
| 1763 |
+
shared_prior = {**base_field, **stored_choice,
|
| 1764 |
+
'key': key, 'source': 'overlay', 'shared': True,
|
| 1765 |
+
'custom': True, 'type': base_field['type']}
|
| 1766 |
+
shared_field = True
|
| 1767 |
if shared_field:
|
| 1768 |
if not _may_edit_field_definition(ctx, key, shared_prior):
|
| 1769 |
return _refuse(
|
|
|
|
| 1782 |
field['format'] = fmt
|
| 1783 |
else:
|
| 1784 |
field.pop('format', None)
|
| 1785 |
+
# The existing Image shared field has no vocabulary. Spreadsheet
|
| 1786 |
+
# choices do, and the definition writer has to validate and retain
|
| 1787 |
+
# its list and visual treatment rather than silently preserving a
|
| 1788 |
+
# read-only source projection.
|
| 1789 |
+
if field.get('type') in ('select', 'multiselect') and 'options' in raw:
|
| 1790 |
+
options = _ag2._clean_options(raw.get('options'))
|
| 1791 |
+
if not options:
|
| 1792 |
+
return _refuse(
|
| 1793 |
+
ctx, 'no_options', 'a select column needs at least one choice', key)
|
| 1794 |
+
field['options'] = options
|
| 1795 |
+
field.update(_ag2._choice_appearance({**field, **raw}, options))
|
| 1796 |
+
# The canonical spreadsheet declaration predates the normal field
|
| 1797 |
+
# definition record. Its first normal save is a creation, so stamp
|
| 1798 |
+
# the actual creator exactly as any other shared field does.
|
| 1799 |
+
if spreadsheet_choice and not str(field.get('createdBy') or '').strip():
|
| 1800 |
+
field['createdBy'] = uname
|
| 1801 |
elif key.startswith(_ag2.MEASURE_FIELD_PREFIX):
|
| 1802 |
# A FORMULA-MEASURE column (owner item 7). Validated against THIS caller's measure
|
| 1803 |
# offer — the same admission the condition builder uses — so a field can only name a
|
|
|
|
| 2060 |
_shares.set_grants('field', _shares.field_oid(grant_topic, key),
|
| 2061 |
_fp.grant_entries(field.get('permissions')),
|
| 2062 |
owner=field.get('createdBy') or uname, st=ctx.table.st)
|
| 2063 |
+
elif spreadsheet_choice_created:
|
| 2064 |
+
# The first ordinary save turns the spreadsheet declaration
|
| 2065 |
+
# into a normal field created by this user and shared to the
|
| 2066 |
+
# same collaborative audience as its cells.
|
| 2067 |
+
import core.shares as _shares
|
| 2068 |
+
_shares.set_grants('field', _shares.field_oid(grant_topic, key),
|
| 2069 |
+
_fp.grant_entries(field.get('permissions')),
|
| 2070 |
+
owner=field.get('createdBy') or uname, st=ctx.table.st)
|
| 2071 |
elif _store_of(ctx).available():
|
| 2072 |
field = (_tops(ctx).save_field(
|
| 2073 |
uname, field, reserved_names=_reserved_field_names,
|