chore(refactor): use public appConfig getter instead of private _appConfig field (#5923)
This commit is contained in:
parent
9718ecc407
commit
d7dd12ad67
@ -11,7 +11,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockExtensionManager = {
|
const mockExtensionManager = {
|
||||||
_appConfig: {
|
appConfig: {
|
||||||
measurementTrackingMode: 'standard',
|
measurementTrackingMode: 'standard',
|
||||||
disableConfirmationPrompts: false,
|
disableConfirmationPrompts: false,
|
||||||
},
|
},
|
||||||
@ -57,7 +57,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return HYDRATE response when disableConfirmationPrompts is true for non-SR types', async () => {
|
it('should return HYDRATE response when disableConfirmationPrompts is true for non-SR types', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = true;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = true;
|
||||||
|
|
||||||
const result = await promptHydrationDialog(defaultParameters);
|
const result = await promptHydrationDialog(defaultParameters);
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show dialog when disableConfirmationPrompts is false for non-SR types', async () => {
|
it('should show dialog when disableConfirmationPrompts is false for non-SR types', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog(defaultParameters);
|
const promise = promptHydrationDialog(defaultParameters);
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle CANCEL response', async () => {
|
it('should handle CANCEL response', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog(defaultParameters);
|
const promise = promptHydrationDialog(defaultParameters);
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle onOutsideClick', async () => {
|
it('should handle onOutsideClick', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog(defaultParameters);
|
const promise = promptHydrationDialog(defaultParameters);
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle onKeyPress Enter', async () => {
|
it('should handle onKeyPress Enter', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog(defaultParameters);
|
const promise = promptHydrationDialog(defaultParameters);
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle onKeyPress non-Enter key', async () => {
|
it('should handle onKeyPress non-Enter key', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog(defaultParameters);
|
const promise = promptHydrationDialog(defaultParameters);
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle SEG type hydration with setTimeout', async () => {
|
it('should handle SEG type hydration with setTimeout', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = true;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = true;
|
||||||
|
|
||||||
await promptHydrationDialog({
|
await promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -178,7 +178,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle RTSTRUCT type hydration', async () => {
|
it('should handle RTSTRUCT type hydration', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = true;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = true;
|
||||||
|
|
||||||
const result = await promptHydrationDialog({
|
const result = await promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -194,7 +194,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle SR type hydration when standardMode is true', async () => {
|
it('should handle SR type hydration when standardMode is true', async () => {
|
||||||
mockExtensionManager._appConfig.measurementTrackingMode = 'standard';
|
mockExtensionManager.appConfig.measurementTrackingMode = 'standard';
|
||||||
const mockHydrationResult = {
|
const mockHydrationResult = {
|
||||||
StudyInstanceUID: 'test-study-uid',
|
StudyInstanceUID: 'test-study-uid',
|
||||||
SeriesInstanceUIDs: ['series-1', 'series-2'],
|
SeriesInstanceUIDs: ['series-1', 'series-2'],
|
||||||
@ -222,7 +222,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle SR type hydration when standardMode is false', async () => {
|
it('should handle SR type hydration when standardMode is false', async () => {
|
||||||
mockExtensionManager._appConfig.measurementTrackingMode = 'other';
|
mockExtensionManager.appConfig.measurementTrackingMode = 'other';
|
||||||
|
|
||||||
const result = await promptHydrationDialog({
|
const result = await promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -241,7 +241,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle SR type with CANCEL response', async () => {
|
it('should handle SR type with CANCEL response', async () => {
|
||||||
mockExtensionManager._appConfig.measurementTrackingMode = 'standard';
|
mockExtensionManager.appConfig.measurementTrackingMode = 'standard';
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -262,7 +262,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle undefined preHydrateCallbacks', async () => {
|
it('should handle undefined preHydrateCallbacks', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = true;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = true;
|
||||||
|
|
||||||
await promptHydrationDialog({
|
await promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -273,7 +273,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle empty preHydrateCallbacks array', async () => {
|
it('should handle empty preHydrateCallbacks array', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = true;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = true;
|
||||||
|
|
||||||
await promptHydrationDialog({
|
await promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -285,7 +285,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
|
|
||||||
it('should execute multiple preHydrateCallbacks', async () => {
|
it('should execute multiple preHydrateCallbacks', async () => {
|
||||||
const mockPreHydrateCallback2 = jest.fn();
|
const mockPreHydrateCallback2 = jest.fn();
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = true;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = true;
|
||||||
|
|
||||||
await promptHydrationDialog({
|
await promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -297,7 +297,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get correct customization message key for SEG type', async () => {
|
it('should get correct customization message key for SEG type', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -314,7 +314,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get correct customization message key for RTSTRUCT type', async () => {
|
it('should get correct customization message key for RTSTRUCT type', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -331,7 +331,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get correct customization message key for SR type', async () => {
|
it('should get correct customization message key for SR type', async () => {
|
||||||
mockExtensionManager._appConfig.measurementTrackingMode = 'standard';
|
mockExtensionManager.appConfig.measurementTrackingMode = 'standard';
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -348,7 +348,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get default customization message key for unknown type', async () => {
|
it('should get default customization message key for unknown type', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -365,7 +365,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get correct dialog id for SEG type', async () => {
|
it('should get correct dialog id for SEG type', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -384,7 +384,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get correct dialog id for SR type', async () => {
|
it('should get correct dialog id for SR type', async () => {
|
||||||
mockExtensionManager._appConfig.measurementTrackingMode = 'standard';
|
mockExtensionManager.appConfig.measurementTrackingMode = 'standard';
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -403,7 +403,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get default dialog id for unknown type', async () => {
|
it('should get default dialog id for unknown type', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
@ -422,7 +422,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle hydrateCallback returning false for SEG', async () => {
|
it('should handle hydrateCallback returning false for SEG', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = true;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = true;
|
||||||
mockHydrateCallback.mockResolvedValue(false);
|
mockHydrateCallback.mockResolvedValue(false);
|
||||||
|
|
||||||
const result = await promptHydrationDialog({
|
const result = await promptHydrationDialog({
|
||||||
@ -434,7 +434,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle hydrateCallback returning false for RTSTRUCT', async () => {
|
it('should handle hydrateCallback returning false for RTSTRUCT', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = true;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = true;
|
||||||
mockHydrateCallback.mockResolvedValue(false);
|
mockHydrateCallback.mockResolvedValue(false);
|
||||||
|
|
||||||
const result = await promptHydrationDialog({
|
const result = await promptHydrationDialog({
|
||||||
@ -446,7 +446,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle SR hydration with null result', async () => {
|
it('should handle SR hydration with null result', async () => {
|
||||||
mockExtensionManager._appConfig.measurementTrackingMode = 'standard';
|
mockExtensionManager.appConfig.measurementTrackingMode = 'standard';
|
||||||
mockHydrateCallback.mockResolvedValue(null);
|
mockHydrateCallback.mockResolvedValue(null);
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
@ -470,7 +470,7 @@ describe('promptHydrationDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle RTSTRUCT type in getDialogId', async () => {
|
it('should handle RTSTRUCT type in getDialogId', async () => {
|
||||||
mockExtensionManager._appConfig.disableConfirmationPrompts = false;
|
mockExtensionManager.appConfig.disableConfirmationPrompts = false;
|
||||||
|
|
||||||
const promise = promptHydrationDialog({
|
const promise = promptHydrationDialog({
|
||||||
...defaultParameters,
|
...defaultParameters,
|
||||||
|
|||||||
@ -70,7 +70,7 @@ function promptHydrationDialog({
|
|||||||
}: HydrationDialogProps): Promise<boolean | HydrationSRResult> {
|
}: HydrationDialogProps): Promise<boolean | HydrationSRResult> {
|
||||||
const { uiViewportDialogService, customizationService } = servicesManager.services;
|
const { uiViewportDialogService, customizationService } = servicesManager.services;
|
||||||
const extensionManager = servicesManager._extensionManager;
|
const extensionManager = servicesManager._extensionManager;
|
||||||
const appConfig = extensionManager._appConfig;
|
const appConfig = extensionManager.appConfig;
|
||||||
|
|
||||||
// Todo: make this use enum from the extension, we should move the enum
|
// Todo: make this use enum from the extension, we should move the enum
|
||||||
const standardMode = appConfig?.measurementTrackingMode === 'standard';
|
const standardMode = appConfig?.measurementTrackingMode === 'standard';
|
||||||
|
|||||||
@ -87,7 +87,7 @@ function PanelStudyBrowser({
|
|||||||
commandsManager,
|
commandsManager,
|
||||||
servicesManager,
|
servicesManager,
|
||||||
isHangingProtocolLayout,
|
isHangingProtocolLayout,
|
||||||
appConfig: extensionManager._appConfig,
|
appConfig: extensionManager.appConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlers = customHandler?.callbacks.map(callback => callback(setupArgs));
|
const handlers = customHandler?.callbacks.map(callback => callback(setupArgs));
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export const measurementTrackingMode = {
|
|||||||
|
|
||||||
function promptBeginTracking({ servicesManager, extensionManager }, ctx, evt) {
|
function promptBeginTracking({ servicesManager, extensionManager }, ctx, evt) {
|
||||||
const { uiViewportDialogService, customizationService } = servicesManager.services;
|
const { uiViewportDialogService, customizationService } = servicesManager.services;
|
||||||
const appConfig = extensionManager._appConfig;
|
const appConfig = extensionManager.appConfig;
|
||||||
// When the state change happens after a promise, the state machine sends the retult in evt.data;
|
// When the state change happens after a promise, the state machine sends the retult in evt.data;
|
||||||
// In case of direct transition to the state, the state machine sends the data in evt;
|
// In case of direct transition to the state, the state machine sends the data in evt;
|
||||||
const { viewportId, StudyInstanceUID, SeriesInstanceUID } = evt.data || evt;
|
const { viewportId, StudyInstanceUID, SeriesInstanceUID } = evt.data || evt;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ function promptTrackNewSeries({ servicesManager, extensionManager }, ctx, evt) {
|
|||||||
const { viewportId, StudyInstanceUID, SeriesInstanceUID } = evt.data || evt;
|
const { viewportId, StudyInstanceUID, SeriesInstanceUID } = evt.data || evt;
|
||||||
|
|
||||||
return new Promise(async function (resolve, reject) {
|
return new Promise(async function (resolve, reject) {
|
||||||
const appConfig = extensionManager._appConfig;
|
const appConfig = extensionManager.appConfig;
|
||||||
|
|
||||||
const showPrompt = appConfig?.measurementTrackingMode === measurementTrackingMode.STANDARD;
|
const showPrompt = appConfig?.measurementTrackingMode === measurementTrackingMode.STANDARD;
|
||||||
let promptResult = showPrompt
|
let promptResult = showPrompt
|
||||||
|
|||||||
@ -17,7 +17,7 @@ function promptTrackNewStudy({ servicesManager, extensionManager }: withAppTypes
|
|||||||
const { viewportId, StudyInstanceUID, SeriesInstanceUID } = evt.data || evt;
|
const { viewportId, StudyInstanceUID, SeriesInstanceUID } = evt.data || evt;
|
||||||
|
|
||||||
return new Promise(async function (resolve, reject) {
|
return new Promise(async function (resolve, reject) {
|
||||||
const appConfig = extensionManager._appConfig;
|
const appConfig = extensionManager.appConfig;
|
||||||
|
|
||||||
const standardMode = appConfig?.measurementTrackingMode === measurementTrackingMode.STANDARD;
|
const standardMode = appConfig?.measurementTrackingMode === measurementTrackingMode.STANDARD;
|
||||||
const simplifiedMode =
|
const simplifiedMode =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user