Skip to content

Commit

Permalink
Merge pull request #1882 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
1.9.10
  • Loading branch information
zhu327 authored Mar 28, 2023
2 parents b1d4b04 + 1b9f394 commit 5cd501b
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 40 deletions.
1 change: 1 addition & 0 deletions frontend/build/paas-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const GLOBAL_VAR = {
BK_ITSM_APP_URL: process.env.BK_ITSM_APP_URL || '',
ENABLE_MODEL_BUILD: process.env.ENABLE_MODEL_BUILD || '',
ENABLE_PERMISSION_HANDOVER: process.env.ENABLE_PERMISSION_HANDOVER || '',
ENABLE_TEMPORARY_POLICY: process.env.ENABLE_TEMPORARY_POLICY || '',
BK_COMPONENT_API_URL: process.env.BK_COMPONENT_API_URL || ''
};

Expand Down
2 changes: 2 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
const BK_ITSM_APP_URL = '{{ BK_ITSM_APP_URL }}'
const ENABLE_MODEL_BUILD = '{{ ENABLE_MODEL_BUILD }}' || ''
const ENABLE_PERMISSION_HANDOVER = '{{ ENABLE_PERMISSION_HANDOVER }}' || ''
const ENABLE_TEMPORARY_POLICY = '{{ ENABLE_TEMPORARY_POLICY }}' || ''
document.domain = '{{ SESSION_COOKIE_DOMAIN }}'
window.LOGIN_SERVICE_URL = LOGIN_SERVICE_URL
window.AJAX_URL_PREFIX = AJAX_URL_PREFIX
Expand All @@ -35,6 +36,7 @@
window.BK_ITSM_APP_URL = BK_ITSM_APP_URL
window.ENABLE_MODEL_BUILD = ENABLE_MODEL_BUILD
window.ENABLE_PERMISSION_HANDOVER = ENABLE_PERMISSION_HANDOVER
window.ENABLE_TEMPORARY_POLICY = ENABLE_TEMPORARY_POLICY
window.CE_URL = CE_URL
})()

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,8 @@ export const m = {
'续期申请提交成功': 'Renewal application submitted',
'即将过期的用户/组织': 'Users/organizations about to expire',
'请选择即将过期的用户/组织': 'Please select the user/organization that will expire soon',
'确定要移除该用户或组织吗?': 'Are you sure you want to remove this user or organization? '
'确定要移除该用户或组织吗?': 'Are you sure you want to remove this user or organization?',
'请选择过期权限': 'Please select expired permissions'
},
audit: {
'时间': 'Time',
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,8 @@ export const m = {
'续期成功': '续期成功',
'即将过期的用户/组织': '即将过期的用户/组织',
'请选择即将过期的用户/组织': '请选择即将过期的用户/组织',
'确定要移除该用户或组织吗?': '确定要移除该用户或组织吗?'
'确定要移除该用户或组织吗?': '确定要移除该用户或组织吗?',
'请选择过期权限': '请选择过期权限'
},
audit: {
'时间': '时间',
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@ if (window.ENABLE_MODEL_BUILD.toLowerCase() === 'true') {
});
}

if (window.ENABLE_TEMPORARY_POLICY.toLowerCase() === 'true') {
currentNav[0].children.push({
icon: 'perm-apply',
name: il8n('nav', '临时权限申请'),
id: 'provisionPermApplyNav',
rkey: 'applyProvisionPerm',
path: `${SITE_URL}apply-provision-perm`,
disabled: false
});
}

