Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
f4d3e951
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f4d3e951
编写于
5月 29, 2020
作者:
Q
q4speed
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.增加URL验证
2.URL不填不能保存或运行
上级
e403e7bc
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
49 addition
and
15 deletion
+49
-15
frontend/src/business/components/api/test/ApiTestConfig.vue
frontend/src/business/components/api/test/ApiTestConfig.vue
+2
-2
frontend/src/business/components/api/test/components/ApiRequestForm.vue
...usiness/components/api/test/components/ApiRequestForm.vue
+24
-11
frontend/src/business/components/api/test/model/ScenarioModel.js
...d/src/business/components/api/test/model/ScenarioModel.js
+18
-0
frontend/src/common/js/message.js
frontend/src/common/js/message.js
+2
-2
frontend/src/i18n/en-US.js
frontend/src/i18n/en-US.js
+1
-0
frontend/src/i18n/zh-CN.js
frontend/src/i18n/zh-CN.js
+1
-0
frontend/src/i18n/zh-TW.js
frontend/src/i18n/zh-TW.js
+1
-0
未找到文件。
frontend/src/business/components/api/test/ApiTestConfig.vue
浏览文件 @
f4d3e951
...
...
@@ -200,10 +200,10 @@
computed
:
{
isShowRun
()
{
return
this
.
test
.
projectId
&&
this
.
test
.
name
&&
!
this
.
change
;
return
this
.
test
.
isValid
()
&&
!
this
.
change
;
},
isDisabled
()
{
return
!
(
this
.
test
.
projectId
&&
this
.
test
.
name
&&
this
.
change
)
return
!
(
this
.
test
.
isValid
()
&&
this
.
change
)
}
},
...
...
frontend/src/business/components/api/test/components/ApiRequestForm.vue
浏览文件 @
f4d3e951
...
...
@@ -56,6 +56,13 @@
},
data
()
{
let
validateURL
=
(
rule
,
value
,
callback
)
=>
{
try
{
new
URL
(
this
.
addProtocol
(
this
.
request
.
url
));
}
catch
(
e
)
{
callback
(
this
.
$t
(
'
api_test.request.url_invalid
'
));
}
};
return
{
activeName
:
"
parameters
"
,
rules
:
{
...
...
@@ -63,7 +70,8 @@
{
max
:
100
,
message
:
this
.
$t
(
'
commons.input_limit
'
,
[
0
,
100
]),
trigger
:
'
blur
'
}
],
url
:
[
{
max
:
100
,
message
:
this
.
$t
(
'
commons.input_limit
'
,
[
0
,
100
]),
trigger
:
'
blur
'
}
{
max
:
100
,
required
:
true
,
message
:
this
.
$t
(
'
commons.input_limit
'
,
[
0
,
100
]),
trigger
:
'
blur
'
},
{
validator
:
validateURL
,
trigger
:
'
blur
'
}
]
}
}
...
...
@@ -74,16 +82,21 @@
if
(
!
this
.
request
.
url
)
return
;
let
parameters
=
[];
let
url
=
new
URL
(
this
.
addProtocol
(
this
.
request
.
url
));
url
.
searchParams
.
forEach
((
value
,
key
)
=>
{
if
(
key
&&
value
)
{
parameters
.
push
(
new
KeyValue
(
key
,
value
));
}
});
// 添加一个空的,用于填写
parameters
.
push
(
new
KeyValue
());
this
.
request
.
parameters
=
parameters
;
this
.
request
.
url
=
url
.
toString
();
try
{
let
url
=
new
URL
(
this
.
addProtocol
(
this
.
request
.
url
));
url
.
searchParams
.
forEach
((
value
,
key
)
=>
{
if
(
key
&&
value
)
{
parameters
.
push
(
new
KeyValue
(
key
,
value
));
}
});
// 添加一个空的,用于填写
parameters
.
push
(
new
KeyValue
());
this
.
request
.
parameters
=
parameters
;
this
.
request
.
url
=
url
.
toString
();
}
catch
(
e
)
{
this
.
$error
(
this
.
$t
(
'
api_test.request.url_invalid
'
),
2000
)
}
},
methodChange
(
value
)
{
if
(
value
===
'
GET
'
&&
this
.
activeName
===
'
body
'
)
{
...
...
frontend/src/business/components/api/test/model/ScenarioModel.js
浏览文件 @
f4d3e951
...
...
@@ -110,6 +110,15 @@ export class Test extends BaseConfig {
return
options
;
}
isValid
()
{
for
(
let
i
=
0
;
i
<
this
.
scenarioDefinition
.
length
;
i
++
)
{
if
(
this
.
scenarioDefinition
[
i
].
isValid
())
{
return
this
.
projectId
&&
this
.
name
;
}
}
return
false
;
}
toJMX
()
{
return
{
name
:
this
.
name
+
'
.jmx
'
,
...
...
@@ -140,6 +149,15 @@ export class Scenario extends BaseConfig {
clone
()
{
return
new
Scenario
(
this
);
}
isValid
()
{
for
(
let
i
=
0
;
i
<
this
.
requests
.
length
;
i
++
)
{
if
(
this
.
requests
[
i
].
isValid
())
{
return
true
;
}
}
return
false
;
}
}
export
class
Request
extends
BaseConfig
{
...
...
frontend/src/common/js/message.js
浏览文件 @
f4d3e951
...
...
@@ -34,12 +34,12 @@ export default {
})
};
Vue
.
prototype
.
$error
=
function
(
message
)
{
Vue
.
prototype
.
$error
=
function
(
message
,
duration
)
{
Message
.
error
({
message
:
message
,
type
:
"
error
"
,
showClose
:
true
,
duration
:
10000
duration
:
duration
||
10000
})
};
...
...
frontend/src/i18n/en-US.js
浏览文件 @
f4d3e951
...
...
@@ -276,6 +276,7 @@ export default {
name
:
"
Scenario Name
"
,
base_url
:
"
Base URL
"
,
base_url_description
:
"
Base URL as URL prefix for all requests
"
,
url_invalid
:
"
Invalid URL
"
,
variables
:
"
Variables
"
,
headers
:
"
Headers
"
,
kv_description
:
"
Variables are available for all requests
"
,
...
...
frontend/src/i18n/zh-CN.js
浏览文件 @
f4d3e951
...
...
@@ -287,6 +287,7 @@ export default {
method
:
"
请求方法
"
,
url
:
"
请求URL
"
,
url_description
:
"
例如: https://fit2cloud.com
"
,
url_invalid
:
"
URL无效
"
,
parameters
:
"
请求参数
"
,
parameters_desc
:
"
参数追加到URL,例如https://fit2cloud.com/entries?key1=Value1&Key2=Value2
"
,
headers
:
"
请求头
"
,
...
...
frontend/src/i18n/zh-TW.js
浏览文件 @
f4d3e951
...
...
@@ -289,6 +289,7 @@ export default {
method
:
"
請求方法
"
,
url
:
"
請求URL
"
,
url_description
:
"
例如:https://fit2cloud.com
"
,
url_invalid
:
"
URL無效
"
,
parameters
:
"
請求參數
"
,
parameters_desc
:
"
參數追加到URL,例如https://fit2cloud.com/entries?key1=Value1&Key2=Value2
"
,
headers
:
"
請求頭
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录