Skip to content

Commit

Permalink
Add search_only and guide fields #10602
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Mar 8, 2024
1 parent 6b47885 commit 18177b3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.2.10 on 2024-02-26 12:22

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("models", "10553_lists_reffed_by_node_idx"),
]

operations = [
migrations.AddField(
model_name="controlledlist",
name="search_only",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="controlledlistitem",
name="guide",
field=models.BooleanField(default=False),
),
]
2 changes: 2 additions & 0 deletions arches/app/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,7 @@ class ControlledList(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=127, null=False)
dynamic = models.BooleanField(default=False)
search_only = models.BooleanField(default=False)

class Meta:
db_table = "controlled_lists"
Expand All @@ -1886,6 +1887,7 @@ class ControlledListItem(models.Model):
parent = models.ForeignKey(
"self", null=True, blank=True, on_delete=models.CASCADE, related_name="children"
)
guide = models.BooleanField(default=False)

class Meta:
db_table = "controlled_list_items"
Expand Down
2 changes: 2 additions & 0 deletions arches/app/src/types/ControlledListManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type ControlledListItem = {
id: string,
uri: string,
sortorder: number,
guide: boolean,
labels: Label[],
children: ControlledListItem[],
parent_id: string,
Expand All @@ -30,6 +31,7 @@ export type ControlledList = {
id: string,
name: string,
dynamic: boolean,
search_only: boolean,
items: ControlledListItem[],
nodes: ReferencingNode[],
};
Expand Down
3 changes: 3 additions & 0 deletions arches/app/views/controlled_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def serialize(obj, depth_map=None, flat=False, nodes=False):
"id": str(obj.id),
"name": obj.name,
"dynamic": obj.dynamic,
"search_only": obj.search_only,
"items": sorted(
[
serialize(item, depth_map, flat)
Expand Down Expand Up @@ -83,6 +84,7 @@ def serialize(obj, depth_map=None, flat=False, nodes=False):
"id": str(obj.id),
"uri": obj.uri,
"sortorder": obj.sortorder,
"guide": obj.guide,
"labels": [serialize(label, depth_map) for label in obj.labels.all()],
"parent_id": str(obj.parent_id) if obj.parent_id else None,
"depth": depth_map[obj.id],
Expand Down Expand Up @@ -258,6 +260,7 @@ def post(self, request, **kwargs):
return JSONErrorResponse(status=404)

clist.dynamic = data["dynamic"]
clist.search_only = data["search_only"]
clist.name = data["name"]

for item in data["items"]:
Expand Down

0 comments on commit 18177b3

Please sign in to comment.