wire up measurement service "removed" event w/ cornerstone ext
This commit is contained in:
1 parent
7a67b28c3f
commit
f3e783b63e
2 files changed
+103
-58
No files matched your search
@@ -47,6 +47,7 @@ const MEASUREMENT_SCHEMA_KEYS = [
|
||||
const EVENTS = {
|
||||
MEASUREMENT_UPDATED: 'event::measurement_updated',
|
||||
MEASUREMENT_ADDED: 'event::measurement_added',
|
||||
MEASUREMENT_REMOVED: 'event::measurement_removed',
|
||||
};
|
||||
|
||||
const VALUE_TYPES = {
|
||||
@@ -136,6 +137,9 @@ class MeasurementService {
|
||||
source.addOrUpdate = (definition, measurement) => {
|
||||
return this.addOrUpdate(source, definition, measurement);
|
||||
};
|
||||
source.remove = id => {
|
||||
return this.remove(source, id);
|
||||
};
|
||||
source.getAnnotation = (definition, measurementId) => {
|
||||
return this.getAnnotation(source, definition, measurementId);
|
||||
};
|
||||
@@ -338,6 +342,16 @@ class MeasurementService {
|
||||
return newMeasurement.id;
|
||||
}
|
||||
|
||||
remove(source, id) {
|
||||
if (!id || !this.measurements[id]) {
|
||||
log.warn(`No id provided, or unable to find measurement by id.`);
|
||||
return;
|
||||
}
|
||||
|
||||
delete this.measurements[id];
|
||||
this._broadcastChange(this.EVENTS.MEASUREMENT_REMOVED, source, id);
|
||||
}
|
||||
|
||||
_getMappingByMeasurementSource(measurementId, definition) {
|
||||
const measurement = this.getMeasurement(measurementId);
|
||||
if (this._isValidSource(measurement.source)) {
|
||||
|
||||
Reference in new issue
Block a user