From bd418cb142b0c0d710b1b0a1946c5cedadc3f420 Mon Sep 17 00:00:00 2001 From: Yuikill <1191184301@qq.com> Date: Wed, 28 Feb 2024 16:32:00 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=96=B0=E5=BB=BA=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E6=94=AF=E6=8C=81=E5=8F=98=E9=87=8F=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= 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 | 8 ++ bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts | 8 ++ .../scripts/components/internal-variable.vue | 121 ++++++++++++++++++ .../scripts/components/script-editor.vue | 41 +++++- .../space/scripts/list/create-script.vue | 29 ++++- 5 files changed, 197 insertions(+), 10 deletions(-) create mode 100644 bcs-services/bcs-bscp/ui/src/views/space/scripts/components/internal-variable.vue 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 c40fa29a69..c83414ad07 100644 --- a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts +++ b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts @@ -519,6 +519,14 @@ export default { 脚本类型: 'Script type', form_版本号: 'Version number', 上线版本成功: 'Online version successful', + 内置变量: 'Internal variables', + '客户端配置的配置存放临时目录(temp_dir),默认值为 /data/bscp': 'The client configuration directory is temp dir. The default value is /data/bscp', + '蓝鲸配置平台上的业务ID,例如:2': 'Service ID on the bscp, for example, 2', + '服务配置中心上的服务名称,例如:demo_service': 'bscp service name, for example, demo service', + '单个客户端可使用多个服务的配置,为保证路径唯一,服务配置需存放于:配置根目录/业务ID/服务名称,服务配置存放目录 = 配置存放根目录/业务ID/服务名称': 'A client can use multiple service configurations. To ensure a unique path, service configurations must be saved in the following directory: Configuration root directory/service ID/ service name. Service configuration directory = Configuration root directory/service ID/ service name', + 配置根目录: 'Configuring the root directory', + 业务ID: 'BusinessID', + 服务配置目录: 'Service configuration directory', // 服务密钥 '密钥仅用于 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', 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 4ff5a804f2..7e178af1d0 100644 --- a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts +++ b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts @@ -519,6 +519,14 @@ export default { 脚本类型: '脚本类型', form_版本号: '版本号', 上线版本成功: '上线版本成功', + 内置变量: '内置变量', + '客户端配置的配置存放临时目录(temp_dir),默认值为 /data/bscp': '客户端配置的配置存放临时目录(temp_dir),默认值为 /data/bscp', + '蓝鲸配置平台上的业务ID,例如:2': '蓝鲸配置平台上的业务ID,例如:2', + '服务配置中心上的服务名称,例如:demo_service': '服务配置中心上的服务名称,例如:demo_service', + '单个客户端可使用多个服务的配置,为保证路径唯一,服务配置需存放于:配置根目录/业务ID/服务名称,服务配置存放目录 = 配置存放根目录/业务ID/服务名称': '单个客户端可使用多个服务的配置,为保证路径唯一,服务配置需存放于:配置根目录/业务ID/服务名称,服务配置存放目录 = 配置存放根目录/业务ID/服务名称', + 配置根目录: '配置根目录', + 业务ID: '业务ID', + 服务配置目录: '服务配置目录', // 服务密钥 '密钥仅用于 SDK/API 拉取配置使用。服务管理/配置管理/分组管理等功能的权限申请,请前往': '密钥仅用于 SDK/API 拉取配置使用。服务管理/配置管理/分组管理等功能的权限申请,请前往', diff --git a/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/internal-variable.vue b/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/internal-variable.vue new file mode 100644 index 0000000000..ff86e55461 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/internal-variable.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/script-editor.vue b/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/script-editor.vue index 3b64938b8d..69f3eea8e6 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/script-editor.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/script-editor.vue @@ -6,6 +6,14 @@
+ +
@@ -60,6 +69,7 @@ const props = withDefaults( defineProps<{ modelValue: string; + isShowVariable?: boolean; language?: string; editable?: boolean; uploadIcon?: boolean; @@ -70,7 +80,7 @@ }, ); - const emits = defineEmits(['update:modelValue']); + const emits = defineEmits(['update:modelValue', 'update:isShowVariable']); const isOpenFullScreen = ref(false); @@ -122,11 +132,15 @@ .head-title { flex: 1; } - .action-icon { - color: #979ba5; - cursor: pointer; - &:hover { - color: #3a84ff; + .actions { + display: flex; + align-items: center; + .action-icon { + color: #979ba5; + cursor: pointer; + &:hover { + color: #3a84ff; + } } } } @@ -136,4 +150,19 @@ .pre-content { height: 100%; } + .bk-bscp-icon { + display: inline-flex; + align-items: center; + justify-content: center; + width: 24px; + height: 24px; + margin-right: 10px; + color: #979ba5; + cursor: pointer; + } + .show-var { + background: #000000; + border-radius: 2px; + color: #bdbfc5; + } diff --git a/bcs-services/bcs-bscp/ui/src/views/space/scripts/list/create-script.vue b/bcs-services/bcs-bscp/ui/src/views/space/scripts/list/create-script.vue index b8d073a464..3658deef3a 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/scripts/list/create-script.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/scripts/list/create-script.vue @@ -32,8 +32,8 @@ -
- +
+ +
@@ -69,6 +72,7 @@ import { createScript, getScriptTagList } from '../../../../api/script'; import DetailLayout from '../components/detail-layout.vue'; import ScriptEditor from '../components/script-editor.vue'; + import InternalVariable from '../components/internal-variable.vue'; import dayjs from 'dayjs'; const { spaceId } = storeToRefs(useGlobalStore()); @@ -95,8 +99,8 @@ revision_name: `v${dayjs().format('YYYYMMDDHHmmss')}`, }); const formDataContent = ref({ - shell: '#!/bin/bash', - python: '#!/usr/bin/env python\n# -*- coding: utf8 -*-', + shell: '#!/bin/bash\n##### 进入配置文件存放目录: cd ${bk_bscp_app_temp_dir}/files\n##### 进入前/后置脚本存放目录: cd ${bk_bscp_app_temp_dir}/hooks', + python: '#!/usr/bin/env python\n# -*- coding: utf8 -*-\n##### 进入配置文件存放目录: config_dir = os.environ.get(‘bk_bscp_app_temp_dir’)+”/files”;os.chdir(config_dir)\n##### 进入前/后置脚本存放目录: hook_dir = os.environ.get(‘bk_bscp_app_temp_dir’)+”/hooks”;os.chdir(hook_dir)', }); const showContent = computed({ get: () => (formData.value.type === 'shell' ? formDataContent.value.shell : formDataContent.value.python), @@ -104,6 +108,7 @@ formData.value.type === 'shell' ? (formDataContent.value.shell = val) : (formDataContent.value.python = val); }, }); + const isShowVariable = ref(true); const rules = { name: [ @@ -189,6 +194,13 @@ .script-content-wrapper { min-width: 520px; } + .show-variable { + :deep(.script-editor) { + .code-editor-wrapper { + width: calc(100% - 272px); + } + } + } .language-tabs { display: flex; @@ -215,4 +227,13 @@ min-width: 88px; } } + + :deep(.script-editor) { + .content-wrapper { + display: flex; + } + .code-editor-wrapper { + width: 100%; + } + } From a1f5a6cde6ad05faf57be5777f1321e9c8294992 Mon Sep 17 00:00:00 2001 From: Yuikill <1191184301@qq.com> Date: Thu, 29 Feb 2024 16:27:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E7=89=88=E6=9C=AC=E5=8F=B7=E4=B8=BA=E5=BF=85?= =?UTF-8?q?=E5=A1=AB=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bcs-bscp/ui/src/views/space/scripts/list/create-script.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bcs-services/bcs-bscp/ui/src/views/space/scripts/list/create-script.vue b/bcs-services/bcs-bscp/ui/src/views/space/scripts/list/create-script.vue index 3658deef3a..ca091cd27b 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/scripts/list/create-script.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/scripts/list/create-script.vue @@ -28,7 +28,7 @@ :maxlength="200" :resize="true" /> - + From fe91115c2536aad15b867960f11c68145c1bc464 Mon Sep 17 00:00:00 2001 From: Yuikill <1191184301@qq.com> Date: Thu, 29 Feb 2024 17:52:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E6=9B=BF=E6=8D=A2=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bcs-services/bcs-bscp/ui/src/components/diff/navigator.vue | 1 - .../ui/src/views/space/scripts/components/script-editor.vue | 3 ++- .../views/space/service/detail/components/service-selector.vue | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bcs-services/bcs-bscp/ui/src/components/diff/navigator.vue b/bcs-services/bcs-bscp/ui/src/components/diff/navigator.vue index f1f708285d..2541c8dedb 100644 --- a/bcs-services/bcs-bscp/ui/src/components/diff/navigator.vue +++ b/bcs-services/bcs-bscp/ui/src/components/diff/navigator.vue @@ -155,7 +155,6 @@ background: #63656e; border-radius: 2px; .number { - font-family: MicrosoftYaHei; font-size: 12px; color: #c4c6cc; } diff --git a/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/script-editor.vue b/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/script-editor.vue index 69f3eea8e6..83f29891e0 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/script-editor.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/scripts/components/script-editor.vue @@ -12,7 +12,7 @@ placement: 'top', distance: 20, }" - :class="['bk-bscp-icon', 'icon-kv', { 'show-var': isShowVariable }]" + :class="['bk-bscp-icon', 'icon-variable', { 'show-var': isShowVariable }]" @click="emits('update:isShowVariable',!isShowVariable)">