New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved components by changing API usage from getDeviceType/ getAssetЕype to getDeviceProfileName/getAssetProfileName #9935
Conversation
@@ -343,7 +344,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, | |||
} | |||
if (subTypesObservable) { | |||
this.entitySubtypes = subTypesObservable.pipe( | |||
map(subTypes => subTypes.map(subType => subType.type)), | |||
map(subTypes => subTypes.map(subType => this.isEntitySubType(subType) ? subType.type : subType.name)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to do fetch type once when receiving data and not every time when filtering
subTypes.forEach(subType => { | ||
const typeName = this.isEntitySubType(subType) ? subType.type : subType.name; | ||
return !excludeSubTypesSet.has(typeName) && filteredSubTypes.push(typeName); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to do fetch type once when receiving data and not every time when filtering
subTypes.forEach(subType => { | ||
const typeName = this.isEntitySubType(subType) ? subType.type : subType.name; | ||
return !excludeSubTypesSet.has(typeName) && filteredSubTypes.push(typeName); | ||
}); | ||
return filteredSubTypes; | ||
}), | ||
publishReplay(1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this deprecated method
})) | ||
); | ||
} | ||
|
||
getSubTypes(): Observable<Array<EntitySubtype | string>> { | ||
getSubTypes(): Observable<Array<EntitySubtype | string | EntityInfoData>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it is better to rewrite so the function returns only the string data type?
private deviceProfileService: DeviceProfileService, | ||
private assetProfileService: AssetProfileService, | ||
private edgeService: EdgeService, | ||
private entityViewService: EntityViewService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After refactoring the code, you need to clean the imports.
private assetProfileService: AssetProfileService, | ||
private deviceProfileService: DeviceProfileService, | ||
private edgeService: EdgeService, | ||
private entityViewService: EntityViewService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After refactoring the code, you need to clean the imports.
private deviceProfileService: DeviceProfileService, | ||
private assetProfileService: AssetProfileService, | ||
private edgeService: EdgeService, | ||
private entityViewService: EntityViewService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After refactoring the code, you need to clean the imports.
Issue - #9321
Related BE - #9776
Before:
scrnli_1_3_2024_3-07-41.PM.webm
After:
scrnli_1_3_2024_3-12-11.PM.webm
General checklist
Front-End feature checklist