Skip to content

Commit

Permalink
fix: 可见范围/灰度的组织添加 tof_id 字段 & 体验修复
Browse files Browse the repository at this point in the history
  • Loading branch information
leafage-collb committed Sep 11, 2024
1 parent 8b1915b commit 2d51cab
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 14 deletions.
10 changes: 8 additions & 2 deletions webfe/package_vue/src/components/user-selector/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,19 @@
white-space: nowrap;
vertical-align: top;
}
.delete-depart-icon {
.delete-depart-icon,
.disabled-del {
display: block;
width: 16px;
margin: 4px 6px 0 0;
margin-right: 6px;
cursor: pointer;
float: right;
}
.disabled-del {
cursor: not-allowed;
color: #e3e3e3;
transform: rotate(45deg);
}
}
.folder-icon {
position: relative;
Expand Down
32 changes: 30 additions & 2 deletions webfe/package_vue/src/components/user-selector/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,32 @@
<span class="user-count">0</span>
</template>
</div>
<bk-button theme="primary" text :disabled="!isShowSelectedText" @click="handleDeleteAll"> {{ $t('清空') }} </bk-button>
<!-- 是否允许清空 -->
<bk-button
theme="primary"
text
:disabled="clearable || !isShowSelectedText"
@click="handleDeleteAll">
{{ $t('清空') }}
</bk-button>
</div>
<div class="content">
<div class="organization-content" v-if="isDepartSelectedEmpty">
<div class="organization-item" v-for="item in hasSelectedDepartments" :key="item.id">
<img class="folder-icon" src="./images/file-close.svg" alt="">
<span class="organization-name" :title="item.name">{{ item.name }}</span>
<img class="delete-depart-icon" src="./images/delete-fill.svg" alt="" @click="handleDelete(item, 'organization')">
<!-- 禁用删除icon -->
<i
v-if="organizeDisableIconFn(item.id)"
class="paasng-icon paasng-plus-circle-shape disabled-del"
v-bk-tooltips="$t('扩大灰度范围不允许删除已经灰度过的组织')"
/>
<img
v-else
class="delete-depart-icon"
src="./images/delete-fill.svg"
@click="handleDelete(item, 'organization')"
/>
</div>
</div>
<div class="user-content" v-if="isUserSelectedEmpty">
Expand Down Expand Up @@ -200,6 +218,14 @@ export default {
departmentsFn: {
type: Function,
},
clearable: {
type: Boolean,
default: false,
},
organizeDisableIconFn: {
type: Function,
default: () => false,
},
},
data() {
return {
Expand Down Expand Up @@ -709,6 +735,8 @@ export default {
name: item.name,
id: item.id,
type: 'department',
// 兼容插件
...(this.departmentsType === 'tc' && { tof_id: item.extras?.code || '' }),
});
});
if (!this.customClose) {
Expand Down
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 @@ -2775,4 +2775,5 @@ export default {
'请输入蓝盾项目 ID,多个 ID 以英文分号分隔,最多可输入 10 个 ID': 'Please enter Blue Shield Project IDs, separate multiple IDs with English semicolons, up to 10 IDs',
'灰度发布需由<em>工具管理员</em>进行审批;若选择了灰度组织范围,还需要由<em>工具发布者的组长</em>同时进行审批。': 'Gray release needs to be approved by the <em>tool administrator</em>; if a gray organization scope is selected, it also needs to be approved by the <em>team leader of the tool publisher</em>.',
已终止当前的发布版本: 'The current release version has been terminated',
扩大灰度范围不允许删除已经灰度过的组织: 'Expanding the gray range does not allow deleting organizations that have already been grayed out',
};
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 @@ -2912,4 +2912,5 @@ export default {
'请输入蓝盾项目 ID,多个 ID 以英文分号分隔,最多可输入 10 个 ID': '请输入蓝盾项目 ID,多个 ID 以英文分号分隔,最多可输入 10 个 ID',
'灰度发布需由<em>工具管理员</em>进行审批;若选择了灰度组织范围,还需要由<em>工具发布者的组长</em>同时进行审批。': '灰度发布需由<em>工具管理员</em>进行审批;若选择了灰度组织范围,还需要由<em>工具发布者的组长</em>同时进行审批。',
已终止当前的发布版本: '已终止当前的发布版本',
扩大灰度范围不允许删除已经灰度过的组织: '扩大灰度范围不允许删除已经灰度过的组织',
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="visible-range">
<paas-plugin-title :tips="$t('仅可见范围内的组织、用户可在研发商店查看并使用该插件')" />
<paas-content-loader
class="app-container middle"
class="app-container"
:is-loading="isContentLoading"
placeholder="visible-range-loading"
:is-transform="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@
<script>
import card from '@/components/card/card.vue';
import viewMode from './view-mode.vue';
import pluginBaseMixin from '@/mixins/plugin-base-mixin';
export default {
name: 'ReleaseContent',
components: {
card,
viewMode,
},
mixins: [pluginBaseMixin],
props: {
mode: {
type: String,
Expand Down Expand Up @@ -298,13 +300,8 @@ export default {
toTestDetails() {
const url = this.isEdit ? this.curVersionData.url : this.versionInfo.url;
const id = url.split('=')[1];
this.$router.push({
name: 'pluginVersionRelease',
query: {
release_id: id,
type: 'test',
},
});
const newTabUrl = `${location.origin}/plugin-center/plugin/${this.pdId}/${this.pluginId}/version-release?release_id=${id}&type=test`;
window.open(newTabUrl, '_blank');
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
:custom-close="true"
:range="'departments'"
:departments-fn="handleDepartments"
:clearable="isDetailStep"
:organize-disable-icon-fn="handleDisableIconFn"
departments-type="tc"
@sumbit="handleSubmit"
/>
Expand Down Expand Up @@ -198,6 +200,7 @@ export default {
isShow: false,
apiHost: window.BK_COMPONENT_API_URL,
departments: [],
initDepartments: [],
releaseStrategyMap: [
{ value: 'gray', name: this.$t('先灰度后全量发布') },
{ value: 'full', name: this.$t('直接全量发布') },
Expand Down Expand Up @@ -246,6 +249,7 @@ export default {
if (this.isDetailStep) {
this.releaseStrategy = cloneDeep(newValue?.latest_release_strategy || {});
this.departments = newValue.latest_release_strategy?.organization || [];
this.initDepartments = cloneDeep(this.departments);
if (this.departments.length) {
this.requestAllOrganization(this.departments);
}
Expand Down Expand Up @@ -307,9 +311,9 @@ export default {
this.isShow = true;
},
async handleSubmit(payload) {
await this.requestAllOrganization(payload);
this.releaseStrategy.organization = payload;
this.departments = payload;
await this.requestAllOrganization(payload);
this.isShow = false;
},
// 请求组织的层级结构
Expand Down Expand Up @@ -357,6 +361,11 @@ export default {
this.releaseStrategy.bkci_project.push(input);
}
},
// 是否允许删除已勾选的组织
handleDisableIconFn(id) {
if (!this.isDetailStep) return false;
return this.initDepartments.findIndex(v => v.id === id) !== -1;
},
},
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
:loading="isApplyLoading"
@click="handleSubmit"
>
{{ $t('申请灰度发布') }}
{{ $t('申请扩大灰度范围') }}
</bk-button>
<bk-button
:theme="'default'"
Expand Down

0 comments on commit 2d51cab

Please sign in to comment.