Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
nightingale
提交
82345bc0
N
nightingale
项目概览
DiDi
/
nightingale
11 个月 前同步成功
通知
46
Star
7053
Fork
1161
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nightingale
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82345bc0
编写于
5月 09, 2020
作者:
J
jsers
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add plugin collect page
上级
7d774562
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
161 addition
and
1 deletion
+161
-1
web/src/locales/en.ts
web/src/locales/en.ts
+6
-0
web/src/locales/zh.ts
web/src/locales/zh.ts
+6
-0
web/src/pages/Monitor/Collect/CollectForm/PLUGINForm.tsx
web/src/pages/Monitor/Collect/CollectForm/PLUGINForm.tsx
+145
-0
web/src/pages/Monitor/Collect/CollectForm/PORTForm.tsx
web/src/pages/Monitor/Collect/CollectForm/PORTForm.tsx
+1
-1
web/src/pages/Monitor/Collect/CollectForm/index.tsx
web/src/pages/Monitor/Collect/CollectForm/index.tsx
+2
-0
web/src/pages/Monitor/Collect/config.tsx
web/src/pages/Monitor/Collect/config.tsx
+1
-0
未找到文件。
web/src/locales/en.ts
浏览文件 @
82345bc0
...
...
@@ -236,6 +236,12 @@ export default {
'
collect.proc.type.name
'
:
'
Process Name
'
,
'
collect.proc.type.input.pattern.msg
'
:
'
Cannot contain Chinese
'
,
'
collect.plugin
'
:
'
Plugin
'
,
'
collect.plugin.name.placeholder
'
:
'
Description of the collection
'
,
'
collect.plugin.filepath
'
:
'
FilePath
'
,
'
collect.plugin.params
'
:
'
Params
'
,
'
collect.plugin.filepath.placeholder
'
:
'
The absolute path of the plugin
'
,
'
graph.subscribe
'
:
'
Subscribe
'
,
'
graph.subscribe.node
'
:
'
Node
'
,
'
graph.subscribe.screen
'
:
'
Screen
'
,
...
...
web/src/locales/zh.ts
浏览文件 @
82345bc0
...
...
@@ -237,6 +237,12 @@ export default {
'
collect.proc.type.name
'
:
'
进程名
'
,
'
collect.proc.type.input.pattern.msg
'
:
'
不能包含中文
'
,
'
collect.plugin
'
:
'
插件
'
,
'
collect.plugin.name.placeholder
'
:
'
对采集配置的说明
'
,
'
collect.plugin.filepath
'
:
'
文件路径
'
,
'
collect.plugin.params
'
:
'
参数
'
,
'
collect.plugin.filepath.placeholder
'
:
'
待执行插件所在的绝对路径
'
,
'
graph.subscribe
'
:
'
订阅图表
'
,
'
graph.subscribe.node
'
:
'
所属节点
'
,
'
graph.subscribe.screen
'
:
'
选择大盘
'
,
...
...
web/src/pages/Monitor/Collect/CollectForm/PLUGINForm.tsx
0 → 100644
浏览文件 @
82345bc0
import
React
,
{
useState
}
from
'
react
'
;
import
{
Link
}
from
'
react-router-dom
'
;
import
_
from
'
lodash
'
;
import
{
Button
,
Form
,
Select
,
Input
,
TreeSelect
}
from
'
antd
'
;
import
{
injectIntl
,
FormattedMessage
}
from
'
react-intl
'
;
import
{
renderTreeNodes
}
from
'
@cpts/Layout/utils
'
;
import
{
nameRule
,
interval
}
from
'
../config
'
;
const
FormItem
=
Form
.
Item
;
const
{
Option
}
=
Select
;
const
formItemLayout
=
{
labelCol
:
{
span
:
6
},
wrapperCol
:
{
span
:
14
},
};
const
defaultFormData
=
{
collect_type
:
'
plugin
'
,
timeout
:
3
,
step
:
10
,
};
const
getInitialValues
=
(
initialValues
:
any
)
=>
{
return
_
.
assignIn
({},
defaultFormData
,
_
.
cloneDeep
(
initialValues
));
}
const
CollectForm
=
(
props
:
any
)
=>
{
const
initialValues
=
getInitialValues
(
props
.
initialValues
);
const
{
getFieldProps
,
getFieldDecorator
}
=
props
.
form
;
getFieldDecorator
(
'
collect_type
'
,
{
initialValue
:
initialValues
.
collect_type
,
});
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
handleSubmit
=
(
e
:
any
)
=>
{
e
.
preventDefault
();
props
.
form
.
validateFields
((
errors
:
any
,
values
:
any
)
=>
{
if
(
errors
)
{
console
.
error
(
errors
);
return
;
}
setSubmitLoading
(
true
);
props
.
onSubmit
(
values
).
catch
(()
=>
{
setSubmitLoading
(
false
);
});
});
}
return
(
<
Form
layout
=
"horizontal"
onSubmit
=
{
handleSubmit
}
>
<
FormItem
{
...
formItemLayout
}
label
=
{
<
FormattedMessage
id
=
"collect.common.node"
/>
}
>
{
getFieldDecorator
(
'
nid
'
,
{
initialValue
:
initialValues
.
nid
,
rules
:
[{
required
:
true
}],
})(
<
TreeSelect
style
=
{
{
width
:
500
}
}
showSearch
allowClear
treeDefaultExpandAll
treeNodeFilterProp
=
"title"
treeNodeLabelProp
=
"path"
dropdownStyle
=
{
{
maxHeight
:
400
,
overflow
:
'
auto
'
}
}
>
{
renderTreeNodes
(
props
.
treeData
)
}
</
TreeSelect
>,
)
}
</
FormItem
>
<
FormItem
{
...
formItemLayout
}
label
=
{
<
FormattedMessage
id
=
"collect.common.name"
/>
}
>
<
Input
{
...
getFieldProps
(
'
name
'
,
{
initialValue
:
initialValues
.
name
,
rules
:
[
{
required
:
true
},
nameRule
,
],
})
}
size
=
"default"
style
=
{
{
width
:
500
}
}
placeholder
=
{
props
.
intl
.
formatMessage
({
id
:
'
collect.plugin.name.placeholder
'
})
}
/>
</
FormItem
>
<
FormItem
{
...
formItemLayout
}
label
=
{
<
FormattedMessage
id
=
"collect.plugin.filepath"
/>
}
>
<
Input
{
...
getFieldProps
(
'
file_path
'
,
{
initialValue
:
initialValues
.
file_path
,
rules
:
[{
required
:
true
}]
})
}
style
=
{
{
width
:
500
}
}
placeholder
=
{
props
.
intl
.
formatMessage
({
id
:
'
collect.plugin.filepath.placeholder
'
})
}
/>
</
FormItem
>
<
FormItem
{
...
formItemLayout
}
label
=
{
<
FormattedMessage
id
=
"collect.plugin.params"
/>
}
>
<
Input
{
...
getFieldProps
(
'
params
'
,
{
initialValue
:
initialValues
.
params
,
})
}
style
=
{
{
width
:
500
}
}
/>
</
FormItem
>
<
FormItem
{
...
formItemLayout
}
label
=
{
<
FormattedMessage
id
=
"collect.common.step"
/>
}
>
<
Select
size
=
"default"
style
=
{
{
width
:
100
}
}
{
...
getFieldProps
(
'
step
'
,
{
initialValue
:
initialValues
.
step
,
rules
:
[
{
required
:
true
},
],
})
}
>
{
_
.
map
(
interval
,
item
=>
<
Option
key
=
{
item
}
value
=
{
item
}
>
{
item
}
</
Option
>)
}
</
Select
>
{
<
FormattedMessage
id
=
"collect.common.step.unit"
/>
}
</
FormItem
>
<
FormItem
{
...
formItemLayout
}
label
=
{
<
FormattedMessage
id
=
"collect.common.note"
/>
}
>
<
Input
type
=
"textarea"
placeholder
=
""
{
...
getFieldProps
(
'
comment
'
,
{
initialValue
:
initialValues
.
comment
,
})
}
style
=
{
{
width
:
500
}
}
/>
</
FormItem
>
<
FormItem
wrapperCol
=
{
{
offset
:
6
}
}
style
=
{
{
marginTop
:
24
}
}
>
<
Button
type
=
"primary"
htmlType
=
"submit"
loading
=
{
submitLoading
}
>
{
<
FormattedMessage
id
=
"form.submit"
/>
}
</
Button
>
<
Button
style
=
{
{
marginLeft
:
8
}
}
>
<
Link
to
=
{
{
pathname
:
'
/collect
'
}
}
>
{
<
FormattedMessage
id
=
"form.goback"
/>
}
</
Link
>
</
Button
>
</
FormItem
>
</
Form
>
);
}
export
default
Form
.
create
()(
injectIntl
(
CollectForm
));
web/src/pages/Monitor/Collect/CollectForm/PORTForm.tsx
浏览文件 @
82345bc0
...
...
@@ -61,7 +61,7 @@ class CollectForm extends Component<Props & WrappedComponentProps> {
render
()
{
const
{
form
}
=
this
.
props
;
const
initialValues
=
this
.
getInitialValues
();
const
{
getFieldDecorator
,
getFieldProps
}
=
form
!
;
const
{
getFieldDecorator
,
getFieldProps
}
=
form
!
as
any
;
const
service
=
_
.
chain
(
initialValues
.
tags
).
split
(
'
,
'
).
filter
(
item
=>
item
.
indexOf
(
'
service=
'
)
===
0
).
head
().
split
(
'
service=
'
).
last
().
value
();
getFieldProps
(
'
collect_type
'
,
{
initialValue
:
initialValues
.
collect_type
,
...
...
web/src/pages/Monitor/Collect/CollectForm/index.tsx
浏览文件 @
82345bc0
import
LOGForm
from
'
./LOGForm
'
;
import
PORTForm
from
'
./PORTForm
'
;
import
PROCForm
from
'
./PROCForm
'
;
import
PLUGINForm
from
'
./PLUGINForm
'
;
export
default
{
log
:
LOGForm
,
port
:
PORTForm
,
proc
:
PROCForm
,
plugin
:
PLUGINForm
,
};
web/src/pages/Monitor/Collect/config.tsx
浏览文件 @
82345bc0
...
...
@@ -2,6 +2,7 @@ export const typeMap: any = {
log
:
'
日志
'
,
port
:
'
端口
'
,
proc
:
'
进程
'
,
plugin
:
'
插件
'
,
};
export
const
interval
=
[
10
,
30
,
60
,
120
,
300
,
600
,
1800
,
3600
];
export
const
nameRule
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录