Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-24 03:11:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-24 03:11:30 +0300
commit1dd92924325105bb04d8900ac2577e59eb39f603 (patch)
tree0639fdc40eb357eb3fab79155e1e59076fbc1cec /app
parenta0686b4653208e66c768b63e249bd73406f9e267 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/ml/model_registry/apps/show_ml_model.vue59
-rw-r--r--app/assets/javascripts/ml/model_registry/translations.js10
-rw-r--r--app/assets/javascripts/sidebar/components/severity/sidebar_severity_widget.vue4
-rw-r--r--app/components/projects/ml/show_ml_model_component.rb15
-rw-r--r--app/graphql/mutations/namespace/package_settings/update.rb10
-rw-r--r--app/graphql/types/namespace/package_settings_type.rb15
-rw-r--r--app/presenters/ml/model_presenter.rb6
7 files changed, 94 insertions, 25 deletions
diff --git a/app/assets/javascripts/ml/model_registry/apps/show_ml_model.vue b/app/assets/javascripts/ml/model_registry/apps/show_ml_model.vue
index d4f17c840d7..e8ec8f157ef 100644
--- a/app/assets/javascripts/ml/model_registry/apps/show_ml_model.vue
+++ b/app/assets/javascripts/ml/model_registry/apps/show_ml_model.vue
@@ -1,16 +1,71 @@
<script>
+import { GlTab, GlTabs, GlBadge } from '@gitlab/ui';
+import MetadataItem from '~/vue_shared/components/registry/metadata_item.vue';
+import TitleArea from '~/vue_shared/components/registry/title_area.vue';
+import * as i18n from '../translations';
+
export default {
name: 'ShowMlModelApp',
- components: {},
+ components: {
+ TitleArea,
+ GlTabs,
+ GlTab,
+ GlBadge,
+ MetadataItem,
+ },
props: {
model: {
type: Object,
required: true,
},
},
+ computed: {
+ versionCount() {
+ return this.model.versionCount || 0;
+ },
+ candidateCount() {
+ return this.model.candidateCount || 0;
+ },
+ },
+ i18n,
};
</script>
<template>
- <div>{{ model.name }}</div>
+ <div>
+ <title-area :title="model.name">
+ <template #metadata-versions-count>
+ <metadata-item
+ icon="machine-learning"
+ :text="$options.i18n.versionsCountLabel(model.versionCount)"
+ />
+ </template>
+
+ <template #sub-header>
+ {{ model.description }}
+ </template>
+ </title-area>
+
+ <gl-tabs class="gl-mt-4">
+ <gl-tab :title="$options.i18n.MODEL_DETAILS_TAB_LABEL">
+ <h3 class="gl-font-lg">{{ $options.i18n.LATEST_VERSION_LABEL }}</h3>
+ <template v-if="model.latestVersion">
+ {{ model.latestVersion.version }}
+ </template>
+ <div v-else class="gl-text-secondary">{{ $options.i18n.NO_VERSIONS_LABEL }}</div>
+ </gl-tab>
+ <gl-tab>
+ <template #title>
+ {{ $options.i18n.MODEL_OTHER_VERSIONS_TAB_LABEL }}
+ <gl-badge size="sm" class="gl-tab-counter-badge">{{ versionCount }}</gl-badge>
+ </template>
+ </gl-tab>
+ <gl-tab>
+ <template #title>
+ {{ $options.i18n.MODEL_CANDIDATES_TAB_LABEL }}
+ <gl-badge size="sm" class="gl-tab-counter-badge">{{ candidateCount }}</gl-badge>
+ </template>
+ </gl-tab>
+ </gl-tabs>
+ </div>
</template>
diff --git a/app/assets/javascripts/ml/model_registry/translations.js b/app/assets/javascripts/ml/model_registry/translations.js
new file mode 100644
index 00000000000..5305285b363
--- /dev/null
+++ b/app/assets/javascripts/ml/model_registry/translations.js
@@ -0,0 +1,10 @@
+import { s__, n__ } from '~/locale';
+
+export const MODEL_DETAILS_TAB_LABEL = s__('MlModelRegistry|Details');
+export const MODEL_OTHER_VERSIONS_TAB_LABEL = s__('MlModelRegistry|Versions');
+export const MODEL_CANDIDATES_TAB_LABEL = s__('MlModelRegistry|Version candidates');
+export const LATEST_VERSION_LABEL = s__('MlModelRegistry|Latest version');
+export const NO_VERSIONS_LABEL = s__('MlModelRegistry|This model has no versions');
+
+export const versionsCountLabel = (versionCount) =>
+ n__('MlModelRegistry|%d version', 'MlModelRegistry|%d versions', versionCount);
diff --git a/app/assets/javascripts/sidebar/components/severity/sidebar_severity_widget.vue b/app/assets/javascripts/sidebar/components/severity/sidebar_severity_widget.vue
index e2a3efa096f..e14fee5bfb8 100644
--- a/app/assets/javascripts/sidebar/components/severity/sidebar_severity_widget.vue
+++ b/app/assets/javascripts/sidebar/components/severity/sidebar_severity_widget.vue
@@ -112,7 +112,7 @@ export default {
</script>
<template>
- <div ref="sidebarSeverity" class="block">
+ <div ref="sidebarSeverity" class="block" data-testid="severity-block-container">
<sidebar-editable-item
ref="toggle"
:loading="isUpdating"
@@ -131,7 +131,7 @@ export default {
</gl-sprintf>
</gl-tooltip>
</div>
- <div class="hide-collapsed">
+ <div class="hide-collapsed" data-testid="incident-severity">
<severity-token :severity="selectedItem" />
</div>
</template>
diff --git a/app/components/projects/ml/show_ml_model_component.rb b/app/components/projects/ml/show_ml_model_component.rb
index 2fe2c7e7e9d..d349c0a22e9 100644
--- a/app/components/projects/ml/show_ml_model_component.rb
+++ b/app/components/projects/ml/show_ml_model_component.rb
@@ -16,11 +16,22 @@ module Projects
model: {
id: model.id,
name: model.name,
- path: model.path
+ path: model.path,
+ description: "This is a placeholder for the short description",
+ latest_version: latest_version_view_model,
+ version_count: model.version_count
}
}
- Gitlab::Json.generate(vm)
+ Gitlab::Json.generate(vm.deep_transform_keys { |k| k.to_s.camelize(:lower) })
+ end
+
+ def latest_version_view_model
+ return unless model.latest_version
+
+ {
+ version: model.latest_version.version
+ }
end
end
end
diff --git a/app/graphql/mutations/namespace/package_settings/update.rb b/app/graphql/mutations/namespace/package_settings/update.rb
index 4e71bed52c6..97c16ee79fe 100644
--- a/app/graphql/mutations/namespace/package_settings/update.rb
+++ b/app/graphql/mutations/namespace/package_settings/update.rb
@@ -8,8 +8,6 @@ module Mutations
include Mutations::ResolvesNamespace
- NUGET_DUPLICATES_FF_ERROR = '`nuget_duplicates_option` feature flag is disabled.'
-
description <<~DESC
These settings can be adjusted by the group Owner or Maintainer.
[Issue 370471](https://gitlab.com/gitlab-org/gitlab/-/issues/370471) proposes limiting
@@ -91,10 +89,6 @@ module Mutations
def resolve(namespace_path:, **args)
namespace = authorized_find!(namespace_path: namespace_path)
- if nuget_duplicate_settings_present?(args) && Feature.disabled?(:nuget_duplicates_option, namespace)
- raise_resource_not_available_error! NUGET_DUPLICATES_FF_ERROR
- end
-
result = ::Namespaces::PackageSettings::UpdateService
.new(container: namespace, current_user: current_user, params: args)
.execute
@@ -110,10 +104,6 @@ module Mutations
def find_object(namespace_path:)
resolve_namespace(full_path: namespace_path)
end
-
- def nuget_duplicate_settings_present?(args)
- args.key?(:nuget_duplicates_allowed) || args.key?(:nuget_duplicate_exception_regex)
- end
end
end
end
diff --git a/app/graphql/types/namespace/package_settings_type.rb b/app/graphql/types/namespace/package_settings_type.rb
index 61240243b1f..6c6144f2357 100644
--- a/app/graphql/types/namespace/package_settings_type.rb
+++ b/app/graphql/types/namespace/package_settings_type.rb
@@ -20,21 +20,18 @@ module Types
field :maven_duplicates_allowed, GraphQL::Types::Boolean,
null: false,
description: 'Indicates whether duplicate Maven packages are allowed for this namespace.'
- field :nuget_duplicate_exception_regex, Types::UntrustedRegexp,
- null: true,
- description: 'When nuget_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect. ' \
- 'Error is raised if `nuget_duplicates_option` feature flag is disabled.'
- field :nuget_duplicates_allowed, GraphQL::Types::Boolean,
- null: false,
- description: 'Indicates whether duplicate NuGet packages are allowed for this namespace. ' \
- 'Error is raised if `nuget_duplicates_option` feature flag is disabled.'
-
field :maven_package_requests_forwarding, GraphQL::Types::Boolean,
null: true,
description: 'Indicates whether Maven package forwarding is allowed for this namespace.'
field :npm_package_requests_forwarding, GraphQL::Types::Boolean,
null: true,
description: 'Indicates whether npm package forwarding is allowed for this namespace.'
+ field :nuget_duplicate_exception_regex, Types::UntrustedRegexp,
+ null: true,
+ description: 'When nuget_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect. '
+ field :nuget_duplicates_allowed, GraphQL::Types::Boolean,
+ null: false,
+ description: 'Indicates whether duplicate NuGet packages are allowed for this namespace. '
field :pypi_package_requests_forwarding, GraphQL::Types::Boolean,
null: true,
description: 'Indicates whether PyPI package forwarding is allowed for this namespace.'
diff --git a/app/presenters/ml/model_presenter.rb b/app/presenters/ml/model_presenter.rb
index 388e2b73bc1..324701be2c6 100644
--- a/app/presenters/ml/model_presenter.rb
+++ b/app/presenters/ml/model_presenter.rb
@@ -8,6 +8,12 @@ module Ml
model.latest_version&.version
end
+ def version_count
+ return model.version_count if model.respond_to?(:version_count)
+
+ model.versions.size
+ end
+
def latest_package_path
return unless model.latest_version&.package_id.present?