diff --git a/app/assets/javascripts/access_tokens/components/access_token_table_app.vue b/app/assets/javascripts/access_tokens/components/access_token_table_app.vue index 85b3c994e02c997186676e8ea0775e067d13ce88..9a7296b6b1f0b266c3756506e4c2c43f13d5e397 100644 --- a/app/assets/javascripts/access_tokens/components/access_token_table_app.vue +++ b/app/assets/javascripts/access_tokens/components/access_token_table_app.vue @@ -33,7 +33,7 @@ export default { emptyField: __('Never'), expired: __('Expired'), modalMessage: __( - 'Are you sure you want to revoke this %{accessTokenType}? This action cannot be undone.', + 'Are you sure you want to revoke the %{accessTokenType} "%{tokenName}"? This action cannot be undone.', ), revokeButton: __('Revoke'), tokenValidity: __('Token valid until revoked'), @@ -72,11 +72,6 @@ export default { return FIELDS.filter(({ key }) => !ignoredFields.includes(key)); }, - modalMessage() { - return sprintf(this.$options.i18n.modalMessage, { - accessTokenType: this.accessTokenType, - }); - }, showPagination() { return this.activeAccessTokens.length > PAGE_SIZE; }, @@ -87,6 +82,12 @@ export default { this.activeAccessTokens = convertObjectPropsToCamelCase(activeAccessTokens, { deep: true }); this.currentPage = INITIAL_PAGE; }, + modalMessage(tokenName) { + return sprintf(this.$options.i18n.modalMessage, { + accessTokenType: this.accessTokenType, + tokenName, + }); + }, sortingChanged(aRow, bRow, key) { if (['createdAt', 'lastUsedAt', 'expiresAt'].includes(key)) { // Transform `null` value to the latest possible date @@ -149,13 +150,13 @@ export default { }}</span> </template> - <template #cell(action)="{ item: { revokePath } }"> + <template #cell(action)="{ item: { name, revokePath } }"> <gl-button v-if="revokePath" category="tertiary" :title="$options.i18n.revokeButton" :aria-label="$options.i18n.revokeButton" - :data-confirm="modalMessage" + :data-confirm="modalMessage(name)" data-confirm-btn-variant="danger" data-qa-selector="revoke_button" data-method="put" diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 7ca4705cf810890229c8c077f2212158d9081a98..436d78bfcdfea821ac3a1d33792ebc2cab0ebedf 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6327,7 +6327,7 @@ msgstr "" msgid "Are you sure you want to retry this migration?" msgstr "" -msgid "Are you sure you want to revoke this %{accessTokenType}? This action cannot be undone." +msgid "Are you sure you want to revoke the %{accessTokenType} \"%{tokenName}\"? This action cannot be undone." msgstr "" msgid "Are you sure you want to revoke this SSH key?" diff --git a/spec/frontend/access_tokens/components/access_token_table_app_spec.js b/spec/frontend/access_tokens/components/access_token_table_app_spec.js index 5236f38dc3510fbdb1395b9b6837ea791a1e569d..ae767f8b3f5bc350476dd1ec44280616539d1991 100644 --- a/spec/frontend/access_tokens/components/access_token_table_app_spec.js +++ b/spec/frontend/access_tokens/components/access_token_table_app_spec.js @@ -157,9 +157,9 @@ describe('~/access_tokens/components/access_token_table_app', () => { href: '/-/profile/personal_access_tokens/1/revoke', 'data-confirm': sprintf( __( - 'Are you sure you want to revoke this %{accessTokenType}? This action cannot be undone.', + 'Are you sure you want to revoke the %{accessTokenType} "%{tokenName}"? This action cannot be undone.', ), - { accessTokenType }, + { accessTokenType, tokenName: 'a' }, ), }); expect(button.props('category')).toBe('tertiary');