Skip to content

Commit

Permalink
fix(app-console): fix restart old api #72
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed May 6, 2022
1 parent 66448c4 commit bfd49c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
19 changes: 3 additions & 16 deletions packages/app-console/src/api/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,13 @@ export function searchUserByUsername(username) {
}

/**
* 启动应用服务
* 重启应用服务
* @param {*} appid
* @returns
*/
export async function startApplicationService(appid) {
export async function restartApplicationInstance(appid) {
const res = await request({
url: `/apps/${appid}/service/start`,
method: 'post'
})
return res
}

/**
* 停止应用服务
* @param {*} appid
* @returns
*/
export async function stopApplicationService(appid) {
const res = await request({
url: `/apps/${appid}/service/stop`,
url: `/apps/${appid}/instance/restart`,
method: 'post'
})
return res
Expand Down
8 changes: 2 additions & 6 deletions packages/app-console/src/views/cloudfunction/packages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<script>
import store from '@/store'
import { addApplicationPackage, getApplicationPackages, removeApplicationPackage, startApplicationService, stopApplicationService, updateApplicationPackage } from '@/api/application'
import { addApplicationPackage, getApplicationPackages, removeApplicationPackage, restartApplicationInstance, updateApplicationPackage } from '@/api/application'
import { showError, showSuccess } from '@/utils/show'
// 默认化创建表单的值
Expand Down Expand Up @@ -171,11 +171,7 @@ export default {
await this.$confirm('确认要重启应用服务?', '服务操作确认')
this.listLoading = true
const app = this.app
if (app.status === 'running') {
await stopApplicationService(app.appid)
}
await startApplicationService(app.appid)
await restartApplicationInstance(app.appid)
this.listLoading = false
showSuccess('操作成功')
Expand Down

0 comments on commit bfd49c4

Please sign in to comment.