Fix/sr hydration non tracking (#3080)
* fix:DICOM SR hydration - remove redundancies feat:Allow save and restore on non-tracking view * PR comments
This commit is contained in:
1 parent
ec7cdba901
commit
9a03bde0ae
21 files changed
+466
-73
No files matched your search
@@ -23,6 +23,7 @@ export default class ExtensionManager {
|
||||
});
|
||||
this._extensionLifeCycleHooks = { onModeEnter: {}, onModeExit: {} };
|
||||
this.dataSourceMap = {};
|
||||
this.dataSourceDefs = {};
|
||||
this.defaultDataSourceName = appConfig.defaultDataSourceName;
|
||||
this.activeDataSource = undefined;
|
||||
}
|
||||
@@ -298,6 +299,9 @@ export default class ExtensionManager {
|
||||
|
||||
_initDataSourcesModule(extensionModule, extensionId, dataSources = []) {
|
||||
const { UserAuthenticationService } = this._servicesManager.services;
|
||||
dataSources.forEach(dataSource => {
|
||||
this.dataSourceDefs[dataSource.sourceName] = dataSource;
|
||||
});
|
||||
|
||||
extensionModule.forEach(element => {
|
||||
const namespace = `${extensionId}.${MODULE_TYPES.DATA_SOURCE}.${element.name}`;
|
||||
|
||||
@@ -467,6 +467,12 @@ class HangingProtocolService {
|
||||
return defaultReturn;
|
||||
}
|
||||
|
||||
// If the viewport options says to allow any instance, then we can assume
|
||||
// it just updates this viewport
|
||||
if (protocolViewport.viewportOptions.allowUnmatchedView) {
|
||||
return defaultReturn;
|
||||
}
|
||||
|
||||
// if the viewport is not empty, then we check the displaySets it is showing
|
||||
// currently, which means we need to check if the requested updated displaySet
|
||||
// follow the same rules as the current displaySets
|
||||
@@ -1098,10 +1104,9 @@ class HangingProtocolService {
|
||||
) {
|
||||
const { seriesMatchingRules } = displaySetSelector;
|
||||
|
||||
if (seriesMatchingRules.length) {
|
||||
// only match the required rules
|
||||
const requiredRules = seriesMatchingRules.filter(rule => rule.required);
|
||||
|
||||
// only match the required rules
|
||||
const requiredRules = seriesMatchingRules.filter(rule => rule.required);
|
||||
if (requiredRules.length) {
|
||||
const matched = this.protocolEngine.findMatch(displaySet, requiredRules);
|
||||
|
||||
if (!matched || matched.score === 0) {
|
||||
|
||||
@@ -57,19 +57,18 @@ validate.validators.endsWith = function(value, options, key) {
|
||||
}
|
||||
};
|
||||
|
||||
const getTestValue = options => options?.value ?? options;
|
||||
|
||||
validate.validators.greaterThan = function(value, options, key) {
|
||||
const testValue = options?.value ?? options;
|
||||
if (testValue !== undefined && value <= testValue) {
|
||||
const testValue = getTestValue(options);
|
||||
if (value === undefined || value === null || value <= testValue) {
|
||||
return key + 'with value ' + value + ' must be greater than ' + testValue;
|
||||
}
|
||||
};
|
||||
|
||||
validate.validators.range = function(value, options, key) {
|
||||
const testValue = options?.value ?? options;
|
||||
if (
|
||||
(testValue !== undefined && value < testValue[0]) ||
|
||||
value > testValue[1]
|
||||
) {
|
||||
const testValue = getTestValue(options);
|
||||
if (value === undefined || value < testValue[0] || value > testValue[1]) {
|
||||
return (
|
||||
key +
|
||||
'with value ' +
|
||||
|
||||
@@ -1,49 +1,107 @@
|
||||
import validate from "./validator.js";
|
||||
import validate from './validator.js';
|
||||
|
||||
describe("validator", () => {
|
||||
describe('validator', () => {
|
||||
const attributeMap = {
|
||||
str: "string",
|
||||
str: 'string',
|
||||
num: 3,
|
||||
nullValue: null,
|
||||
list: ["abc", "def"],
|
||||
}
|
||||
list: ['abc', 'def'],
|
||||
};
|
||||
|
||||
const options = {
|
||||
format: 'grouped',
|
||||
};
|
||||
|
||||
describe("contains", () => {
|
||||
it("returns match any list contains", () => {
|
||||
expect(validate(attributeMap, { list: { contains: 'a' } }, [options])).toBeUndefined();
|
||||
expect(validate(attributeMap, { str: { contains: 'i' } }, [options])).toBeUndefined();
|
||||
expect(validate(attributeMap, { str: { contains: ['i'] } }, [options])).toBeUndefined();
|
||||
expect(validate(attributeMap, { list: { contains: ['a'] } }, [options])).toBeUndefined();
|
||||
expect(validate(attributeMap, { list: { contains: ['z', 'd'] } }, [options])).toBeUndefined();
|
||||
expect(validate(attributeMap, { list: { contains: ['z'] } }, [options])).not.toBeUndefined();
|
||||
})
|
||||
})
|
||||
describe('contains', () => {
|
||||
it('returns match any list contains', () => {
|
||||
expect(
|
||||
validate(attributeMap, { list: { contains: 'a' } }, [options])
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
validate(attributeMap, { str: { contains: 'i' } }, [options])
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
validate(attributeMap, { str: { contains: ['i'] } }, [options])
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
validate(attributeMap, { list: { contains: ['a'] } }, [options])
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
validate(attributeMap, { list: { contains: ['z', 'd'] } }, [options])
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
validate(attributeMap, { list: { contains: ['z'] } }, [options])
|
||||
).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("equals", () => {
|
||||
it("returned undefined on equals", () => {
|
||||
expect(validate(attributeMap, { str: { equals: attributeMap.str } }, [options])).toBeUndefined();
|
||||
expect(validate(attributeMap, { num: { equals: { value: attributeMap.num } } }, [options])).toBeUndefined();
|
||||
})
|
||||
describe('equals', () => {
|
||||
it('returned undefined on equals', () => {
|
||||
expect(
|
||||
validate(attributeMap, { str: { equals: attributeMap.str } }, [options])
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
validate(
|
||||
attributeMap,
|
||||
{ num: { equals: { value: attributeMap.num } } },
|
||||
[options]
|
||||
)
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it("returns error on not equals", () => {
|
||||
expect(validate(attributeMap, { str: { equals: "abc" } }, [options])).not.toBeUndefined();
|
||||
expect(validate(attributeMap, { num: { equals: { value: 1 + attributeMap.num } } }, [options])).not.toBeUndefined();
|
||||
})
|
||||
})
|
||||
it('returns error on not equals', () => {
|
||||
expect(
|
||||
validate(attributeMap, { str: { equals: 'abc' } }, [options])
|
||||
).not.toBeUndefined();
|
||||
expect(
|
||||
validate(
|
||||
attributeMap,
|
||||
{ num: { equals: { value: 1 + attributeMap.num } } },
|
||||
[options]
|
||||
)
|
||||
).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("greaterThan", () => {
|
||||
it("returns undefined on greaterThan", () => {
|
||||
expect(validate(attributeMap, { num: { greaterThan: { value: attributeMap.num - 1 } } }, [options])).toBeUndefined();
|
||||
expect(validate(attributeMap, { num: { greaterThan: attributeMap.num - 1 } }, [options])).toBeUndefined();
|
||||
})
|
||||
describe('greaterThan', () => {
|
||||
it('returns undefined on greaterThan', () => {
|
||||
expect(
|
||||
validate(
|
||||
attributeMap,
|
||||
{ num: { greaterThan: { value: attributeMap.num - 1 } } },
|
||||
[options]
|
||||
)
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
validate(attributeMap, { num: { greaterThan: attributeMap.num - 1 } }, [
|
||||
options,
|
||||
])
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it("returns error on not greater than", () => {
|
||||
expect(validate(attributeMap, { num: { greaterThan: { value: attributeMap.num } } }, [options])).not.toBeUndefined();
|
||||
expect(validate(attributeMap, { num: { greaterThan: attributeMap.num } }, [options])).not.toBeUndefined();
|
||||
})
|
||||
})
|
||||
it('returns error on not greater than', () => {
|
||||
expect(
|
||||
validate(
|
||||
attributeMap,
|
||||
{ num: { greaterThan: { value: attributeMap.num } } },
|
||||
[options]
|
||||
)
|
||||
).not.toBeUndefined();
|
||||
expect(
|
||||
validate(attributeMap, { num: { greaterThan: attributeMap.num } }, [
|
||||
options,
|
||||
])
|
||||
).not.toBeUndefined();
|
||||
});
|
||||
|
||||
it('returns error on undefined value', () => {
|
||||
expect(
|
||||
validate(
|
||||
attributeMap,
|
||||
{ numUndefined: { greaterThan: { value: 3 } } },
|
||||
[options]
|
||||
)
|
||||
).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user