Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 体验提单修复 #1335

Merged
merged 8 commits into from
May 28, 2024
1 change: 1 addition & 0 deletions webfe/package_vue/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -2595,4 +2595,5 @@ export default {
'增强服务实例已分配,不能再修改配置信息': 'The enhanced service instance has been allocated and configuration information cannot be modified anymore.',
新建测试版本: 'Create Test Version',
提交并开始测试: 'Submit and Start Testing',
'环境变量不生效,KEY 与{s}增强服务的内置环境变量冲突': 'Environmental variables do not take effect, KEY conflicts with the built-in environmental variables of the {s} enhanced service',
};
1 change: 1 addition & 0 deletions webfe/package_vue/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -2735,4 +2735,5 @@ export default {
'增强服务实例已分配,不能再修改配置信息': '增强服务实例已分配,不能再修改配置信息',
新建测试版本: '新建测试版本',
提交并开始测试: '提交并开始测试',
'环境变量不生效,KEY 与{s}增强服务的内置环境变量冲突': '环境变量不生效,KEY 与{s}增强服务的内置环境变量冲突',
};
61 changes: 34 additions & 27 deletions webfe/package_vue/src/store/modules/var.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,93 +28,100 @@ export default {
mutations: {},
actions: {
/**
* 获取所有运行时基础镜像
*/
getAllImages({ }, { appCode, moduleId }) {
* 获取所有运行时基础镜像
*/
getAllImages({}, { appCode, moduleId }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/runtime/list/`;
return http.get(url);
},

/**
* 获取运行时基础信息
*/
getRuntimeInfo({ }, { appCode, moduleId }) {
* 获取运行时基础信息
*/
getRuntimeInfo({}, { appCode, moduleId }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/runtime/`;
return http.get(url);
},

/**
* 保存运行时基础信息
*/
updateRuntimeInfo({ }, { appCode, moduleId, data }) {
* 保存运行时基础信息
*/
updateRuntimeInfo({}, { appCode, moduleId, data }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/runtime/`;
return http.post(url, data);
},

/**
* 从模块导入环境变量
* @param {Object} params 包括appCode, moduleId, sourceModuleName
*/
exportModuleEnv({ }, { appCode, moduleId, sourceModuleName }) {
* 从模块导入环境变量
* @param {Object} params 包括appCode, moduleId, sourceModuleName
*/
exportModuleEnv({}, { appCode, moduleId, sourceModuleName }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/config_vars/clone_from/${sourceModuleName}`;
return http.post(url, {});
},

/**
* 应用基本信息
*/
getBasicInfo({ }, { appCode }) {
* 应用基本信息
*/
getBasicInfo({}, { appCode }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/config_vars/builtin/app/`;
return http.get(url);
},

/**
* 应用运行时信息
*/
getBkPlatformInfo({ }, { appCode }) {
* 应用运行时信息
*/
getBkPlatformInfo({}, { appCode }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/config_vars/builtin/bk_platform/`;
return http.get(url);
},

/**
* 蓝鲸体系内平台信息
*/
getAppRuntimeInfo({ }, { appCode }) {
* 蓝鲸体系内平台信息
*/
getAppRuntimeInfo({}, { appCode }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/config_vars/builtin/runtime/`;
return http.get(url);
},


/**
* 保存环境变量数据
*/
saveEnvItem({ }, { appCode, moduleId, data }) {
saveEnvItem({}, { appCode, moduleId, data }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/config_vars/batch/`;
return http.post(url, data);
},

/**
* 新增单个环境变量
*/
createdEnvVariable({ }, { appCode, moduleId, data }) {
createdEnvVariable({}, { appCode, moduleId, data }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/config_vars/`;
return http.post(url, data);
},

/**
* 修改单个环境变量
*/
updateEnvVariable({ }, { appCode, moduleId, varId, data }) {
updateEnvVariable({}, { appCode, moduleId, varId, data }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/config_vars/${varId}/`;
return http.put(url, data);
},

/**
* 删除单个环境变量
*/
deleteEnvVariable({ }, { appCode, moduleId, varId }) {
deleteEnvVariable({}, { appCode, moduleId, varId }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/config_vars/${varId}/`;
return http.delete(url, {});
},

/**
* 获取增强服务内置环境变量
*/
getConfigVarKeys({}, { appCode, moduleId }) {
const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/services/config_var_keys/`;
return http.get(url, {});
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -983,17 +983,17 @@ export default {
watch: {
appInfo() {
// 云原生应用无需请求模块接口
if (this.curAppModule.repo && this.curAppModule.repo.type) {
if (!this.isCloudNativeApp) {
this.init();
}
},
'$route'() {
this.resetParams();
if (this.curAppModule.repo && this.curAppModule.repo.type) {
if (!this.isCloudNativeApp) {
this.init();
}
},
'curAppModule.name'(val) {
'curAppModule.name'() {
this.getLessCode();
},
'curAppModule.repo'(repo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,10 @@ export default {
this.isLoading = false;
}
},
// 排序
sortingRules(a, b) {
return new Date(b.last_update).getTime() - new Date(a.last_update).getTime();
},
async getModuleBranches(favBranchName) {
this.isBranchesLoading = true;
this.branchErrorTips = '';
Expand All @@ -771,10 +775,14 @@ export default {
moduleId: this.curModuleId,
});

// last_update有值,根据时间排序
if (res.results[0]?.last_update) {
res.results.sort(this.sortingRules);
}

// Smart 应用(预发布/生产)显示最新分支
if (this.isSmartApp) {
const sortList = res.results.sort(this.sortData);
this.branchValue = `${sortList[0].type}:${sortList[0].name}`;
this.branchValue = res.results.length ? `${res.results[0]?.type}:${res.results[0]?.name}` : '';
}
this.branchesData = res.results;
const branchesList = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export default {
theme: 'light',
content: '#switcher-tooltip',
placement: 'bottom',
extCls: 'tips-cls',
extCls: 'services-tips-cls',
},
startData: [{ value: 'start', label: this.$t('直接启用') }, { value: 'shared', label: this.$t('从其他模块共享') }],
isShowDialog: false,
Expand Down Expand Up @@ -796,7 +796,6 @@ export default {
}
}
#switcher-tooltip{
padding: 4px 0px;
border: 1px solid #DCDEE5;
border-radius: 2px;
.item{
Expand All @@ -809,16 +808,23 @@ export default {
&:hover {
background: #F5F7FA;
}
&:first-child {
margin-top: 4px;
}
&:last-child {
margin-bottom: 4px;
}
}
}

</style>
<style lang="scss">
.tips-cls{
.services-tips-cls{
.tippy-arrow{
display: none !important;
}
.tippy-tooltip{
.tippy-tooltip,
.tippy-content{
padding: 0 !important;
}
}
Expand Down
Loading