diff --git a/assay/package-lock.json b/assay/package-lock.json index 500eab4e713..807da13c4ae 100644 --- a/assay/package-lock.json +++ b/assay/package-lock.json @@ -8,7 +8,7 @@ "name": "assay", "version": "0.0.0", "dependencies": { - "@labkey/components": "7.42.1" + "@labkey/components": "7.42.3-fb-redirectGH1023.2" }, "devDependencies": { "@labkey/build": "9.1.5", @@ -3742,9 +3742,9 @@ } }, "node_modules/@labkey/api": { - "version": "1.51.4", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.51.4.tgz", - "integrity": "sha512-D8Rs1yd8dKnmLxGzMaTtOg3S7EpQRSGMCGPRNTPqICTukYwlHhi39UViiF9b7s3knlK4gtp9D64CHbQcehgw+w==", + "version": "1.51.5", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.51.5.tgz", + "integrity": "sha512-F7qo6roSBTqeh68Z4yWwel/AAWvt620SSVdCQauKBYjHRJao/Z29gOKWEQ7lWy0E66avDwBOVzpBZq8syhvP0g==", "license": "Apache-2.0" }, "node_modules/@labkey/build": { @@ -3786,13 +3786,13 @@ } }, "node_modules/@labkey/components": { - "version": "7.42.1", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-7.42.1.tgz", - "integrity": "sha512-y9sVFxdqCQDBnWCSW4BqtpauFMbjuTmywXDT1O6Zh31PopyyWhGiEA99K+zPxGzn7QRKh6BLcm0QrlTFPh0+jA==", + "version": "7.42.3-fb-redirectGH1023.2", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-7.42.3-fb-redirectGH1023.2.tgz", + "integrity": "sha512-Qil0DK/6qQlmjH+shA7CCdkrwVLztBc1IrH24ZuinomiA1e1J3a0Q1ITI/4sKiGee/04zuRQVaH0UF8Ezfd6Kg==", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.51.4", + "@labkey/api": "1.51.5", "@testing-library/dom": "~10.4.1", "@testing-library/jest-dom": "~6.9.1", "@testing-library/react": "~16.3.2", diff --git a/assay/package.json b/assay/package.json index 4966ca533cc..59dbd56037a 100644 --- a/assay/package.json +++ b/assay/package.json @@ -15,7 +15,7 @@ "lint-fix": "eslint --fix" }, "dependencies": { - "@labkey/components": "7.42.1" + "@labkey/components": "7.42.3-fb-redirectGH1023.2" }, "devDependencies": { "@labkey/build": "9.1.5", diff --git a/assay/src/client/AssayTypeSelect/AssayTypeSelect.tsx b/assay/src/client/AssayTypeSelect/AssayTypeSelect.tsx index d1d20327916..47bcd19a6d7 100644 --- a/assay/src/client/AssayTypeSelect/AssayTypeSelect.tsx +++ b/assay/src/client/AssayTypeSelect/AssayTypeSelect.tsx @@ -12,6 +12,7 @@ import { AssayPickerTabs, GENERAL_ASSAY_PROVIDER_NAME, App as LabKeyApp, + redirect, useServerContext, } from '@labkey/components'; @@ -58,7 +59,7 @@ const AssayTypeSelect = memo(() => { const tab = useMemo(() => ActionURL.getParameter('tab'), []); const onCancel = useCallback(() => { - window.location.href = returnUrl || ActionURL.buildURL('project', 'begin'); + redirect(returnUrl || ActionURL.buildURL('project', 'begin')); }, [returnUrl]); const onChange = useCallback((model: AssayPickerSelectionModel) => { diff --git a/core/package-lock.json b/core/package-lock.json index c87eb45ebef..3ae560924e7 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -8,7 +8,7 @@ "name": "labkey-core", "version": "0.0.0", "dependencies": { - "@labkey/components": "7.42.1", + "@labkey/components": "7.42.3-fb-redirectGH1023.2", "@labkey/themes": "1.9.4" }, "devDependencies": { @@ -3745,9 +3745,9 @@ } }, "node_modules/@labkey/api": { - "version": "1.51.4", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.51.4.tgz", - "integrity": "sha512-D8Rs1yd8dKnmLxGzMaTtOg3S7EpQRSGMCGPRNTPqICTukYwlHhi39UViiF9b7s3knlK4gtp9D64CHbQcehgw+w==", + "version": "1.51.5", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.51.5.tgz", + "integrity": "sha512-F7qo6roSBTqeh68Z4yWwel/AAWvt620SSVdCQauKBYjHRJao/Z29gOKWEQ7lWy0E66avDwBOVzpBZq8syhvP0g==", "license": "Apache-2.0" }, "node_modules/@labkey/build": { @@ -3789,13 +3789,13 @@ } }, "node_modules/@labkey/components": { - "version": "7.42.1", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-7.42.1.tgz", - "integrity": "sha512-y9sVFxdqCQDBnWCSW4BqtpauFMbjuTmywXDT1O6Zh31PopyyWhGiEA99K+zPxGzn7QRKh6BLcm0QrlTFPh0+jA==", + "version": "7.42.3-fb-redirectGH1023.2", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-7.42.3-fb-redirectGH1023.2.tgz", + "integrity": "sha512-Qil0DK/6qQlmjH+shA7CCdkrwVLztBc1IrH24ZuinomiA1e1J3a0Q1ITI/4sKiGee/04zuRQVaH0UF8Ezfd6Kg==", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.51.4", + "@labkey/api": "1.51.5", "@testing-library/dom": "~10.4.1", "@testing-library/jest-dom": "~6.9.1", "@testing-library/react": "~16.3.2", diff --git a/core/package.json b/core/package.json index dc5e7450330..b2efddd6b31 100644 --- a/core/package.json +++ b/core/package.json @@ -20,7 +20,7 @@ "lint-branch-fix": "node lint.diff.mjs --currentBranch --fix" }, "dependencies": { - "@labkey/components": "7.42.1", + "@labkey/components": "7.42.3-fb-redirectGH1023.2", "@labkey/themes": "1.9.4" }, "devDependencies": { diff --git a/core/src/client/AssayDesigner/AssayDesigner.tsx b/core/src/client/AssayDesigner/AssayDesigner.tsx index 9f866319365..7b8a7d59eec 100644 --- a/core/src/client/AssayDesigner/AssayDesigner.tsx +++ b/core/src/client/AssayDesigner/AssayDesigner.tsx @@ -27,6 +27,7 @@ import { getWebDavUrl, inferDomainFromFile, LoadingSpinner, + redirect, setDomainFields, } from '@labkey/components'; @@ -136,9 +137,7 @@ class AssayDesigner extends React.Component { navigate(defaultUrl: string) { this._dirty = false; - const redirectUrl = this.state.returnUrl || defaultUrl; - // TODO refactor this and other usages in platform/core/src/client to a helper safeRedirect() function from @labkey/components - window.location.href = ActionURL.buildURL('core', 'safeRedirect', undefined, { returnUrl: redirectUrl }); + redirect(this.state.returnUrl || defaultUrl); } onCancel = (): void => { diff --git a/core/src/client/DataClassDesigner/DataClassDesigner.tsx b/core/src/client/DataClassDesigner/DataClassDesigner.tsx index 9c83f7ae853..a2a3f538f09 100644 --- a/core/src/client/DataClassDesigner/DataClassDesigner.tsx +++ b/core/src/client/DataClassDesigner/DataClassDesigner.tsx @@ -23,6 +23,7 @@ import { DataClassModel, fetchDataClass, LoadingSpinner, + redirect, } from '@labkey/components'; import '../DomainDesigner.scss'; @@ -66,8 +67,7 @@ class DataClassDesignerWrapper extends React.Component { navigate(defaultUrl: string) { this._dirty = false; - const redirectUrl = ActionURL.getReturnUrl() || defaultUrl; - window.location.href = ActionURL.buildURL('core', 'safeRedirect', undefined, { returnUrl: redirectUrl }); + redirect(ActionURL.getReturnUrl() || defaultUrl); } onCancel = () => { diff --git a/core/src/client/DatasetDesigner/DatasetDesigner.tsx b/core/src/client/DatasetDesigner/DatasetDesigner.tsx index f7504d327c2..4c24160f2b1 100644 --- a/core/src/client/DatasetDesigner/DatasetDesigner.tsx +++ b/core/src/client/DatasetDesigner/DatasetDesigner.tsx @@ -23,6 +23,7 @@ import { DatasetModel, fetchDatasetDesign, LoadingSpinner, + redirect, } from '@labkey/components'; import { ActionURL, Domain, getServerContext } from '@labkey/api'; @@ -66,8 +67,7 @@ class DatasetDesigner extends PureComponent { navigate(defaultUrl: string): void { this._dirty = false; - const redirectUrl = ActionURL.getReturnUrl() || defaultUrl; - window.location.href = ActionURL.buildURL('core', 'safeRedirect', undefined, { returnUrl: redirectUrl }); + redirect(ActionURL.getReturnUrl() || defaultUrl); } navigateOnComplete(model: DatasetModel): void { diff --git a/core/src/client/DomainDesigner/DomainDesigner.tsx b/core/src/client/DomainDesigner/DomainDesigner.tsx index 0ff8aed6b54..72cc388132a 100644 --- a/core/src/client/DomainDesigner/DomainDesigner.tsx +++ b/core/src/client/DomainDesigner/DomainDesigner.tsx @@ -27,6 +27,7 @@ import { FormButtons, LoadingSpinner, Modal, + redirect, resolveErrorMessage, saveDomain, } from '@labkey/components'; @@ -161,8 +162,7 @@ class DomainDesigner extends React.PureComponent> { navigate = (): void => { this._dirty = false; - const redirectUrl = ActionURL.getReturnUrl() || ActionURL.buildURL('project', 'begin', getServerContext().container.path); - window.location.href = ActionURL.buildURL('core', 'safeRedirect', undefined, { returnUrl: redirectUrl }); + redirect(ActionURL.getReturnUrl() || ActionURL.buildURL('project', 'begin', getServerContext().container.path)); }; renderWarningConfirm() { diff --git a/core/src/client/ErrorHandler/ErrorType.tsx b/core/src/client/ErrorHandler/ErrorType.tsx index 9c5ac69246c..65af7a44465 100644 --- a/core/src/client/ErrorHandler/ErrorType.tsx +++ b/core/src/client/ErrorHandler/ErrorType.tsx @@ -4,7 +4,7 @@ * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 */ import React, { ReactNode } from 'react'; -import { imageURL, HelpLink, HELP_LINK_REFERRER } from '@labkey/components'; +import { HELP_LINK_REFERRER, HelpLink, imageURL, redirect } from '@labkey/components'; import { ActionURL, Ajax, getServerContext } from '@labkey/api'; import { ErrorDetails, ErrorType } from './model'; @@ -161,7 +161,7 @@ const PERMISSION_DETAILS = (errorDetails: ErrorDetails) => ( returnUrl, }, callback: () => { - window.location.href = returnUrl; + redirect(returnUrl); }, }); }} diff --git a/core/src/client/IssuesListDesigner/IssuesListDesigner.tsx b/core/src/client/IssuesListDesigner/IssuesListDesigner.tsx index 4896391279a..1084a2ab498 100644 --- a/core/src/client/IssuesListDesigner/IssuesListDesigner.tsx +++ b/core/src/client/IssuesListDesigner/IssuesListDesigner.tsx @@ -23,6 +23,7 @@ import { IssuesListDefDesignerPanels, IssuesListDefModel, LoadingSpinner, + redirect, } from '@labkey/components'; import '../DomainDesigner.scss'; @@ -82,8 +83,7 @@ class IssuesListDesigner extends React.Component<{}, State> { navigate = (defaultUrl: string) => { this._dirty = false; - const redirectUrl = ActionURL.getReturnUrl() || defaultUrl; - window.location.href = ActionURL.buildURL('core', 'safeRedirect', undefined, { returnUrl: redirectUrl }); + redirect(ActionURL.getReturnUrl() || defaultUrl); }; onComplete = (model: IssuesListDefModel) => { diff --git a/core/src/client/ListDesigner/ListDesigner.tsx b/core/src/client/ListDesigner/ListDesigner.tsx index 96ac31d955d..c57ba143d35 100644 --- a/core/src/client/ListDesigner/ListDesigner.tsx +++ b/core/src/client/ListDesigner/ListDesigner.tsx @@ -24,6 +24,7 @@ import { ListDesignerPanels, ListModel, LoadingSpinner, + redirect, } from '@labkey/components'; import '../DomainDesigner.scss'; @@ -104,7 +105,7 @@ export class ListDesigner extends React.Component { navigate = async (returnUrlProvider: () => Promise, model?: ListModel): Promise => { this._dirty = false; const redirectUrl = this.getReturnUrl(model) ?? (await returnUrlProvider()); - window.location.href = ActionURL.buildURL('core', 'safeRedirect', undefined, { returnUrl: redirectUrl }); + redirect(redirectUrl); }; getReturnUrl = (model?: ListModel): string => { diff --git a/core/src/client/SampleTypeDesigner/SampleTypeDesigner.tsx b/core/src/client/SampleTypeDesigner/SampleTypeDesigner.tsx index 9f70eb8376b..497937e7c43 100644 --- a/core/src/client/SampleTypeDesigner/SampleTypeDesigner.tsx +++ b/core/src/client/SampleTypeDesigner/SampleTypeDesigner.tsx @@ -26,6 +26,7 @@ import { getSampleSet, getSampleTypeDetails, LoadingSpinner, + redirect, SampleTypeDesigner, SampleTypeModel, } from '@labkey/components'; @@ -144,8 +145,7 @@ class SampleTypeDesignerWrapper extends React.PureComponent { navigate(defaultUrl: string) { this._dirty = false; - const redirectUrl = ActionURL.getReturnUrl() || defaultUrl; - window.location.href = ActionURL.buildURL('core', 'safeRedirect', undefined, { returnUrl: redirectUrl }); + redirect(ActionURL.getReturnUrl() || defaultUrl); } render() { diff --git a/experiment/package-lock.json b/experiment/package-lock.json index e1fde491bd6..80eed60242d 100644 --- a/experiment/package-lock.json +++ b/experiment/package-lock.json @@ -8,7 +8,7 @@ "name": "experiment", "version": "0.0.0", "dependencies": { - "@labkey/components": "7.42.1" + "@labkey/components": "7.42.3-fb-redirectGH1023.2" }, "devDependencies": { "@labkey/build": "9.1.5", @@ -3754,9 +3754,9 @@ } }, "node_modules/@labkey/api": { - "version": "1.51.4", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.51.4.tgz", - "integrity": "sha512-D8Rs1yd8dKnmLxGzMaTtOg3S7EpQRSGMCGPRNTPqICTukYwlHhi39UViiF9b7s3knlK4gtp9D64CHbQcehgw+w==", + "version": "1.51.5", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.51.5.tgz", + "integrity": "sha512-F7qo6roSBTqeh68Z4yWwel/AAWvt620SSVdCQauKBYjHRJao/Z29gOKWEQ7lWy0E66avDwBOVzpBZq8syhvP0g==", "license": "Apache-2.0" }, "node_modules/@labkey/build": { @@ -3798,13 +3798,13 @@ } }, "node_modules/@labkey/components": { - "version": "7.42.1", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-7.42.1.tgz", - "integrity": "sha512-y9sVFxdqCQDBnWCSW4BqtpauFMbjuTmywXDT1O6Zh31PopyyWhGiEA99K+zPxGzn7QRKh6BLcm0QrlTFPh0+jA==", + "version": "7.42.3-fb-redirectGH1023.2", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-7.42.3-fb-redirectGH1023.2.tgz", + "integrity": "sha512-Qil0DK/6qQlmjH+shA7CCdkrwVLztBc1IrH24ZuinomiA1e1J3a0Q1ITI/4sKiGee/04zuRQVaH0UF8Ezfd6Kg==", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.51.4", + "@labkey/api": "1.51.5", "@testing-library/dom": "~10.4.1", "@testing-library/jest-dom": "~6.9.1", "@testing-library/react": "~16.3.2", diff --git a/experiment/package.json b/experiment/package.json index d8741240456..95f3197ee51 100644 --- a/experiment/package.json +++ b/experiment/package.json @@ -13,7 +13,7 @@ "test-integration": "cross-env NODE_ENV=test jest --ci --runInBand -c test/js/jest.config.integration.js" }, "dependencies": { - "@labkey/components": "7.42.1" + "@labkey/components": "7.42.3-fb-redirectGH1023.2" }, "devDependencies": { "@labkey/build": "9.1.5", diff --git a/pipeline/package-lock.json b/pipeline/package-lock.json index 05a94bf5859..d8fca3a3893 100644 --- a/pipeline/package-lock.json +++ b/pipeline/package-lock.json @@ -8,7 +8,7 @@ "name": "pipeline", "version": "0.0.0", "dependencies": { - "@labkey/components": "7.42.1" + "@labkey/components": "7.42.3-fb-redirectGH1023.2" }, "devDependencies": { "@labkey/build": "9.1.5", @@ -2835,9 +2835,9 @@ } }, "node_modules/@labkey/api": { - "version": "1.51.4", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.51.4.tgz", - "integrity": "sha512-D8Rs1yd8dKnmLxGzMaTtOg3S7EpQRSGMCGPRNTPqICTukYwlHhi39UViiF9b7s3knlK4gtp9D64CHbQcehgw+w==", + "version": "1.51.5", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.51.5.tgz", + "integrity": "sha512-F7qo6roSBTqeh68Z4yWwel/AAWvt620SSVdCQauKBYjHRJao/Z29gOKWEQ7lWy0E66avDwBOVzpBZq8syhvP0g==", "license": "Apache-2.0" }, "node_modules/@labkey/build": { @@ -2879,13 +2879,13 @@ } }, "node_modules/@labkey/components": { - "version": "7.42.1", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-7.42.1.tgz", - "integrity": "sha512-y9sVFxdqCQDBnWCSW4BqtpauFMbjuTmywXDT1O6Zh31PopyyWhGiEA99K+zPxGzn7QRKh6BLcm0QrlTFPh0+jA==", + "version": "7.42.3-fb-redirectGH1023.2", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-7.42.3-fb-redirectGH1023.2.tgz", + "integrity": "sha512-Qil0DK/6qQlmjH+shA7CCdkrwVLztBc1IrH24ZuinomiA1e1J3a0Q1ITI/4sKiGee/04zuRQVaH0UF8Ezfd6Kg==", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.51.4", + "@labkey/api": "1.51.5", "@testing-library/dom": "~10.4.1", "@testing-library/jest-dom": "~6.9.1", "@testing-library/react": "~16.3.2", diff --git a/pipeline/package.json b/pipeline/package.json index ddab3d84e85..04e779c4f51 100644 --- a/pipeline/package.json +++ b/pipeline/package.json @@ -14,7 +14,7 @@ "build-prod": "npm run clean && cross-env NODE_ENV=production PROD_SOURCE_MAP=source-map webpack --config node_modules/@labkey/build/webpack/prod.config.js --color --progress --profile" }, "dependencies": { - "@labkey/components": "7.42.1" + "@labkey/components": "7.42.3-fb-redirectGH1023.2" }, "devDependencies": { "@labkey/build": "9.1.5", diff --git a/pipeline/src/client/CreatePipelineTrigger/CreatePipelineTrigger.tsx b/pipeline/src/client/CreatePipelineTrigger/CreatePipelineTrigger.tsx index 4917d722453..818caa8cb85 100644 --- a/pipeline/src/client/CreatePipelineTrigger/CreatePipelineTrigger.tsx +++ b/pipeline/src/client/CreatePipelineTrigger/CreatePipelineTrigger.tsx @@ -3,9 +3,9 @@ * * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 */ -import React, { ChangeEvent, Dispatch, FC, Reducer, useCallback, useEffect, useState, useReducer } from 'react'; +import React, { ChangeEvent, Dispatch, FC, Reducer, useCallback, useEffect, useReducer, useState } from 'react'; import { ActionURL, Ajax, Utils } from '@labkey/api'; -import { naturalSort, FormSchema, AutoForm, Alert, cancelEvent } from '@labkey/components'; +import { Alert, AutoForm, cancelEvent, FormSchema, naturalSort, redirect } from '@labkey/components'; // eslint-disable-next-line import/no-unassigned-import import './CreatePipelineTrigger.scss'; @@ -738,7 +738,7 @@ export const CreatePipelineTrigger: FC = props => { useEffect(() => { if (saveSuccessful) { - window.setTimeout(() => (window.location.href = returnUrl), 1000); + window.setTimeout(() => redirect(returnUrl), 1000); } }, [returnUrl, saveSuccessful]);