Skip to content

Commit 4c19b42

Browse files
committed
Add admin column to PAT table with visibility restricted to admins
1 parent 400f4de commit 4c19b42

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

frontend/src/pages/account/Security/Tokens.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import TokenCreated from './dialogs/TokenCreated.vue'
4141
import TokenDialog from './dialogs/TokenDialog.vue'
4242
4343
import { pluralize } from '@/composables/strings/String.js'
44+
import { useAccountAuthStore } from '@/stores/account-auth.js'
4445
4546
export default {
4647
name: 'PersonalAccessTokens',
@@ -53,8 +54,15 @@ export default {
5354
data () {
5455
return {
5556
loading: false,
56-
tokens: [],
57-
columns: [
57+
tokens: []
58+
}
59+
},
60+
computed: {
61+
isAdmin () {
62+
return useAccountAuthStore().isAdminUser
63+
},
64+
columns () {
65+
return [
5866
{ label: 'Name', key: 'name', sortable: true },
5967
{
6068
label: 'Teams',
@@ -94,14 +102,27 @@ export default {
94102
})
95103
}
96104
},
105+
{
106+
label: 'Admin Access',
107+
key: 'adminOptIn',
108+
sortable: false,
109+
hidden: !this.isAdmin,
110+
component: {
111+
is: markRaw({
112+
name: 'AdminOptInCell',
113+
props: ['adminOptIn'],
114+
template: '<span v-if="adminOptIn" class="text-green-500">&#x2714;</span><span v-else class="text-red-500">&#x2718;</span>'
115+
})
116+
}
117+
},
97118
{
98119
label: 'Expires',
99120
key: 'expiresAt',
100121
component: {
101122
is: markRaw(ExpiryCell)
102123
}
103124
}
104-
]
125+
].filter(col => !col.hidden)
105126
}
106127
},
107128
mounted () {

0 commit comments

Comments
 (0)