|
|
@ -21,8 +21,8 @@ const emits = defineEmits(['update:state', 'update:reload']) |
|
|
|
const vModel = useVModel(props, 'state', emits) |
|
|
|
const vModel = useVModel(props, 'state', emits) |
|
|
|
const vReload = useVModel(props, 'reload', emits) |
|
|
|
const vReload = useVModel(props, 'reload', emits) |
|
|
|
|
|
|
|
|
|
|
|
const { $api } = useNuxtApp() |
|
|
|
const { $api, $e } = useNuxtApp() |
|
|
|
const { project } = useProject() |
|
|
|
const { project, loadProject } = useProject() |
|
|
|
|
|
|
|
|
|
|
|
let sources = $ref<BaseType[]>([]) |
|
|
|
let sources = $ref<BaseType[]>([]) |
|
|
|
let activeBaseId = $ref('') |
|
|
|
let activeBaseId = $ref('') |
|
|
@ -67,6 +67,30 @@ const baseAction = (baseId: string, action: string) => { |
|
|
|
vModel.value = action |
|
|
|
vModel.value = action |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const deleteBase = (base: BaseType) => { |
|
|
|
|
|
|
|
$e('c:base:delete') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Modal.confirm({ |
|
|
|
|
|
|
|
title: `Do you want to delete '${base.alias}' project?`, |
|
|
|
|
|
|
|
wrapClassName: 'nc-modal-base-delete', |
|
|
|
|
|
|
|
okText: 'Yes', |
|
|
|
|
|
|
|
okType: 'danger', |
|
|
|
|
|
|
|
cancelText: 'No', |
|
|
|
|
|
|
|
async onOk() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
await $api.base.delete(base.project_id as string, base.id as string) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$e('a:base:delete') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sources.splice(sources.indexOf(base), 1) |
|
|
|
|
|
|
|
await loadProject() |
|
|
|
|
|
|
|
} catch (e: any) { |
|
|
|
|
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => { |
|
|
|
onMounted(async () => { |
|
|
|
if (sources.length === 0) { |
|
|
|
if (sources.length === 0) { |
|
|
|
await loadBases() |
|
|
|
await loadBases() |
|
|
@ -140,7 +164,7 @@ watch( |
|
|
|
</a-tooltip> |
|
|
|
</a-tooltip> |
|
|
|
<a-tooltip v-if="!record.is_meta"> |
|
|
|
<a-tooltip v-if="!record.is_meta"> |
|
|
|
<template #title>Delete</template> |
|
|
|
<template #title>Delete</template> |
|
|
|
<MdiDeleteOutline class="nc-action-btn cursor-pointer outline-0" /> |
|
|
|
<MdiDeleteOutline class="nc-action-btn cursor-pointer outline-0" @click="deleteBase(record)" /> |
|
|
|
</a-tooltip> |
|
|
|
</a-tooltip> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|