Adapting OHIFStudyMetadataSource to use new retrieveMetadata call from ohif:study-list package.

This commit is contained in:
Emanuel F. Oliveira 2017-02-23 10:57:17 -03:00 committed by Eloízio Salgado
parent 7dff1a815e
commit e1cc8adbad
2 changed files with 6 additions and 3 deletions

View File

@ -13,9 +13,7 @@ export class OHIFStudyMetadataSource extends OHIF.viewerbase.StudyMetadataSource
* @return {Promise} A Promise object
*/
getByInstanceUID(studyInstanceUID) {
return new Promise((resolve, reject) => {
getStudyMetadata(studyInstanceUID, resolve, reject);
});
return OHIF.studylist.retrieveStudyMetadata(studyInstanceUID);
}
/**

View File

@ -13,6 +13,11 @@ const StudyMetaDataPromises = new Map();
* @returns {Promise} that will be resolved with the metadata or rejected with the error
*/
OHIF.studylist.retrieveStudyMetadata = studyInstanceUid => {
// @TODO: Whenever a study metadata request has failed, its related promise will be rejected once and for all
// and further requests for that metadata will always fail. On failure, we probably need to remove the
// corresponding promise from the "StudyMetaDataPromises" map...
// If the StudyMetaDataPromises cache already has a pending or resolved promise related to the
// given studyInstanceUid, then that promise is returned
if (StudyMetaDataPromises.has(studyInstanceUid)) {