-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(store): Add global store and project refactor
- Loading branch information
Showing
24 changed files
with
803 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { ActionsButtons } from "@/components/custom/action-buttons"; | ||
import { TRunStatus } from "@/services/run"; | ||
import React from "react"; | ||
|
||
export function JobsActions() { | ||
const [currentState, setCurrentState] = React.useState<TRunStatus>("init"); | ||
|
||
return ( | ||
<ActionsButtons | ||
currentState={currentState} | ||
cancelButton={{ | ||
isDisabled: | ||
currentState === "init" || | ||
currentState === "failed" || | ||
currentState === "success", | ||
onClick: () => { | ||
setCurrentState("failed"); | ||
}, | ||
tooltipText: "To cancel all the jobs running.", | ||
}} | ||
playButton={{ | ||
isDisabled: false, | ||
tooltipText: "To run all the jobs in the current step.", | ||
onClick: () => { | ||
setCurrentState("pending"); | ||
setTimeout(() => { | ||
setCurrentState("running"); | ||
}, 3000); | ||
setTimeout(() => { | ||
setCurrentState("failed"); | ||
}, 5000); | ||
}, | ||
}} | ||
pendingButton={{ | ||
isDisabled: false, | ||
tooltipText: "All jobs execution is in pending.", | ||
}} | ||
runningButton={{ | ||
isDisabled: false, | ||
tooltipText: "Executing all the jobs in the current steps.", | ||
}} | ||
successButton={{ | ||
isDisabled: false, | ||
onClick: () => { | ||
setCurrentState("pending"); | ||
}, | ||
tooltipText: "Click to run all the jobs again.", | ||
}} | ||
failedButton={{ | ||
tooltipText: | ||
"Last execution was failed. Press this button to retry the execution.", | ||
onClick: () => { | ||
setCurrentState("pending"); | ||
setTimeout(() => { | ||
setCurrentState("running"); | ||
}, 3000); | ||
|
||
setTimeout(() => { | ||
setCurrentState("success"); | ||
}, 6000); | ||
}, | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { ActionsButtons } from "@/components/custom/action-buttons"; | ||
import { TRunStatus } from "@/services/run"; | ||
import React from "react"; | ||
|
||
export function ProjectActions() { | ||
const [currentState, setCurrentState] = React.useState<TRunStatus>("init"); | ||
|
||
return ( | ||
<ActionsButtons | ||
currentState={currentState} | ||
cancelButton={{ | ||
isDisabled: | ||
currentState === "init" || | ||
currentState === "failed" || | ||
currentState === "success", | ||
onClick: () => { | ||
setCurrentState("failed"); | ||
}, | ||
tooltipText: "To cancel all the steps running in this Project.", | ||
}} | ||
playButton={{ | ||
isDisabled: false, | ||
tooltipText: "To run all the steps in the current project.", | ||
onClick: () => { | ||
setCurrentState("pending"); | ||
setTimeout(() => { | ||
setCurrentState("running"); | ||
}, 3000); | ||
setTimeout(() => { | ||
setCurrentState("failed"); | ||
}, 5000); | ||
}, | ||
}} | ||
pendingButton={{ | ||
isDisabled: false, | ||
tooltipText: "Project execution is in pending.", | ||
}} | ||
runningButton={{ | ||
isDisabled: false, | ||
tooltipText: "Executing all the steps in the current project.", | ||
}} | ||
successButton={{ | ||
isDisabled: false, | ||
onClick: () => { | ||
setCurrentState("pending"); | ||
}, | ||
tooltipText: "Click to run all the steps in the project again.", | ||
}} | ||
failedButton={{ | ||
tooltipText: | ||
"Last execution was failed. Press this button to retry the execution.", | ||
onClick: () => { | ||
setCurrentState("pending"); | ||
setTimeout(() => { | ||
setCurrentState("running"); | ||
}, 3000); | ||
|
||
setTimeout(() => { | ||
setCurrentState("success"); | ||
}, 6000); | ||
}, | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use client"; | ||
|
||
import { Breadcrumb } from "@/components/custom/breadcrumb"; | ||
import { PageHeading } from "@/components/custom/page-heading"; | ||
import { PROJECTS_LISTING_URL } from "@/constants/routes"; | ||
import { TProject } from "@/services/projects"; | ||
import { ProjectStoreProvider } from "@/stores/project"; | ||
import { StepsContainer } from "./steps-container"; | ||
import { ProjectActions } from "./project-actions"; | ||
|
||
export type TProjectMainContentProps = { | ||
project: TProject; | ||
}; | ||
|
||
export function ProjectMainContent(props: TProjectMainContentProps) { | ||
const { project } = props; | ||
|
||
return ( | ||
<ProjectStoreProvider project={project}> | ||
<div className="flex flex-col flex-1 overflow-auto"> | ||
<PageHeading heading={project.name} /> | ||
<Breadcrumb | ||
links={[ | ||
{ title: "All Projects", href: PROJECTS_LISTING_URL }, | ||
{ title: project.name }, | ||
]} | ||
/> | ||
<div className="flex flex-1 flex-col"> | ||
<div className="py-4"> | ||
<p>{project.description}</p> | ||
<div className="flex justify-end"> | ||
<ProjectActions /> | ||
</div> | ||
</div> | ||
<StepsContainer /> | ||
</div> | ||
</div> | ||
</ProjectStoreProvider> | ||
); | ||
} |
Oops, something went wrong.