mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-18 19:44:21 +00:00
feat: plugin list installed finish
This commit is contained in:
@@ -7,6 +7,8 @@ import PluginCardComponent from "@/app/home/plugins/plugin-installed/plugin-card
|
|||||||
import styles from "@/app/home/plugins/plugins.module.css";
|
import styles from "@/app/home/plugins/plugins.module.css";
|
||||||
import {Modal, Input} from "antd";
|
import {Modal, Input} from "antd";
|
||||||
import {GithubOutlined} from "@ant-design/icons";
|
import {GithubOutlined} from "@ant-design/icons";
|
||||||
|
import {httpClient} from "@/app/infra/http/HttpClient";
|
||||||
|
import * as http from "node:http";
|
||||||
|
|
||||||
export default function PluginInstalledComponent () {
|
export default function PluginInstalledComponent () {
|
||||||
const [pluginList, setPluginList] = useState<PluginCardVO[]>([])
|
const [pluginList, setPluginList] = useState<PluginCardVO[]>([])
|
||||||
@@ -19,42 +21,21 @@ export default function PluginInstalledComponent () {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
function initData() {
|
function initData() {
|
||||||
getPluginList().then((value) => {
|
getPluginList()
|
||||||
setPluginList(value)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPluginList() {
|
function getPluginList() {
|
||||||
return [
|
httpClient.getPlugins().then((value) => {
|
||||||
new PluginCardVO({
|
setPluginList(value.plugins.map(plugin => {
|
||||||
description: "一般的描述",
|
return new PluginCardVO({
|
||||||
handlerCount: 0,
|
author: plugin.author,
|
||||||
name: "插件AAA",
|
description: plugin.description.zh_CN,
|
||||||
author: "/hana",
|
handlerCount: 0,
|
||||||
version: "0.1"
|
name: plugin.name,
|
||||||
}),
|
version: plugin.version
|
||||||
new PluginCardVO({
|
})
|
||||||
description: "一般的描述",
|
}))
|
||||||
handlerCount: 0,
|
})
|
||||||
name: "插件AAA",
|
|
||||||
author: "/hana",
|
|
||||||
version: "0.1"
|
|
||||||
}),
|
|
||||||
new PluginCardVO({
|
|
||||||
description: "一般的描述",
|
|
||||||
handlerCount: 0,
|
|
||||||
name: "插件AAA",
|
|
||||||
author: "/hana",
|
|
||||||
version: "0.1"
|
|
||||||
}),
|
|
||||||
new PluginCardVO({
|
|
||||||
description: "一般的描述",
|
|
||||||
handlerCount: 0,
|
|
||||||
name: "插件AAA",
|
|
||||||
author: "/hana",
|
|
||||||
version: "0.1"
|
|
||||||
})
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleModalConfirm() {
|
function handleModalConfirm() {
|
||||||
@@ -63,8 +44,12 @@ export default function PluginInstalledComponent () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function installPlugin(url: string) {
|
function installPlugin(url: string) {
|
||||||
// TODO 接安装Plugin的接口
|
httpClient.installPluginFromGithub(url).then(res => {
|
||||||
console.log("installPlugin: ", url)
|
// 安装后重新拉取
|
||||||
|
getPluginList()
|
||||||
|
}).catch(err => {
|
||||||
|
console.log("error when install plugin:", err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.pluginListContainer}`}>
|
<div className={`${styles.pluginListContainer}`}>
|
||||||
|
|||||||
Reference in New Issue
Block a user