Skip to content

Commit

Permalink
Fix search for category in motion edit (#2817)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisa-beerboom authored Sep 21, 2023
1 parent 64c0ce7 commit 412525f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions client/src/app/infrastructure/definitions/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface TreeNodeWithoutItem extends TreeIdNode {
export interface OSTreeNode<T> extends TreeNodeWithoutItem {
item: T;
children?: OSTreeNode<T>[];
toString: () => string;
}

/**
Expand All @@ -46,6 +47,7 @@ export type FlatNode<T> = T & {
expandable: boolean;
id: number;
filtered?: boolean;
toString: () => string;
};

function isIdentifiedItemNode(obj: any): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
formControlName="category_id"
placeholder="{{ 'Category' | translate }}"
[repo]="categoryRepo"
[excludeIds]="true"
></os-repo-search-selector>
</mat-form-field>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export class TreeService {
name: item.getTitle(),
id: item.id,
item,
children
children,
toString: function () {
return this.item.toString();
}
};
}

Expand Down Expand Up @@ -352,7 +355,10 @@ export class TreeService {
isSeen: true,
expandable: false,
id: item.id,
position: index + oldMaxPosition + 1
position: index + oldMaxPosition + 1,
toString: function () {
return this.item.toString();
}
}));
return tree.concat(items);
}
Expand Down Expand Up @@ -406,7 +412,10 @@ export class TreeService {
expandable: !!children,
isExpanded: !!children,
level,
isSeen: true
isSeen: true,
toString: function () {
return this.item.toString();
}
};
return new Proxy(node, {
get: (target: FlatNode<T>, property: keyof Identifiable & Displayable & T) => {
Expand Down

0 comments on commit 412525f

Please sign in to comment.