Skip to content

Commit

Permalink
feat: 修改部分按钮问题 #2738
Browse files Browse the repository at this point in the history
  • Loading branch information
lannoy0523 committed Nov 11, 2024
1 parent 51764a5 commit 20279db
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
uid: this.userInfo.name
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
window.open(res, '_blank')
}
})
Expand Down
14 changes: 7 additions & 7 deletions src/frontend/devops-repository/src/views/repoGeneric/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
repoName: this.repoName
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
Expand Down Expand Up @@ -966,7 +966,7 @@
path: fullPath
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
Expand Down Expand Up @@ -1047,7 +1047,7 @@
path: row.fullPath
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
Expand Down Expand Up @@ -1147,7 +1147,7 @@
repoName: this.repoName
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
Expand Down Expand Up @@ -1223,7 +1223,7 @@
repoName: this.repoName
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
Expand Down Expand Up @@ -1310,7 +1310,7 @@
path: row.fullPath
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
Expand Down Expand Up @@ -1366,7 +1366,7 @@
path: row.fullPath
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
uid: this.userInfo.name
}
}).then(res => {
if (res !== '') {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
Expand Down
35 changes: 31 additions & 4 deletions src/frontend/devops-repository/src/views/repoList/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<div class="repo-list-container" v-bkloading="{ isLoading }">
<div class="ml20 mr20 mt10 flex-between-center">
<bk-button icon="plus" theme="primary" @click="createRepo">{{ $t('createRepository') }}</bk-button>
<bk-button v-if="userInfo.manage || userInfo.admin" icon="plus" theme="primary" @click="createRepo">{{ $t('createRepository') }}</bk-button>
<bk-button v-else icon="plus" class="no-permission-button" @click="creatNoPermission">{{ $t('createRepository') }}</bk-button>
<div class="flex-align-center">
<bk-input
v-model.trim="query.name"
Expand Down Expand Up @@ -41,7 +42,8 @@
<template #default="{ row }">
<Icon class="mr5 table-svg" size="16" :name="row.repoType" />
<span class="hover-btn" @click="toPackageList(row)">{{replaceRepoName(row.name)}}</span>
<span v-if="MODE_CONFIG === 'ci' && ['custom', 'pipeline'].includes(row.name)"
<span
v-if="MODE_CONFIG === 'ci' && ['custom', 'pipeline'].includes(row.name)"
class="mr5 repo-tag SUCCESS" :data-name="$t('built-in')"></span>
<span v-if="row.configuration.settings.system" class="mr5 repo-tag" :data-name="$t('system')"></span>
<span v-if="row.public" class="mr5 repo-tag WARNING" :data-name="$t('public')"></span>
Expand Down Expand Up @@ -77,7 +79,7 @@
<template #default="{ row }">
<operation-list
:list="[
{ label: $t('setting'), clickEvent: () => toRepoConfig(row) },
(userInfo.admin || userInfo.manage) && { label: $t('setting'), clickEvent: () => toRepoConfig(row) },
(row.repoType !== 'generic' ||
(row.repoType === 'generic'
&& row.name !== 'custom'
Expand Down Expand Up @@ -125,7 +127,7 @@
limitList: [10, 20, 40]
}
export default {
name: 'repoList',
name: 'RepoList',
components: { OperationList, createRepoDialog, iamDenyDialog, genericCleanDialog },
data () {
return {
Expand Down Expand Up @@ -442,6 +444,26 @@
} else {
this.$refs.genericCleanDialog.date = beforeYears(1)
}
},
creatNoPermission () {
this.getPermissionUrl({
body: {
projectId: this.projectId,
action: 'MANAGE',
resourceType: 'PROJECT',
uid: this.userInfo.name
}
}).then(res => {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
action: 'MANAGE',
repoName: '',
url: res
}
}
})
}
}
}
Expand All @@ -461,5 +483,10 @@
display: block;
}
}
.no-permission-button {
background: #dcdee5 !important;
border-color: #dcdee5 !important;
color: #fff !important;
}
}
</style>
25 changes: 23 additions & 2 deletions src/frontend/devops-repository/src/views/repoSearch/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
}
},
computed: {
...mapState(['userList']),
...mapState(['userList', 'userInfo']),
projectId () {
return this.$route.params.projectId
},
Expand All @@ -140,7 +140,7 @@
},
methods: {
formatDate,
...mapActions(['searchPackageList', 'searchRepoList']),
...mapActions(['searchPackageList', 'searchRepoList', 'getPermissionUrl']),
refreshRoute () {
this.$router.replace({
query: {
Expand Down Expand Up @@ -194,6 +194,27 @@
this.hasNext = false
}
scrollLoad ? this.resultList.push(...records) : (this.resultList = records)
}).catch(err => {
if (err.status === 403) {
this.getPermissionUrl({
body: {
projectId: this.projectId,
action: 'READ',
resourceType: 'PROJECT',
uid: this.userInfo.name
}
}).then(res => {
if (res !== '' && res !== null) {
this.showIamDenyDialog = true
this.showData = {
projectId: this.projectId,
repoName: '',
action: 'READ',
url: res
}
}
})
}
}).finally(() => {
this.isLoading = false
})
Expand Down

0 comments on commit 20279db

Please sign in to comment.