Merge branch 'develop' into ui-fix

This commit is contained in:
Rohit
2025-01-08 12:50:46 +05:30
committed by GitHub
67 changed files with 7978 additions and 1189 deletions

View File

@@ -14,6 +14,9 @@ import axios from "axios";
import { useGlobalInfoStore } from "../../context/globalInfo";
import { getStoredRecording } from "../../api/storage";
import { apiUrl } from "../../apiConfig.js";
import Cookies from 'js-cookie';
import { useTranslation } from "react-i18next";
interface IntegrationProps {
isOpen: boolean;
@@ -46,6 +49,7 @@ export const IntegrationSettingsModal = ({
handleStart,
handleClose,
}: IntegrationProps) => {
const { t } = useTranslation();
const [settings, setSettings] = useState<IntegrationSettings>({
spreadsheetId: "",
spreadsheetName: "",
@@ -90,9 +94,9 @@ export const IntegrationSettingsModal = ({
);
notify(
"error",
`Error fetching spreadsheet files: ${
error.response?.data?.message || error.message
}`
t('integration_settings.errors.fetch_error', {
message: error.response?.data?.message || error.message
})
);
}
};
@@ -121,7 +125,7 @@ export const IntegrationSettingsModal = ({
},
{ withCredentials: true }
);
notify(`success`, `Google Sheet selected successfully`);
notify(`success`, t('integration_settings.notifications.sheet_selected'));
console.log("Google Sheet ID updated:", response.data);
} catch (error: any) {
console.error(
@@ -182,37 +186,28 @@ export const IntegrationSettingsModal = ({
return (
<GenericModal isOpen={isOpen} onClose={handleClose} modalStyle={modalStyle}>
<div
style={{
<div style={{
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
marginLeft: "65px",
}}
>
}}>
<Typography variant="h6">
Integrate with Google Sheet{" "}
{t('integration_settings.title')}
</Typography>
{recording && recording.google_sheet_id ? (
<>
<Alert severity="info" sx={{ marginTop: '10px', border: '1px solid #ff00c3' }}>
<AlertTitle>Google Sheet Integrated Successfully.</AlertTitle>
Every time this robot creates a successful run, its captured data
is appended to your {recording.google_sheet_name} Google Sheet.
You can check the data updates{" "}
<a
href={`https://docs.google.com/spreadsheets/d/${recording.google_sheet_id}`}
<AlertTitle>{t('integration_settings.alerts.success.title')}</AlertTitle>
{t('integration_settings.alerts.success.content', { sheetName: recording.google_sheet_name })}
<a href={`https://docs.google.com/spreadsheets/d/${recording.google_sheet_id}`}
target="_blank"
rel="noreferrer"
>
here
</a>
.
rel="noreferrer">
{t('integration_settings.alerts.success.here')}
</a>.
<br />
<strong>Note:</strong> The data extracted before integrating with
Google Sheets will not be synced in the Google Sheet. Only the
data extracted after the integration will be synced.
<strong>{t('integration_settings.alerts.success.note')}</strong> {t('integration_settings.alerts.success.sync_limitation')}
</Alert>
<Button
variant="outlined"
@@ -220,31 +215,29 @@ export const IntegrationSettingsModal = ({
onClick={removeIntegration}
style={{ marginTop: "15px" }}
>
Remove Integration
{t('integration_settings.buttons.remove_integration')}
</Button>
</>
) : (
<>
{!recording?.google_sheet_email ? (
<>
<p>
If you enable this option, every time this robot runs a task
successfully, its captured data will be appended to your
Google Sheet.
</p>
<p>{t('integration_settings.descriptions.sync_info')}</p>
<Button
variant="contained"
color="primary"
onClick={authenticateWithGoogle}
>
Authenticate with Google
{t('integration_settings.buttons.authenticate')}
</Button>
</>
) : (
<>
{recording.google_sheet_email && (
<Typography sx={{ margin: "20px 0px 30px 0px" }}>
Authenticated as: {recording.google_sheet_email}
{t('integration_settings.descriptions.authenticated_as', {
email: recording.google_sheet_email
})}
</Typography>
)}
@@ -260,14 +253,14 @@ export const IntegrationSettingsModal = ({
color="primary"
onClick={fetchSpreadsheetFiles}
>
Fetch Google Spreadsheets
{t('integration_settings.buttons.fetch_sheets')}
</Button>
<Button
variant="outlined"
color="error"
onClick={removeIntegration}
>
Remove Integration
{t('integration_settings.buttons.remove_integration')}
</Button>
</div>
</>
@@ -276,7 +269,7 @@ export const IntegrationSettingsModal = ({
<TextField
sx={{ marginBottom: "15px" }}
select
label="Select Google Sheet"
label={t('integration_settings.fields.select_sheet')}
required
value={settings.spreadsheetId}
onChange={handleSpreadsheetSelect}
@@ -291,13 +284,10 @@ export const IntegrationSettingsModal = ({
{settings.spreadsheetId && (
<Typography sx={{ marginBottom: "10px" }}>
Selected Sheet:{" "}
{
spreadsheets.find(
(s) => s.id === settings.spreadsheetId
)?.name
}{" "}
(ID: {settings.spreadsheetId})
{t('integration_settings.fields.selected_sheet', {
name: spreadsheets.find((s) => s.id === settings.spreadsheetId)?.name,
id: settings.spreadsheetId
})}
</Typography>
)}
@@ -311,7 +301,7 @@ export const IntegrationSettingsModal = ({
style={{ marginTop: "10px" }}
disabled={!settings.spreadsheetId || loading}
>
Submit
{t('integration_settings.buttons.submit')}
</Button>
</>
)}