Commit 1a8a6c7b authored by Emily Ring's avatar Emily Ring Committed by Vitaly Slobodin

Add name to agent token table

parent ab3055aa
...@@ -19,6 +19,7 @@ export default { ...@@ -19,6 +19,7 @@ export default {
dateCreated: s__('ClusterAgents|Date created'), dateCreated: s__('ClusterAgents|Date created'),
description: s__('ClusterAgents|Description'), description: s__('ClusterAgents|Description'),
learnMore: s__('ClusterAgents|Learn how to create an agent access token'), learnMore: s__('ClusterAgents|Learn how to create an agent access token'),
name: s__('ClusterAgents|Name'),
noTokens: s__('ClusterAgents|This agent has no tokens'), noTokens: s__('ClusterAgents|This agent has no tokens'),
unknownUser: s__('ClusterAgents|Unknown user'), unknownUser: s__('ClusterAgents|Unknown user'),
}, },
...@@ -31,6 +32,11 @@ export default { ...@@ -31,6 +32,11 @@ export default {
computed: { computed: {
fields() { fields() {
return [ return [
{
key: 'name',
label: this.$options.i18n.name,
tdAttr: { 'data-testid': 'agent-token-name' },
},
{ {
key: 'createdAt', key: 'createdAt',
label: this.$options.i18n.dateCreated, label: this.$options.i18n.dateCreated,
......
...@@ -2,6 +2,7 @@ fragment Token on ClusterAgentToken { ...@@ -2,6 +2,7 @@ fragment Token on ClusterAgentToken {
id id
createdAt createdAt
description description
name
createdByUser { createdByUser {
name name
......
---
title: Add name to agent token table
merge_request: 55503
author:
type: changed
...@@ -27,6 +27,7 @@ describe('ClusterAgentShow', () => { ...@@ -27,6 +27,7 @@ describe('ClusterAgentShow', () => {
createdByUser: { createdByUser: {
name: 'user-1', name: 'user-1',
}, },
name: 'token-1',
tokens: { tokens: {
count: 1, count: 1,
nodes: [], nodes: [],
......
...@@ -15,12 +15,14 @@ describe('ClusterAgentTokenTable', () => { ...@@ -15,12 +15,14 @@ describe('ClusterAgentTokenTable', () => {
createdByUser: { createdByUser: {
name: 'user-1', name: 'user-1',
}, },
name: 'token-1',
}, },
{ {
id: '2', id: '2',
createdAt: '2021-02-10T00:00:00Z', createdAt: '2021-02-10T00:00:00Z',
description: null, description: null,
createdByUser: null, createdByUser: null,
name: 'token-2',
}, },
]; ];
...@@ -47,6 +49,17 @@ describe('ClusterAgentTokenTable', () => { ...@@ -47,6 +49,17 @@ describe('ClusterAgentTokenTable', () => {
expect(learnMoreLink.text()).toBe(TokenTable.i18n.learnMore); expect(learnMoreLink.text()).toBe(TokenTable.i18n.learnMore);
}); });
it.each`
name | lineNumber
${'token-1'} | ${0}
${'token-2'} | ${1}
`('displays token name "$name" for line "$lineNumber"', ({ name, lineNumber }) => {
const tokens = wrapper.findAll('[data-testid="agent-token-name"]');
const token = tokens.at(lineNumber);
expect(token.text()).toBe(name);
});
it.each` it.each`
createdText | lineNumber createdText | lineNumber
${'2 days ago'} | ${0} ${'2 days ago'} | ${0}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment