Skip to content
代码片段 群组 项目
提交 e683b5ac 编辑于 作者: Eduardo Sanz García's avatar Eduardo Sanz García 提交者: Jose Ivan Vargas
浏览文件

Change the revoke button to type `tertiary`

We decided this change was better than these two other proposals:

* [Draft: Change the revoke button type to `secondary`](
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89504
)

* [Draft: Change the revoke button to 3 different types](
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89507
)

In the AccessTokenTableApp component, users may not understand why
some access tokens have a primary revoke button (background red),
while other access tokens have a secondary (transparent background).

Originally, I believe the primary|secondary buttons were meant to
match the color of the text of the Expires column (3 colors: red for
expired token, orange for soon-to-be-expired, black for tokens without
expiration). However, the match for the button was not perfect:
primary button for tokens with expiration, secondary button for
tokens without expiration.

This MR changes the revoke buttons to be of type tertiary.

Changelog: changed
上级 2ef9c1f3
No related branches found
No related tags found
无相关合并请求
...@@ -138,10 +138,9 @@ export default { ...@@ -138,10 +138,9 @@ export default {
}}</span> }}</span>
</template> </template>
<template #cell(action)="{ item: { revokePath, expiresAt } }"> <template #cell(action)="{ item: { revokePath } }">
<gl-button <gl-button
variant="danger" category="tertiary"
:category="expiresAt ? 'primary' : 'secondary'"
:aria-label="$options.i18n.revokeButton" :aria-label="$options.i18n.revokeButton"
:data-confirm="modalMessage" :data-confirm="modalMessage"
data-confirm-btn-variant="danger" data-confirm-btn-variant="danger"
......
import { GlPagination, GlTable } from '@gitlab/ui'; import { GlButton, GlPagination, GlTable } from '@gitlab/ui';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
import AccessTokenTableApp from '~/access_tokens/components/access_token_table_app.vue'; import AccessTokenTableApp from '~/access_tokens/components/access_token_table_app.vue';
...@@ -164,8 +164,8 @@ describe('~/access_tokens/components/access_token_table_app', () => { ...@@ -164,8 +164,8 @@ describe('~/access_tokens/components/access_token_table_app', () => {
expect(cells.at(3).text()).toBe(__('Never')); expect(cells.at(3).text()).toBe(__('Never'));
expect(cells.at(4).text()).toBe(__('Never')); expect(cells.at(4).text()).toBe(__('Never'));
expect(cells.at(5).text()).toBe('Maintainer'); expect(cells.at(5).text()).toBe('Maintainer');
let anchor = cells.at(6).find('a'); let button = cells.at(6).findComponent(GlButton);
expect(anchor.attributes()).toMatchObject({ expect(button.attributes()).toMatchObject({
'aria-label': __('Revoke'), 'aria-label': __('Revoke'),
'data-qa-selector': __('revoke_button'), 'data-qa-selector': __('revoke_button'),
href: '/-/profile/personal_access_tokens/1/revoke', href: '/-/profile/personal_access_tokens/1/revoke',
...@@ -176,8 +176,7 @@ describe('~/access_tokens/components/access_token_table_app', () => { ...@@ -176,8 +176,7 @@ describe('~/access_tokens/components/access_token_table_app', () => {
{ accessTokenType }, { accessTokenType },
), ),
}); });
expect(button.props('category')).toBe('tertiary');
expect(anchor.classes()).toContain('btn-danger-secondary');
// Second row // Second row
expect(cells.at(7).text()).toBe('b'); expect(cells.at(7).text()).toBe('b');
...@@ -186,9 +185,9 @@ describe('~/access_tokens/components/access_token_table_app', () => { ...@@ -186,9 +185,9 @@ describe('~/access_tokens/components/access_token_table_app', () => {
expect(cells.at(10).text()).not.toBe(__('Never')); expect(cells.at(10).text()).not.toBe(__('Never'));
expect(cells.at(11).text()).toBe(__('Expired')); expect(cells.at(11).text()).toBe(__('Expired'));
expect(cells.at(12).text()).toBe('Maintainer'); expect(cells.at(12).text()).toBe('Maintainer');
anchor = cells.at(13).find('a'); button = cells.at(13).findComponent(GlButton);
expect(anchor.attributes('href')).toBe('/-/profile/personal_access_tokens/2/revoke'); expect(button.attributes('href')).toBe('/-/profile/personal_access_tokens/2/revoke');
expect(anchor.classes()).toEqual(['btn', 'btn-danger', 'btn-md', 'gl-button', 'btn-icon']); expect(button.props('category')).toBe('tertiary');
}); });
it('sorts rows alphabetically', async () => { it('sorts rows alphabetically', async () => {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册