Merge branch 'develop' of https://github.com/getmaxun/maxun into develop
This commit is contained in:
@@ -41,7 +41,8 @@
|
|||||||
"duplicate": "Duplizieren",
|
"duplicate": "Duplizieren",
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"delete_warning": "Roboter kann nicht gelöscht werden, da zugehörige Ausführungen vorhanden sind",
|
"delete_warning": "Roboter kann nicht gelöscht werden, da zugehörige Ausführungen vorhanden sind",
|
||||||
"delete_success": "Roboter erfolgreich gelöscht"
|
"delete_success": "Roboter erfolgreich gelöscht",
|
||||||
|
"auth_success": "Roboter erfolgreich authentifiziert"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mainmenu": {
|
"mainmenu": {
|
||||||
|
|||||||
@@ -42,7 +42,8 @@
|
|||||||
"search":"Search Robots...",
|
"search":"Search Robots...",
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"delete_warning": "Cannot delete robot as it has associated runs",
|
"delete_warning": "Cannot delete robot as it has associated runs",
|
||||||
"delete_success": "Robot deleted successfully"
|
"delete_success": "Robot deleted successfully",
|
||||||
|
"auth_success": "Robot successfully authenticated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mainmenu":{
|
"mainmenu":{
|
||||||
|
|||||||
@@ -42,7 +42,8 @@
|
|||||||
"search": "Buscar robots...",
|
"search": "Buscar robots...",
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"delete_warning": "No se puede eliminar el robot ya que tiene ejecuciones asociadas",
|
"delete_warning": "No se puede eliminar el robot ya que tiene ejecuciones asociadas",
|
||||||
"delete_success": "Robot eliminado exitosamente"
|
"delete_success": "Robot eliminado exitosamente",
|
||||||
|
"auth_success": "Robot autenticado exitosamente"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mainmenu": {
|
"mainmenu": {
|
||||||
|
|||||||
@@ -42,7 +42,8 @@
|
|||||||
"search": "ロボットを検索...",
|
"search": "ロボットを検索...",
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"delete_warning": "関連する実行があるため、ロボットを削除できません",
|
"delete_warning": "関連する実行があるため、ロボットを削除できません",
|
||||||
"delete_success": "ロボットが正常に削除されました"
|
"delete_success": "ロボットが正常に削除されました",
|
||||||
|
"auth_success": "ロボットの認証に成功しました"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mainmenu": {
|
"mainmenu": {
|
||||||
|
|||||||
@@ -42,7 +42,8 @@
|
|||||||
"search": "搜索机器人...",
|
"search": "搜索机器人...",
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"delete_warning": "无法删除机器人,因为它有关联的运行记录",
|
"delete_warning": "无法删除机器人,因为它有关联的运行记录",
|
||||||
"delete_success": "机器人删除成功"
|
"delete_success": "机器人删除成功",
|
||||||
|
"auth_success": "机器人认证成功"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mainmenu": {
|
"mainmenu": {
|
||||||
|
|||||||
@@ -380,11 +380,19 @@ router.get(
|
|||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
maxAge: 60000,
|
maxAge: 60000,
|
||||||
}); // 1-minute expiration
|
}); // 1-minute expiration
|
||||||
res.cookie("robot_auth_message", "Robot successfully authenticated", {
|
// res.cookie("robot_auth_message", "Robot successfully authenticated", {
|
||||||
|
// httpOnly: false,
|
||||||
|
// maxAge: 60000,
|
||||||
|
// });
|
||||||
|
res.cookie('robot_auth_robotId', robotId, {
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
maxAge: 60000,
|
maxAge: 60000,
|
||||||
});
|
});
|
||||||
res.redirect(`${process.env.PUBLIC_URL}/robots/${robotId}/integrate` as string || `http://localhost:5173/robots/${robotId}/integrate`);
|
|
||||||
|
const baseUrl = process.env.PUBLIC_URL || "http://localhost:5173";
|
||||||
|
const redirectUrl = `${baseUrl}/robots/`;
|
||||||
|
|
||||||
|
res.redirect(redirectUrl);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
res.status(500).json({ message: `Google OAuth error: ${error.message}` });
|
res.status(500).json({ message: `Google OAuth error: ${error.message}` });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,20 +29,6 @@ export interface IntegrationSettings {
|
|||||||
data: string;
|
data: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions to replace js-cookie functionality
|
|
||||||
const getCookie = (name: string): string | null => {
|
|
||||||
const value = `; ${document.cookie}`;
|
|
||||||
const parts = value.split(`; ${name}=`);
|
|
||||||
if (parts.length === 2) {
|
|
||||||
return parts.pop()?.split(';').shift() || null;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const removeCookie = (name: string): void => {
|
|
||||||
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const IntegrationSettingsModal = ({
|
export const IntegrationSettingsModal = ({
|
||||||
isOpen,
|
isOpen,
|
||||||
handleStart,
|
handleStart,
|
||||||
@@ -154,17 +140,6 @@ export const IntegrationSettingsModal = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Check if there is a success message in cookies
|
|
||||||
const status = getCookie("robot_auth_status");
|
|
||||||
const message = getCookie("robot_auth_message");
|
|
||||||
|
|
||||||
if (status === "success" && message) {
|
|
||||||
notify("success", message);
|
|
||||||
// Clear the cookies after reading
|
|
||||||
removeCookie("robot_auth_status");
|
|
||||||
removeCookie("robot_auth_message");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we're on the callback URL
|
// Check if we're on the callback URL
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const code = urlParams.get("code");
|
const code = urlParams.get("code");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { RecordingsTable } from "./RecordingsTable";
|
import { RecordingsTable } from "./RecordingsTable";
|
||||||
import { Grid } from "@mui/material";
|
import { Grid } from "@mui/material";
|
||||||
import { RunSettings, RunSettingsModal } from "../run/RunSettings";
|
import { RunSettings, RunSettingsModal } from "../run/RunSettings";
|
||||||
@@ -8,6 +8,8 @@ import { RobotSettingsModal } from "./RobotSettings";
|
|||||||
import { RobotEditModal } from "./RobotEdit";
|
import { RobotEditModal } from "./RobotEdit";
|
||||||
import { RobotDuplicationModal } from "./RobotDuplicate";
|
import { RobotDuplicationModal } from "./RobotDuplicate";
|
||||||
import { useNavigate, useLocation, useParams } from "react-router-dom";
|
import { useNavigate, useLocation, useParams } from "react-router-dom";
|
||||||
|
import { useGlobalInfoStore } from "../../context/globalInfo";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
interface RecordingsProps {
|
interface RecordingsProps {
|
||||||
handleEditRecording: (id: string, fileName: string) => void;
|
handleEditRecording: (id: string, fileName: string) => void;
|
||||||
@@ -26,6 +28,8 @@ export const Recordings = ({
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { selectedRecordingId } = useParams();
|
const { selectedRecordingId } = useParams();
|
||||||
const [params, setParams] = useState<string[]>([]);
|
const [params, setParams] = useState<string[]>([]);
|
||||||
|
const { notify } = useGlobalInfoStore();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const handleNavigate = (path: string, id: string, name: string, params: string[]) => {
|
const handleNavigate = (path: string, id: string, name: string, params: string[]) => {
|
||||||
setParams(params);
|
setParams(params);
|
||||||
@@ -39,6 +43,31 @@ export const Recordings = ({
|
|||||||
navigate("/robots"); // Navigate back to the main robots page
|
navigate("/robots"); // Navigate back to the main robots page
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Helper function to get and clear a cookie
|
||||||
|
const getAndClearCookie = (name: string) => {
|
||||||
|
const value = document.cookie
|
||||||
|
.split('; ')
|
||||||
|
.find(row => row.startsWith(`${name}=`))
|
||||||
|
?.split('=')[1];
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const authStatus = getAndClearCookie('robot_auth_status');
|
||||||
|
const robotId = getAndClearCookie('robot_auth_robotId');
|
||||||
|
|
||||||
|
if (authStatus === 'success' && robotId) {
|
||||||
|
notify(authStatus, t("recordingtable.notifications.auth_success"));
|
||||||
|
|
||||||
|
handleNavigate(`/robots/${robotId}/integrate`, robotId, "", []);''
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Determine which modal to open based on the current route
|
// Determine which modal to open based on the current route
|
||||||
const getCurrentModal = () => {
|
const getCurrentModal = () => {
|
||||||
const currentPath = location.pathname;
|
const currentPath = location.pathname;
|
||||||
|
|||||||
Reference in New Issue
Block a user