fix(typescript): Missed renames UIModalService and UserAuthenticationService (#3171)

This commit is contained in:
Bill Wallace 2023-02-13 08:55:55 -05:00 committed by GitHub
parent 8af0362d12
commit ecfdc9a687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 41 additions and 39 deletions

View File

@ -196,15 +196,15 @@ const commandsModule = ({ servicesManager }) => {
}, },
showDownloadViewportModal: () => { showDownloadViewportModal: () => {
const { activeViewportIndex } = viewportGridService.getState(); const { activeViewportIndex } = viewportGridService.getState();
const { UIModalService } = servicesManager.services; const { uiModalService } = servicesManager.services;
if (UIModalService) { if (uiModalService) {
UIModalService.show({ uiModalService.show({
content: CornerstoneViewportDownloadForm, content: CornerstoneViewportDownloadForm,
title: 'Download High Quality Image', title: 'Download High Quality Image',
contentProps: { contentProps: {
activeViewportIndex, activeViewportIndex,
onClose: UIModalService.hide, onClose: uiModalService.hide,
cornerstoneViewportService, cornerstoneViewportService,
}, },
}); });

View File

@ -62,11 +62,11 @@ export default async function init({
); );
const { const {
UserAuthenticationService, userAuthenticationService,
measurementService, measurementService,
displaySetService, displaySetService,
uiDialogService, uiDialogService,
UIModalService, uiModalService,
uiNotificationService, uiNotificationService,
cineService, cineService,
cornerstoneViewportService, cornerstoneViewportService,
@ -87,7 +87,7 @@ export default async function init({
} }
if (cornerstone.getShouldUseCPURendering()) { if (cornerstone.getShouldUseCPURendering()) {
_showCPURenderingModal(UIModalService, hangingProtocolService); _showCPURenderingModal(uiModalService, hangingProtocolService);
} }
const labelmapRepresentation = const labelmapRepresentation =
@ -128,7 +128,7 @@ export default async function init({
prefetch: appConfig?.maxNumRequests?.prefetch || 10, prefetch: appConfig?.maxNumRequests?.prefetch || 10,
}; };
initWADOImageLoader(UserAuthenticationService, appConfig); initWADOImageLoader(userAuthenticationService, appConfig);
/* Measurement Service */ /* Measurement Service */
const measurementServiceSource = connectToolsToMeasurementService( const measurementServiceSource = connectToolsToMeasurementService(
@ -403,10 +403,10 @@ function CPUModal() {
); );
} }
function _showCPURenderingModal(UIModalService, hangingProtocolService) { function _showCPURenderingModal(uiModalService, hangingProtocolService) {
const callback = progress => { const callback = progress => {
if (progress === 100) { if (progress === 100) {
UIModalService.show({ uiModalService.show({
content: CPUModal, content: CPUModal,
title: 'OHIF Fell Back to CPU Rendering', title: 'OHIF Fell Back to CPU Rendering',
}); });

View File

@ -34,7 +34,7 @@ function initWebWorkers(appConfig) {
} }
export default function initWADOImageLoader( export default function initWADOImageLoader(
UserAuthenticationService, userAuthenticationService,
appConfig appConfig
) { ) {
cornerstoneWADOImageLoader.external.cornerstone = cornerstone; cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
@ -55,7 +55,7 @@ export default function initWADOImageLoader(
convertFloatPixelDataToInt: false, convertFloatPixelDataToInt: false,
}, },
beforeSend: function(xhr) { beforeSend: function(xhr) {
const headers = UserAuthenticationService.getAuthorizationHeader(); const headers = userAuthenticationService.getAuthorizationHeader();
// Request: // Request:
// JPEG-LS Lossless (1.2.840.10008.1.2.4.80) if available, otherwise accept // JPEG-LS Lossless (1.2.840.10008.1.2.4.80) if available, otherwise accept

View File

@ -157,8 +157,8 @@ class CornerstoneCacheService {
// getSOPClassHandler method // getSOPClassHandler method
if (displaySet.load && displaySet.load instanceof Function) { if (displaySet.load && displaySet.load instanceof Function) {
const { UserAuthenticationService } = this.servicesManager.services; const { userAuthenticationService } = this.servicesManager.services;
const headers = UserAuthenticationService.getAuthorizationHeader(); const headers = userAuthenticationService.getAuthorizationHeader();
await displaySet.load({ headers }); await displaySet.load({ headers });
volumeData.push({ volumeData.push({

View File

@ -49,7 +49,7 @@ const metadataProvider = classes.MetadataProvider;
* @param {bool} lazyLoadStudy - "enableStudyLazyLoad"; Request series meta async instead of blocking * @param {bool} lazyLoadStudy - "enableStudyLazyLoad"; Request series meta async instead of blocking
* @param {string|bool} singlepart - indicates of the retrieves can fetch singlepart. Options are bulkdata, video, image or boolean true * @param {string|bool} singlepart - indicates of the retrieves can fetch singlepart. Options are bulkdata, video, image or boolean true
*/ */
function createDicomWebApi(dicomWebConfig, UserAuthenticationService) { function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
const { const {
qidoRoot, qidoRoot,
wadoRoot, wadoRoot,
@ -65,7 +65,7 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
url: qidoRoot, url: qidoRoot,
staticWado, staticWado,
singlepart, singlepart,
headers: UserAuthenticationService.getAuthorizationHeader(), headers: userAuthenticationService.getAuthorizationHeader(),
errorInterceptor: errorHandler.getHTTPErrorHandler(), errorInterceptor: errorHandler.getHTTPErrorHandler(),
}; };
@ -73,7 +73,7 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
url: wadoRoot, url: wadoRoot,
staticWado, staticWado,
singlepart, singlepart,
headers: UserAuthenticationService.getAuthorizationHeader(), headers: userAuthenticationService.getAuthorizationHeader(),
errorInterceptor: errorHandler.getHTTPErrorHandler(), errorInterceptor: errorHandler.getHTTPErrorHandler(),
}; };
@ -105,7 +105,7 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
studies: { studies: {
mapParams: mapParams.bind(), mapParams: mapParams.bind(),
search: async function (origParams) { search: async function (origParams) {
const headers = UserAuthenticationService.getAuthorizationHeader(); const headers = userAuthenticationService.getAuthorizationHeader();
if (headers) { if (headers) {
qidoDicomWebClient.headers = headers; qidoDicomWebClient.headers = headers;
} }
@ -130,7 +130,7 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
series: { series: {
// mapParams: mapParams.bind(), // mapParams: mapParams.bind(),
search: async function (studyInstanceUid) { search: async function (studyInstanceUid) {
const headers = UserAuthenticationService.getAuthorizationHeader(); const headers = userAuthenticationService.getAuthorizationHeader();
if (headers) { if (headers) {
qidoDicomWebClient.headers = headers; qidoDicomWebClient.headers = headers;
} }
@ -146,7 +146,7 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
}, },
instances: { instances: {
search: (studyInstanceUid, queryParameters) => { search: (studyInstanceUid, queryParameters) => {
const headers = UserAuthenticationService.getAuthorizationHeader(); const headers = userAuthenticationService.getAuthorizationHeader();
if (headers) { if (headers) {
qidoDicomWebClient.headers = headers; qidoDicomWebClient.headers = headers;
} }
@ -184,7 +184,7 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
sortFunction, sortFunction,
madeInClient = false, madeInClient = false,
} = {}) => { } = {}) => {
const headers = UserAuthenticationService.getAuthorizationHeader(); const headers = userAuthenticationService.getAuthorizationHeader();
if (headers) { if (headers) {
wadoDicomWebClient.headers = headers; wadoDicomWebClient.headers = headers;
} }
@ -218,7 +218,7 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
store: { store: {
dicom: async dataset => { dicom: async dataset => {
const headers = UserAuthenticationService.getAuthorizationHeader(); const headers = userAuthenticationService.getAuthorizationHeader();
if (headers) { if (headers) {
wadoDicomWebClient.headers = headers; wadoDicomWebClient.headers = headers;
} }

View File

@ -34,15 +34,15 @@ const commandsModule = ({ servicesManager, commandsManager }) => {
const { displaySetInstanceUIDs } = activeViewportSpecificData; const { displaySetInstanceUIDs } = activeViewportSpecificData;
const displaySets = displaySetService.activeDisplaySets; const displaySets = displaySetService.activeDisplaySets;
const { UIModalService } = servicesManager.services; const { uiModalService } = servicesManager.services;
const displaySetInstanceUID = displaySetInstanceUIDs[0]; const displaySetInstanceUID = displaySetInstanceUIDs[0];
UIModalService.show({ uiModalService.show({
content: DicomTagBrowser, content: DicomTagBrowser,
contentProps: { contentProps: {
displaySets, displaySets,
displaySetInstanceUID, displaySetInstanceUID,
onClose: UIModalService.hide, onClose: uiModalService.hide,
}, },
title: 'DICOM Tag Browser', title: 'DICOM Tag Browser',
}); });

View File

@ -357,7 +357,7 @@ export default class ExtensionManager {
}; };
_initDataSourcesModule(extensionModule, extensionId, dataSources = []) { _initDataSourcesModule(extensionModule, extensionId, dataSources = []) {
const { UserAuthenticationService } = this._servicesManager.services; const { userAuthenticationService } = this._servicesManager.services;
dataSources.forEach(dataSource => { dataSources.forEach(dataSource => {
this.dataSourceDefs[dataSource.sourceName] = dataSource; this.dataSourceDefs[dataSource.sourceName] = dataSource;
}); });
@ -369,7 +369,7 @@ export default class ExtensionManager {
if (dataSource.namespace === namespace) { if (dataSource.namespace === namespace) {
const dataSourceInstance = element.createDataSource( const dataSourceInstance = element.createDataSource(
dataSource.configuration, dataSource.configuration,
UserAuthenticationService userAuthenticationService
); );
if (this.dataSourceMap[dataSource.sourceName]) { if (this.dataSourceMap[dataSource.sourceName]) {

View File

@ -11,6 +11,7 @@ import {
* The interface for the services object * The interface for the services object
*/ */
export default interface Services { export default interface Services {
userAuthenticationService?: Record<string, unknown>;
hangingProtocolService?: HangingProtocolService; hangingProtocolService?: HangingProtocolService;
customizationService?: CustomizationService; customizationService?: CustomizationService;
measurementService?: MeasurementService; measurementService?: MeasurementService;
@ -21,6 +22,7 @@ export default interface Services {
uiDialogService?: Record<string, unknown>; uiDialogService?: Record<string, unknown>;
toolGroupService?: Record<string, unknown>; toolGroupService?: Record<string, unknown>;
uiNotificationService?: Record<string, unknown>; uiNotificationService?: Record<string, unknown>;
uiModalService?: Record<string, unknown>;
viewportGridService?: ViewportGridService; viewportGridService?: ViewportGridService;
syncGroupService?: Record<string, unknown>; syncGroupService?: Record<string, unknown>;
cornerstoneCacheService?: Record<string, unknown>; cornerstoneCacheService?: Record<string, unknown>;

View File

@ -60,18 +60,18 @@ function App({ config, defaultExtensions, defaultModes }) {
const { const {
UIDialogService, UIDialogService,
UIModalService, uiModalService,
UINotificationService, UINotificationService,
UIViewportDialogService, UIViewportDialogService,
ViewportGridService, ViewportGridService,
CineService, CineService,
UserAuthenticationService, userAuthenticationService,
customizationService, customizationService,
} = servicesManager.services; } = servicesManager.services;
const providers = [ const providers = [
[AppConfigProvider, { value: appConfigState }], [AppConfigProvider, { value: appConfigState }],
[UserAuthenticationProvider, { service: UserAuthenticationService }], [UserAuthenticationProvider, { service: userAuthenticationService }],
[I18nextProvider, { i18n }], [I18nextProvider, { i18n }],
[ThemeWrapper], [ThemeWrapper],
[ViewportGridProvider, { service: ViewportGridService }], [ViewportGridProvider, { service: ViewportGridService }],
@ -79,7 +79,7 @@ function App({ config, defaultExtensions, defaultModes }) {
[CineProvider, { service: CineService }], [CineProvider, { service: CineService }],
[SnackbarProvider, { service: UINotificationService }], [SnackbarProvider, { service: UINotificationService }],
[DialogProvider, { service: UIDialogService }], [DialogProvider, { service: UIDialogService }],
[ModalProvider, { service: UIModalService, modal: Modal }], [ModalProvider, { service: uiModalService, modal: Modal }],
]; ];
const CombinedProviders = ({ children }) => const CombinedProviders = ({ children }) =>
Compose({ components: providers, children }); Compose({ components: providers, children });
@ -106,7 +106,7 @@ function App({ config, defaultExtensions, defaultModes }) {
<OpenIdConnectRoutes <OpenIdConnectRoutes
oidc={oidc} oidc={oidc}
routerBasename={routerBasename} routerBasename={routerBasename}
UserAuthenticationService={UserAuthenticationService} userAuthenticationService={userAuthenticationService}
/> />
); );
} }

View File

@ -81,7 +81,7 @@ const createRoutes = ({
); );
} }
const { UserAuthenticationService } = servicesManager.services; const { userAuthenticationService } = servicesManager.services;
// Note: PrivateRoutes in react-router-dom 6.x should be defined within // Note: PrivateRoutes in react-router-dom 6.x should be defined within
// a Route element // a Route element
@ -96,7 +96,7 @@ const createRoutes = ({
element={ element={
<PrivateRoute <PrivateRoute
handleUnauthenticated={ handleUnauthenticated={
UserAuthenticationService.handleUnauthenticated userAuthenticationService.handleUnauthenticated
} }
> >
<RouteWithErrorBoundary route={route} /> <RouteWithErrorBoundary route={route} />

View File

@ -104,12 +104,12 @@ function LoginComponent(userManager) {
function OpenIdConnectRoutes({ function OpenIdConnectRoutes({
oidc, oidc,
routerBasename, routerBasename,
UserAuthenticationService, userAuthenticationService,
}) { }) {
const userManager = initUserManager(oidc, routerBasename); const userManager = initUserManager(oidc, routerBasename);
const getAuthorizationHeader = () => { const getAuthorizationHeader = () => {
const user = UserAuthenticationService.getUser(); const user = userAuthenticationService.getUser();
return { return {
Authorization: `Bearer ${user.access_token}`, Authorization: `Bearer ${user.access_token}`,
@ -145,9 +145,9 @@ function OpenIdConnectRoutes({
}, []); }, []);
useEffect(() => { useEffect(() => {
UserAuthenticationService.set({ enabled: true }); userAuthenticationService.set({ enabled: true });
UserAuthenticationService.setServiceImplementation({ userAuthenticationService.setServiceImplementation({
getAuthorizationHeader, getAuthorizationHeader,
handleUnauthenticated, handleUnauthenticated,
}); });
@ -200,7 +200,7 @@ function OpenIdConnectRoutes({
sessionStorage.getItem('ohif-redirect-to') sessionStorage.getItem('ohif-redirect-to')
); );
UserAuthenticationService.setUser(user); userAuthenticationService.setUser(user);
navigate({ navigate({
pathname, pathname,