Skip to content
Snippets Groups Projects
Commit e8b110fe authored by Gerardo Navarro's avatar Gerardo Navarro :speech_balloon:
Browse files

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
  gitlab-org/gitlab!146523 (comment 1838085406)
- This MR addresses on point in the implementation plan, see
  gitlab-org/gitlab#413641

Changelog: added
parent 9b32aa4b
No related branches found
No related tags found
No related merge requests found
Pipeline #1240478194 canceled
Pipeline: GitLab Community Fork

#1240488513

    Pipeline: GitLab Community Fork

    #1240488493

      ......@@ -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 {
      >
      <template #header>
      <div class="gl-new-card-title-wrapper gl-justify-content-space-between">
      <h3 class="gl-new-card-title">{{ $options.i18n.settingBlockTitle }}</h3>
      <h3 class="gl-new-card-title">
      {{ $options.i18n.settingBlockTitle }}
      <span class="gl-new-card-count">
      <gl-icon name="package" class="gl-mr-2" />
      {{ protectionRulesQueryResultCount }}
      </span>
      </h3>
      </div>
      </template>
      ......
      ......@@ -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 {
      >
      <template #header>
      <div class="gl-new-card-title-wrapper gl-justify-content-space-between">
      <h3 class="gl-new-card-title">{{ $options.i18n.settingBlockTitle }}</h3>
      <h3 class="gl-new-card-title">
      {{ $options.i18n.settingBlockTitle }}
      <span class="gl-new-card-count">
      <gl-icon name="package" class="gl-mr-2" />
      {{ packageProtectionRulesQueryResultCount }}
      </span>
      </h3>
      <div class="gl-new-card-actions">
      <gl-button
      size="small"
      ......
      # frozen_string_literal: true
      module Resolvers
      class ProjectContainerRegistryProtectionRulesCountResolver < BaseResolver
      type Types::ContainerRegistry::Protection::RuleType.connection_type, null: true
      alias_method :project, :object
      def resolve(**_args)
      return 0 if Feature.disabled?(:container_registry_protected_containers, project)
      project.container_registry_protection_rules.size
      end
      end
      end
      ......@@ -508,6 +508,13 @@ class ProjectType < BaseObject
      alpha: { milestone: '16.10' },
      resolver: Resolvers::ProjectContainerRegistryProtectionRulesResolver
      field :container_registry_protection_rules_count,
      Types::ContainerRegistry::Protection::RuleType.connection_type,
      null: true,
      description: 'Number of container protection rules in the project.',
      alpha: { milestone: '16.11' },
      resolver: Resolvers::ProjectContainerRegistryProtectionRulesCountResolver
      field :container_repositories, Types::ContainerRepositoryType.connection_type,
      null: true,
      description: 'Container repositories of the project.',
      ......
      ......@@ -25522,6 +25522,7 @@ Check permissions for the current user on a vulnerability finding.
      | <a id="projectcontainerexpirationpolicy"></a>`containerExpirationPolicy` | [`ContainerExpirationPolicy`](#containerexpirationpolicy) | Container expiration policy of the project. |
      | <a id="projectcontainerregistryenabled"></a>`containerRegistryEnabled` | [`Boolean`](#boolean) | Indicates if Container Registry is enabled for the current user. |
      | <a id="projectcontainerregistryprotectionrules"></a>`containerRegistryProtectionRules` **{warning-solid}** | [`ContainerRegistryProtectionRuleConnection`](#containerregistryprotectionruleconnection) | **Introduced** in GitLab 16.10. **Status**: Experiment. Container protection rules for the project. |
      | <a id="projectcontainerregistryprotectionrulescount"></a>`containerRegistryProtectionRulesCount` **{warning-solid}** | [`ContainerRegistryProtectionRuleConnection`](#containerregistryprotectionruleconnection) | **Introduced** in GitLab 16.11. **Status**: Experiment. Number of container protection rules in the project. |
      | <a id="projectcontainerrepositoriescount"></a>`containerRepositoriesCount` | [`Int!`](#int) | Number of container repositories in the project. |
      | <a id="projectcorpuses"></a>`corpuses` | [`CoverageFuzzingCorpusConnection`](#coveragefuzzingcorpusconnection) | Find corpuses of the project. (see [Connections](#connections)) |
      | <a id="projectcreatedat"></a>`createdAt` | [`Time`](#time) | Timestamp of the project creation. |
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Finish editing this message first!
      Please register or to comment