Skip to content

Commit e45b596

Browse files
feat: 创建沙箱,添加使用的增强服务选项 (#2364)
1 parent 48607d8 commit e45b596

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

webfe/package_vue/src/language/lang/en.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,4 +3056,6 @@ export default {
30563056
'敏感环境变量的值将在页面上以脱敏形式展示,只有应用进程内能够获取到这些变量的明文值。': 'The values of sensitive environment variables will be displayed in a desensitized form on the page; only within the application process can these variables plaintext values be accessed.',
30573057
是否敏感: 'Is Sensitive',
30583058
其他: 'Other',
3059+
使用的增强服务: 'Used Enhanced Services',
3060+
'沙箱会复用已选中增强服务 “预发布环境” 的环境变量': 'The sandbox will reuse the environment variables of the selected enhanced services "Staging Env"',
30593061
};

webfe/package_vue/src/language/lang/zh.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,4 +3178,6 @@ export default {
31783178
'敏感环境变量的值将在页面上以脱敏形式展示,只有应用进程内能够获取到这些变量的明文值。': '敏感环境变量的值将在页面上以脱敏形式展示,只有应用进程内能够获取到这些变量的明文值。',
31793179
是否敏感: '是否敏感',
31803180
其他: '其他',
3181+
使用的增强服务: '使用的增强服务',
3182+
'沙箱会复用已选中增强服务 “预发布环境” 的环境变量': '沙箱会复用已选中增强服务 “预发布环境” 的环境变量',
31813183
};

webfe/package_vue/src/views/dev-center/app/engine/cloud-deploy-manage/comps/sandbox-sideslider.vue

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,29 @@
207207
{{ $t('仅支持通过代码分支创建沙箱,不支持选择 Tag') }}
208208
</p>
209209
</bk-form-item>
210+
<bk-form-item :label="$t('使用的增强服务')">
211+
<bk-select
212+
style="height: 100%"
213+
v-model="servicesConfig.list"
214+
:loading="servicesConfig.loading"
215+
searchable
216+
multiple
217+
display-tag
218+
>
219+
<bk-option
220+
v-for="option in servicesConfig.servicelist"
221+
:key="option?.service?.name"
222+
:id="option?.service?.name"
223+
:name="option?.service?.name"
224+
></bk-option>
225+
</bk-select>
226+
<p
227+
class="dialog-tip"
228+
slot="tip"
229+
>
230+
{{ $t('沙箱会复用已选中增强服务 “预发布环境” 的环境变量') }}
231+
</p>
232+
</bk-form-item>
210233
</bk-form>
211234
<!-- 错误提示 -->
212235
<div
@@ -288,6 +311,11 @@ export default {
288311
errorInfo: {},
289312
isShowErrorAlert: false,
290313
dataReady: false,
314+
servicesConfig: {
315+
list: [],
316+
servicelist: [],
317+
loading: false,
318+
},
291319
rules: {
292320
branch: [
293321
{
@@ -460,6 +488,7 @@ export default {
460488
this.insufficientResourcesNotify();
461489
return;
462490
}
491+
this.getServices(row.name);
463492
this.sandboxDialog.visible = true;
464493
this.sandboxDialog.name = row.name;
465494
this.sandboxDialog.branch = '';
@@ -488,6 +517,7 @@ export default {
488517
version_type: curBranchData.type,
489518
version_name: curBranchData.name,
490519
},
520+
enabled_addons_services: this.servicesConfig.list,
491521
};
492522
const ret = await this.$store.dispatch('sandbox/createSandbox', {
493523
appCode: this.appCode,
@@ -513,6 +543,26 @@ export default {
513543
const route = this.$router.resolve({ name: 'serviceCode' });
514544
window.open(route.href, '_blank');
515545
},
546+
// 获取增强服务
547+
async getServices(moduleId) {
548+
this.servicesConfig.loading = true;
549+
try {
550+
const { bound = [], shared = [] } = await this.$store.dispatch('service/getServicesList', {
551+
appCode: this.appCode,
552+
moduleId,
553+
});
554+
const enabledServices = [...bound, ...shared];
555+
this.servicesConfig = {
556+
...this.servicesConfig,
557+
servicelist: enabledServices,
558+
list: enabledServices.map((item) => item.service?.name),
559+
};
560+
} catch (e) {
561+
this.catchErrorHandler(e);
562+
} finally {
563+
this.servicesConfig.loading = false;
564+
}
565+
},
516566
},
517567
};
518568
</script>

0 commit comments

Comments
 (0)