Merge pull request #62 from amhsirak/develop

feat: use robot id for scheduler
This commit is contained in:
Karishma Shukla
2024-10-10 03:46:24 +05:30
committed by GitHub
3 changed files with 8 additions and 7 deletions

View File

@@ -118,15 +118,15 @@ export const notifyAboutAbort = async (id:string): Promise<boolean> => {
}
}
export const scheduleStoredRecording = async (fileName: string, settings: ScheduleSettings): Promise<ScheduleRunResponse> => {
export const scheduleStoredRecording = async (id: string, settings: ScheduleSettings): Promise<ScheduleRunResponse> => {
try {
const response = await axios.put(
`http://localhost:8080/storage/schedule/${fileName}`,
`http://localhost:8080/storage/schedule/${id}`,
{...settings});
if (response.status === 200) {
return response.data;
} else {
throw new Error(`Couldn't schedule recording ${fileName}. Please try again later.`);
throw new Error(`Couldn't schedule recording ${id}. Please try again later.`);
}
} catch(error: any) {
console.log(error);

View File

@@ -72,9 +72,9 @@ interface Data {
interface RecordingsTableProps {
handleEditRecording: (id: string, fileName: string) => void;
handleRunRecording: (id: string,fileName: string, params: string[]) => void;
handleScheduleRecording: (id: string,fileName: string, params: string[]) => void;
handleIntegrateRecording: (id: string,fileName: string, params: string[]) => void;
handleRunRecording: (id: string, fileName: string, params: string[]) => void;
handleScheduleRecording: (id: string, fileName: string, params: string[]) => void;
handleIntegrateRecording: (id: string, fileName: string, params: string[]) => void;
}
export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handleScheduleRecording, handleIntegrateRecording }: RecordingsTableProps) => {

View File

@@ -108,7 +108,7 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
}, [runningRecordingName, sockets, ids, readyForRunHandler, debugMessageHandler])
const handleScheduleRecording = (settings: ScheduleSettings) => {
scheduleStoredRecording(runningRecordingName, settings)
scheduleStoredRecording(runningRecordingId, settings)
.then(({ message, runId }: ScheduleRunResponse) => {
if (message === 'success') {
notify('success', `Recording ${runningRecordingName} scheduled successfully`);
@@ -118,6 +118,7 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
});
}
// todo: use runningRecordingId here (first change in backend)
const handleIntegrateRecording = (settings: IntegrationSettings) => {
handleUploadCredentials(runningRecordingName, settings.credentials, settings.spreadsheetId, settings.range)
.then((response) => {