From b4819a81164e29d4e7b3ebc84e85110235afcde5 Mon Sep 17 00:00:00 2001 From: Gerardo Navarro Date: Thu, 4 Apr 2024 18:10:21 +0200 Subject: [PATCH] Protected packages + containers: Add count icon to list in settings UI - Adding count icon (package icon + number of entries) to the tables `protected packages` and `protected containers` - This icon element was suggested by @annabeldunstone in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/146523#note_1838085406 - This MR addresses on point in the implementation plan, see https://gitlab.com/gitlab-org/gitlab/-/issues/413641#checklist-implementation-plan Changelog: added --- .../components/container_protection_rules.vue | 13 +++++++++++- .../components/packages_protection_rules.vue | 13 +++++++++++- ...egistry_protection_rules_count_resolver.rb | 15 ++++++++++++++ app/graphql/types/project_type.rb | 7 +++++++ doc/api/graphql/reference/index.md | 1 + .../container_protection_rules_spec.js | 20 ++++++++++++++----- .../packages_protection_rules_spec.js | 20 ++++++++++++++----- 7 files changed, 77 insertions(+), 12 deletions(-) create mode 100644 app/graphql/resolvers/project_container_registry_protection_rules_count_resolver.rb diff --git a/app/assets/javascripts/packages_and_registries/settings/project/components/container_protection_rules.vue b/app/assets/javascripts/packages_and_registries/settings/project/components/container_protection_rules.vue index 4ffd1e6085c9d0..51ae5b93f3ae74 100644 --- a/app/assets/javascripts/packages_and_registries/settings/project/components/container_protection_rules.vue +++ b/app/assets/javascripts/packages_and_registries/settings/project/components/container_protection_rules.vue @@ -2,6 +2,7 @@ import { GlAlert, GlCard, + GlIcon, GlTable, GlLoadingIcon, GlKeysetPagination, @@ -30,6 +31,7 @@ export default { components: { GlAlert, GlCard, + GlIcon, GlKeysetPagination, GlLoadingIcon, GlTable, @@ -91,6 +93,9 @@ export default { protectionRulesQueryResult() { return this.protectionRulesQueryPayload.nodes; }, + protectionRulesQueryResultCount() { + return this.protectionRulesQueryResult.length; + }, isLoadingprotectionRules() { return this.$apollo.queries.protectionRulesQueryPayload.loading; }, @@ -180,7 +185,13 @@ export default { > diff --git a/app/assets/javascripts/packages_and_registries/settings/project/components/packages_protection_rules.vue b/app/assets/javascripts/packages_and_registries/settings/project/components/packages_protection_rules.vue index 4522b37572d9bf..88fde9438187a5 100644 --- a/app/assets/javascripts/packages_and_registries/settings/project/components/packages_protection_rules.vue +++ b/app/assets/javascripts/packages_and_registries/settings/project/components/packages_protection_rules.vue @@ -3,6 +3,7 @@ import { GlAlert, GlButton, GlCard, + GlIcon, GlTable, GlLoadingIcon, GlKeysetPagination, @@ -29,6 +30,7 @@ export default { SettingsBlock, GlButton, GlCard, + GlIcon, GlAlert, GlTable, GlLoadingIcon, @@ -82,6 +84,9 @@ export default { packageProtectionRulesQueryResult() { return this.packageProtectionRulesQueryPayload.nodes; }, + packageProtectionRulesQueryResultCount() { + return this.packageProtectionRulesQueryResult.length; + }, isLoadingPackageProtectionRules() { return this.$apollo.queries.packageProtectionRulesQueryPayload.loading; }, @@ -269,7 +274,13 @@ export default { >