Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Austenem/CAT-767 update workspace toast #3514

Merged
merged 7 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-update-workspace-toast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Update language and add an action button to toasts for successful workspace creation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';

function WorkspaceLaunchSuccessToast(id: number) {
return (
<Stack spacing={1} sx={{ maxWidth: '22rem' }}>
austenem marked this conversation as resolved.
Show resolved Hide resolved
<Typography>
Workspace successfully launched in a new tab. If the tab didn&apos;t open, please check your pop-up blocker
settings and relaunch your workspace.
</Typography>
<Button href={`/workspaces/${id}`} variant="text" color="inherit" sx={{ alignSelf: 'flex-end' }}>
View Workspace Detail Page
</Button>
</Stack>
);
}

export default WorkspaceLaunchSuccessToast;
5 changes: 4 additions & 1 deletion context/app/static/js/components/workspaces/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useMemo } from 'react';
import { KeyedMutator, useSWRConfig } from 'swr';

import { useSnackbarActions } from 'js/shared-styles/snackbars';
import { useLaunchWorkspaceStore } from 'js/stores/useWorkspaceModalStore';
import { useAppContext } from 'js/components/Contexts';
Expand Down Expand Up @@ -28,6 +29,7 @@ import {
} from './api';
import { MergedWorkspace, Workspace, CreateTemplatesResponse } from './types';
import { useWorkspaceTemplates } from './NewWorkspaceDialog/hooks';
import WorkspaceLaunchSuccessToast from './WorkspaceLaunchSuccessToast';

interface UseWorkspacesListTypes<T> {
workspaces: Workspace[];
Expand Down Expand Up @@ -271,7 +273,8 @@ export function useCreateAndLaunchWorkspace() {
toastError('Failed to create workspace.');
return;
}
toastSuccess('Workspace successfully created.');

toastSuccess(WorkspaceLaunchSuccessToast(workspace.id));

try {
await startNewWorkspace({ workspace, jobTypeId: body.default_job_type, templatePath });
Expand Down
Loading