Skip to content

Commit

Permalink
feat: add more app status process for release action (#251)
Browse files Browse the repository at this point in the history
* feat: add more app status process for release action

- add more `app.status` type. because backend cannot release `starting/etc...` status
  those request will return 422 response
  now disable it.
- add new tooltip for disable case, tell user the reason of why we
  cannot release

* feat: add popconfirm for release app(its danger action)
  • Loading branch information
moonrailgun authored Aug 11, 2022
1 parent 5680d38 commit dfed3e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/system-server/src/handler/application/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-08-30 15:22:34
* @LastEditTime: 2022-01-19 14:48:50
* @Description:
* @Description:
*/

import * as assert from 'assert'
Expand Down Expand Up @@ -45,7 +45,7 @@ export async function handleRemoveApplication(req: Request, res: Response) {
return res.status(403).send('only owner can remove application')
}

if (app.status !== 'stopped') {
if (app.status !== 'stopped' && app.status !== 'created') {
return res.status(400).send('you should stopped application instance before removing')
}

Expand All @@ -62,4 +62,4 @@ export async function handleRemoveApplication(req: Request, res: Response) {
// remote route
await deleteApplicationRoute(app.appid)
return res.send({ data: ret })
}
}
23 changes: 18 additions & 5 deletions packages/web/src/pages/apps/components/AppTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,24 @@ const toDetail = (app: any) => {
<el-button type="default" size="small" @click="$emit('showImportDialog', row)">
导入
</el-button>
<el-tooltip v-if="type === 'created'" content="释放即完全删除应用,暂不可恢复,谨慎操作,仅应用创建者可执行此操作!" effect="light" placement="left">
<el-button :disabled="row.status === 'running'" size="small" type="default" @click="deleteApp(row)">
释放
</el-button>
</el-tooltip>
<template v-if="type === 'created'">
<el-tooltip v-if="row.status === 'stopped' || row.status === 'created'" content="释放即完全删除应用,暂不可恢复,谨慎操作,仅应用创建者可执行此操作!" effect="light" placement="left">
<el-popconfirm title="确认要释放应用吗?该操作不可撤回" cancel-button-text="" confirm-button-text="" @confirm="deleteApp(row)">
<template #reference>
<el-button size="small" type="default">
释放
</el-button>
</template>
</el-popconfirm>
</el-tooltip>
<el-tooltip v-else content="请先停止应用" effect="light" placement="left">
<div class="inline-block ml-12px">
<el-button :disabled="true" size="small" type="default" @click="deleteApp(row)">
释放
</el-button>
</div>
</el-tooltip>
</template>
</template>
</el-table-column>
</el-table>
Expand Down

0 comments on commit dfed3e5

Please sign in to comment.