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> => {
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.
const newFlow = createNewFlow(flowData, flow);

View file

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

View file

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

View file

@ -23,6 +23,7 @@ import _ from "lodash";
import { updateFlowInDatabase, uploadFlowsToDatabase } from "../../controllers/API";
import { MenuBar } from "../../components/headerComponent/components/menuBar";
import { CardComponent } from "./components/cardComponent";
import { useNavigate } from "react-router-dom";
export default function HomePage() {
const {
flows,
@ -34,6 +35,7 @@ export default function HomePage() {
useEffect(() => {
setTabId("");
}, [])
const navigate = useNavigate();
return (
<div
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 Database
</Button>
<Button variant="primary" onClick={() => {addFlow();}}>
<Button variant="primary" onClick={() => {addFlow().then((id) => {
navigate("/flow/"+id);
});}}>
<Plus className="w-4 mr-2" />
New Project
</Button>