File size: 904 Bytes
a43ac26
 
 
 
 
d0c18f0
a43ac26
d0c18f0
 
a43ac26
d0c18f0
 
 
 
a43ac26
d0c18f0
 
a43ac26
 
 
 
 
d0c18f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a43ac26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
 * 插件列表组件
 */

import { PluginListItem } from '@typings/plugin';
import { PluginCard } from './PluginCard';
import { StatePanel } from '@components/console';

interface PluginListProps {
  plugins: PluginListItem[];
  onEnable: (name: string) => void;
  onDisable: (name: string) => void;
}

export function PluginList({ plugins, onEnable, onDisable }: PluginListProps) {
  if (plugins.length === 0) {
    return (
      <StatePanel
        state="empty"
        title="暂无已部署的插件"
        description="插件随部署注入,请检查部署配置"
      />
    );
  }

  return (
    <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
      {plugins.map((plugin) => (
        <PluginCard
          key={plugin.metadata.name}
          plugin={plugin}
          onEnable={onEnable}
          onDisable={onDisable}
        />
      ))}
    </div>
  );
}