Complete halo admin updation

pull/3445/head
johnniang 2019-06-13 00:21:43 +08:00
parent 5649cd0505
commit 9c2f6d41c9
2 changed files with 121 additions and 76 deletions

View File

@ -51,4 +51,12 @@ adminApi.refreshToken = refreshToken => {
method: 'post' method: 'post'
}) })
} }
adminApi.updateAdminAssets = () => {
return service({
url: `${baseUrl}/halo-admin`,
method: 'put',
timeout: 600 * 1000
})
}
export default adminApi export default adminApi

View File

@ -3,54 +3,67 @@
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-card :bordered="false"> <a-card :bordered="false">
<a-card
title="环境信息"
:bordered="false"
class="environment-info"
>
<a-popconfirm
slot="extra"
placement="left"
okText="是"
cancelText="否"
@confirm="confirmUpdate"
>
<template slot="title">
<p>确认更新 <b>Halo admin</b> </p>
</template>
<a-icon
type="cloud-download"
slot="icon"
></a-icon>
<a-button
:loading="updating"
type="dashed"
shape="circle"
icon="cloud-download"
>
</a-button>
</a-popconfirm>
<a-list itemLayout="horizontal">
<a-list-item>
<a-list-item-meta>
<h3 slot="title">
环境信息
</h3>
<template slot="description">
<ul> <ul>
<li>Halo server 版本{{ environments.version }}</li> <li>版本{{ environments.version }}</li>
<li>Halo admin 版本{{ version }}</li>
<li>数据库{{ environments.database }}</li> <li>数据库{{ environments.database }}</li>
<li>运行模式{{ environments.mode }}</li> <li>运行模式{{ environments.mode }}</li>
<li>启动时间{{ environments.startTime | moment }}</li> <li>启动时间{{ environments.startTime | moment }}</li>
</ul> </ul>
<a <a
href="https://github.com/halo-dev" href="https://github.com/halo-dev"
target="_blank" target="_blank"
>开源地址 >开源地址
<a-icon type="link" /></a>&nbsp; <a-icon type="link" /></a>
<a <a
href="https://halo.run/docs" href="https://halo.run/docs"
target="_blank" target="_blank"
>用户文档 >用户文档
<a-icon type="link" /></a>&nbsp; <a-icon type="link" /></a>
<a <a
href="https://bbs.halo.run" href="https://bbs.halo.run"
target="_blank" target="_blank"
>在线社区 >在线社区
<a-icon type="link" /></a>&nbsp; <a-icon type="link" /></a>
</template> </a-card>
</a-list-item-meta>
</a-list-item> <a-card
<a-list-item> title="开发者"
<a-list-item-meta> :bordered="false"
<h3 slot="title">
开发者
</h3>
<template slot="description">
<a
:href="item.github"
v-for="(item,index) in developers"
:key="index"
target="_blank"
> >
<a-tooltip <a-tooltip
placement="top" placement="top"
v-for="(item,index) in developers"
:title="item.name" :title="item.name"
:key="index"
> >
<a-avatar <a-avatar
size="large" size="large"
@ -58,17 +71,12 @@
:style="{ marginRight: '10px' }" :style="{ marginRight: '10px' }"
/> />
</a-tooltip> </a-tooltip>
</a> </a-card>
</template>
</a-list-item-meta>
</a-list-item>
<a-list-item> <a-card
<a-list-item-meta> title="时间轴"
<h3 slot="title"> :bordered="false"
时间轴 >
</h3>
<template slot="description">
<a-timeline> <a-timeline>
<a-timeline-item>...</a-timeline-item> <a-timeline-item>...</a-timeline-item>
<a-timeline-item <a-timeline-item
@ -76,10 +84,7 @@
:key="index" :key="index"
>{{ item.date }} {{ item.content }}</a-timeline-item> >{{ item.date }} {{ item.content }}</a-timeline-item>
</a-timeline> </a-timeline>
</template> </a-card>
</a-list-item-meta>
</a-list-item>
</a-list>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
@ -88,6 +93,7 @@
<script> <script>
import adminApi from '@/api/admin' import adminApi from '@/api/admin'
export default { export default {
data() { data() {
return { return {
@ -160,17 +166,37 @@ export default {
date: '2018-03-21', date: '2018-03-21',
content: '确定命名为 Halo并上传到 Github' content: '确定命名为 Halo并上传到 Github'
} }
] ],
updating: false
} }
}, },
created() { created() {
this.getEnvironments() this.getEnvironments()
}, },
computed: {
updateText() {
return this.updating ? '更新中...' : '更新'
}
},
methods: { methods: {
getEnvironments() { getEnvironments() {
adminApi.environments().then(response => { adminApi.environments().then(response => {
this.environments = response.data.data this.environments = response.data.data
}) })
},
confirmUpdate() {
this.updating = true
adminApi
.updateAdminAssets()
.then(response => {
this.$notification.success({
message: '更新成功',
description: '请刷新后体验最新版本!'
})
})
.finally(() => {
this.updating = false
})
} }
} }
} }
@ -181,4 +207,15 @@ ul {
padding: 0; padding: 0;
list-style: none; list-style: none;
} }
.environment-info {
ul {
margin: 0;
padding: 0;
list-style: none;
}
a {
margin-right: 10px;
}
}
</style> </style>