mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: check status
This commit is contained in:
parent
c4d6f9e179
commit
ca9e23d6ea
|
@ -4,7 +4,7 @@ import { TaskStatus } from '../../types'
|
|||
|
||||
const INTERVAL = 10 * 1000 // 10 seconds
|
||||
|
||||
interface Params {
|
||||
type Params = {
|
||||
taskId: string
|
||||
pluginUniqueIdentifier: string
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ function checkTaskStatus() {
|
|||
pluginUniqueIdentifier,
|
||||
}: Params) => {
|
||||
if (isStop) return
|
||||
const { plugins } = await fetchCheckTaskStatus(taskId)
|
||||
const res = await fetchCheckTaskStatus(taskId)
|
||||
const { plugins } = res.task
|
||||
const plugin = plugins.find((p: PluginStatus) => p.plugin_unique_identifier === pluginUniqueIdentifier)
|
||||
if (!plugin) {
|
||||
nextStatus = TaskStatus.failed
|
||||
|
|
|
@ -37,6 +37,19 @@ const InstallPluginDropdown = ({
|
|||
}
|
||||
}
|
||||
|
||||
// TODO TEST INSTALL : uninstall
|
||||
// const [pluginLists, setPluginLists] = useState<any>([])
|
||||
// useEffect(() => {
|
||||
// (async () => {
|
||||
// const list: any = await get('workspaces/current/plugin/list')
|
||||
// })()
|
||||
// })
|
||||
|
||||
// const handleUninstall = async (id: string) => {
|
||||
// const res = await post('workspaces/current/plugin/uninstall', { body: { plugin_installation_id: id } })
|
||||
// console.log(res)
|
||||
// }
|
||||
|
||||
return (
|
||||
<PortalToFollowElem
|
||||
open={isMenuOpen}
|
||||
|
@ -110,6 +123,9 @@ const InstallPluginDropdown = ({
|
|||
/>
|
||||
)
|
||||
}
|
||||
{/* {pluginLists.map((item: any) => (
|
||||
<div key={item.id} onClick={() => handleUninstall(item.id)}>{item.name} 卸载</div>
|
||||
))} */}
|
||||
</PortalToFollowElem>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ export enum PluginSource {
|
|||
debugging = 'remote',
|
||||
}
|
||||
|
||||
export interface PluginToolDeclaration {
|
||||
export type PluginToolDeclaration = {
|
||||
identity: {
|
||||
author: string
|
||||
name: string
|
||||
|
@ -27,17 +27,17 @@ export interface PluginToolDeclaration {
|
|||
credentials_schema: ToolCredential[] // TODO
|
||||
}
|
||||
|
||||
export interface PluginEndpointDeclaration {
|
||||
export type PluginEndpointDeclaration = {
|
||||
settings: ToolCredential[]
|
||||
endpoints: EndpointItem[]
|
||||
}
|
||||
|
||||
export interface EndpointItem {
|
||||
export type EndpointItem = {
|
||||
path: string
|
||||
method: string
|
||||
}
|
||||
|
||||
export interface EndpointListItem {
|
||||
export type EndpointListItem = {
|
||||
id: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
|
@ -53,7 +53,7 @@ export interface EndpointListItem {
|
|||
}
|
||||
|
||||
// Plugin manifest
|
||||
export interface PluginDeclaration {
|
||||
export type PluginDeclaration = {
|
||||
version: string
|
||||
author: string
|
||||
icon: string
|
||||
|
@ -70,7 +70,7 @@ export interface PluginDeclaration {
|
|||
model: any // TODO
|
||||
}
|
||||
|
||||
export interface PluginDetail {
|
||||
export type PluginDetail = {
|
||||
id: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
|
@ -87,7 +87,7 @@ export interface PluginDetail {
|
|||
meta?: any
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
export type Plugin = {
|
||||
type: PluginType
|
||||
org: string
|
||||
name: string
|
||||
|
@ -113,7 +113,7 @@ export enum PermissionType {
|
|||
noOne = 'noOne',
|
||||
}
|
||||
|
||||
export interface Permissions {
|
||||
export type Permissions = {
|
||||
canManagement: PermissionType
|
||||
canDebugger: PermissionType
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ export enum InstallStepFromGitHub {
|
|||
installed = 'installed',
|
||||
}
|
||||
|
||||
export interface InstallState {
|
||||
export type InstallState = {
|
||||
step: InstallStepFromGitHub
|
||||
repoUrl: string
|
||||
selectedVersion: string
|
||||
|
@ -133,34 +133,34 @@ export interface InstallState {
|
|||
releases: GitHubRepoReleaseResponse[]
|
||||
}
|
||||
|
||||
export interface GitHubUrlInfo {
|
||||
export type GitHubUrlInfo = {
|
||||
isValid: boolean
|
||||
owner?: string
|
||||
repo?: string
|
||||
}
|
||||
|
||||
// endpoint
|
||||
export interface CreateEndpointRequest {
|
||||
export type CreateEndpointRequest = {
|
||||
plugin_unique_identifier: string
|
||||
settings: Record<string, any>
|
||||
name: string
|
||||
}
|
||||
export interface EndpointOperationResponse {
|
||||
export type EndpointOperationResponse = {
|
||||
result: 'success' | 'error'
|
||||
}
|
||||
export interface EndpointsRequest {
|
||||
export type EndpointsRequest = {
|
||||
limit: number
|
||||
page: number
|
||||
plugin_id: string
|
||||
}
|
||||
export interface EndpointsResponse {
|
||||
export type EndpointsResponse = {
|
||||
endpoints: EndpointListItem[]
|
||||
has_more: boolean
|
||||
limit: number
|
||||
total: number
|
||||
page: number
|
||||
}
|
||||
export interface UpdateEndpointRequest {
|
||||
export type UpdateEndpointRequest = {
|
||||
endpoint_id: string
|
||||
settings: Record<string, any>
|
||||
name: string
|
||||
|
@ -175,24 +175,24 @@ export enum InstallStep {
|
|||
installFailed = 'failed',
|
||||
}
|
||||
|
||||
export interface GitHubAsset {
|
||||
export type GitHubAsset = {
|
||||
id: number
|
||||
name: string
|
||||
browser_download_url: string
|
||||
}
|
||||
|
||||
export interface GitHubRepoReleaseResponse {
|
||||
export type GitHubRepoReleaseResponse = {
|
||||
tag_name: string
|
||||
assets: GitHubAsset[]
|
||||
}
|
||||
|
||||
export interface InstallPackageResponse {
|
||||
export type InstallPackageResponse = {
|
||||
plugin_unique_identifier: string
|
||||
all_installed: boolean
|
||||
task_id: string
|
||||
}
|
||||
|
||||
export interface DebugInfo {
|
||||
export type DebugInfo = {
|
||||
key: string
|
||||
host: string
|
||||
port: number
|
||||
|
@ -204,14 +204,15 @@ export enum TaskStatus {
|
|||
failed = 'failed',
|
||||
}
|
||||
|
||||
export interface PluginStatus {
|
||||
export type PluginStatus = {
|
||||
plugin_unique_identifier: string
|
||||
plugin_id: string
|
||||
status: TaskStatus
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface TaskStatusResponse {
|
||||
export type TaskStatusResponse = {
|
||||
task: {
|
||||
id: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
|
@ -220,3 +221,4 @@ export interface TaskStatusResponse {
|
|||
completed_plugins: number
|
||||
plugins: PluginStatus[]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user