Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/daas/src/i18n/langs/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ export default {
data_import_export_transfer_type: 'Export Type',
data_import_export_file_export: 'File Export',
data_import_export_git_export: 'Git Export',
data_import_export_remove_sensitive_data: 'Remove sensitive data',
data_import_export_remove_sensitive_data_on_tip:
'The package carries no connection credentials. On import, credentials already configured in the target environment are kept instead of being cleared.',
data_import_export_remove_sensitive_data_off_tip:
'The package will contain plaintext database credentials (host, username, password). Do not share it or commit it to a code repository.',
data_import_export_git_always_masked_tip:
'Git export always removes connection credentials and cannot be turned off — repository history cannot be taken back.',
data_import_export_git_config_required:
'Git configuration is required for this project',
data_import_export_config_git: 'Configure Git',
Expand Down
7 changes: 7 additions & 0 deletions apps/daas/src/i18n/langs/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ export default {
data_import_export_transfer_type: '导出类型',
data_import_export_file_export: '文件导出',
data_import_export_git_export: 'Git 导出',
data_import_export_remove_sensitive_data: '移除敏感信息',
data_import_export_remove_sensitive_data_on_tip:
'包内不含连接凭据。导入时目标环境已配置的凭据将被保留,不会被清空。',
data_import_export_remove_sensitive_data_off_tip:
'导出包内将含数据库连接的明文凭据(地址、账号、密码),请勿外发或提交到代码仓库。',
data_import_export_git_always_masked_tip:
'Git 导出一律移除连接凭据,不可关闭 —— 提交进仓库的历史无法撤回。',
data_import_export_git_config_required: '该项目尚未配置 Git 信息',
data_import_export_config_git: '配置 Git',
data_import_export_latest_tag: '最新 Tag',
Expand Down
7 changes: 7 additions & 0 deletions apps/daas/src/i18n/langs/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ export default {
data_import_export_transfer_type: '導出類型',
data_import_export_file_export: '文件導出',
data_import_export_git_export: 'Git 導出',
data_import_export_remove_sensitive_data: '移除敏感信息',
data_import_export_remove_sensitive_data_on_tip:
'包內不含連接憑據。導入時目標環境已配置的憑據將被保留,不會被清空。',
data_import_export_remove_sensitive_data_off_tip:
'導出包內將含數據庫連接的明文憑據(地址、賬號、密碼),請勿外發或提交到代碼倉庫。',
data_import_export_git_always_masked_tip:
'Git 導出一律移除連接憑據,不可關閉 —— 提交進倉庫的歷史無法撤回。',
data_import_export_git_config_required: '該項目尚未配置 Git 信息',
data_import_export_config_git: '配置 Git',
data_import_export_latest_tag: '最新 Tag',
Expand Down
34 changes: 33 additions & 1 deletion apps/daas/src/views/data-import-export/GroupExportDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const searchKeyword = ref('') // 搜索关键词
// 导出状态
const exporting = ref(false)
const groupTransferType = ref<'FILE' | 'GIT'>('FILE') // 导出类型
// 是否移除包内敏感信息(连接凭据)。默认 false = 保真,本地导出的包能直接搬到另一个环境用。
// 仅对 FILE 生效:GIT 由后端强制脱敏,界面不给这个假开关。
const removeSensitiveData = ref(false)
const gitBranchName = ref('') // 分支名
const gitPrTitle = ref('') // PR 标题
const gitPrDescription = ref('') // PR 描述
Expand Down Expand Up @@ -180,6 +183,7 @@ watch(visible, async (val) => {

// 重置导出类型和字段
groupTransferType.value = 'FILE'
removeSensitiveData.value = false
gitBranchName.value = generateBranchName()
gitPrTitle.value = ''
gitPrDescription.value = ''
Expand Down Expand Up @@ -280,11 +284,13 @@ const handleExport = async () => {
const res = await exportGroupInfoBatch({
groupIds: selectedGroupIds.value,
groupTransferType: groupTransferType.value,
removeSensitiveData: removeSensitiveData.value,
groupResetTask: rerunData,
})
downloadBlob(res)
} else {
// 调用导出接口
// 调用导出接口。GIT 不带 removeSensitiveData:后端强制脱敏,
// 显式发 false 只会换回一条「你的请求被覆盖了」的告警,而界面从未给过这个选择。
await exportGroupInfoBatchGit({
groupIds: selectedGroupIds.value,
groupTransferType: groupTransferType.value,
Expand Down Expand Up @@ -459,6 +465,32 @@ const handleCreateProject = () => {
</el-radio>
</el-radio-group>

<!-- 敏感信息:FILE 可选(默认保真),GIT 后端强制脱敏、只说明不给假开关 -->
<div class="mt-2">
<template v-if="groupTransferType === 'FILE'">
<el-checkbox v-model="removeSensitiveData" class="h-auto">
{{ $t('data_import_export_remove_sensitive_data') }}
</el-checkbox>
<div
v-if="removeSensitiveData"
class="fs-8 font-color-sslight lh-base"
>
{{ $t('data_import_export_remove_sensitive_data_on_tip') }}
</div>
<div v-else class="fs-8 color-warning lh-base flex gap-1">
<el-icon class="flex-shrink-0 mt-1">
<i-lucide-triangle-alert />
</el-icon>
<span>{{
$t('data_import_export_remove_sensitive_data_off_tip')
}}</span>
</div>
</template>
<div v-else class="fs-8 font-color-sslight lh-base">
{{ $t('data_import_export_git_always_masked_tip') }}
</div>
</div>

<!-- Git 配置入口 -->
<div v-if="needGitConfig" class="mt-2">
<el-alert type="warning" :closable="false" show-icon>
Expand Down
8 changes: 8 additions & 0 deletions packages/api/src/core/group-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ export function deleteGroupInfo(id: string) {
export interface ExportGroupInfoBatchParams {
groupIds: string[]
groupTransferType: 'FILE' | 'GIT'
/**
* 是否移除包内的敏感信息(连接凭据)。三态语义与后端 ExportGroupRequest 对齐:
* 省略 = 未指定(FILE 按保真、GIT 按脱敏)、true = 要求脱敏、false = 要求保真。
*
* GIT 路径后端强制脱敏、本字段一律不生效,所以 GIT 导出**不要发送它**:
* 发 false 会被后端当成「用户明确要保真却被覆盖」而回告一条告警,而界面上从未给过这个选择。
*/
removeSensitiveData?: boolean
groupResetTask: {
[groupId: string]: string[]
}
Expand Down
Loading