From 726dd8a44321da56b50a78b1da6e6d88bf73a95a Mon Sep 17 00:00:00 2001
From: q15971095971 <764419406@qq.com>
Date: Mon, 30 Sep 2024 18:04:10 +0800
Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E7=A4=BA?=
=?UTF-8?q?=E4=BE=8B=E6=96=B0=E5=A2=9Ewindows=E8=B7=AF=E5=BE=84=E9=9C=80?=
=?UTF-8?q?=E6=B1=82--story=3D119618143?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
bcs-services/bcs-bscp/ui/src/i18n/en-us.ts | 1 +
bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts | 1 +
.../components/content/node-mana-example.vue | 1 +
.../client/example/components/form-option.vue | 46 +++++++++++++++----
4 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
index a086b2931a..2f6788635e 100644
--- a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
+++ b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
@@ -163,6 +163,7 @@ export default {
文件own必须有读取权限: 'The file owner must have read permission',
最大长度1024个字符: 'Maximum length of 1024 characters',
'无效的路径,路径不符合Unix文件路径格式规范': 'Invalid path, the path does not comply with the Unix file path format specification',
+ '无效的路径,路径不符合Unix或Windows文件路径格式规范': 'Invalid path, the path does not conform to Unix or Windows file path format specifications',
最大长度200个字符: 'Maximum length of 200 characters',
请上传文件: 'Please upload the file',
'配置内容不能超过{size}M': 'Configuration content cannot exceed {size}M',
diff --git a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
index e7935ce150..b0f2e3b71c 100644
--- a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
+++ b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
@@ -163,6 +163,7 @@ export default {
文件own必须有读取权限: '文件own必须有读取权限',
最大长度1024个字符: '最大长度1024个字符',
'无效的路径,路径不符合Unix文件路径格式规范': '无效的路径,路径不符合Unix文件路径格式规范',
+ '无效的路径,路径不符合Unix或Windows文件路径格式规范': '无效的路径,路径不符合Unix或Windows文件路径格式规范',
最大长度200个字符: '最大长度200个字符',
请上传文件: '请上传文件',
'配置内容不能超过{size}M': '配置内容不能超过{size}M',
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
index 81e6a42c73..aa8550ce51 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
@@ -4,6 +4,7 @@
ref="fileOptionRef"
label-name="服务标签"
:associate-config-show="true"
+ :dual-system-support="true"
@update-option-data="getOptionData" />
{{ $t('示例预览') }}
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
index cdccc23182..e112ee07ea 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
@@ -19,7 +19,7 @@
@@ -34,8 +34,8 @@
placement: 'top',
}"
class="description-em"
- @click="handleCopyText(`${formData.tempDir}/${spaceId}/${basicInfo?.serviceName.value}/files`)">
- {{ `${formData.tempDir}/${spaceId}/${basicInfo?.serviceName.value}/files` }}
+ @click="handleCopyText(realPath)">
+ {{ realPath }}
@@ -100,11 +100,12 @@
const props = withDefaults(
defineProps<{
- directoryShow?: boolean;
+ directoryShow?: boolean; // 临时目录
labelName?: string;
- p2pShow?: boolean;
- httpConfigShow?: boolean;
- associateConfigShow?: boolean;
+ p2pShow?: boolean; // p2p网络加速(Sidecar容器)
+ httpConfigShow?: boolean; // 配置项名称(Python SDK、http(s)接口调用)
+ associateConfigShow?: boolean; // 配置文件筛选功能(所有文件型)
+ dualSystemSupport?: boolean; // Unix与windows双系统支持(节点管理插件与文件型命令行工具)
}>(),
{
directoryShow: true,
@@ -112,6 +113,7 @@
p2pShow: false,
httpConfigShow: false,
associateConfigShow: false,
+ dualSystemSupport: false,
},
);
@@ -167,6 +169,13 @@
{
required: true,
validator: (value: string) => {
+ // Unix与Windows双路径判断
+ if (props.dualSystemSupport) {
+ if (isWindowsPath.value) {
+ return true;
+ }
+ }
+ // 单Unix路径判断
// 必须为绝对路径, 且不能以/结尾
if (!value.startsWith('/') || value.endsWith('/')) {
return false;
@@ -184,7 +193,7 @@
return isValid;
},
trigger: 'change',
- message: t('无效的路径,路径不符合Unix文件路径格式规范'),
+ message: t(`无效的路径,路径不符合Unix${props.dualSystemSupport ? '或Windows' : ''}文件路径格式规范`),
},
],
httpConfigName: [
@@ -223,8 +232,29 @@
return rules.tempDir.every((ruleItem) => ruleItem.validator(formData.value.tempDir));
});
+ // 验证是否windows路径
+ const isWindowsPath = computed(() => {
+ return /^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]+$/.test(formData.value.tempDir);
+ });
+
+ // 真实路径
+ const realPath = computed(() => {
+ if (isWindowsPath.value) {
+ return `${formData.value.tempDir}\\${spaceId.value}\\${basicInfo?.serviceName.value}\\files`;
+ }
+ return `${formData.value.tempDir}/${spaceId.value}/${basicInfo?.serviceName.value}/files`;
+ });
+
+ const tempDirToolTips = computed(() => {
+ if (isWindowsPath.value) {
+ return t('临时目录提示文案').replaceAll('/', '\\');
+ }
+ return t('临时目录提示文案');
+ });
+
watch(formData.value, () => {
sendAll();
+ // tempDirPathType(formData.value.tempDir);
});
onMounted(() => {
From 9a7079628bd2056b3140b7adc14d963583558ca7 Mon Sep 17 00:00:00 2001
From: q15971095971 <764419406@qq.com>
Date: Sat, 12 Oct 2024 17:59:39 +0800
Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E7=A4=BA?=
=?UTF-8?q?=E4=BE=8B=E6=B7=BB=E5=8A=A0windows=E8=B7=AF=E5=BE=84=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E9=9C=80=E6=B1=82done--story=3D119618143?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ui/src/assets/example-data/file-cmd.yaml | 1 -
bcs-services/bcs-bscp/ui/src/i18n/en-us.ts | 7 +-
bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts | 5 ++
.../components/content/cmd-example.vue | 78 +++++++++++++++++--
.../components/content/container-example.vue | 10 +--
.../components/content/node-mana-example.vue | 20 -----
.../client/example/components/form-option.vue | 16 ++--
7 files changed, 97 insertions(+), 40 deletions(-)
diff --git a/bcs-services/bcs-bscp/ui/src/assets/example-data/file-cmd.yaml b/bcs-services/bcs-bscp/ui/src/assets/example-data/file-cmd.yaml
index 9992b38f4b..ba949713f5 100644
--- a/bcs-services/bcs-bscp/ui/src/assets/example-data/file-cmd.yaml
+++ b/bcs-services/bcs-bscp/ui/src/assets/example-data/file-cmd.yaml
@@ -13,6 +13,5 @@ labels: {{ .Bk_Bscp_Variable_Leabels }}
# 临时目录,在拉取配置文件时,用于存储配置文件的目录,默认为:/data/bscp,可根据实际情况调整
temp_dir: {{ .Bk_Bscp_VariableTempDir }}
-
{{ .Bk_Bscp_Variable_Rules }}
EOF
\ No newline at end of file
diff --git a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
index 487c934eee..6aaf6ef16d 100644
--- a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
+++ b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
@@ -831,6 +831,7 @@ export default {
'如果没有安装 GO,可以通过浏览器手动下载,建议下载最新版本': 'If GO is not installed, you can download it manually through the browser. You are advised to download the latest version',
'下载地址:': 'download url',
'为命令行工具创建所需的配置文件bscp.yaml,请复制以下命令并在与该命令行工具相同的目录下执行': 'Create the necessary configuration file bscp.yaml for the command-line tool. Please copy the following command and execute it in the directory where the command-line tool resides',
+ '为命令行工具创建所需的配置文件bscp.yaml': 'Create the necessary configuration file bscp.yaml for the command-line tool',
获取业务下的服务列表: 'Get the service list of the service',
拉取服务下所有配置文件: 'Pull all configuration files under the service',
获取服务下所有配置文件列表: 'Obtain a list of all configuration files for the service',
@@ -848,13 +849,16 @@ export default {
复制成功: 'Copy Successful',
'下载配置文件时,保留目录层级,并将其保存到指定目录下,例如:将 /etc/nginx.conf 文件下载到 /tmp 目录时,文件保存在 /tmp/etc/nginx.conf': 'When downloading configuration files, preserve directory structure and save them to a specified directory. For example, downloading the file /etc/nginx.conf to the /tmp directory would save it as /tmp/etc/nginx.conf',
'下载配置文件时,不保留目录层级,并将其保存到指定目录下,例如:将 /etc/nginx.conf 文件下载到 /tmp 目录时,文件保存在 /tmp/nginx.conf': 'When downloading configuration files, do not preserve directory structure and save them directly to a specified directory. For example, downloading the file /etc/nginx.conf to the /tmp directory would save it as /tmp/nginx.conf',
+ '下载配置文件时,保留目录层级,并将其保存到指定目录下,例如:将 \\etc\\nginx.conf 文件下载到当前目录时,文件保存在 .\\etc\\nginx.conf': 'When downloading the configuration file, retain the directory structure and save it to a specified directory. For example, when downloading the \\etc\\nginx.conf file to the current directory, it should be saved as .\\etc\\nginx.conf',
+ '下载配置文件时,不保留目录层级,并将其保存到指定目录下,例如:将 \\etc\\nginx.conf 文件下载到当前目录时,文件保存在 .\\nginx.conf': 'When downloading the configuration file, do not retain the directory structure and save it to a specified directory. For example, when downloading the \\etc\\nginx.conf file to the current directory, it should be saved as .\\nginx.conf',
'BSCP Python SDK依赖说明': 'dependency instructions in the BSCP Python SDK',
'用于主动获取配置项值的场景,此方法不会监听服务器端的配置更改,有关Python SDK的部署环境和依赖组件,请参阅白皮书中的': 'For scenarios where configuration values are actively retrieved, this method does not monitor server-side configuration changes. For information on the deployment environment and dependent components of the Python SDK, please refer to the',
'通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景,有关Python SDK的部署环境和依赖组件,请参阅白皮书中的': 'By establishing a persistent connection, real-time changes to configuration versions are monitored. When a new version of configuration is released, the callback method is automatically invoked to handle the new configuration information. This method is suitable for scenarios requiring real-time response to configuration changes. For information on the deployment environment and dependent components of the Python SDK, please refer to the',
'用于主动获取配置项值的场景,此方法不会监听服务器端的配置更改\n有关Python SDK的部署环境和依赖组件,请参阅白皮书中的 [BSCP Python SDK依赖说明]': 'For scenarios where configuration values are actively retrieved, this method does not monitor server-side configuration changes\nFor information on the deployment environment and dependent components of the Python SDK, please refer to the [dependency instructions in the BSCP Python SDK]',
'通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景\n有关Python SDK的部署环境和依赖组件,请参阅白皮书中的 [BSCP Python SDK依赖说明]': 'By establishing a persistent connection, real-time changes to configuration versions are monitored. When a new version of configuration is released, the callback method is automatically invoked to handle the new configuration information. This method is suitable for scenarios requiring real-time response to configuration changes\nFor information on the deployment environment and dependent components of the Python SDK, please refer to the [dependency instructions in the BSCP Python SDK]',
'请将 {{ YOUR_KEY }} 替换为您的实际 Key': 'Please replace {\'{{ YOUR_KEY }}\'} with your actual key',
- 复制命令: 'Command Copy',
+ 复制命令: 'Copy',
+ 复制配置: 'Copy',
'仅支持字母,数字,\'-\',\'_\',\'.\' 及 \'/\' 且需以字母数字开头和结尾': 'Only supports letters, numbers, \'-\', \'_\', \'.\' and \'/\' characters, and must start and end with a letter or number',
'需以字母、数字开头和结尾,可包含 \'-\',\'_\',\'.\' 和字母数字及负数': 'Must start and end with a letter or number, can include \'-\', \'_\', \'.\', and alphanumeric characters, as well as negative numbers',
服务标签: 'Service label',
@@ -884,6 +888,7 @@ export default {
'全局配置文件筛选:': 'Global Configuration File Filter:',
'(全局配置文件筛选与服务配置文件筛选一样,不同的是全局配置文件筛选可供多个服务共用)': '(The filtering of the global configuration file is the same as that of the service configuration file; the difference is that the global configuration file can be shared among multiple services)',
配置筛选规则: 'Configuration filtering rules',
+ '服务feed-server地址:': 'The address of the feed-server service:',
// 公共组件
页面不存在: 'Page does not exist',
diff --git a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
index b45dc77892..29831f0f6b 100644
--- a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
+++ b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
@@ -835,6 +835,7 @@ export default {
'如果没有安装 GO,可以通过浏览器手动下载,建议下载最新版本': '如果没有安装 GO,可以通过浏览器手动下载,建议下载最新版本',
'下载地址:': '下载地址:',
'为命令行工具创建所需的配置文件bscp.yaml,请复制以下命令并在与该命令行工具相同的目录下执行': '为命令行工具创建所需的配置文件bscp.yaml,请复制以下命令并在与该命令行工具相同的目录下执行',
+ '为命令行工具创建所需的配置文件bscp.yaml': '为命令行工具创建所需的配置文件bscp.yaml',
获取业务下的服务列表: '获取业务下的服务列表',
拉取服务下所有配置文件: '拉取服务下所有配置文件',
获取服务下所有配置文件列表: '获取服务下所有配置文件列表',
@@ -852,6 +853,8 @@ export default {
复制成功: '复制成功',
'下载配置文件时,保留目录层级,并将其保存到指定目录下,例如:将 /etc/nginx.conf 文件下载到 /tmp 目录时,文件保存在 /tmp/etc/nginx.conf': '下载配置文件时,保留目录层级,并将其保存到指定目录下,例如:将 /etc/nginx.conf 文件下载到 /tmp 目录时,文件保存在 /tmp/etc/nginx.conf',
'下载配置文件时,不保留目录层级,并将其保存到指定目录下,例如:将 /etc/nginx.conf 文件下载到 /tmp 目录时,文件保存在 /tmp/nginx.conf': '下载配置文件时,不保留目录层级,并将其保存到指定目录下,例如:将 /etc/nginx.conf 文件下载到 /tmp 目录时,文件保存在 /tmp/nginx.conf',
+ '下载配置文件时,保留目录层级,并将其保存到指定目录下,例如:将 \\etc\\nginx.conf 文件下载到当前目录时,文件保存在 .\\etc\\nginx.conf': '下载配置文件时,保留目录层级,并将其保存到指定目录下,例如:将 \\etc\\nginx.conf 文件下载到当前目录时,文件保存在 .\\etc\\nginx.conf',
+ '下载配置文件时,不保留目录层级,并将其保存到指定目录下,例如:将 \\etc\\nginx.conf 文件下载到当前目录时,文件保存在 .\\nginx.conf': '下载配置文件时,不保留目录层级,并将其保存到指定目录下,例如:将 \\etc\\nginx.conf 文件下载到当前目录时,文件保存在 .\\nginx.conf',
'BSCP Python SDK依赖说明': 'BSCP Python SDK依赖说明',
'用于主动获取配置项值的场景,此方法不会监听服务器端的配置更改,有关Python SDK的部署环境和依赖组件,请参阅白皮书中的': '用于主动获取配置项值的场景,此方法不会监听服务器端的配置更改,有关Python SDK的部署环境和依赖组件,请参阅白皮书中的',
'通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景,有关Python SDK的部署环境和依赖组件,请参阅白皮书中的': '通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景,有关Python SDK的部署环境和依赖组件,请参阅白皮书中的',
@@ -859,6 +862,7 @@ export default {
'通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景\n有关Python SDK的部署环境和依赖组件,请参阅白皮书中的 [BSCP Python SDK依赖说明]': '通过建立长连接,实时监听配置版本的变更,当新版本的配置发布时,将自动调用回调方法处理新的配置信息,适用于需要实时响应配置变更的场景\n有关Python SDK的部署环境和依赖组件,请参阅白皮书中的 [BSCP Python SDK依赖说明]',
'请将 {{ YOUR_KEY }} 替换为您的实际 Key': '请将 {\'{{ YOUR_KEY }}\'} 替换为您的实际 Key',
复制命令: '复制命令',
+ 复制配置: '复制配置',
'仅支持字母,数字,\'-\',\'_\',\'.\' 及 \'/\' 且需以字母数字开头和结尾': '仅支持字母,数字,\'-\',\'_\',\'.\' 及 \'/\' 且需以字母数字开头和结尾',
'需以字母、数字开头和结尾,可包含 \'-\',\'_\',\'.\' 和字母数字及负数': '需以字母、数字开头和结尾,可包含 \'-\',\'_\',\'.\' 和字母数字及负数',
服务标签: '服务标签',
@@ -887,6 +891,7 @@ export default {
'全局配置文件筛选:': '全局配置文件筛选:',
'(全局配置文件筛选与服务配置文件筛选一样,不同的是全局配置文件筛选可供多个服务共用)': '全局配置文件筛选与服务配置文件筛选一样,不同的是全局配置文件筛选可供多个服务共用',
配置筛选规则: '配置筛选规则',
+ '服务feed-server地址:': '服务feed-server地址:',
// 公共组件
页面不存在: '页面不存在',
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/cmd-example.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/cmd-example.vue
index c42c660193..c84465409c 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/cmd-example.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/cmd-example.vue
@@ -4,23 +4,28 @@
ref="fileOptionRef"
:directory-show="basicInfo!.serviceType.value === 'file'"
:associate-config-show="basicInfo!.serviceType.value === 'file'"
+ :dual-system-support="true"
+ @is-windows-path="isWindowsPath = $event"
@update-option-data="getOptionData" />
{{ $t('配置指引与示例预览') }}
-
+
{{ `${index + 1}. ${item.title}` }}
{{ item.value }}
- {{ $t('复制命令') }}
+
+ {{ $t(isWindowsPath ? '复制配置' : '复制命令') }}
+
();
+ const isWindowsPath = ref(false);
// fileOption组件传递过来的数据汇总
const optionData = ref({
clientKey: '',
@@ -151,7 +197,13 @@
});
const cmdContent = computed(() => {
- return basicInfo!.serviceType.value === 'file' ? fileText : kvText;
+ if (basicInfo!.serviceType.value === 'file') {
+ if (isWindowsPath.value) {
+ return windowsFileText; // 文件型-windows路径提示文案
+ }
+ return fileText; // 文件型-unix路径提示文案
+ }
+ return kvText;
});
onMounted(async () => {
@@ -183,14 +235,20 @@
// 文件配置筛选规则动态增/删
if (optionData.value.rules?.length) {
const rulesPart = `
- # 当客户端无需拉取配置服务中的全量配置文件时,指定相应的通配符,可仅拉取客户端所需的文件,支持多个通配符
+# 当客户端无需拉取配置服务中的全量配置文件时,指定相应的通配符,可仅拉取客户端所需的文件,支持多个通配符
config_matches: {{ .Bk_Bscp_Variable_Rules_Value }}`;
- updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules }}', rulesPart.trim());
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules }}', rulesPart);
} else {
- updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules }}', '');
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules }}', 'delete');
+ // updateString = updateString.replaceAll('\r\n{{ .Bk_Bscp_Variable_Rules }}', '');
+ }
+ // 临时目录为windows路径时去除首尾两行
+ if (isWindowsPath.value) {
+ // updateString = updateString.replaceAll('cat << EOF > ./bscp.yaml\r\n', '').replaceAll('\r\nEOF', '');
+ updateString = updateString.replaceAll('cat << EOF > ./bscp.yaml', 'delete').replaceAll('EOF', 'delete');
}
// 去除 动态插入的值为空的情况下产生的空白行
- replaceVal.value = updateString.replaceAll(/\r\n\s+\r\n/g, '\n');
+ replaceVal.value = updateString.replaceAll(/(delete\r?\n|\r?\ndelete)/g, '');
};
const updateVariables = () => {
variables.value = [
@@ -330,5 +388,11 @@ config_matches: {{ .Bk_Bscp_Variable_Rules_Value }}`;
&.rules-height {
height: 394px;
}
+ &.windows-path-height {
+ height: 298px;
+ }
+ &.rules-height.windows-path-height {
+ height: 356px;
+ }
}
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/container-example.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/container-example.vue
index 182decae98..db42c547c0 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/container-example.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/container-example.vue
@@ -102,8 +102,8 @@
fieldRef:
apiVersion: v1
fieldPath: metadata.uid`;
- updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part1 }}', p2pPart1.trim());
- updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part2 }}', p2pPart2.trim());
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part1 }}', p2pPart1);
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part2 }}', p2pPart2);
} else {
updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part1 }}', '');
updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part2 }}', '');
@@ -118,14 +118,14 @@
const rulesPart2 = `
- name: config_matches
value: {{ .Bk_Bscp_Variable_Rules_Value }}`;
- updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules1 }}', rulesPart1.trim());
- updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules2 }}', rulesPart2.trim());
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules1 }}', rulesPart1);
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules2 }}', rulesPart2);
} else {
updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules1 }}', '');
updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules2 }}', '');
}
// 去除 动态插入的值为空的情况下产生的空白行
- replaceVal.value = updateString.replaceAll(/\r\n\s+\r\n/g, '\n');
+ replaceVal.value = updateString.replaceAll(/\r?\n\s+\r?\n/g, '\n');
};
// 高亮配置
const updateVariables = () => {
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
index b42221a653..dcb93900d0 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
@@ -133,7 +133,6 @@
'^[a-z0-9A-Z]([-_a-z0-9A-Z]*[a-z0-9A-Z])?((\\.|\\/)[a-z0-9A-Z]([-_a-z0-9A-Z]*[a-z0-9A-Z])?)*$',
);
const valueValidateReg = new RegExp(/^(?:-?\d+(\.\d+)?|[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?)$/);
- const sysDirectories: string[] = ['/bin', '/boot', '/dev', '/lib', '/lib64', '/proc', '/run', '/sbin', '/sys'];
const fileOptionRef = ref();
const bizId = ref(String(route.params.spaceId));
@@ -149,7 +148,6 @@
const getOptionData = async (data: any) => {
let labelArr = [];
- let tempDir = data.tempDir;
// 标签展示方式加工
if (data.labelArr.length) {
labelArr = data.labelArr.map((item: string) => {
@@ -161,26 +159,8 @@
return { key, value };
});
}
- // 临时目录展示方式加工
- if (tempDir) {
- if (sysDirectories.some((dir) => tempDir === dir || tempDir.startsWith(`${dir}/`))) {
- tempDir = '';
- }
- if (!tempDir.startsWith('/') || tempDir.endsWith('/')) {
- tempDir = '';
- }
- const parts = tempDir.split('/').slice(1);
- parts.some((part: string) => {
- if (part.startsWith('.') || !/^[\u4e00-\u9fa5A-Za-z0-9.\-_#%,@^+=\\[\]{}]+$/.test(part)) {
- tempDir = '';
- return true;
- }
- return false;
- });
- }
optionData.value = {
...data,
- tempDir,
labelArr,
};
};
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
index 8875c26c2b..6524faf2da 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
@@ -23,7 +23,11 @@
placement: 'top',
}" />
-
+
@@ -105,10 +109,6 @@
httpConfigShow?: boolean; // 配置项名称(Python SDK、http(s)接口调用)
associateConfigShow?: boolean; // 配置文件筛选功能(所有文件型)
dualSystemSupport?: boolean; // Unix与windows双系统支持(节点管理插件与文件型命令行工具)
- directoryShow?: boolean;
- p2pShow?: boolean;
- httpConfigShow?: boolean;
- associateConfigShow?: boolean;
}>(),
{
directoryShow: true,
@@ -119,7 +119,7 @@
},
);
- const emits = defineEmits(['update-option-data']);
+ const emits = defineEmits(['update-option-data', 'is-windows-path']);
const { t } = useI18n();
const route = useRoute();
@@ -303,6 +303,10 @@
const sendAll = () => {
const filterFormData = cloneDeep(formData.value);
+ // 临时目录不合法的路径不发送
+ if (!tempDirValidateStatus.value) {
+ filterFormData.tempDir = '';
+ }
emits('update-option-data', filterFormData);
};