Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qahome-diamond
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qahome-diamond
Commits
9bba2d8a
Commit
9bba2d8a
authored
Jun 12, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加定时刷新
parent
4e40346b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
13 deletions
+64
-13
getters.js
src/store/getters.js
+2
-1
index.js
src/store/index.js
+3
-1
timer.js
src/store/modules/timer.js
+20
-0
envDetail.vue
src/views/docker/envDetail.vue
+39
-11
No files found.
src/store/getters.js
View file @
9bba2d8a
...
...
@@ -14,6 +14,7 @@ const getters = {
setting
:
state
=>
state
.
user
.
setting
,
permission_routers
:
state
=>
state
.
permission
.
routers
,
addRouters
:
state
=>
state
.
permission
.
addRouters
,
errorLogs
:
state
=>
state
.
errorLog
.
logs
errorLogs
:
state
=>
state
.
errorLog
.
logs
,
timer
:
state
=>
state
.
timer
.
switchBool
}
export
default
getters
src/store/index.js
View file @
9bba2d8a
...
...
@@ -5,6 +5,7 @@ import errorLog from './modules/errorLog'
import
permission
from
'
./modules/permission
'
import
tagsView
from
'
./modules/tagsView
'
import
user
from
'
./modules/user
'
import
timer
from
'
./modules/timer
'
import
getters
from
'
./getters
'
Vue
.
use
(
Vuex
)
...
...
@@ -15,7 +16,8 @@ const store = new Vuex.Store({
errorLog
,
permission
,
tagsView
,
user
user
,
timer
},
getters
})
...
...
src/store/modules/timer.js
0 → 100644
View file @
9bba2d8a
const
timer
=
{
state
:
{
switchBool
:
true
},
mutations
:
{
SET_SWITCH
:
(
state
,
switchBool
)
=>
{
state
.
switchBool
=
switchBool
}
},
actions
:
{
changeSwitch
({
commit
},
flag
)
{
commit
(
'
SET_SWITCH
'
,
flag
)
}
}
}
export
default
timer
src/views/docker/envDetail.vue
View file @
9bba2d8a
<
template
>
<div>
<div
class=
"shadow-content"
>
<div
style=
"padding:10px 20px"
>
<div
style=
"float:right"
>
<span
style=
"font-size:13px"
>
自动刷新
</span>
<el-switch
v-model=
"timer"
@
change=
"refreshInterval"
/>
</div>
</div>
<div
class=
"shadow-content"
>
<div
class=
"warn-content"
>
<svg-icon
icon-class=
"service"
/>
基础服务
<div
style=
"float: right;
min-width: 300px;overflow: hidden
"
>
<div
style=
"float: right;"
>
<el-button
type=
"warning"
size=
"mini"
round
@
click=
"getRepository('base')"
>
新增服务
</el-button>
<el-button
type=
"
warning
"
size=
"mini"
round
@
click=
"refresh"
>
刷新状态
</el-button>
<el-button
type=
"
success
"
size=
"mini"
round
@
click=
"refresh"
>
刷新状态
</el-button>
<el-dropdown>
<el-button
type=
"
warning
"
size=
"mini"
round
>
<el-button
type=
"
primary
"
size=
"mini"
round
>
更多操作
</el-button>
<el-dropdown-menu
slot=
"dropdown"
>
...
...
@@ -83,7 +90,7 @@
{{ item._id }}服务
<div
style=
"float: right"
>
<el-button
type=
"warning"
size=
"mini"
round
@
click=
"getRepository(item._id)"
>
新增服务
</el-button>
<el-button
type=
"
warning
"
size=
"mini"
round
@
click=
"refresh"
>
刷新状态
</el-button>
<el-button
type=
"
success
"
size=
"mini"
round
@
click=
"refresh"
>
刷新状态
</el-button>
</div>
</div>
<el-table
...
...
@@ -350,7 +357,9 @@ export default {
{
required
:
true
,
message
:
'
请输入更新的域名信息
'
,
trigger
:
'
blur
'
}
]
},
dialogHost
:
false
dialogHost
:
false
,
timer
:
this
.
$store
.
getters
.
timer
,
timerFunction
:
null
}
},
created
()
{
...
...
@@ -358,22 +367,41 @@ export default {
this
.
typeList
=
res
.
data
})
this
.
namespace
=
this
.
$route
.
params
.
name
this
.
getServicelist
()
clearInterval
(
this
.
timerFunction
)
this
.
timerFunction
=
null
if
(
this
.
timer
)
{
this
.
refreshInterval
(
this
.
timer
)
}
else
{
this
.
getServicelist
()
}
},
destroyed
()
{
// 每次离开当前界面时,清除定时器
clearInterval
(
this
.
timerFunction
)
this
.
timerFunction
=
null
},
methods
:
{
getServicelist
()
{
fetchK8sdetail
({
'
namespace
'
:
this
.
namespace
}).
then
(
res
=>
{
const
servicelist
=
res
.
data
.
services
this
.
array2Object
(
servicelist
)
// this.$message({
// message: '服务状态已拉取',
// type: 'success'
// })
})
},
refresh
()
{
this
.
getServicelist
()
},
refreshInterval
(
value
)
{
this
.
$store
.
dispatch
(
'
changeSwitch
'
,
value
)
if
(
value
)
{
this
.
getServicelist
()
this
.
timerFunction
=
setInterval
(
this
.
getServicelist
,
5000
)
}
else
{
clearInterval
(
this
.
timerFunction
)
}
},
getRepository
(
label
)
{
this
.
label
=
label
this
.
reponame
=
''
...
...
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