Skip to content

Commit

Permalink
[2.20.2][hot-fix] - textual search scopes : use full_path for search …
Browse files Browse the repository at this point in the history
…perimeter - Ref gestion-de-projet#1495
  • Loading branch information
Mehdi-BOUYAHIA committed Mar 6, 2023
1 parent 3336f79 commit c01c936
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
17 changes: 9 additions & 8 deletions src/components/ScopeTree/ScopeTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ const ScopeTreeListItem: React.FC<ScopeTreeListItemProps> = (props) => {
</TableCell>

<TableCell>
{debouncedSearchTerm && row.name ? (
{debouncedSearchTerm && row.full_path ? (
<Breadcrumbs maxItems={2}>
{(row.name.split('/').length > 1 ? row.name.split('/').slice(1) : row.name.split('/').slice(0)).map(
(name: any, index: number) => (
<Typography key={index} style={{ color: '#153D8A' }}>
{name}
</Typography>
)
)}
{(row.full_path.split('/').length > 1
? row.full_path.split('/').slice(1)
: row.full_path.split('/').slice(0)
).map((full_path: any, index: number) => (
<Typography key={index} style={{ color: '#153D8A' }}>
{full_path}
</Typography>
))}
</Breadcrumbs>
) : (
<Typography>{row.name}</Typography>
Expand Down
5 changes: 3 additions & 2 deletions src/services/aphp/servicePerimeters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ const servicesPerimeters: IServicePerimeters = {
scopeRowItem.id = '' + scopeItem.perimeter.id
scopeRowItem.cohort_id = scopeItem.perimeter.cohort_id
scopeRowItem.name = servicesPerimeters.getScopeName(scopeItem.perimeter)
scopeRowItem.full_path = scopeItem.perimeter.full_path
scopeRowItem.quantity = +scopeItem.perimeter.cohort_size
scopeRowItem.access = servicesPerimeters.getAccessFromScope(scopeItem)
scopeRowItem.inferior_levels_ids = scopeItem.perimeter.inferior_levels_ids
Expand All @@ -394,9 +395,9 @@ const servicesPerimeters: IServicePerimeters = {
getScopeName: (perimeter: any) => {
const perimeterID = perimeter ? perimeter.source_value : false
if (!perimeterID) {
return perimeter ? perimeter.full_path : ''
return perimeter ? perimeter.name : ''
}
return `${perimeterID} - ${perimeter.full_path}`
return `${perimeterID} - ${perimeter.name}`
}
}

Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export type ScopeTreeRow = {
resourceType?: string
id: string
name: string
full_path?: string
quantity: number
parentId?: string
subItems: ScopeTreeRow[]
Expand Down

0 comments on commit c01c936

Please sign in to comment.