Implement confirmation dialog and menu popup (#12)
* Implement confirmation dialog for cancel deployment * Add menu to project and deployment card * Use dropdown for account selection * Organize create project components * Refactor cancel deployment dialog * Fix cancel button flex align * Fix typo --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
parent
c0a20c80a2
commit
d04517d9bb
@ -1,6 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Menu,
|
||||||
|
MenuHandler,
|
||||||
|
MenuList,
|
||||||
|
MenuItem,
|
||||||
|
} from '@material-tailwind/react';
|
||||||
|
|
||||||
import { relativeTime } from '../../utils/time';
|
import { relativeTime } from '../../utils/time';
|
||||||
import { ProjectDetails } from '../../types/project';
|
import { ProjectDetails } from '../../types/project';
|
||||||
|
|
||||||
@ -19,7 +26,15 @@ const ProjectCard: React.FC<ProjectCardProps> = ({ project }) => {
|
|||||||
</Link>
|
</Link>
|
||||||
<p className="text-sm text-gray-400">{project.domain}</p>
|
<p className="text-sm text-gray-400">{project.domain}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>...</div>
|
<Menu placement="bottom-end">
|
||||||
|
<MenuHandler>
|
||||||
|
<button>...</button>
|
||||||
|
</MenuHandler>
|
||||||
|
<MenuList>
|
||||||
|
<MenuItem>^ Project settings</MenuItem>
|
||||||
|
<MenuItem className="text-red-500">^ Delete project</MenuItem>
|
||||||
|
</MenuList>
|
||||||
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
<div className="border-slate-200 border-t-2 border-solid p-4 text-gray-500 text-xs">
|
<div className="border-slate-200 border-t-2 border-solid p-4 text-gray-500 text-xs">
|
||||||
<p>{project.latestCommit.message}</p>
|
<p>{project.latestCommit.message}</p>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { relativeTime } from '../utils/time';
|
import { relativeTime } from '../../../utils/time';
|
||||||
|
|
||||||
interface RepositoryDetails {
|
interface RepositoryDetails {
|
||||||
title: string;
|
title: string;
|
@ -1,18 +1,25 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import SearchBar from './SearchBar';
|
import SearchBar from '../../SearchBar';
|
||||||
import ProjectRepoCard from './ProjectRepoCard';
|
import ProjectRepoCard from './ProjectRepoCard';
|
||||||
import repositoryDetails from '../assets/repositories.json';
|
import repositoryDetails from '../../../assets/repositories.json';
|
||||||
|
import Dropdown from '../../Dropdown';
|
||||||
|
|
||||||
|
const ACCOUNT_OPTIONS = [
|
||||||
|
{ value: 'alice', label: 'Alice' },
|
||||||
|
{ value: 'bob', label: 'Bob' },
|
||||||
|
{ value: 'charlie', label: 'Charlie' },
|
||||||
|
];
|
||||||
|
|
||||||
const RepositoryList = () => {
|
const RepositoryList = () => {
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<div className="basis-1/3">
|
<div className="basis-1/3">
|
||||||
<input
|
<Dropdown
|
||||||
type="text"
|
|
||||||
placeholder="All accounts"
|
placeholder="All accounts"
|
||||||
className="text-gray-700 text-xs w-full border-none focus:outline-none"
|
options={ACCOUNT_OPTIONS}
|
||||||
|
onChange={() => {}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="basis-2/3">
|
<div className="basis-2/3">
|
@ -0,0 +1,51 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Dialog,
|
||||||
|
DialogHeader,
|
||||||
|
DialogBody,
|
||||||
|
DialogFooter,
|
||||||
|
} from '@material-tailwind/react';
|
||||||
|
|
||||||
|
interface CancelDeploymentDialogProp {
|
||||||
|
open: boolean;
|
||||||
|
handleOpen: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CancelDeploymentDialog = ({
|
||||||
|
open,
|
||||||
|
handleOpen,
|
||||||
|
}: CancelDeploymentDialogProp) => {
|
||||||
|
return (
|
||||||
|
<Dialog open={open} handler={handleOpen}>
|
||||||
|
<DialogHeader className="flex justify-between">
|
||||||
|
<div>Cancel deployment?</div>
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
onClick={handleOpen}
|
||||||
|
className="mr-1 rounded-3xl"
|
||||||
|
>
|
||||||
|
<span>X</span>
|
||||||
|
</Button>
|
||||||
|
</DialogHeader>
|
||||||
|
<DialogBody>
|
||||||
|
This will halt the deployment and you will have to start the process
|
||||||
|
from scratch.
|
||||||
|
</DialogBody>
|
||||||
|
<DialogFooter className="flex justify-center">
|
||||||
|
<Button variant="outlined" onClick={handleOpen} className="mr-1">
|
||||||
|
<span>Cancel</span>
|
||||||
|
</Button>
|
||||||
|
<Link to="/projects/create/template/">
|
||||||
|
<Button variant="gradient" color="red" onClick={handleOpen}>
|
||||||
|
<span>Yes, Cancel deployment</span>
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
</DialogFooter>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CancelDeploymentDialog;
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import { Stopwatch, setStopWatchOffset } from './StopWatch';
|
import { Stopwatch, setStopWatchOffset } from '../../../../StopWatch';
|
||||||
import FormatMillisecond from './FormatMilliSecond';
|
import FormatMillisecond from '../../../../FormatMilliSecond';
|
||||||
|
|
||||||
const PROCESS_LOGS = [
|
const PROCESS_LOGS = [
|
||||||
'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
|
'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
|
@ -1,5 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Menu,
|
||||||
|
MenuHandler,
|
||||||
|
MenuList,
|
||||||
|
MenuItem,
|
||||||
|
} from '@material-tailwind/react';
|
||||||
|
|
||||||
import { relativeTime } from '../../../utils/time';
|
import { relativeTime } from '../../../utils/time';
|
||||||
|
|
||||||
interface DeploymentDetails {
|
interface DeploymentDetails {
|
||||||
@ -39,7 +46,19 @@ const DeployDetailsCard = ({ deployment }: DeployDetailsCardProps) => {
|
|||||||
<p className="grow">
|
<p className="grow">
|
||||||
{relativeTime(deployment.updatedAt)} ^ {deployment.author}
|
{relativeTime(deployment.updatedAt)} ^ {deployment.author}
|
||||||
</p>
|
</p>
|
||||||
|
<Menu placement="bottom-start">
|
||||||
|
<MenuHandler>
|
||||||
<button className="self-start">...</button>
|
<button className="self-start">...</button>
|
||||||
|
</MenuHandler>
|
||||||
|
<MenuList>
|
||||||
|
<MenuItem>^ Visit</MenuItem>
|
||||||
|
<MenuItem>^ Assign domain</MenuItem>
|
||||||
|
<MenuItem>^ Change to production</MenuItem>
|
||||||
|
<hr className="my-3" />
|
||||||
|
<MenuItem>^ Redeploy</MenuItem>
|
||||||
|
<MenuItem>^ Rollback to this version</MenuItem>
|
||||||
|
</MenuList>
|
||||||
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -5,8 +5,9 @@ import DeployDetailsCard from './DeploymentDetailsCard';
|
|||||||
import Dropdown from '../../Dropdown';
|
import Dropdown from '../../Dropdown';
|
||||||
|
|
||||||
const STATUS_OPTIONS = [
|
const STATUS_OPTIONS = [
|
||||||
{ value: 'production', label: 'Production' },
|
{ value: 'building', label: 'Building' },
|
||||||
{ value: 'preview', label: 'Preview' },
|
{ value: 'ready', label: 'Ready' },
|
||||||
|
{ value: 'error', label: 'Error' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const DeploymentsTabPanel = () => {
|
const DeploymentsTabPanel = () => {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import templateDetails from '../../../assets/templates.json';
|
import templateDetails from '../../../assets/templates.json';
|
||||||
import TemplateCard from '../../../components/TemplateCard';
|
import TemplateCard from '../../../components/projects/create/TemplateCard';
|
||||||
import RepositoryList from '../../../components/RepositoryList';
|
import RepositoryList from '../../../components/projects/create/RepositoryList';
|
||||||
import ConnectAccount from '../../../components/ConnectAccount';
|
import ConnectAccount from '../../../components/projects/create/ConnectAccount';
|
||||||
|
|
||||||
const IS_GIT_AUTH = true;
|
const IS_GIT_AUTH = true;
|
||||||
|
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { DeployStep, DeployStatus } from '../../../../components/DeployStep';
|
import { Button } from '@material-tailwind/react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
DeployStep,
|
||||||
|
DeployStatus,
|
||||||
|
} from '../../../../components/projects/create/template/deploy/DeployStep';
|
||||||
import {
|
import {
|
||||||
Stopwatch,
|
Stopwatch,
|
||||||
setStopWatchOffset,
|
setStopWatchOffset,
|
||||||
} from '../../../../components/StopWatch';
|
} from '../../../../components/StopWatch';
|
||||||
|
import CancelDeploymentDialog from '../../../../components/projects/create/template/deploy/CancelDeploymentDialog';
|
||||||
|
|
||||||
const Deploy = () => {
|
const Deploy = () => {
|
||||||
|
const [open, setOpen] = React.useState(false);
|
||||||
|
const handleOpen = () => setOpen(!open);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex justify-between mb-6">
|
<div className="flex justify-between mb-6">
|
||||||
@ -20,8 +29,11 @@ const Deploy = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button className="border rounded-xl p-1 text-sm">^Cancel</button>
|
<Button onClick={handleOpen} variant="outlined" size="sm">
|
||||||
|
^Cancel
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<CancelDeploymentDialog handleOpen={handleOpen} open={open} />
|
||||||
</div>
|
</div>
|
||||||
<DeployStep
|
<DeployStep
|
||||||
title="Building"
|
title="Building"
|
||||||
|
Loading…
Reference in New Issue
Block a user