Skip to content

Commit

Permalink
Merge pull request #185 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
v1.5.3
  • Loading branch information
zhu327 authored Sep 24, 2021
2 parents 8fd2f74 + 251c8fb commit 9bb96b3
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 19 deletions.
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const SITE_URL = '{{ SITE_URL }}'
const STATIC_URL = '{{ STATIC_URL }}'
const BK_PAAS_HOST = '{{ BK_PAAS_HOST }}'
const BK_USER_API = BK_PAAS_HOST + '/api/c/compapi/v2/usermanage/fs_list_users/'
const BK_USER_API = '{{ BK_COMPONENT_API_URL }}' + '/api/c/compapi/v2/usermanage/fs_list_users/'
const CSRF_COOKIE_NAME = '{{ CSRF_COOKIE_NAME }}'
const PRODUCT_DOC_URL_PREFIX = 'https://bk.tencent.com/docs/'
const CE_URL = 'https://bk.tencent.com/s-mart/community'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/model/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class Policy {
return
}
this.related_resource_types = payload.related_resource_types.map(
item => new RelateResourceTypes(item, action, flag, instanceNotDisabled)
item => new RelateResourceTypes(item, action, flag, instanceNotDisabled, this.isNew)
)
}

Expand Down
11 changes: 6 additions & 5 deletions frontend/src/model/related-resource-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Condition from './condition'
const isCn = language === 'zh-cn'
export default class RelateResourceTypes {
// instanceNotDisabled: instance 不允许 disabled
constructor (payload, action, flag = '', instanceNotDisabled = false) {
constructor (payload, action, flag = '', instanceNotDisabled = false, isNew = false) {
this.type = ['', 'detail'].includes(flag) ? payload.type : payload.id
this.system_id = payload.system_id
this.name = payload.name || ''
Expand All @@ -40,19 +40,20 @@ export default class RelateResourceTypes {
this.tag = payload.tag || ''
this.flag = ['add', 'detail'].includes(flag) ? 'add' : ''
this.isChange = false
this.isNew = isNew
this.selectionMode = payload.selection_mode || 'all'
const curFlag = flag === 'detail' ? 'add' : ''
this.initCondition(payload, curFlag, instanceNotDisabled)
this.initCondition(payload, curFlag, instanceNotDisabled, isNew)
}

initCondition (payload, flag, instanceNotDisabled) {
initCondition (payload, flag, instanceNotDisabled, isNew) {
// conditionBackup: 做还原操作时的数据备份
const isEmpty = !payload.condition
|| (
payload.condition.length > 0
&& payload.condition.every(item => item.attributes.length < 1 && item.instances.length < 1)
)
if (isEmpty) {
if (isEmpty || (payload.condition.length === 0 && isNew)) {
this.condition = ['none']
this.conditionBackup = ['none']
return
Expand All @@ -67,7 +68,7 @@ export default class RelateResourceTypes {
}

get isDefaultLimit () {
return this.flag === '' && this.condition.length < 1 && !this.isChange
return this.flag === '' && this.condition.length < 1 && !this.isChange && !this.isNew
}

get empty () {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/views/group/common/render-template-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<bk-popconfirm
trigger="click"
:title="$t(`m.info['确定删除']`)"
@confirm="handleDelete">
@confirm="handleDelete"
v-if="isStaff || isPermTemplateDetail || isUser ? false : true">
<template v-if="isExpanded || ShowEditFill && !isUser">
<section class="delete-action" @click.stop="toDeletePolicyCount">
<Icon type="delete-line" v-if="isStaff || isPermTemplateDetail || isUser ? false : true" />
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/views/perm-apply/apply-custom-perm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@
</div>
<div class="tableData">
<resource-instance-table
:cache-id="routerQuery.cache_id"
:list="newTableList"
:original-list="tableDataBackup"
:system-id="systemValue"
Expand Down Expand Up @@ -1782,6 +1783,7 @@
}
try {
const res = await this.$store.dispatch('permApply/getPolicies', params)
console.log(res.data, params)
const data = res.data.map(item => {
const relatedActions = this.linearActionList.find(sub => sub.id === item.id).related_actions
return new Policy({
Expand Down Expand Up @@ -1818,7 +1820,9 @@
this.newTableList = _.cloneDeep(this.tableData.filter(item => {
return !item.isExpiredAtDisabled
}))
console.log('this.tableData', this.tableData)
this.tableDataBackup = _.cloneDeep(this.tableData)
console.log('this.tableDataBackup', this.tableDataBackup)
this.aggregationsTableData = _.cloneDeep(this.tableData)
} catch (e) {
console.error(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@
</template>
<template v-else>
<!-- 22 -->
<template v-if="!row.isNew && !row.isExpired">
<template v-if="!row.isNew && !row.isExpired && !row.isChanged">
<!-- 33 -->
<div class="mock-disabled-select">{{row.expired_display}}</div>
</template>
<template v-else>
<!-- 44 -->
<template v-if="row.isShowRelatedText && row.inOriginalList">
<template v-if="row.isShowRelatedText && row.inOriginalList && !cacheId">
<!-- 55 -->
<div class="mock-disabled-select">{{row.expired_display}}</div>
</template>
Expand Down Expand Up @@ -144,7 +144,7 @@
<bk-button
class="cancel-renewal-action"
outline
v-if="!row.isNew && !row.isShowRenewal"
v-if="!row.isNew && !row.isShowRenewal && !row.isChanged"
@click="handleCancelRenewal(row)">
{{ $t(`m.permApply['取消续期']`) }}
</bk-button>
Expand Down Expand Up @@ -234,6 +234,10 @@
systemId: {
type: String,
default: ''
},
cacheId: {
type: String,
default: ''
}
},
data () {
Expand Down Expand Up @@ -285,7 +289,6 @@
if (!curData) {
return []
}
if (curData.condition.length === 0) curData.condition = ['none']
return _.cloneDeep(curData.condition)
},
originalCondition () {
Expand Down Expand Up @@ -341,6 +344,7 @@
list: {
handler (value) {
this.tableList = value
console.log('this.tableList', this.tableList)
},
immediate: true
},
Expand Down Expand Up @@ -668,7 +672,7 @@
this.tableList.splice(
curIndex,
1,
new Policy({ ...item, tag: item.tag || 'update', isShowRelatedText: true, inOriginalList }, '', false)
new Policy({ ...item, tag: item.tag || 'add', isShowRelatedText: true, inOriginalList }, '', false)
)
}
})
Expand Down Expand Up @@ -1134,7 +1138,7 @@
tempExpiredAt = parseInt(item.expired_display, 10) * 24 * 3600
}
if (!item.isAggregate) {
const { type, id, name, environment, description, policy_id, isNew } = item
const { type, id, name, environment, description, policy_id, isNew, isChanged } = item
const relatedResourceTypes = []
if (item.related_resource_types.length > 0) {
item.related_resource_types.forEach(resItem => {
Expand Down Expand Up @@ -1205,7 +1209,7 @@
policy_id,
expired_at: item.expired_at === '' ? tempExpiredAt : Number(item.expired_at)
}
if ((isNew || item.isExpired) && params.expired_at !== PERMANENT_TIMESTAMP) {
if ((isNew || isChanged || item.isExpired) && params.expired_at !== PERMANENT_TIMESTAMP) { // 变更isChanged也需要加上this.user.timestamp
// 说明显示了 取消续期 按钮,即选择续期时间的下拉框已经选择了选择具体的续期时间,所以过期时间是选择的那个续期时间加上时间戳
// 如果没有显示 取消续期 按钮,那么就是显示的续期按钮,这时没有选择具体的续期时间因此过期时间还是之前的,不变
if (!item.isShowRenewal) {
Expand Down
10 changes: 10 additions & 0 deletions release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# V1.5.3

### 缺陷修复
* 修复v3 Smart包前端ESB地址
* 修复忽略路径bug导致授权信息错误
* 修复续期邮件企业微信邮箱链接显示问题
* 修改我的权限用户组权限查看态提示删除bug
* 修复资源实例无限制的权限,申请权限时不应该能修改
* 修复业务跳转权限中心申请权限,申请期限不能修改

# V1.5.2

### 功能优化
Expand Down
2 changes: 1 addition & 1 deletion saas/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2
1.5.3
2 changes: 1 addition & 1 deletion saas/backend/biz/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def ignore_path(self, selection: InstanceSelection) -> List[PathNodeBean]:
if (
selection.ignore_iam_path
and len(self.nodes) == len(selection.resource_type_chain)
and self.nodes[-1] != ANY_ID
and self.nodes[-1].id != ANY_ID
):
return [self.nodes[-1]]

Expand Down
1 change: 1 addition & 0 deletions saas/backend/common/vue.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def get(self, request):
try:
context = {
"BK_PAAS_HOST": settings.BK_PAAS_HOST.rstrip("/"),
"BK_COMPONENT_API_URL": settings.BK_COMPONENT_API_URL.rstrip("/"),
"LOGIN_SERVICE_URL": settings.LOGIN_SERVICE_URL.rstrip("/"),
"AJAX_URL_PREFIX": settings.AJAX_URL_PREFIX.rstrip("/"),
"SITE_URL": settings.SITE_URL,
Expand Down
8 changes: 7 additions & 1 deletion saas/resources/templates/group_expired_mail.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@
text-align: center;
cursor: pointer;
}

.renewal-action a {
border: none;
text-decoration: none !important;
color: #fff;
}
</style>
</head>

Expand Down Expand Up @@ -240,7 +246,7 @@
<p class="current-info">你收到此邮件,是因为你是 [ {{ role.name }} ] {{ role.get_type_display }}。</p>
<div class="current-date">{% now "Y-m-d H:i:s" %}</div>
</section>
<div class="renewal-action" id="renewal-button"><a href="{{ url }}">马上续期</a></div>
<div class="renewal-action" id="renewal-button"><a style="color: #fff;" href="{{ url }}">马上续期</a></div>
</td>
</tr>
</table>
Expand Down
8 changes: 7 additions & 1 deletion saas/resources/templates/user_expired_mail.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@
text-align: center;
cursor: pointer;
}

.renewal-action a {
border: none;
text-decoration: none !important;
color: #fff;
}
</style>
</head>

Expand Down Expand Up @@ -311,7 +317,7 @@
<p class="current-info">你收到此邮件,是因为你是这些权限的拥有者。</p>
<div class="current-date">{% now "Y-m-d H:i:s" %}</div>
</section>
<div class="renewal-action" id="renewal-button"><a href="{{ url }}">马上续期</a></div>
<div class="renewal-action" id="renewal-button"><a style="color: #fff;" href="{{ url }}">马上续期</a></div>
</td>
</tr>
</table>
Expand Down
9 changes: 9 additions & 0 deletions saas/resources/version_log/V1.5.3_2021-09-24.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# V1.5.3 版本更新日志

### 缺陷修复
* 修复v3 Smart包前端ESB地址
* 修复忽略路径bug导致授权信息错误
* 修复续期邮件企业微信邮箱链接显示问题
* 修改我的权限用户组权限查看态提示删除bug
* 修复资源实例无限制的权限,申请权限时不应该能修改
* 修复业务跳转权限中心申请权限,申请期限不能修改
9 changes: 9 additions & 0 deletions saas/resources/version_log/V1.5.3_2021-09-24_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# V1.5.3 ChangeLog

### Bug Fixes
* Fix the front-end ESB address of the v3 Smart package
* Fix ignoring the path bug causing authorization information error
* Fix the display problem of the renewal email enterprise WeChat email link
* Modify my permission user group permission view prompt delete bug
* Fix the unlimited permissions of resource instances, which should not be able to be modified when applying for permissions
* Fix the application permission of the business jump permission center, the application period cannot be modified

0 comments on commit 9bb96b3

Please sign in to comment.