Skip to content

Hide `Action` column when revokePath is absent

What does this MR do and why?

In the access token table, we hide the Action column when revokePath is absent from all the tokens. If the table is empty we still show the column.

Follow up from !96276 (comment 1083611365)

Screenshots or screen recordings

Before

image

After

image

The column is still present when the table is empty:

image

How to set up and validate locally

  1. Create a personal access token:
  2. See the Action column is present
  3. Apply patch:
diff --git a/app/assets/javascripts/access_tokens/index.js b/app/assets/javascripts/access_tokens/index.js
index f0c1b415157..c12b45bf2b1 100644
--- a/app/assets/javascripts/access_tokens/index.js
+++ b/app/assets/javascripts/access_tokens/index.js
@@ -43,7 +43,7 @@ export const initAccessTokenTableApp = () => {
     provide: {
       accessTokenType,
       accessTokenTypePlural,
-      initialActiveAccessTokens,
+      initialActiveAccessTokens: initialActiveAccessTokens.map(({ revokePath, ...rest }) => rest),
       noActiveTokensMessage,
       showRole,
     },
  1. Reload the page and observe that the Action column is not present.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading