Skip to content

Commit

Permalink
fix: ip list
Browse files Browse the repository at this point in the history
  • Loading branch information
Wangtaofeng committed May 17, 2024
1 parent 685f582 commit 9ec4233
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 52 deletions.
12 changes: 0 additions & 12 deletions Dashboard/services/index.tsx

This file was deleted.

15 changes: 3 additions & 12 deletions ResourceGenerator/components/ColumnWhiteList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, useEffect, useState } from "react"
import { FC } from "react"
import { useTranslation } from "react-i18next"
import { fetchWhiteListIP } from "../../service"
import { WHITE_LIST_IP } from "../../config"
import {
descriptionContainerStyle,
headerContainerStyle,
Expand All @@ -12,15 +12,6 @@ import {
export const WhiteList: FC = () => {
const { t } = useTranslation()

const [ipList, setIPList] = useState<string[]>([])

useEffect(() => {
fetchWhiteListIP().then((response) => {
const { resources } = response.data
setIPList(resources)
})
}, [])

return (
<>
<div css={headerContainerStyle}>
Expand All @@ -32,7 +23,7 @@ export const WhiteList: FC = () => {
</p>
</div>
<div css={ipListContainerStyle}>
{ipList.map((ip) => (
{WHITE_LIST_IP.map((ip) => (
<p key={ip} css={ipItemStyle}>
{ip}
</p>
Expand Down
21 changes: 5 additions & 16 deletions ResourceGenerator/components/RowWhiteList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
copyToClipboard,
isCloudVersion,
} from "@illa-public/utils"
import { FC, useCallback, useEffect, useState } from "react"
import { FC, useCallback, useState } from "react"
import { useTranslation } from "react-i18next"
import {
Card,
Expand All @@ -12,7 +12,7 @@ import {
UpIcon,
useMessage,
} from "@illa-design/react"
import { fetchWhiteListIP } from "../../service"
import { WHITE_LIST_IP } from "../../config"
import {
ipListContainerStyle,
ipListStyle,
Expand All @@ -35,25 +35,14 @@ export const WhiteList: FC<IWhiteList> = (props) => {
const { onCopyIpReport } = props

const [showIPList, setShowIPList] = useState<boolean>(false)
const [ipList, setIPList] = useState<string[]>([])

useEffect(() => {
if (!isCloudVersion) {
return
}
fetchWhiteListIP().then((response) => {
const { resources } = response.data
setIPList(resources)
})
}, [])

const handleOperationIconClick = () => {
setShowIPList((prevState) => !prevState)
}

const handleCopyClick = useCallback(() => {
onCopyIpReport && onCopyIpReport()
const copyResult = copyToClipboard(ipList.join("\n"))
const copyResult = copyToClipboard(WHITE_LIST_IP.join("\n"))
if (copyResult === COPY_STATUS.SUCCESS) {
message.success({
content: t("copied"),
Expand All @@ -63,7 +52,7 @@ export const WhiteList: FC<IWhiteList> = (props) => {
content: t("copy_failed"),
})
}
}, [ipList, message, onCopyIpReport, t])
}, [message, onCopyIpReport, t])

return (
<div>
Expand Down Expand Up @@ -95,7 +84,7 @@ export const WhiteList: FC<IWhiteList> = (props) => {
<div css={ipListContainerStyle}>
<Card>
<div css={ipListStyle}>
{ipList.map((ip) => (
{WHITE_LIST_IP.map((ip) => (
<div key={ip}>{ip}</div>
))}
</div>
Expand Down
8 changes: 8 additions & 0 deletions ResourceGenerator/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,11 @@ export const ResourceTypeList = [
category: "notFind" as const,
},
]

export const WHITE_LIST_IP = [
"143.198.75.2",
"146.190.51.14",
"146.190.35.24",
"64.23.134.60",
"146.190.59.192",
]
12 changes: 0 additions & 12 deletions ResourceGenerator/service/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { actionRequest, agentRequest } from "@illa-public/illa-net"
import { notNeedAuthRequest } from "@illa-public/illa-net"
import { Agent, ResourceContent, ResourceType } from "@illa-public/public-types"

export interface IActionTestConnectionRequestData {
Expand All @@ -21,17 +20,6 @@ export const fetchActionTestConnection = (
)
}

interface IWhiteListIPResponse {
resources: string[]
}

export const fetchWhiteListIP = async () => {
return await notNeedAuthRequest<IWhiteListIPResponse>({
url: "https://peripheral-api.illasoft.com/v1/meta",
method: "GET",
})
}

export const forkAIAgentToTeam = (teamID: string, aiAgentID: string) => {
return agentRequest<Agent>({
url: `/aiAgent/${aiAgentID}/forkTo/teams/${teamID}`,
Expand Down

0 comments on commit 9ec4233

Please sign in to comment.