Skip to content

Commit

Permalink
fix(system-client): fix remove function feat;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Sep 6, 2021
1 parent 5810a20 commit 5c18d15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/system-client/src/api/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ export function updateFunctionCode(func_id, function_data) {
}

/**
* Delete a cloud function
* Remove a cloud function
* @param {*} func_id
* @returns
*/
export function deleteFunction(func_id) {
export function removeFunction(func_id) {
const appid = store.state.app.appid
return request({
url: `/apps/${appid}/function/${func_id}`,
Expand Down
25 changes: 8 additions & 17 deletions packages/system-client/src/views/cloudfunction/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
日志
</el-button>
<el-button plain type="primary" size="mini" @click="handleTriggers(row)">
触发器
触发器<b v-if="row.triggers && row.triggers.length">({{ row.triggers.length }})</b>
</el-button>
<el-button v-if="row.status!='deleted'" plain size="mini" type="danger" @click="handleDelete(row,$index)">
删除
Expand Down Expand Up @@ -171,16 +171,14 @@
</el-dialog>

<!-- 部署面板 -->
<!-- <deploy-panel v-model="deployPanelVisible" :functions="deploy_functions" /> -->
<deploy-panel v-model="deployPanelVisible" :functions="deploy_functions" />
</div>
</template>

<script>
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import { db } from '../../api/cloud'
// import DeployPanel from '../deploy/components/deploy-panel.vue'
import { Constants } from '../../api/constants'
import { createFunction, getFunctions, publishFunctions, updateFunction } from '@/api/func'
import DeployPanel from '../deploy/components/deploy-panel.vue'
import { createFunction, getFunctions, publishFunctions, removeFunction, updateFunction } from '@/api/func'
const defaultCode = `
import cloud from '@/cloud-sdk'
Expand Down Expand Up @@ -225,8 +223,8 @@ const formRules = {
export default {
name: 'FunctionListPage',
components: {
Pagination
// DeployPanel
Pagination,
DeployPanel
},
directives: { },
filters: {
Expand Down Expand Up @@ -389,17 +387,10 @@ export default {
return this.$message.error('请先停用函数,再删除!')
}
const $ = db.command
// 执行删除请求
const r = await db.collection(Constants.cn.functions)
.where({
_id: row._id,
status: 0,
reserved: $.neq(true)
})
.remove()
const r = await removeFunction(row._id)
if (!r.ok) {
if (r.error) {
this.$notify({
type: 'error',
title: '操作失败',
Expand Down

0 comments on commit 5c18d15

Please sign in to comment.