From 43d27d5c268a1f0e44e6c65724e9b09c14f25bf4 Mon Sep 17 00:00:00 2001 From: Darby Frey Date: Mon, 13 Jan 2025 12:12:49 -0600 Subject: [PATCH 1/8] =?UTF-8?q?Add=20=E2=80=9CAdded=20from=20log=E2=80=9D?= =?UTF-8?q?=20icon=20in=20job=20token=20allowlist=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Job token allowlist entries now display an icon indicating when they were added from the authentication log. MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/177785 Changelog: added --- .../components/inbound_token_access.vue | 13 ++++++++++ .../components/token_access_table.vue | 25 ++++++++++++++++++- .../allowlist_entry.fragment.graphql | 2 ++ ...ects_with_ci_job_token_scope.query.graphql | 2 ++ .../job_token_scope/allowlist_entry_type.rb | 5 ++++ app/graphql/types/ci/job_token_scope_type.rb | 14 +++++++++++ app/models/ci/job_token/allowlist.rb | 8 ++++++ app/models/ci/job_token/scope.rb | 8 ++++++ doc/api/graphql/reference/index.md | 3 +++ locale/gitlab.pot | 3 +++ 10 files changed, 82 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/token_access/components/inbound_token_access.vue b/app/assets/javascripts/token_access/components/inbound_token_access.vue index b927483ade5c1f..a3eb90cdf4d46b 100644 --- a/app/assets/javascripts/token_access/components/inbound_token_access.vue +++ b/app/assets/javascripts/token_access/components/inbound_token_access.vue @@ -132,6 +132,13 @@ export default { } else { projects = project?.ciJobTokenScope?.inboundAllowlist?.nodes ?? []; groups = project?.ciJobTokenScope?.groupsAllowlist?.nodes ?? []; + const groupAllowlistAutopopulatedIds = + project?.ciJobTokenScope?.groupAllowlistAutopopulatedIds ?? []; + const inboundAllowlistAutopopulatedIds = + project?.ciJobTokenScope?.inboundAllowlistAutopopulatedIds ?? []; + + projects = this.addAutopopulatedAttribute(projects, inboundAllowlistAutopopulatedIds); + groups = this.addAutopopulatedAttribute(groups, groupAllowlistAutopopulatedIds); } return { projects, groups }; @@ -269,6 +276,12 @@ export default { this.namespaceToEdit = namespace; showFormFn(); }, + addAutopopulatedAttribute(collection, idList) { + return collection.map((item) => ({ + ...item, + autopopulated: idList.includes(item.id), + })); + }, }, }; diff --git a/app/assets/javascripts/token_access/components/token_access_table.vue b/app/assets/javascripts/token_access/components/token_access_table.vue index c7d1e0bb91978f..d145aaac1430ef 100644 --- a/app/assets/javascripts/token_access/components/token_access_table.vue +++ b/app/assets/javascripts/token_access/components/token_access_table.vue @@ -1,5 +1,13 @@