chore(prettier): full repo linting and code reformatting once and for all (#3627)

This commit is contained in:
Alireza authored and GitHub committed 2023-09-01 16:19:39 -04:00
1 parent 01500a2d4c
commit 9045ddaedc
656 files changed
+21737 -20628

No files matched your search

+1 -3
View File
@@ -12,9 +12,7 @@ export default function Compose(props) {
return (
<React.Fragment>
{components.reduceRight((acc, curr) => {
const [Comp, props] = Array.isArray(curr)
? [curr[0], curr[1]]
: [curr, {}];
const [Comp, props] = Array.isArray(curr) ? [curr[0], curr[1]] : [curr, {}];
return <Comp {...props}>{acc}</Comp>;
}, children)}
</React.Fragment>
+28 -58
View File
@@ -28,23 +28,15 @@ function defaultRouteInit(
{ servicesManager, studyInstanceUIDs, dataSource, filters },
hangingProtocolId
) {
const {
displaySetService,
hangingProtocolService,
uiNotificationService,
} = servicesManager.services;
const { displaySetService, hangingProtocolService, uiNotificationService } =
servicesManager.services;
const unsubscriptions = [];
const issuedWarningSeries = [];
const {
unsubscribe: instanceAddedUnsubscribe,
} = DicomMetadataStore.subscribe(
const { unsubscribe: instanceAddedUnsubscribe } = DicomMetadataStore.subscribe(
DicomMetadataStore.EVENTS.INSTANCES_ADDED,
function({ StudyInstanceUID, SeriesInstanceUID, madeInClient = false }) {
const seriesMetadata = DicomMetadataStore.getSeries(
StudyInstanceUID,
SeriesInstanceUID
);
function ({ StudyInstanceUID, SeriesInstanceUID, madeInClient = false }) {
const seriesMetadata = DicomMetadataStore.getSeries(StudyInstanceUID, SeriesInstanceUID);
// checks if the series filter was used, if it exists
const seriesInstanceUIDs = filters?.seriesInstanceUID;
@@ -96,10 +88,7 @@ function defaultRouteInit(
// run the hanging protocol matching on the displaySets with the predefined
// hanging protocol in the mode configuration
hangingProtocolService.run(
{ studies, activeStudy, displaySets },
hangingProtocolId
);
hangingProtocolService.run({ studies, activeStudy, displaySets }, hangingProtocolId);
});
return unsubscriptions;
@@ -128,10 +117,7 @@ export default function ModeRoute({
const [studyInstanceUIDs, setStudyInstanceUIDs] = useState();
const [refresh, setRefresh] = useState(false);
const [
ExtensionDependenciesLoaded,
setExtensionDependenciesLoaded,
] = useState(false);
const [ExtensionDependenciesLoaded, setExtensionDependenciesLoaded] = useState(false);
const layoutTemplateData = useRef(false);
const locationRef = useRef(null);
@@ -145,22 +131,13 @@ export default function ModeRoute({
locationRef.current = location;
}
const {
displaySetService,
hangingProtocolService,
userAuthenticationService,
} = (servicesManager as ServicesManager).services;
const { displaySetService, hangingProtocolService, userAuthenticationService } = (
servicesManager as ServicesManager
).services;
const {
extensions,
sopClassHandlers,
hotkeys: hotkeyObj,
hangingProtocol,
} = mode;
const { extensions, sopClassHandlers, hotkeys: hotkeyObj, hangingProtocol } = mode;
const runTimeHangingProtocolId = lowerCaseSearchParams.get(
'hangingprotocolid'
);
const runTimeHangingProtocolId = lowerCaseSearchParams.get('hangingprotocolid');
const token = lowerCaseSearchParams.get('token');
if (token) {
@@ -173,9 +150,7 @@ export default function ModeRoute({
});
// Create a URL object with the current location
const urlObj = new URL(
window.location.origin + location.pathname + location.search
);
const urlObj = new URL(window.location.origin + location.pathname + location.search);
// Remove the token from the URL object
urlObj.searchParams.delete('token');
@@ -232,9 +207,7 @@ export default function ModeRoute({
const loadedExtensions = await loadModules(Object.keys(extensions));
for (const extension of loadedExtensions) {
const { id: extensionId } = extension;
if (
extensionManager.registeredExtensionIds.indexOf(extensionId) === -1
) {
if (extensionManager.registeredExtensionIds.indexOf(extensionId) === -1) {
await extensionManager.registerExtension(extension);
}
}
@@ -369,24 +342,21 @@ export default function ModeRoute({
* }
*/
const filters =
Array.from(query.keys()).reduce(
(acc: Record<string, string>, val: string) => {
const lowerVal = val.toLowerCase();
if (lowerVal !== 'studyinstanceuids') {
// Not sure why the case matters here - it doesn't in the URL
if (lowerVal === 'seriesinstanceuid') {
const seriesUIDs = getSplitParam(lowerVal, query);
return {
...acc,
seriesInstanceUID: seriesUIDs,
};
}
return { ...acc, [val]: getSplitParam(lowerVal, query) };
Array.from(query.keys()).reduce((acc: Record<string, string>, val: string) => {
const lowerVal = val.toLowerCase();
if (lowerVal !== 'studyinstanceuids') {
// Not sure why the case matters here - it doesn't in the URL
if (lowerVal === 'seriesinstanceuid') {
const seriesUIDs = getSplitParam(lowerVal, query);
return {
...acc,
seriesInstanceUID: seriesUIDs,
};
}
},
{}
) ?? {};
return { ...acc, [val]: getSplitParam(lowerVal, query) };
}
}, {}) ?? {};
if (route.init) {
return await route.init(
+2 -8
View File
@@ -39,11 +39,7 @@ const getStudiesfromDisplaySets = (displaysets): StudyMetadata[] => {
}, []);
// Return the sorted studies, first on study date and second on study instance UID
ret.sort((a, b) => {
return compare(
a.StudyDate,
b.StudyDate,
compare(a.StudyInstanceUID, b.StudyInstanceUID)
);
return compare(a.StudyDate, b.StudyDate, compare(a.StudyInstanceUID, b.StudyInstanceUID));
});
return ret;
};
@@ -61,9 +57,7 @@ const getStudiesFromUIDs = (studyUids: string[]): StudyMetadata[] => {
/** Gets the array of studies */
const getStudies = (studyUids?: string[], displaySets): StudyMetadata[] => {
return (
getStudiesFromUIDs(studyUids) || getStudiesfromDisplaySets(displaySets)
);
return getStudiesFromUIDs(studyUids) || getStudiesfromDisplaySets(displaySets);
};
export default getStudies;