const store = new Vuex.Store({
modules: {
system,
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/views/apply/components/left.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
@on-change="handleChange"></apply-item>
<div class="load-more-wrapper"
v-bkloading="{ isLoading: isScrollLoading, opacity: 1, color: '#fff' }"
v-if="isScrollLoading"></div>
v-if="isScrollLoading"
/>
<div class="no-data-tips" v-show="isShowNoDataTips">{{ $t(`m.common['没有更多内容了']`) }}</div>
</template>
<template v-else>
Expand Down Expand Up @@ -183,9 +184,11 @@
border-right: 1px solid #dcdee5;
}
.no-data-tips {
padding: 10px 0;
height: 70px;
line-height: 35px;
font-size: 12px;
color: #979ba5;
padding-bottom: 15px;
border-right: 1px solid #dcdee5;
text-align: center;
}
Expand Down
20 changes: 13 additions & 7 deletions frontend/src/views/apply/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,15 @@
},
canScrollLoad () {
return this.pagination.totalPage > this.currentBackup;
},
listHeight () {
// 可视化高度减去面包屑和导航栏高度,再减去固定标题的两个边框像素
return window.innerHeight - 51 - 51 - 2;
}
},
created () {
this.comMap = COM_MAP;
this.pagination.limit = Math.ceil(this.listHeight / 79);
},
methods: {
async fetchPageData () {
Expand All @@ -96,31 +101,32 @@
async fetchApplyList (isLoading = false, isScrollLoad = false) {
this.isApplyLoading = isLoading;
const { current, limit } = this.pagination;
const params = {
...this.searchParams,
period: this.currentActive,
limit: this.pagination.limit,
offset: this.pagination.limit * (this.pagination.current - 1)
limit,
offset: limit * (current - 1)
};
if (!isScrollLoad) {
this.applyList.splice(0, this.applyList.length, ...[]);
}
try {
const res = await this.$store.dispatch('myApply/getApplyList', params);
const { data } = await this.$store.dispatch('myApply/getApplyList', params);
if (!isScrollLoad) {
this.applyList = [...res.data.results];
this.applyList = [...data.results];
if (this.applyList.length < 1) {
this.currentApplyData = {};
} else {
this.currentApplyData = this.applyList[0];
}
this.pagination.totalPage = Math.ceil(res.data.count / this.pagination.limit);
this.pagination.totalPage = Math.ceil(data.count / limit);
} else {
this.currentBackup++;
(res.data.results || []).forEach(item => {
(data.results || []).forEach(item => {
item.is_read = false;
});
this.applyList.push(...res.data.results);
this.applyList.push(...data.results);
}
} catch (e) {
console.error(e);
Expand Down
62 changes: 56 additions & 6 deletions frontend/src/views/perm-apply/apply-custom-perm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,32 @@
v-model="systemValue"
style="width: 480px;"
:popover-min-width="480"
searchable
:searchable="true"
:search-with-pinyin="true"
:clearable="false"
@selected="handleSysSelected">
<bk-option v-for="option in systemList"
@selected="handleSysSelected"
@toggle="handleToggle">
<bk-option
v-for="option in systemList"
v-bind="option"
:key="option.id"
:id="option.id"
:name="option.displayName">
<span>{{ option.name }}</span>
<span style="color: #c4c6cc;">({{ option.id }})</span>
<div class="select-collection"
@mouseenter="handleSystemEnter(option.id)"
@mouseleave="handleSystemLeave(option.id)"
>
<div>
<span>{{ option.name }}</span>
<span style="color: #c4c6cc;">({{ option.id }})</span>
</div>
<bk-star
v-if="(hoverId === option.id || option.collection)"
:rate="option.collection"
:max-stars="1"
@click.native.stop="handleCollection(option)">
</bk-star>
</div>
</bk-option>
</bk-select>
<div slot="right">
Expand All @@ -32,7 +49,13 @@
</render-search>
<form class="bk-form bk-form-vertical inner-content">
<div class="bk-form-item">
<div :class="['custom-tmpl-list-content-wrapper', { 'is-loading': customLoading }]" v-bkloading="{ isLoading: customLoading, opacity: 1 }">
<div
v-bkloading="{ isLoading: customLoading, opacity: 1 }"
:class="[
'custom-tmpl-list-content-wrapper',
{ 'is-loading': customLoading }
]"
>
<render-action-tag
ref="commonActionRef"
:system-id="systemValue"
Expand Down Expand Up @@ -613,6 +636,7 @@
{ title: this.$t(`m.permApply['细粒度权限']`), desc: this.$t(`m.permApply['只包含当前需要的最小范围权限']`), key: 'independent' }
],
tabIndex: 0,
hoverId: -1,
hoverActionData: {
actions: []
}
Expand Down Expand Up @@ -1995,6 +2019,7 @@
const res = await this.$store.dispatch('system/getSystems');
(res.data || []).forEach(item => {
item.displayName = `${item.name}(${item.id})`;
item.collection = item.collection ? 1 : 0;
});
this.systemList = res.data || [];
if (!this.systemValue) {
Expand Down Expand Up @@ -2244,6 +2269,26 @@
this.buttonLoading = false;
}
},

handleSystemEnter (id) {
this.hoverId = id;
},

handleSystemLeave () {
this.hoverId = -1;
},

handleCollection (option) {
option.collection = option.collection > 0 ? 0 : 1;
},

// 收藏置顶
handleToggle () {
this.systemList = this.systemList.sort((pre, next) => {
return next.collection - pre.collection;
});
},

// 申请期限逻辑
handleDeadlineChange (payload) {
if (payload) {
Expand Down Expand Up @@ -2379,4 +2424,9 @@
background: #E7EFFE;
color: #3a84ff;
}
.select-collection {
display: flex;
align-items: center;
justify-content: space-between;
}
</style>
47 changes: 36 additions & 11 deletions frontend/src/views/perm/components/render-renewal-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,14 @@
this.currentBackup = value;
},
type: {
handler (value) {
this.tableProps = this.getTableProps(value);
handler (newValue, oldValue) {
this.tableProps = this.getTableProps(newValue);
if (oldValue && oldValue !== newValue) {
this.pagination = Object.assign(this.pagination, {
current: 1,
limit: 10
});
}
},
immediate: true
},
Expand Down Expand Up @@ -161,6 +167,7 @@
data: {
handler (value) {
this.allData = value;
this.pagination = Object.assign(this.pagination, { count: value.length });
const data = this.getCurPageData();
this.tableList.splice(0, this.tableList.length, ...data);
const getDays = payload => {
Expand Down Expand Up @@ -188,12 +195,14 @@
}
});
});
}
},
immediate: true
},
count: {
handler (value) {
this.pagination.count = value;
}
},
immediate: true
}
},
methods: {
Expand Down Expand Up @@ -226,8 +235,13 @@
},
limitChange (currentLimit, prevLimit) {
this.pagination.limit = currentLimit;
this.pagination.current = 1;
this.pagination = Object.assign(
this.pagination,
{
current: 1,
limit: currentLimit
}
);
this.pageChange();
},
Expand All @@ -254,11 +268,22 @@
async fetchTableData () {
this.isLoading = true;
try {
const res = await this.$store.dispatch('renewal/getExpireSoonGroupWithUser', {
page_size: this.pagination.limit,
page: this.pagination.current
});
this.tableList = res.data || [];
const { current, limit } = this.pagination;
const tabItem = {
group: async () => {
const { data } = await this.$store.dispatch('renewal/getExpireSoonGroupWithUser', {
page_size: limit,
page: current
});
this.tableList = data.results || [];
this.pagination.count = data.count;
},
custom: () => {
this.tableList = this.getCurPageData(current);
console.log(this.tableList);
}
};
return tabItem[this.type]();
} catch (e) {
console.error(e);
this.bkMessageInstance = this.$bkMessage({
Expand Down
24 changes: 21 additions & 3 deletions frontend/src/views/perm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@
@click="handleGoPermTransfer">
{{ $t(`m.permTransfer['权限交接']`) }}
</bk-button>
<div v-if="!systemList.length && !teporarySystemList.length" class="info-sys" style="background: #000"
v-bk-tooltips="'您还没有权限,无需交接'"></div>
<bk-button
v-if="enableTemporaryPolicy.toLowerCase() === 'true'"
data-test-id="myPerm_btn_temporaryPerm"
type="button"
style="margin-bottom: 16px;"
@click="handleGoApplyProvisionPerm">
{{ $t(`m.nav['临时权限申请']`) }}
</bk-button>
</div>
<div class="redCircle" v-if="!isNoRenewal"></div>
<template v-if="isEmpty">
Expand Down Expand Up @@ -105,14 +111,21 @@
systemList: [],
teporarySystemList: [],
departmentGroupList: [],
enablePermissionHandover: window.ENABLE_PERMISSION_HANDOVER
enablePermissionHandover: window.ENABLE_PERMISSION_HANDOVER,
enableTemporaryPolicy: window.ENABLE_TEMPORARY_POLICY
};
},
created () {
const query = this.$route.query;
if (query.tab) {
this.active = query.tab;
}
if (this.enableTemporaryPolicy.toLowerCase() === 'true') {
this.panels.push({
name: 'TeporaryCustomPerm',
label: this.$t(`m.myApply['临时权限']`)
});
}
},
methods: {
async fetchPageData () {
Expand Down Expand Up @@ -225,6 +238,11 @@
this.$router.push({
name: 'permTransfer'
});
},
handleGoApplyProvisionPerm () {
this.$router.push({
name: 'applyProvisionPerm'
});
}
}
};
Expand Down
Loading

0 comments on commit 5cd501b

Please sign in to comment.