Merge pull request #8074 from ToolJet/main

Merge main to develop
This commit is contained in:
Midhun G S 2023-10-30 19:51:50 +05:30 committed by GitHub
commit ebdda1598b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 15 deletions

View file

@ -1 +1 @@
2.22.1
2.22.2

View file

@ -1 +1 @@
2.22.1
2.22.2

View file

@ -22,7 +22,7 @@ import toast from 'react-hot-toast';
export const authorizeWorkspace = () => {
if (!isThisExistedRoute()) {
const workspaceIdOrSlug = getWorkspaceIdOrSlugFromURL();
const isApplicationsPath = getPathname(null, true).includes('/applications/');
const isApplicationsPath = getPathname(null, true).startsWith('/applications/');
const appId = isApplicationsPath ? getPathname().split('/')[2] : null;
/* CASE-1 */
authenticationService

View file

@ -119,7 +119,7 @@ export const getWorkspaceIdOrSlugFromURL = () => {
};
export const excludeWorkspaceIdFromURL = (pathname) => {
if (!['integrations', 'applications', 'switch-workspace'].find((path) => pathname.includes(path))) {
if (!['/integrations', '/applications/', '/switch-workspace'].find((path) => pathname.startsWith(path))) {
pathname = getSubpath() ? pathname.replace(getSubpath(), '') : pathname;
const paths = pathname?.split('/').filter((path) => path !== '');
paths.shift();
@ -132,9 +132,9 @@ export const excludeWorkspaceIdFromURL = (pathname) => {
export const getSubpath = () =>
window?.public_config?.SUB_PATH ? stripTrailingSlash(window?.public_config?.SUB_PATH) : null;
const returnWorkspaceIdIfNeed = (path) => {
export const returnWorkspaceIdIfNeed = (path) => {
if (path) {
return !path.includes('applications') && !path.includes('integrations') ? `/${getWorkspaceId()}` : '';
return !path.startsWith('/applications/') && !path.startsWith('/integrations') ? `/${getWorkspaceId()}` : '';
}
return `/${getWorkspaceId()}`;
};

View file

@ -9,7 +9,7 @@ import { authenticationService } from '@/_services/authentication.service';
import { useDataQueriesStore } from '@/_stores/dataQueriesStore';
import { getCurrentState } from '@/_stores/currentStateStore';
import { getWorkspaceIdOrSlugFromURL, getSubpath } from './routes';
import { getWorkspaceIdOrSlugFromURL, getSubpath, returnWorkspaceIdIfNeed } from './routes';
import { getCookie, eraseCookie } from '@/_helpers/cookie';
import { staticDataSources } from '@/Editor/QueryManager/constants';
@ -1027,13 +1027,6 @@ export function eraseRedirectUrl() {
return redirectPath;
}
export const returnWorkspaceIdIfNeed = (path) => {
if (path) {
return !path.includes('applications') && !path.includes('integrations') ? `/${getWorkspaceId()}` : '';
}
return `/${getWorkspaceId()}`;
};
export const redirectToWorkspace = () => {
const path = eraseRedirectUrl();
const redirectPath = `${returnWorkspaceIdIfNeed(path)}${path && path !== '/' ? path : ''}`;

View file

@ -1 +1 @@
2.22.1
2.22.2