Skip to content

Commit

Permalink
Hammer/refresh task (#900)
Browse files Browse the repository at this point in the history
* Refresh task app every 15 seconds, refresh task app on cancel

Signed-off-by: Aaron Chong <[email protected]>

* Modify messages to reflect actions more accurately

Signed-off-by: Aaron Chong <[email protected]>

---------

Signed-off-by: Aaron Chong <[email protected]>
  • Loading branch information
aaronchongth authored Feb 15, 2024
1 parent 0374aa4 commit 7d5cefd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions packages/dashboard/src/components/appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,13 @@ export const AppBar = React.memo(({ extraToolbarItems }: AppBarProps): React.Rea
deleteFavoriteTask={deleteFavoriteTask}
tasksFromFile={tasksFromFile}
onSuccess={() => {
console.log('Successfully created task');
console.log('Dispatch task requested');
setOpenCreateTaskForm(false);
showAlert('success', 'Successfully created task');
showAlert('success', 'Dispatch task requested');
}}
onFail={(e) => {
console.error(`Failed to create task: ${e.message}`);
showAlert('error', `Failed to create task: ${e.message}`);
console.error(`Failed to dispatch task: ${e.message}`);
showAlert('error', `Failed to dispatch task: ${e.message}`);
}}
onSuccessFavoriteTask={(message) => {
console.log(`Created favorite task: ${message}`);
Expand All @@ -579,9 +579,9 @@ export const AppBar = React.memo(({ extraToolbarItems }: AppBarProps): React.Rea
showAlert('error', `Failed to create or delete favorite task: ${e.message}`);
}}
onSuccessScheduling={() => {
console.log('Successfully created schedule');
console.log('Create schedule requested');
setOpenCreateTaskForm(false);
showAlert('success', 'Successfully created schedule');
showAlert('success', 'Create schedule requested');
}}
onFailScheduling={(e) => {
console.error(`Failed to create schedule: ${e.message}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ export function TaskCancelButton({
type: 'cancel_task_request',
task_id: taskState.booking.id,
});
appController.showAlert('success', 'Successfully cancelled task');
appController.showAlert('success', 'Task cancellation requested');
AppEvents.taskSelect.next(null);
AppEvents.refreshTaskApp.next();
} catch (e) {
appController.showAlert('error', `Failed to cancel task: ${(e as Error).message}`);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/src/components/tasks/tasks-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { TaskSchedule } from './task-schedule';
import { TaskSummary } from './task-summary';
import { downloadCsvFull, downloadCsvMinimal } from './utils';

const RefreshTaskQueueTableInterval = 30000;
const RefreshTaskQueueTableInterval = 15000;

enum TaskTablePanel {
QueueTable = 0,
Expand Down

0 comments on commit 7d5cefd

Please sign in to comment.