MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / SystemList

Function SystemList

frontend/packages/core/src/pages/system/SystemList.tsx:20–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18import { LogsFooter } from './serviceDeployment/ServiceDeployMentFooter.tsx'
19
20const SystemList: FC = () => {
21 const navigate = useNavigate()
22 const [tableSearchWord, setTableSearchWord] = useState<string>('')
23 const { setBreadcrumb } = useBreadcrumb()
24 const [teamList, setTeamList] = useState<{ [k: string]: { text: string } }>()
25 const { fetchData } = useFetch()
26 const [tableListDataSource, setTableListDataSource] = useState<SystemTableListItem[]>([])
27 const [tableHttpReload, setTableHttpReload] = useState(true)
28 const { message, modal } = App.useApp()
29 const pageListRef = useRef<ActionType>(null)
30 const [memberValueEnum, setMemberValueEnum] = useState<{ [k: string]: { text: string } }>({})
31 const [open, setOpen] = useState(false)
32 const drawerFormRef = useRef<SystemConfigHandle>(null)
33 const { checkPermission, accessInit, getGlobalAccessData, state } = useGlobalContext()
34 const [stateColumnMap] = useState<{ [k: string]: { text: string; className?: string } }>({
35 normal: { text: '正常' },
36 deploying: { text: '部署中', className: 'text-[#2196f3]' },
37 error: { text: '异常', className: 'text-[#ff4d4f]' },
38 public: { text: '公共服务' },
39 private: { text: '私有服务' }
40 })
41 const getSystemList = () => {
42 if (!accessInit) {
43 getGlobalAccessData()?.then?.(() => {
44 getSystemList()
45 })
46 return Promise.resolve({ data: [], success: false })
47 }
48 if (!tableHttpReload) {
49 setTableHttpReload(true)
50 return Promise.resolve({
51 data: tableListDataSource,
52 success: true
53 })
54 }
55 return fetchData<BasicResponse<{ services: SystemTableListItem[] }>>(
56 !checkPermission('system.workspace.service.view_all') ? 'my_services' : 'services',
57 {
58 method: 'GET',
59 eoParams: { keyword: tableSearchWord },
60 eoTransformKeys: ['api_num', 'service_num', 'create_time']
61 }
62 )
63 .then((response) => {
64 const { code, data, msg } = response
65 if (code === STATUS_CODE.SUCCESS) {
66 setTableListDataSource(data.services)
67 setTableHttpReload(false)
68 return { data: data.services, success: true }
69 } else {
70 message.error(msg || $t(RESPONSE_TIPS.error))
71 return { data: [], success: false }
72 }
73 })
74 .catch(() => {
75 return { data: [], success: false }
76 })
77 }

Callers

nothing calls this directly

Calls 11

useBreadcrumbFunction · 0.90
useFetchFunction · 0.90
useGlobalContextFunction · 0.90
$tFunction · 0.90
findMethod · 0.80
saveMethod · 0.80
getTeamsListFunction · 0.70
getMemberListFunction · 0.70
openLogsModalFunction · 0.70
getSystemListFunction · 0.70
manualReloadTableFunction · 0.70

Tested by

no test coverage detected