Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 34x 34x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x | import i18n from 'i18next'; const RESPONSE = { NO_NEVER: -1, CANCEL: 0, CREATE_REPORT: 1, ADD_SERIES: 2, SET_STUDY_AND_SERIES: 3, }; export const measurementTrackingMode = { STANDARD: 'standard', SIMPLIFIED: 'simplified', NONE: 'none', }; function promptBeginTracking({ servicesManager, extensionManager }, ctx, evt) { const { uiViewportDialogService, customizationService } = servicesManager.services; const appConfig = extensionManager._appConfig; // 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; const { viewportId, StudyInstanceUID, SeriesInstanceUID } = evt.data || evt; return new Promise(async function (resolve, reject) { const standardMode = appConfig?.measurementTrackingMode === measurementTrackingMode.STANDARD; const noTrackingMode = appConfig?.measurementTrackingMode === measurementTrackingMode.NONE; let promptResult; promptResult = noTrackingMode ? RESPONSE.NO_NEVER : standardMode ? await _askTrackMeasurements(uiViewportDialogService, customizationService, viewportId) : RESPONSE.SET_STUDY_AND_SERIES; resolve({ userResponse: promptResult, StudyInstanceUID, SeriesInstanceUID, viewportId, }); }); } function _askTrackMeasurements(uiViewportDialogService, customizationService, viewportId) { return new Promise(function (resolve, reject) { const message = customizationService.getCustomization( 'viewportNotification.beginTrackingMessage' ); const actions = [ { id: 'prompt-begin-tracking-cancel', type: 'secondary', text: i18n.t('Common:No'), value: RESPONSE.CANCEL, }, { id: 'prompt-begin-tracking-no-do-not-ask-again', type: 'secondary', text: i18n.t('MeasurementTable:No, do not ask again'), value: RESPONSE.NO_NEVER, }, { id: 'prompt-begin-tracking-yes', type: 'primary', text: i18n.t('Common:Yes'), value: RESPONSE.SET_STUDY_AND_SERIES, }, ]; const onSubmit = result => { uiViewportDialogService.hide(); resolve(result); }; uiViewportDialogService.show({ viewportId, id: 'measurement-tracking-prompt-begin-tracking', type: 'info', message, actions, onSubmit, onOutsideClick: () => { uiViewportDialogService.hide(); resolve(RESPONSE.CANCEL); }, onKeyPress: event => { Iif (event.key === 'Enter') { const action = actions.find(action => action.id === 'prompt-begin-tracking-yes'); onSubmit(action.value); } }, }); }); } export default promptBeginTracking; |