diff --git a/sysom_web/public/resource/diagnose/v1/cpu/loadtask.json b/sysom_web/public/resource/diagnose/v1/cpu/loadtask.json index c9a98a99e9a8034514c6a10b2441b542d80948bc..7d4fd02f8597fb36088a0a55a71f0bcb1b13b9d2 100644 --- a/sysom_web/public/resource/diagnose/v1/cpu/loadtask.json +++ b/sysom_web/public/resource/diagnose/v1/cpu/loadtask.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/cpu/schedmoni.json b/sysom_web/public/resource/diagnose/v1/cpu/schedmoni.json index 4f8d198c038c9f0efce6889a2a623d4af7a3bea1..9ea76e476ee4468729fc74b93dcd93183d3ba301 100644 --- a/sysom_web/public/resource/diagnose/v1/cpu/schedmoni.json +++ b/sysom_web/public/resource/diagnose/v1/cpu/schedmoni.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/cpu/taskprofile.json b/sysom_web/public/resource/diagnose/v1/cpu/taskprofile.json index 09b693a0e1d586dcc5440a17d5984ae972ba4bd8..48c259cf803d8464f2d29c662bd169f02adf38e6 100644 --- a/sysom_web/public/resource/diagnose/v1/cpu/taskprofile.json +++ b/sysom_web/public/resource/diagnose/v1/cpu/taskprofile.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/custom/command.json b/sysom_web/public/resource/diagnose/v1/custom/command.json index 686a081c527f57923f50bddc45ec556a28bf79f8..76503843f8af7b1304943002aaec3a8d775bf79d 100644 --- a/sysom_web/public/resource/diagnose/v1/custom/command.json +++ b/sysom_web/public/resource/diagnose/v1/custom/command.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/memory/filecache.json b/sysom_web/public/resource/diagnose/v1/memory/filecache.json index c4dcb61b9f52ef75ff7cd8fd512571564ba29a11..6462917dfd513d11a9569abb456d6e1fc3b23216 100644 --- a/sysom_web/public/resource/diagnose/v1/memory/filecache.json +++ b/sysom_web/public/resource/diagnose/v1/memory/filecache.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/memory/memgraph.json b/sysom_web/public/resource/diagnose/v1/memory/memgraph.json index 1c244eccecfad4cc0b99c0cfa3648de92e997094..83a28d31edc2686dbce233957f29dd58de495986 100644 --- a/sysom_web/public/resource/diagnose/v1/memory/memgraph.json +++ b/sysom_web/public/resource/diagnose/v1/memory/memgraph.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/memory/oomcheck.json b/sysom_web/public/resource/diagnose/v1/memory/oomcheck.json index 054b24d6fde948cd1ab744e7113ccf44bba0346f..3ba2c89d336e1c45cb72cb4c583b9588b6a50001 100644 --- a/sysom_web/public/resource/diagnose/v1/memory/oomcheck.json +++ b/sysom_web/public/resource/diagnose/v1/memory/oomcheck.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/net/jitter.json b/sysom_web/public/resource/diagnose/v1/net/jitter.json index c49586923b5c0ad2d3f4607090e2cb3da7853d1a..e0fe9503cf6ebca7a56c0f69b0aa3c5172a20754 100644 --- a/sysom_web/public/resource/diagnose/v1/net/jitter.json +++ b/sysom_web/public/resource/diagnose/v1/net/jitter.json @@ -3,7 +3,7 @@ "version": 1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/net/packetdrop.json b/sysom_web/public/resource/diagnose/v1/net/packetdrop.json index 546c9a4e6c94f26b6369cadd0a03ae223cbc0876..eaac1155a5e71e15287013e7cac94c9e30500289 100644 --- a/sysom_web/public/resource/diagnose/v1/net/packetdrop.json +++ b/sysom_web/public/resource/diagnose/v1/net/packetdrop.json @@ -3,7 +3,7 @@ "version": 1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/net/pingtrace.json b/sysom_web/public/resource/diagnose/v1/net/pingtrace.json index abc614a065e306ea2170f3a143fd2440b0f7c617..d1336128bc9e4f361924af568b6a6684a4387924 100644 --- a/sysom_web/public/resource/diagnose/v1/net/pingtrace.json +++ b/sysom_web/public/resource/diagnose/v1/net/pingtrace.json @@ -3,7 +3,7 @@ "version": 1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "origin_instance", "initialValue": "", "label": "源实例ip", diff --git a/sysom_web/public/resource/diagnose/v1/net/retran.json b/sysom_web/public/resource/diagnose/v1/net/retran.json index 3d0d5244bcfec90440910d4654e9050e9a1a7028..31206f18bf54a6b1b3d86429e666fe3d1d4042ab 100644 --- a/sysom_web/public/resource/diagnose/v1/net/retran.json +++ b/sysom_web/public/resource/diagnose/v1/net/retran.json @@ -3,7 +3,7 @@ "version": 1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/storage/iofsstat.json b/sysom_web/public/resource/diagnose/v1/storage/iofsstat.json index f6d3fbb4e7ca9bf513e7bc26967ce5e3fa082a92..f63b8000c7261059faa67af7d870c2371496feed 100644 --- a/sysom_web/public/resource/diagnose/v1/storage/iofsstat.json +++ b/sysom_web/public/resource/diagnose/v1/storage/iofsstat.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/storage/iohang.json b/sysom_web/public/resource/diagnose/v1/storage/iohang.json index 5a718ea211de7c29757df2795c194cb4e389dcc3..cafec68a5db58e990516d0d11fad3d8c0ab0f3c5 100644 --- a/sysom_web/public/resource/diagnose/v1/storage/iohang.json +++ b/sysom_web/public/resource/diagnose/v1/storage/iohang.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/public/resource/diagnose/v1/storage/iolatency.json b/sysom_web/public/resource/diagnose/v1/storage/iolatency.json index b57a55a95025510020899e54aebccbc7f9c8569f..df3d060fc68a8525953e7e4ed3661e84e108fac8 100644 --- a/sysom_web/public/resource/diagnose/v1/storage/iolatency.json +++ b/sysom_web/public/resource/diagnose/v1/storage/iolatency.json @@ -3,7 +3,7 @@ "version":1.0, "taskform": [ { - "type": "text", + "type": "select_host", "name": "instance", "initialValue": "", "label": "实例IP", diff --git a/sysom_web/src/pages/diagnose/components/TaskForm.jsx b/sysom_web/src/pages/diagnose/components/TaskForm.jsx index bd19b26dbd5485a14d6f56732c58b735f85503d4..53f002333595eb2ca0ada41191e1905d640edf7e 100644 --- a/sysom_web/src/pages/diagnose/components/TaskForm.jsx +++ b/sysom_web/src/pages/diagnose/components/TaskForm.jsx @@ -2,30 +2,13 @@ import ProForm, { ProFormDigit, ProFormText, ProFormSelect } from '@ant-design/p import { Button } from 'antd'; import ProCard from '@ant-design/pro-card'; import { useRequest, FormattedMessage, useIntl } from 'umi'; -import { useState, useEffect } from 'react'; import { postTask, queryHost } from '../service'; const TaskFrom = (props) => { const taskForm = props.taskForm const serviceName = props.serviceName - const [hostList,setHostList] = useState([]); const intl = useIntl(); - useEffect(()=>{ - getHost(); - },[]); - - const getHost = async () => { - const {data} = await queryHost(); - let arr = []; - if(data?.length > 0){ - data.forEach((i)=>{ - arr.push({label: i.ip,value: i.ip}) - }) - } - setHostList(arr); - } - const { loading, error, run } = useRequest(postTask, { manual: true, @@ -37,7 +20,10 @@ const TaskFrom = (props) => { return ( { run(values) }} + onFinish={async (values) => { + values.instance = values.instance[0] + run(values) + }} submitter={{ submitButtonProps: { style: { display: 'none' } }, resetButtonProps: { style: { display: 'none' } } @@ -84,11 +70,24 @@ const TaskFrom = (props) => { return (< ProFormSelect name={formItem.name} label={formItem.label} - initialValue={formItem.initialValue} tooltip={formItem.tooltips} width="sm" - options={hostList} placeholder="请选择实例IP" + mode='tags' + request={async ({ keyWords = '' }) => { + const { data } = await queryHost() + let hostArr = [] + data.map((item)=> { + hostArr.push({label: item.ip, value: item.ip}) + }) + return hostArr.filter(({ value, label }) => { + return value.includes(keyWords) || label.includes(keyWords); + }); + }} + rules={[ + { required: true, message: 'Please input your instance!' }, + { pattern: /^((25[0-5]|2[0-4]\d|[01]?\d\d?)($|(?!\.$)\.)){4}$/, message: "Please input correct IP"} + ]} />) } diff --git a/sysom_web/src/pages/diagnose/oscheck/osCheckTaskForm.jsx b/sysom_web/src/pages/diagnose/oscheck/osCheckTaskForm.jsx index 1b18f9385ef8e092e7d33f88b823486c5764aa90..24b209026fce10271002597c9d9398b9abe62cde 100644 --- a/sysom_web/src/pages/diagnose/oscheck/osCheckTaskForm.jsx +++ b/sysom_web/src/pages/diagnose/oscheck/osCheckTaskForm.jsx @@ -1,11 +1,13 @@ -import ProForm, { ProFormText, } from '@ant-design/pro-form'; +import ProForm, { ProFormText, ProFormSelect } from '@ant-design/pro-form'; import { Button } from 'antd'; import { useRequest, useIntl, FormattedMessage } from 'umi'; import ProCard from '@ant-design/pro-card'; import { postTask } from '../service' +import { getHost } from '@/pages/host/service' export default (props) => { const intl = useIntl(); + const { loading, error, run } = useRequest(postTask, { manual: true, onSuccess: (result, params) => { @@ -13,11 +15,13 @@ export default (props) => { }, }); + return ( { + values.instance = values.instance[0] run(values) }} submitter={{ @@ -41,13 +45,28 @@ export default (props) => { hidden={true} /> - { + const { data } = await getHost() + let hostArr = [] + data.map((item)=> { + hostArr.push({label: item.ip, value: item.ip}) + }) + return hostArr.filter(({ value, label }) => { + return value.includes(keyWords) || label.includes(keyWords); + }); + }} + rules={[ + { required: true, message: 'Please input your instance!' }, + { pattern: /^((25[0-5]|2[0-4]\d|[01]?\d\d?)($|(?!\.$)\.)){4}$/, message: "Please input correct IP"} + ]} />