Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apaas-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gzga-jzapi
apaas-ui
Commits
223cb2d2
Commit
223cb2d2
authored
Jul 08, 2020
by
张俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用调试
parent
c9d95096
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
358 additions
and
175 deletions
+358
-175
src/assets/imgs/btn_front_page.png
src/assets/imgs/btn_front_page.png
+0
-0
src/assets/imgs/btn_front_page_dis.png
src/assets/imgs/btn_front_page_dis.png
+0
-0
src/assets/imgs/btn_last_page.png
src/assets/imgs/btn_last_page.png
+0
-0
src/assets/imgs/btn_last_page_dis.png
src/assets/imgs/btn_last_page_dis.png
+0
-0
src/assets/imgs/btn_next_page.png
src/assets/imgs/btn_next_page.png
+0
-0
src/assets/imgs/btn_next_page_dis.png
src/assets/imgs/btn_next_page_dis.png
+0
-0
src/assets/imgs/btn_previous_page.png
src/assets/imgs/btn_previous_page.png
+0
-0
src/assets/imgs/btn_previous_page_dis.png
src/assets/imgs/btn_previous_page_dis.png
+0
-0
src/components/apass-dialog.vue
src/components/apass-dialog.vue
+1
-1
src/components/service-header.vue
src/components/service-header.vue
+1
-2
src/pages/workbench/fwgl/approval_service_detail.vue
src/pages/workbench/fwgl/approval_service_detail.vue
+0
-1
src/pages/workbench/yygl/app_debugger.vue
src/pages/workbench/yygl/app_debugger.vue
+18
-16
src/pages/workbench/yygl/app_debugger_detail.vue
src/pages/workbench/yygl/app_debugger_detail.vue
+331
-155
src/services/helper.js
src/services/helper.js
+7
-0
No files found.
src/assets/imgs/btn_front_page.png
0 → 100644
View file @
223cb2d2
1.03 KB
src/assets/imgs/btn_front_page_dis.png
0 → 100644
View file @
223cb2d2
1.03 KB
src/assets/imgs/btn_last_page.png
0 → 100644
View file @
223cb2d2
1.03 KB
src/assets/imgs/btn_last_page_dis.png
0 → 100644
View file @
223cb2d2
1.03 KB
src/assets/imgs/btn_next_page.png
0 → 100644
View file @
223cb2d2
1.01 KB
src/assets/imgs/btn_next_page_dis.png
0 → 100644
View file @
223cb2d2
1.01 KB
src/assets/imgs/btn_previous_page.png
0 → 100644
View file @
223cb2d2
1.01 KB
src/assets/imgs/btn_previous_page_dis.png
0 → 100644
View file @
223cb2d2
1.01 KB
src/components/apass-dialog.vue
View file @
223cb2d2
...
@@ -72,7 +72,7 @@ export default {
...
@@ -72,7 +72,7 @@ export default {
default
:
()
=>
false
,
default
:
()
=>
false
,
},
},
submit
:
{
submit
:
{
type
:
Function
,
type
:
[
Function
,
String
]
,
default
:
()
=>
null
,
default
:
()
=>
null
,
},
},
},
},
...
...
src/components/service-header.vue
View file @
223cb2d2
...
@@ -93,7 +93,6 @@ export default {
...
@@ -93,7 +93,6 @@ export default {
mounted
()
{},
mounted
()
{},
methods
:
{
methods
:
{
subevent
(
val
){
subevent
(
val
){
debugger
if
(
val
==
0
){
if
(
val
==
0
){
// this.$emit('deploy',this.data)
// this.$emit('deploy',this.data)
this
.
$router
.
push
(
`/yygl/
${
this
.
$route
.
params
.
level
}
/
${
this
.
$route
.
params
.
type
}
/deployment/
${
this
.
$route
.
params
.
id
}
`
)
this
.
$router
.
push
(
`/yygl/
${
this
.
$route
.
params
.
level
}
/
${
this
.
$route
.
params
.
type
}
/deployment/
${
this
.
$route
.
params
.
id
}
`
)
...
...
src/pages/workbench/fwgl/approval_service_detail.vue
View file @
223cb2d2
...
@@ -352,7 +352,6 @@ export default {
...
@@ -352,7 +352,6 @@ export default {
this
.
$set
(
this
.
list_arr
[
5
],
"
info
"
,
data
.
service_apply_info
.
business_url
);
this
.
$set
(
this
.
list_arr
[
5
],
"
info
"
,
data
.
service_apply_info
.
business_url
);
this
.
$set
(
this
.
list_arr
[
6
],
"
info
"
,
data
.
service_apply_info
.
apply_file
.
split
(
'
/
'
)[
data
.
service_apply_info
.
apply_file
.
split
(
'
/
'
).
length
-
1
]);
this
.
$set
(
this
.
list_arr
[
6
],
"
info
"
,
data
.
service_apply_info
.
apply_file
.
split
(
'
/
'
)[
data
.
service_apply_info
.
apply_file
.
split
(
'
/
'
).
length
-
1
]);
this
.
$set
(
this
.
list_arr
[
6
],
"
url
"
,
data
.
service_apply_info
.
apply_file
);
this
.
$set
(
this
.
list_arr
[
6
],
"
url
"
,
data
.
service_apply_info
.
apply_file
);
debugger
this
.
$set
(
this
.
list_arr
[
8
],
"
info
"
,
data
.
service_apply_info
.
duration
+
(
data
.
service_apply_info
.
duration_unit
==
1
?
'
月
'
:
'
年
'
));
this
.
$set
(
this
.
list_arr
[
8
],
"
info
"
,
data
.
service_apply_info
.
duration
+
(
data
.
service_apply_info
.
duration_unit
==
1
?
'
月
'
:
'
年
'
));
this
.
$set
(
this
.
list_arr
[
9
],
"
info
"
,
"
访问次数:
"
+
data
.
service_apply_info
.
request_spcs
.
pv
+
"
/日 访问量:
"
+
data
.
service_apply_info
.
request_spcs
.
count
+
"
/日
"
);
this
.
$set
(
this
.
list_arr
[
9
],
"
info
"
,
"
访问次数:
"
+
data
.
service_apply_info
.
request_spcs
.
pv
+
"
/日 访问量:
"
+
data
.
service_apply_info
.
request_spcs
.
count
+
"
/日
"
);
this
.
id
=
data
.
service_apply_info
.
id
this
.
id
=
data
.
service_apply_info
.
id
...
...
src/pages/workbench/yygl/app_debugger.vue
View file @
223cb2d2
...
@@ -53,7 +53,8 @@
...
@@ -53,7 +53,8 @@
<div
class=
"tips"
>
<div
class=
"tips"
>
<i
class=
"el-icon-warning-outline"
></i><span>
此操作相当于:kubectl apply -f
{{
'
<
'
+
'
spec.yaml
'
+
'
>
'
}}
</span>
<i
class=
"el-icon-warning-outline"
></i><span>
此操作相当于:kubectl apply -f
{{
'
<
'
+
'
spec.yaml
'
+
'
>
'
}}
</span>
</div>
</div>
<v-apaas-code
:datas=
"code_arr"
></v-apaas-code>
<v-apaas-code
:datas=
"code_arr"
v-show=
"now_yaml==1"
></v-apaas-code>
<v-apaas-code
:datas=
"yaml_arr"
v-show=
"now_yaml==0"
></v-apaas-code>
</div>
</div>
</div>
</div>
...
@@ -93,6 +94,7 @@ export default {
...
@@ -93,6 +94,7 @@ export default {
now_yaml
:
0
,
now_yaml
:
0
,
pod_name
:
''
,
pod_name
:
''
,
code_arr
:
''
,
code_arr
:
''
,
yaml_arr
:
''
,
area_arr
:[],
area_arr
:[],
app_arr
:[],
app_arr
:[],
tableData
:[],
tableData
:[],
...
@@ -126,14 +128,12 @@ export default {
...
@@ -126,14 +128,12 @@ export default {
{
{
prop
:
"
name
"
,
prop
:
"
name
"
,
label
:
"
名称
"
,
label
:
"
名称
"
,
minWidth
:
"
40%
"
,
align
:
"
left
"
,
align
:
"
left
"
,
type
:
"
button
"
type
:
"
button
"
},
},
{
{
prop
:
"
tag
"
,
prop
:
"
tag
"
,
label
:
"
标签
"
,
label
:
"
标签
"
,
minWidth
:
"
60%
"
,
align
:
"
left
"
,
align
:
"
left
"
,
type
:
"
tag
"
,
type
:
"
tag
"
,
},
},
...
@@ -206,13 +206,6 @@ export default {
...
@@ -206,13 +206,6 @@ export default {
methods
:
{
methods
:
{
changyaml
(
n
){
changyaml
(
n
){
this
.
now_yaml
=
n
this
.
now_yaml
=
n
if
(
n
==
0
){
this
.
code_arr
=
yaml
.
stringify
(
this
.
code_arr
)
}
else
{
console
.
log
(
json
.
load
(
this
.
code_arr
));
console
.
log
(
JSON
.
stringify
(
json
.
load
(
this
.
code_arr
),
null
,
2
));
this
.
code_arr
=
JSON
.
stringify
(
json
.
load
(
this
.
code_arr
),
null
,
2
);
}
},
},
get_namespace_list
(){
get_namespace_list
(){
this
.
$http
this
.
$http
...
@@ -232,11 +225,20 @@ export default {
...
@@ -232,11 +225,20 @@ export default {
}
}
})
})
},
},
gotopage
(){
gotopage
(
val
){
this
.
$router
.
push
(
`/yygl/
${
this
.
$route
.
params
.
level
}
/
${
this
.
$route
.
params
.
type
}
/appdebuggerdetail/
${
this
.
$route
.
params
.
deploy_id
}
?content=0`
)
this
.
$http
.
get
(
`/awecloud/rest/kubernetes/api/v1/_raw/pod/namespace/
${
val
.
namespace
}
/name/
${
val
.
name
}
`
)
.
then
(
response
=>
{
this
.
$router
.
push
(
`/yygl/
${
this
.
$route
.
params
.
level
}
/
${
this
.
$route
.
params
.
type
}
/appdebuggerdetail/
${
this
.
$route
.
params
.
deploy_id
}
?content=0&namespace=
${
val
.
namespace
}
&name=
${
val
.
name
}
&container=
${
response
.
data
.
spec
.
containers
[
0
].
name
}
`
)
})
},
},
gotopage1
(){
gotopage1
(
val
){
this
.
$router
.
push
(
`/yygl/
${
this
.
$route
.
params
.
level
}
/
${
this
.
$route
.
params
.
type
}
/appdebuggerdetail/
${
this
.
$route
.
params
.
deploy_id
}
?content=1`
)
this
.
$http
.
get
(
`/awecloud/rest/kubernetes/api/v1/_raw/pod/namespace/
${
val
.
namespace
}
/name/
${
val
.
name
}
`
)
.
then
(
response
=>
{
this
.
$router
.
push
(
`/yygl/
${
this
.
$route
.
params
.
level
}
/
${
this
.
$route
.
params
.
type
}
/appdebuggerdetail/
${
this
.
$route
.
params
.
deploy_id
}
?content=1&namespace=
${
val
.
namespace
}
&name=
${
val
.
name
}
&container=
${
response
.
data
.
spec
.
containers
[
0
].
name
}
`
)
})
},
},
get_list_pod
(){
get_list_pod
(){
this
.
$http
this
.
$http
...
@@ -301,8 +303,8 @@ export default {
...
@@ -301,8 +303,8 @@ export default {
.
get
(
`/awecloud/rest/kubernetes/api/v1/_raw/pod/namespace/
${
val
.
namespace
}
/name/
${
val
.
name
}
`
)
.
get
(
`/awecloud/rest/kubernetes/api/v1/_raw/pod/namespace/
${
val
.
namespace
}
/name/
${
val
.
name
}
`
)
.
then
(
response
=>
{
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
console
.
log
(
response
.
data
);
debugger
this
.
yaml_arr
=
yaml
.
stringify
(
response
.
data
)
this
.
code_arr
=
yaml
.
stringify
(
response
.
data
)
this
.
code_arr
=
JSON
.
stringify
(
json
.
load
(
this
.
yaml_arr
),
null
,
2
);
this
.
$refs
.
actiondialog
.
show
();
this
.
$refs
.
actiondialog
.
show
();
})
})
...
...
src/pages/workbench/yygl/app_debugger_detail.vue
View file @
223cb2d2
...
@@ -10,10 +10,10 @@
...
@@ -10,10 +10,10 @@
<span>
{{
$route
.
query
.
content
==
1
?
"
命令行
"
:
"
容器日志
"
}}
</span>
<span>
{{
$route
.
query
.
content
==
1
?
"
命令行
"
:
"
容器日志
"
}}
</span>
<el-select
v-model=
"pod"
placeholder=
"请选择"
>
<el-select
v-model=
"pod"
placeholder=
"请选择"
>
<el-option
<el-option
v-for=
"
item
in pod_arr"
v-for=
"
(item,index)
in pod_arr"
:key=
"i
tem.value
"
:key=
"i
ndex+60000
"
:label=
"item
.label
"
:label=
"item"
:value=
"item
.value
"
:value=
"item"
>
>
</el-option>
</el-option>
</el-select>
</el-select>
...
@@ -24,14 +24,14 @@
...
@@ -24,14 +24,14 @@
v-if=
"$route.query.content == 0"
v-if=
"$route.query.content == 0"
>
>
<el-option
<el-option
v-for=
"
item
in pod_group_arr"
v-for=
"
(item,index)
in pod_group_arr"
:key=
"i
tem.value
"
:key=
"i
ndex+80000
"
:label=
"item
.label
"
:label=
"item"
:value=
"item
.value
"
:value=
"item"
>
>
</el-option>
</el-option>
</el-select>
</el-select>
<span
v-if=
"$route.query.content == 1"
>
在
请问请问1212
</span>
<span
v-if=
"$route.query.content == 1"
>
在
{{
now_app
}}
</span>
<div
v-if=
"$route.query.content == 0"
style=
"float:right;"
>
<div
v-if=
"$route.query.content == 0"
style=
"float:right;"
>
<el-tooltip
class=
"item"
effect=
"dark"
content=
"显示时间戳"
placement=
"top"
>
<el-tooltip
class=
"item"
effect=
"dark"
content=
"显示时间戳"
placement=
"top"
>
<div
class=
"time"
@
click=
"change_contl(0)"
:style=
"control_arr[0]?
{backgroundImage:'url('+require('../../../assets/imgs/rqrz_btn_time_sel.png')+')'}:''">
</div>
<div
class=
"time"
@
click=
"change_contl(0)"
:style=
"control_arr[0]?
{backgroundImage:'url('+require('../../../assets/imgs/rqrz_btn_time_sel.png')+')'}:''">
</div>
...
@@ -51,16 +51,18 @@
...
@@ -51,16 +51,18 @@
<p
<p
v-for=
"(item, index) in data_arr"
v-for=
"(item, index) in data_arr"
:key=
"index + 89000"
:key=
"index + 89000"
v-html=
"(control_arr[0]?
'1111':'')+item
"
v-html=
"(control_arr[0]?
item.timestamp:'')+item.content
"
></p>
></p>
</el-scrollbar>
</el-scrollbar>
<div
id=
"xterm_contain"
v-if=
"$route.query.content == 1"
></div>
<div
id=
"xterm_contain"
v-if=
"$route.query.content == 1"
></div>
<p
class=
"code"
v-if=
"$route.query.content == 0"
>
<p
class=
"code"
v-if=
"$route.query.content == 0"
>
<span>
日志范围从
4/22/20 3:05 AM 到 4/22/20 3:05 AM UTC
</span>
<span>
日志范围从
{{
from_log
}}
到
{{
to_log
}}
</span>
<img
<img
:src=
"item"
:src=
"item
[logFilePosition=='end'&&(index==0||index==1)?1:logFilePosition=='beginning'&&(index==2||index==3)?1:0]
"
alt=
""
alt=
""
v-for=
"(item, index) in image_arr"
v-for=
"(item, index) in image_arr"
@
click=
"page(3-index,logFilePosition=='end'&&(index==0||index==1)?1:logFilePosition=='beginning'&&(index==2||index==3)?1:0)"
:style=
"logFilePosition=='end'&&(index==0||index==1)?
{cursor:'not-allowed'}:logFilePosition=='beginning'
&&
(index==2||index==3)?{cursor:'not-allowed'}:0"
:key="index + 12000"
:key="index + 12000"
/>
/>
</p>
</p>
...
@@ -71,6 +73,7 @@
...
@@ -71,6 +73,7 @@
title=
"下载日志文件"
title=
"下载日志文件"
sunbmitText=
"保存"
sunbmitText=
"保存"
:submitDisable=
"download_flag"
:submitDisable=
"download_flag"
submit=
"file"
@
submit=
"save_file"
@
submit=
"save_file"
>
>
<template
slot=
"content"
>
<template
slot=
"content"
>
...
@@ -91,6 +94,8 @@ import "xterm/css/xterm.css";
...
@@ -91,6 +94,8 @@ import "xterm/css/xterm.css";
import
{
Terminal
}
from
"
xterm
"
;
import
{
Terminal
}
from
"
xterm
"
;
import
{
FitAddon
}
from
'
xterm-addon-fit
'
;
import
{
FitAddon
}
from
'
xterm-addon-fit
'
;
import
apassDialog
from
'
@/components/apass-dialog
'
import
apassDialog
from
'
@/components/apass-dialog
'
import
helper
from
'
@/services/helper
'
import
SockJS
from
"
sockjs-client
"
;
export
default
{
export
default
{
props
:
[],
props
:
[],
components
:
{
components
:
{
...
@@ -99,151 +104,278 @@ export default {
...
@@ -99,151 +104,278 @@ export default {
data
()
{
data
()
{
return
{
return
{
pod
:
""
,
pod
:
""
,
image_arr
:
[],
image_arr
:
[
control_arr
:[
0
,
0
,
0
],
[
pod_arr
:
[
require
(
'
../../../assets/imgs/btn_last_page.png
'
),
{
require
(
'
../../../assets/imgs/btn_last_page_dis.png
'
)
value
:
1
,
],
label
:
"
jakdsj
"
,
[
},
require
(
'
../../../assets/imgs/btn_next_page.png
'
),
{
require
(
'
../../../assets/imgs/btn_next_page_dis.png
'
)
value
:
2
,
],
label
:
"
容器1
"
,
[
},
require
(
'
../../../assets/imgs/btn_previous_page.png
'
),
{
require
(
'
../../../assets/imgs/btn_previous_page_dis.png
'
)
value
:
3
,
],
label
:
"
容器2
"
,
[
},
require
(
'
../../../assets/imgs/btn_front_page.png
'
),
require
(
'
../../../assets/imgs/btn_front_page_dis.png
'
)
],
],
],
control_arr
:[
0
,
0
,
0
],
pod_arr
:
[],
pod_group
:
""
,
pod_group
:
""
,
from_log
:
''
,
to_log
:
''
,
process
:
0
,
process
:
0
,
pod_group_arr
:
[
pod_group_arr
:
[],
{
value
:
1
,
label
:
"
jakdsj
"
,
},
{
value
:
2
,
label
:
"
容器1
"
,
},
{
value
:
3
,
label
:
"
容器2
"
,
},
],
temp_time
:
''
,
temp_time
:
''
,
download_flag
:
true
,
download_flag
:
true
,
data_arr
:
[
data_arr
:
[],
"
1231231233
"
,
logFilePosition
:
''
,
"
jhabshjdabshdbasjdhb
"
,
referenceTimestamp
:
''
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
offsetFrom
:
''
,
"
iquhdiwqbdjkbaskjdbajsdiquhdiw
"
,
offsetTo
:
''
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
referenceLineNum
:
''
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
filecontant
:
''
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
now_app
:
''
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
term
:
''
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
conn_
:
null
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
connected_
:
false
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
connectSucceed_
:
false
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
connectSucceedString_
:
"
\
u001b[
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
connectionClosed_
:
false
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
id
:
""
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
token
:
""
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
"
iquhdiwqbdjkbaskjdbajsd
"
,
],
};
};
},
},
watch
:
{},
watch
:
{},
computed
:
{},
computed
:
{},
created
()
{},
created
()
{
if
(
this
.
$route
.
query
.
content
==
0
)
{
this
.
get_pod_list
()
this
.
get_now_pod
()
}
else
{
this
.
get_contain_list
()
this
.
pod
=
this
.
$route
.
query
.
container
this
.
now_app
=
this
.
$route
.
query
.
name
}
},
mounted
()
{
mounted
()
{
if
(
this
.
$route
.
query
.
content
==
1
)
{
if
(
this
.
$route
.
query
.
content
==
1
)
{
var
_this
=
this
this
.
initTerm
()
var
term
=
new
Terminal
();
this
.
setinit
()
}
},
methods
:
{
setinit
:
function
()
{
var
urlParams
=
{
namespace
:
this
.
$route
.
params
.
namespace
,
name
:
this
.
$route
.
params
.
name
,
containers
:
this
.
$route
.
params
.
containers
};
this
.
$http
.
get
(
`/awecloud/rest/kubernetes/api/v1/pod/
${
this
.
$route
.
query
.
namespace
}
/
${
this
.
$route
.
query
.
name
}
/shell/
${
this
.
$route
.
query
.
container
}
`
)
.
then
((
response
)
=>
{
this
.
id
=
response
.
data
.
id
;
if
(
this
.
id
!=
undefined
&&
this
.
id
.
length
>
0
)
{
// 建立连接
this
.
setupConnection
();
}
this
.
token
=
response
.
data
.
id
;
})
},
initTerm
()
{
this
.
term
=
new
Terminal
({
// cols: 40,
// rows: 30,
fontSize
:
14
,
fontFamily
:
'
Consolas, "Courier New", monospace
'
,
bellStyle
:
"
sound
"
,
cursorBlink
:
true
});
const
fitAddon
=
new
FitAddon
();
const
fitAddon
=
new
FitAddon
();
term
.
loadAddon
(
fitAddon
);
t
his
.
t
erm
.
loadAddon
(
fitAddon
);
term
.
open
(
document
.
getElementById
(
"
xterm_contain
"
));
t
his
.
t
erm
.
open
(
document
.
getElementById
(
"
xterm_contain
"
));
fitAddon
.
fit
();
fitAddon
.
fit
();
var
temp
=
''
function
runFakeTerminal
()
{
window
.
addEventListener
(
"
resize
"
,
()
=>
{
if
(
term
.
_initialized
)
{
fitAddon
.
fit
();
return
;
});
}
term
.
_initialized
=
true
;
this
.
term
.
onData
(
this
.
onTerminalSendString
.
bind
(
this
));
// this.term.write('\u001b[');
this
.
term
.
onResize
(
this
.
onTerminalResize
.
bind
(
this
));
// this.term.fit();
},
onTerminalSendString
:
function
(
key
)
{
var
_this
=
this
;
if
(
this
.
connected_
)
{
this
.
conn_
.
send
(
JSON
.
stringify
({
Op
:
"
stdin
"
,
Data
:
key
,
Cols
:
this
.
term
.
cols
,
Rows
:
this
.
term
.
rows
})
);
}
},
onTerminalResize
:
function
()
{
if
(
this
.
connected_
)
{
this
.
conn_
.
send
(
JSON
.
stringify
({
Op
:
"
resize
"
,
Cols
:
this
.
term
.
cols
,
Rows
:
this
.
term
.
rows
})
);
}
},
setupConnection
:
function
()
{
var
self
=
this
;
this
.
conn_
=
new
SockJS
(
`/awecloud/proxy/wss/api/sockjs?
${
self
.
id
}
`
);
this
.
conn_
.
onopen
=
function
()
{
var
startData
=
{
Op
:
"
bind
"
,
SessionID
:
self
.
id
};
self
.
conn_
.
send
(
JSON
.
stringify
(
startData
));
self
.
connected_
=
true
;
// Make sure the terminal is with correct display size.
self
.
onTerminalResize
();
term
.
prompt
=
()
=>
{
// Focus on connection
term
.
write
(
"
\r\n
$
"
);
};
};
prompt
(
term
,
false
);
this
.
conn_
.
onmessage
=
function
(
event
)
{
const
msg
=
JSON
.
parse
(
event
.
data
);
self
.
handleConnectionMessage
(
msg
);
term
.
onKey
((
e
)
=>
{
// console.log(msg)
const
printable
=
// self.term.write(msg.Data);
!
e
.
domEvent
.
altKey
&&
};
!
e
.
domEvent
.
altGraphKey
&&
this
.
conn_
.
onclose
=
this
.
onConnectionClose
.
bind
(
this
);
!
e
.
domEvent
.
ctrlKey
&&
},
!
e
.
domEvent
.
metaKey
;
if
(
e
.
domEvent
.
keyCode
===
13
)
{
handleConnectionMessage
:
function
(
msg
)
{
//enter
var
self
=
this
;
prompt
(
term
);
if
(
msg
.
Op
===
"
stdout
"
)
{
}
else
if
(
e
.
domEvent
.
keyCode
===
8
)
{
self
.
term
.
write
(
msg
.
Data
);
// Do not delete the prompt
if
(
term
.
_core
.
buffer
.
x
>
2
)
{
term
.
write
(
"
\
b
\
b
"
);
}
}
}
else
if
(
printable
)
{
},
term
.
write
(
e
.
key
);
onConnectionClose
:
function
(
event
)
{
if
(
!
this
.
connected_
)
{
return
;
}
}
});
this
.
conn_
.
close
();
this
.
connected_
=
false
;
this
.
connectionClosed_
=
true
;
console
.
log
(
"
断开连接
"
,
event
);
},
get_contain_list
(){
this
.
$http
.
get
(
`/awecloud/rest/kubernetes/api/v1/pod/
${
this
.
$route
.
query
.
namespace
}
/
${
this
.
$route
.
query
.
name
}
/container`
)
.
then
((
response
)
=>
{
this
.
pod_arr
=
response
.
data
.
containers
;
})
},
page
(
index
,
flag
)
{
if
(
flag
==
1
){
return
}
}
if
(
index
==
0
)
{
// 上一页
this
.
logFilePosition
=
"
beginning
"
;
this
.
referenceTimestamp
=
"
oldest
"
;
this
.
referenceLineNum
=
0
;
this
.
offsetFrom
=
-
2000000100
;
this
.
offsetTo
=
-
2000000000
;
this
.
get_now_pod
({
logFilePosition
:
this
.
logFilePosition
,
referenceTimestamp
:
this
.
referenceTimestamp
,
referenceLineNum
:
this
.
referenceLineNum
,
offsetFrom
:
this
.
offsetFrom
,
offsetTo
:
this
.
offsetTo
,
previous
:
this
.
control_arr
[
2
]
==
1
});
console
.
log
(
"
0
"
);
}
else
if
(
index
==
1
)
{
// 上移
function
prompt
(
term
,
val
=
true
)
{
this
.
referenceLineNum
=
-
1
;
// term.write("\r\n$ ");
console
.
log
(
this
.
offsetFrom
);
if
(
val
){
this
.
offsetFrom
=
this
.
offsetFrom
-
100
;
term
.
write
(
"
\r\n
"
);
this
.
offsetTo
=
this
.
offsetTo
-
100
;
term
.
write
(
_this
.
getdata
())
console
.
log
(
this
.
offsetFrom
);;
}
this
.
get_now_pod
({
term
.
write
(
"
\r\n
$
"
);
logFilePosition
:
this
.
logFilePosition
,
}
referenceTimestamp
:
this
.
referenceTimestamp
,
runFakeTerminal
();
referenceLineNum
:
this
.
referenceLineNum
,
offsetFrom
:
this
.
offsetFrom
,
offsetTo
:
this
.
offsetTo
,
previous
:
this
.
control_arr
[
2
]
==
1
});
console
.
log
(
"
1
"
);
}
else
if
(
index
==
2
)
{
// 下移
// 现在
this
.
referenceLineNum
=
-
1
;
this
.
offsetFrom
=
this
.
offsetFrom
+
100
;
this
.
offsetTo
=
this
.
offsetTo
+
100
;
this
.
get_now_pod
({
logFilePosition
:
this
.
logFilePosition
,
referenceTimestamp
:
this
.
referenceTimestamp
,
referenceLineNum
:
this
.
referenceLineNum
,
offsetFrom
:
this
.
offsetFrom
,
offsetTo
:
this
.
offsetTo
,
previous
:
this
.
control_arr
[
2
]
==
1
});
console
.
log
(
"
2
"
);
}
else
if
(
index
==
3
)
{
// 下一页
this
.
logFilePosition
=
"
end
"
;
this
.
referenceTimestamp
=
"
newest
"
;
this
.
referenceLineNum
=
0
;
this
.
offsetFrom
=
2000000000
;
this
.
offsetTo
=
2000000100
;;
this
.
get_now_pod
({
logFilePosition
:
this
.
logFilePosition
,
referenceTimestamp
:
this
.
referenceTimestamp
,
referenceLineNum
:
this
.
referenceLineNum
,
offsetFrom
:
this
.
offsetFrom
,
offsetTo
:
this
.
offsetTo
,
previous
:
this
.
control_arr
[
2
]
==
1
});
console
.
log
(
"
3
"
);
}
}
},
},
methods
:
{
get_pod_list
(){
this
.
$http
.
get
(
`/awecloud/rest/kubernetes/api/v1/log/source/
${
this
.
$route
.
query
.
namespace
}
/
${
this
.
$route
.
query
.
name
}
/pod`
)
.
then
((
response
)
=>
{
console
.
log
(
response
);
this
.
pod_arr
=
response
.
data
.
containerNames
this
.
pod_group_arr
=
response
.
data
.
podNames
})
},
get_now_pod
(
url
){
var
temp_url
=
`/awecloud/rest/kubernetes/api/v1/log/
${
this
.
$route
.
query
.
namespace
}
/
${
this
.
$route
.
query
.
name
}
/
${
this
.
$route
.
query
.
container
}
`
this
.
$http
.
get
(
temp_url
,{
params
:
url
})
.
then
((
response
)
=>
{
console
.
log
(
response
);
this
.
pod
=
response
.
data
.
info
.
containerName
;
this
.
pod_group
=
response
.
data
.
info
.
podName
;
this
.
from_log
=
helper
.
CreationDateDesc
(
response
.
data
.
info
.
fromDate
);
this
.
to_log
=
helper
.
CreationDateDesc
(
response
.
data
.
info
.
toDate
);
this
.
logFilePosition
=
response
.
data
.
selection
.
logFilePosition
;
this
.
referenceTimestamp
=
response
.
data
.
selection
.
referencePoint
.
timestamp
;
this
.
offsetFrom
=
response
.
data
.
selection
.
offsetFrom
;
this
.
offsetTo
=
response
.
data
.
selection
.
offsetTo
;
this
.
data_arr
=
response
.
data
.
logs
;
})
},
getdata
(){
getdata
(){
return
'
54555555
'
return
'
54555555
'
},
},
...
@@ -257,48 +389,90 @@ export default {
...
@@ -257,48 +389,90 @@ export default {
if
(
n
==
1
){
if
(
n
==
1
){
if
(
this
.
control_arr
[
n
]
==
1
){
if
(
this
.
control_arr
[
n
]
==
1
){
this
.
temp_time
=
setInterval
(()
=>
{
this
.
temp_time
=
setInterval
(()
=>
{
this
.
data_arr
=
[]
this
.
logFilePosition
=
"
end
"
;
this
.
data_arr
.
push
(
this
.
getrecode
(
!
this
.
control_arr
[
2
]
==
1
))
this
.
referenceTimestamp
=
"
newest
"
;
},
1000
)
this
.
referenceLineNum
=
0
;
this
.
offsetFrom
=
2000000000
;
this
.
offsetTo
=
2000000100
;
this
.
get_now_pod
({
logFilePosition
:
this
.
logFilePosition
,
referenceTimestamp
:
this
.
referenceTimestamp
,
referenceLineNum
:
this
.
referenceLineNum
,
offsetFrom
:
this
.
offsetFrom
,
offsetTo
:
this
.
offsetTo
,
previous
:
this
.
control_arr
[
2
]
==
1
});
},
10000
)
}
else
{
}
else
{
if
(
this
.
temp_time
){
clearInterval
(
this
.
temp_time
)
clearInterval
(
this
.
temp_time
)
}
}
}
}
}
if
(
n
==
2
){
if
(
n
==
2
){
this
.
data_arr
=
[]
if
(
this
.
control_arr
[
n
]
==
1
){
if
(
this
.
control_arr
[
n
]
==
1
){
this
.
data_arr
.
push
(
this
.
getrecode
(
false
))
this
.
logFilePosition
=
"
end
"
;
this
.
referenceTimestamp
=
"
newest
"
;
this
.
referenceLineNum
=
0
;
this
.
offsetFrom
=
2000000000
;
this
.
offsetTo
=
2000000100
;
this
.
get_now_pod
({
logFilePosition
:
this
.
logFilePosition
,
referenceTimestamp
:
this
.
referenceTimestamp
,
referenceLineNum
:
this
.
referenceLineNum
,
offsetFrom
:
this
.
offsetFrom
,
offsetTo
:
this
.
offsetTo
,
previous
:
this
.
control_arr
[
2
]
==
1
});
}
else
{
}
else
{
this
.
data_arr
.
push
(
this
.
getrecode
())
this
.
logFilePosition
=
"
end
"
;
}
this
.
referenceTimestamp
=
"
newest
"
;
this
.
referenceLineNum
=
0
;
this
.
offsetFrom
=
2000000000
;
this
.
offsetTo
=
2000000100
;
this
.
get_now_pod
({
logFilePosition
:
this
.
logFilePosition
,
referenceTimestamp
:
this
.
referenceTimestamp
,
referenceLineNum
:
this
.
referenceLineNum
,
offsetFrom
:
this
.
offsetFrom
,
offsetTo
:
this
.
offsetTo
,
previous
:
this
.
control_arr
[
2
]
==
1
});
}
}
},
getrecode
(
n
=
true
){
if
(
n
){
return
'
124123432423432324
'
}
else
{
return
'
555555555555555
'
}
}
},
},
download
(){
download
(){
var
temp
=
setInterval
(()
=>
{
var
temp
=
setInterval
(()
=>
{
this
.
process
=
this
.
process
+
1
this
.
process
=
this
.
process
+
4
if
(
this
.
process
>=
99
){
if
(
this
.
process
>=
99
){
clearInterval
(
temp
)
clearInterval
(
temp
)
this
.
process
=
100
this
.
process
=
100
this
.
download_flag
=
false
this
.
download_flag
=
false
}
}
},
10
)
},
10
0
)
this
.
$refs
.
actiondialog
.
show
();
this
.
$refs
.
actiondialog
.
show
();
this
.
$http
.
get
(
`/awecloud/rest/kubernetes/api/v1/log/file/
${
this
.
$route
.
query
.
namespace
}
/
${
this
.
$route
.
query
.
name
}
/
${
this
.
$route
.
query
.
container
}
?previous=
${
this
.
control_arr
[
2
]
==
1
}
`
)
.
then
((
response
)
=>
{
if
(
response
.
status
==
200
)
{
this
.
process
=
100
;
this
.
download_flag
=
false
clearInterval
(
temp
)
this
.
filecontant
=
response
.
data
;
}
})
},
},
format
(
n
){
format
(
n
){
return
''
return
''
},
},
save_file
(){
save_file
(){
console
.
log
(
'
1111
'
);
var
filename
=
"
logs-form-
"
+
this
.
pod
+
"
-
"
+
this
.
pod_group
;
var
a
=
document
.
createElement
(
"
a
"
);
var
blob
=
new
Blob
([
this
.
filecontant
]);
a
.
download
=
filename
;
a
.
href
=
URL
.
createObjectURL
(
blob
);
a
.
click
();
URL
.
revokeObjectURL
(
blob
);
}
}
...
@@ -411,6 +585,8 @@ background:khaki;
...
@@ -411,6 +585,8 @@ background:khaki;
}
}
.code
img
{
.code
img
{
float
:
right
;
float
:
right
;
margin-right
:
35px
;
cursor
:
pointer
;
}
}
.back
{
.back
{
width
:
124px
;
width
:
124px
;
...
...
src/services/helper.js
View file @
223cb2d2
...
@@ -78,3 +78,10 @@ module.exports.numberFormat = function (num, decimals) {
...
@@ -78,3 +78,10 @@ module.exports.numberFormat = function (num, decimals) {
return
num
;
return
num
;
}
}
}
}
module
.
exports
.
CreationDateDesc
=
function
(
timestamp
)
{
let
date
=
new
Date
(
timestamp
);
return
date
.
toLocaleDateString
(
"
zh-CN
"
,
{
timeZone
:
"
Asia/Shanghai
"
});
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment