Skip to content

Commit

Permalink
feat: 配置版本上线后新增服务密钥引导--story=115746758 (#2905)
Browse files Browse the repository at this point in the history
* fix: 修复部分国际化内容

* feat: 配置版本上线后新增服务密钥引导--story=115746758
  • Loading branch information
Yuikill authored Jan 17, 2024
1 parent c47588b commit 625be31
Show file tree
Hide file tree
Showing 33 changed files with 170 additions and 103 deletions.
25 changes: 5 additions & 20 deletions bcs-services/bcs-bscp/ui/src/components/footer.vue
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
<template>
<div class="app-footer">
<div class="links">
<a href="https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true" target="_blank">{{ support }}</a> |
<a href="https://bk.tencent.com/s-mart/community/" target="_blank">{{ forum }}</a> |
<a href="https://bk.tencent.com/index/" target="_blank">{{ website }}</a>
<a href="https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true" target="_blank">{{ $t('技术支持') }}</a> |
<a href="https://bk.tencent.com/s-mart/community/" target="_blank">{{ $t('社区论坛') }}</a> |
<a href="https://bk.tencent.com/index/" target="_blank">{{ $t('产品官网') }}</a>
</div>
<p>Copyright © 2012 Tencent BlueKing. All Rights Reserved. {{ version }}</p>
<p>Copyright © 2012 Tencent BlueKing. All Rights Reserved. {{ bscpVersion }}</p>
</div>
</template>
<script lang="ts">
import { useI18n } from 'vue-i18n';
import { defineComponent } from 'vue';
<script lang="ts" setup>
import { storeToRefs } from 'pinia';
import useGlobalStore from '../store/global';
const { bscpVersion } = storeToRefs(useGlobalStore());
export default defineComponent({
name: 'AppFooter',
setup() {
const { t } = useI18n();
return {
version: bscpVersion,
support: t('技术支持'),
forum: t('社区论坛'),
website: t('产品官网'),
};
},
});
</script>
<style lang="scss" scoped>
.app-footer {
Expand Down
38 changes: 31 additions & 7 deletions bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export default {
服务新建成功: 'Service creation successful',
接下来你可以在服务下新增配置文件: 'Next you can add a configuration file under the service',
接下来你可以在服务下新增配置项: 'Next you can add configuration items under the Services',
新增配置文件: 'Add Configuration File',
新增配置项: 'Add Configuration Item',
新增配置文件: 'New Configuration File',
新增配置项: 'New Configuration Item',
稍后再说: 'Later on',
编辑: 'Edit',
最小长度2个字符: 'The minimum length is 2 characters',
Expand All @@ -47,9 +47,19 @@ export default {
'请输入2-32字符,只允许英文、数字、下划线、中划线且必须以英文、数字开头和结尾': 'Please enter 2-32 characters, only allow English, numbers, down lines, mid-line lines, and must start with English, numbers and ending',
'请输入2-128字符,只允许中文、英文、数字、下划线、中划线且必须以中文、英文、数字开头和结尾': 'Please enter 2-128 characters, only allow Chinese, English, numbers, lines, lines, mid-line lines, and must start with Chinese, English, numbers, and ending',
服务描述限制200字符: 'Service description limit 200 characters',
更新者: 'Regenerator',
tips: {
config: `File type: Usually stored in the form of a file, usually has good readability and maintainability
Key-value type: stored in the form of key-value pairs, where key is used to identify a configuration item, value is the specific content of the configuration item, kv type configuration is usually stored in the database, using the SDK or API to read`,
type: `arbitrary type: The type of the configuration item is not restricted. If you select one of the following types, only configuration items of the specified type can be created
string: One-line string
number: Numeric values, including integers, floating-point numbers, and checksum data types
text: Multi-line string text, unverified data structure, size 2Mb
json、xml、yaml: For structured data in different formats, the data structure is checked`,
},

// 导航栏
服务配置中心: 'Service Configuration Center',
服务配置中心: 'BSCP',
服务管理: 'Service Management',
分组管理: 'Group Management',
全局变量: 'Global Variable',
Expand Down Expand Up @@ -219,7 +229,7 @@ export default {
编辑配置项成功: 'Edit configuration item successfully',
查看配置项: 'View configuration items',
线上版本: 'Online version',
对比版本: 'Compare versions',
对比版本: 'Compare version',
当前版本: 'Current version',
上线版本: 'Online version',
只查看差异文件: 'View only diff files',
Expand Down Expand Up @@ -299,9 +309,19 @@ export default {
脚本预览: 'Script preview',
'<不使用脚本>': '<No script>',
初始化脚本设置成功: 'Initialization script set up successfully',
确认恢复该版本: 'Confirm to restore this version',
此操作会把改版本恢复至可用版本列表: 'This operation will restore the modified version to the list of available versions',
版本恢复成功: 'Version restored successfully',
确认删除该版本: 'Confirm to delete this version',
版本删除成功: 'Version deleted successfully',
请输入关键字: 'Please enter a keyword',
'格式:': 'Format:',
'key 类型 value': 'key type value',
新增服务密钥: 'Add service key',
调整分组上线成功: 'Adjustment of grouping went online successfully',

// 分组管理
新增分组: 'Add new group',
新增分组: 'New group',
按标签分类查看: 'View by tag',
'分组名称/标签选择器': 'Group name/Label selector',
分组名称: 'group name',
Expand Down Expand Up @@ -330,7 +350,7 @@ export default {

// 全局变量
配置模板与变量: 'Configure templates and variables',
新增变量: 'Add new variable',
新增变量: 'New variable',
导入变量: 'Import variables',
请输入变量名称: 'Please enter variable name',
默认值: 'default value',
Expand All @@ -349,6 +369,9 @@ export default {
变量内容: 'variable content',
变量必须以bk_bscp_或BK_BSCP_开头: 'Variable must start with bk_bscp_ or BK_BSCP_',
导入变量成功: 'Import variables successfully',
'示例:': 'Example:',
'变量名 变量类型 变量值 变量描述(可选)': 'Variable name Variable type Variable value Variable Description (optional)',
' bk_bscp_nginx_port number 8080 nginx端口': ' bk_bscp_nginx_port number 8080 nginx port',

// 配置模板
'配置模板用于统一业务下服务间配置文件复用,可以在创建服务配置时引用配置模板。': 'Configuration templates are used to reuse configuration files between services under unified services, and can be referenced when creating service configurations.',
Expand Down Expand Up @@ -398,7 +421,7 @@ export default {
添加至套餐: 'Add to package',
移出套餐: 'Move out of package',
添加至: 'Add to',
添加配置文件: 'Add configuration file',
添加配置文件: 'New configuration file',
添加已有配置文件: 'Add existing configuration file',
去创建: 'to create',
新建配置文件成功: 'New configuration file successfully created',
Expand Down Expand Up @@ -477,6 +500,7 @@ export default {
编辑版本成功: 'Edit version successful',
新建版本成功: 'New version successful',
已下线: 'Offline',
脚本类型: 'Script type',

// 服务密钥
'密钥仅用于 SDK/API 拉取配置使用。服务管理/配置管理/分组管理等功能的权限申请,请前往': 'The key is only used for SDK/API pull configurations. To apply for permissions for functions such as service management/configuration management/group management, please go to',
Expand Down
25 changes: 25 additions & 0 deletions bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ export default {
'请输入2-32字符,只允许英文、数字、下划线、中划线且必须以英文、数字开头和结尾': '请输入2-32字符,只允许英文、数字、下划线、中划线且必须以英文、数字开头和结尾',
'请输入2-128字符,只允许中文、英文、数字、下划线、中划线且必须以中文、英文、数字开头和结尾': '请输入2-128字符,只允许中文、英文、数字、下划线、中划线且必须以中文、英文、数字开头和结尾',
服务描述限制200字符: '服务描述限制200字符',
更新者: '更新者',
tips: {
config: `文件型:通常以文件的形式存储,通常具有良好的可读性和可维护性
键值型:以键值对的形式存储,其中键(key)用于位置标识一个配置项,值(value)为该配置项的具体内容,kv型配置通常存储在数据库,使用SDK或API的方式读取`,
type: `任意类型:不对配置项的类型做限制。如果选择下方某个类型,则只能创建指定类型的配置项
string:单行字符串
number:数值,包含整数、浮点数、会校验数据类型
text:多行字符串文本,不校验数据结构,大小2Mb
json、xml、yaml:不同格式的结构化数据,会校验数据结构`,
},

// 导航栏
服务配置中心: '服务配置中心',
服务管理: '服务管理',
Expand Down Expand Up @@ -298,6 +309,16 @@ export default {
脚本预览: '脚本预览',
'<不使用脚本>': '<不使用脚本>',
初始化脚本设置成功: '初始化脚本设置成功',
确认恢复该版本: '确认恢复该版本',
此操作会把改版本恢复至可用版本列表: '此操作会把改版本恢复至可用版本列表',
版本恢复成功: '版本恢复成功',
确认删除该版本: '确认删除该版本',
版本删除成功: '版本删除成功',
请输入关键字: '请输入关键字',
'格式:': '格式:',
'key 类型 value': 'key 类型 value',
新增服务密钥: '新增服务密钥',
调整分组上线成功: '调整分组上线成功',

// 分组管理
新增分组: '新增分组',
Expand Down Expand Up @@ -348,6 +369,9 @@ export default {
变量内容: '变量内容',
变量必须以bk_bscp_或BK_BSCP_开头: '变量必须以bk_bscp_或BK_BSCP_开头',
导入变量成功: '导入变量成功',
'示例:': '示例:',
'变量名 变量类型 变量值 变量描述(可选)': '变量名 变量类型 变量值 变量描述(可选)',
' bk_bscp_nginx_port number 8080 nginx端口': ' bk_bscp_nginx_port number 8080 nginx端口',

// 配置模板
'配置模板用于统一业务下服务间配置文件复用,可以在创建服务配置时引用配置模板。': '配置模板用于统一业务下服务间配置文件复用,可以在创建服务配置时引用配置模板。',
Expand Down Expand Up @@ -476,6 +500,7 @@ export default {
编辑版本成功: '编辑版本成功',
新建版本成功: '新建版本成功',
已下线: '已下线',
脚本类型: '脚本类型',

// 服务密钥
'密钥仅用于 SDK/API 拉取配置使用。服务管理/配置管理/分组管理等功能的权限申请,请前往': '密钥仅用于 SDK/API 拉取配置使用。服务管理/配置管理/分组管理等功能的权限申请,请前往',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const rule = computed(() => ({
}
.rule-wrap {
width: 325px;
height: 56px;
padding: 8px 16px;
background: #f5f7fa;
border-radius: 2px;
Expand All @@ -70,7 +69,6 @@ const rule = computed(() => ({
line-height: 20px;
}
.info {
height: 20px;
font-size: 12px;
color: #979ba5;
line-height: 20px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
</div>
</template>
</bk-table-column>
<bk-table-column :label="t('操作')" width="160">
<bk-table-column :label="t('操作')" :width="160" :fixed="'right'">
<template #default="{ row, index }">
<template v-if="index === 0 && isCreateCredential">
<bk-button text theme="primary" @click="handleCreateCredential">{{ t('创建') }}</bk-button>
Expand Down Expand Up @@ -219,7 +219,7 @@
<div>{{ t('删除的密钥') }}<span>{{ t('无法找回') }}</span>{{ t(',请谨慎操作!') }}</div>
</div>
<div class="tips">{{ t('请输入密钥名称') }} <span>{{ deleteCredentialInfo?.spec.name }}</span> {{ t('以确认删除') }}</div>
<bk-input v-model="dialogInputStr" />
<bk-input v-model="dialogInputStr" :placeholder="t('请输入')" />
</div>
</div>
<template #footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@ defineExpose({
font-size: 14px;
color: #3a84ff;
line-height: 19px;
vertical-align: middle;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="create-script-forms">
<bk-form ref="formRef" form-type="vertical" :model="formData" :rules="rules">
<bk-form-item class="fixed-width-form" :label="t('脚本名称')" property="name" required>
<bk-input v-model="formData.name" />
<bk-input v-model="formData.name" :placeholder="t('请输入')"/>
</bk-form-item>
<bk-form-item class="fixed-width-form" property="tag" :label="t('分类标签')">
<!-- <bk-input v-model="formData.tag" /> -->
Expand All @@ -21,7 +21,7 @@
/>
</bk-form-item>
<bk-form-item class="fixed-width-form" property="memo" :label="t('脚本描述')">
<bk-input v-model="formData.memo" type="textarea" :rows="3" :maxlength="200" :resize="true" />
<bk-input v-model="formData.memo" type="textarea" :placeholder="t('请输入')" :rows="3" :maxlength="200" :resize="true" />
</bk-form-item>
<bk-form-item :label="t('脚本内容')" property="content" required>
<div class="script-content-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<div v-show="!fullscreen" class="version-config-form">
<bk-form ref="formRef" :rules="rules" form-type="vertical" :model="localVal">
<bk-form-item :label="t('版本号')" property="name">
<bk-input v-model="localVal.name" />
<bk-input v-model="localVal.name" :placeholder="t('请输入')"/>
</bk-form-item>
<bk-form-item :label="t('版本说明')" propperty="memo">
<bk-input v-model="localVal.memo" type="textarea" :rows="8" :resize="true" />
<bk-input v-model="localVal.memo" type="textarea" :placeholder="t('请输入')" :rows="8" :resize="true" />
</bk-form-item>
</bk-form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<div class="section-title">{{t('版本信息')}}</div>
<bk-form class="form-wrapper" form-type="vertical" ref="formRef" :rules="rules" :model="formData">
<bk-form-item :label="t('版本名称')" property="name" :required="true">
<bk-input v-model="formData.name" @change="formChange" />
<bk-input v-model="formData.name" :placeholder="t('请输入')" @change="formChange" />
</bk-form-item>
<bk-form-item :label="t('版本描述')" property="memo">
<bk-input v-model="formData.memo" type="textarea" :maxlength="200" @change="formChange" :resize="true" />
<bk-input v-model="formData.memo" type="textarea" :placeholder="t('请输入')" :maxlength="200" @change="formChange" :resize="true" />
</bk-form-item>
<bk-checkbox v-model="isPublish" :true-label="true" :false-label="false" @change="formChange">
<span style="font-size: 12px;">{{ t('同时上线版本') }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import VersionLayout from '../config/components/version-layout.vue';
import ConfirmDialog from './publish-version/confirm-dialog.vue';
import SelectGroup from './publish-version/select-group/index.vue';
import VersionDiff from '../config/components/version-diff/index.vue';
import { useRoute } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import { getConfigVersionList } from '../../../../../api/config';
import { IConfigVersion } from '../../../../../../types/config';
Expand All @@ -99,6 +99,7 @@ const props = defineProps<{
const emit = defineEmits(['confirm']);
const route = useRoute();
const router = useRouter();
const bkBizId = String(route.params.spaceId);
const appId = Number(route.params.appId);
const versionList = ref<IConfigVersion[]>([]);
Expand Down Expand Up @@ -190,17 +191,29 @@ const openPreviewVersionDiff = (id: number) => {
};
// 上线确认
const handleConfirm = () => {
const handleConfirm = (haveCredentials: boolean) => {
console.log(haveCredentials);
isDiffSliderShow.value = false;
publishedVersionId.value = versionData.value.id;
handlePanelClose();
emit('confirm');
InfoBox({
// @ts-ignore
infoType: 'success',
title: '调整分组上线成功',
dialogType: 'confirm',
});
if (haveCredentials) {
InfoBox({
infoType: 'success',
title: t('调整分组上线成功'),
dialogType: 'confirm',
});
} else {
InfoBox({
infoType: 'success',
title: t('调整分组上线成功'),
confirmText: t('新增服务密钥'),
cancelText: t('稍后再说'),
onConfirm: () => {
router.push({ name: 'credentials-management' });
},
});
}
};
// 关闭选择分组面板
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<template v-if="groupsToBePreviewed.length === 0">--</template>
</bk-form-item>
<bk-form-item :label="t('上线说明')" property="memo">
<bk-input v-model="localVal.memo" type="textarea" :maxlength="200" :resize="true"></bk-input>
<bk-input v-model="localVal.memo" type="textarea" :placeholder="t('请输入')" :maxlength="200" :resize="true"></bk-input>
</bk-form-item>
</bk-form>
<template #footer>
Expand Down Expand Up @@ -120,11 +120,11 @@ const handleConfirm = async () => {
params.groups = [];
params.all = true;
}
await publishVersion(props.bkBizId, props.appId, props.releaseId as number, params);
const resp = await publishVersion(props.bkBizId, props.appId, props.releaseId as number, params);
handleClose();
// 目前组件库dialog关闭自带250ms的延迟,所以这里延时300ms
setTimeout(() => {
emits('confirm');
emits('confirm', resp.data.have_credentials as boolean);
}, 300);
} catch (e) {
console.error(e);
Expand Down
Loading

0 comments on commit 625be31

Please sign in to comment.