Added default description and redirected to new flow as soon as its created

This commit is contained in:
Lucas Oliveira 2023-06-13 19:16:27 -03:00
commit ddd0b05947
4 changed files with 10 additions and 5 deletions

View file

@ -417,6 +417,9 @@ export function TabsProvider({ children }: { children: ReactNode }) {
const addFlow = async (flow?: FlowType): Promise<String> => { const addFlow = async (flow?: FlowType): Promise<String> => {
let flowData = extractDataFromFlow(flow); let flowData = extractDataFromFlow(flow);
if(flowData.description == ""){
flowData.description = "This is a new flow.";
}
// Create a new flow with a default name if no flow is provided. // Create a new flow with a default name if no flow is provided.
const newFlow = createNewFlow(flowData, flow); const newFlow = createNewFlow(flowData, flow);

View file

@ -31,8 +31,7 @@ export const CardComponent = ({ flow, id }: { flow: FlowType; id: string }) => {
</CardTitle> </CardTitle>
<CardDescription className="pt-2 pb-2"> <CardDescription className="pt-2 pb-2">
<div className="truncate-doubleline"> <div className="truncate-doubleline">
This flow creates an agent that accesses a department store database {flow.description}
and APIs to monitor customer activity and overall storage.
{/* {flow.description} */} {/* {flow.description} */}
</div> </div>
</CardDescription> </CardDescription>

View file

@ -36,8 +36,7 @@ export const CardComponent = ({ flow, id }: { flow: FlowType; id: string }) => {
</CardTitle> </CardTitle>
<CardDescription className="pt-2 pb-2"> <CardDescription className="pt-2 pb-2">
<div className="truncate-doubleline"> <div className="truncate-doubleline">
This flow creates an agent that accesses a department store database {flow.description}
and APIs to monitor customer activity and overall storage.
{/* {flow.description} */} {/* {flow.description} */}
</div> </div>
</CardDescription> </CardDescription>

View file

@ -23,6 +23,7 @@ import _ from "lodash";
import { updateFlowInDatabase, uploadFlowsToDatabase } from "../../controllers/API"; import { updateFlowInDatabase, uploadFlowsToDatabase } from "../../controllers/API";
import { MenuBar } from "../../components/headerComponent/components/menuBar"; import { MenuBar } from "../../components/headerComponent/components/menuBar";
import { CardComponent } from "./components/cardComponent"; import { CardComponent } from "./components/cardComponent";
import { useNavigate } from "react-router-dom";
export default function HomePage() { export default function HomePage() {
const { const {
flows, flows,
@ -34,6 +35,7 @@ export default function HomePage() {
useEffect(() => { useEffect(() => {
setTabId(""); setTabId("");
}, []) }, [])
const navigate = useNavigate();
return ( return (
<div <div
className="w-full h-full flex overflow-auto flex-col bg-muted px-16" className="w-full h-full flex overflow-auto flex-col bg-muted px-16"
@ -53,7 +55,9 @@ export default function HomePage() {
<Upload className="w-4 mr-2" /> <Upload className="w-4 mr-2" />
Upload Database Upload Database
</Button> </Button>
<Button variant="primary" onClick={() => {addFlow();}}> <Button variant="primary" onClick={() => {addFlow().then((id) => {
navigate("/flow/"+id);
});}}>
<Plus className="w-4 mr-2" /> <Plus className="w-4 mr-2" />
New Project New Project
</Button> </Button>