mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-15 15:00:58 +00:00
feat: fetch pipelines
This commit is contained in:
@@ -1,21 +1,25 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import {Modal} from "antd";
|
import {Modal} from "antd";
|
||||||
import {useState} from "react";
|
import {useState, useEffect} from "react";
|
||||||
import CreateCardComponent from "@/app/infra/basic-component/create-card-component/CreateCardComponent";
|
import CreateCardComponent from "@/app/infra/basic-component/create-card-component/CreateCardComponent";
|
||||||
import PipelineFormComponent from "./components/pipeline-form/PipelineFormComponent";
|
import PipelineFormComponent from "./components/pipeline-form/PipelineFormComponent";
|
||||||
import {httpClient} from "@/app/infra/http/HttpClient";
|
import {httpClient} from "@/app/infra/http/HttpClient";
|
||||||
import {PipelineCardVO} from "@/app/home/pipelines/components/pipeline-card/PipelineCardVO";
|
import {PipelineCardVO} from "@/app/home/pipelines/components/pipeline-card/PipelineCardVO";
|
||||||
|
import PipelineCardComponent from "@/app/home/pipelines/components/pipeline-card/PipelineCardComponent";
|
||||||
|
|
||||||
export default function PluginConfigPage() {
|
export default function PluginConfigPage() {
|
||||||
const [modalOpen, setModalOpen] = useState<boolean>(false);
|
const [modalOpen, setModalOpen] = useState<boolean>(false);
|
||||||
const [isEditForm, setIsEditForm] = useState(false)
|
const [isEditForm, setIsEditForm] = useState(false)
|
||||||
const [pipelineList, setPipelineList] = useState([])
|
const [pipelineList, setPipelineList] = useState<PipelineCardVO[]>([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getPipelines()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
function getPipelines() {
|
function getPipelines() {
|
||||||
httpClient.getPipelines().then(value => {
|
httpClient.getPipelines().then(value => {
|
||||||
value.pipelines.map(pipeline => {
|
const pipelineList = value.pipelines.map(pipeline => {
|
||||||
return new PipelineCardVO({
|
return new PipelineCardVO({
|
||||||
createTime: pipeline.created_at,
|
createTime: pipeline.created_at,
|
||||||
description: pipeline.description,
|
description: pipeline.description,
|
||||||
@@ -24,6 +28,7 @@ export default function PluginConfigPage() {
|
|||||||
version: pipeline.for_version
|
version: pipeline.for_version
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
setPipelineList(pipelineList)
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
// TODO toast
|
// TODO toast
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@@ -49,6 +54,14 @@ export default function PluginConfigPage() {
|
|||||||
onCancel={() => {}}/>
|
onCancel={() => {}}/>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
{
|
||||||
|
pipelineList.length > 0 &&
|
||||||
|
<div className={``}>
|
||||||
|
{pipelineList.map(pipeline => {
|
||||||
|
return <PipelineCardComponent cardVO={pipeline}/>
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<CreateCardComponent width={360} height={200} plusSize={90} onClick={() => {setModalOpen(true)}}/>
|
<CreateCardComponent width={360} height={200} plusSize={90} onClick={() => {setModalOpen(true)}}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user