diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-29 03:12:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-29 03:12:11 +0300 |
commit | 859ee9fc169e0a899af3a683ea452d06334d15b9 (patch) | |
tree | 2ff7dc6cf0940c9c3dde717741845befda4c206e /app/models | |
parent | e5940143fe1fdb95ed7c3dc6f0a4efdfaaf876c0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ml/candidate.rb | 1 | ||||
-rw-r--r-- | app/models/ml/candidate_metadata.rb | 14 | ||||
-rw-r--r-- | app/models/ml/experiment.rb | 1 | ||||
-rw-r--r-- | app/models/ml/experiment_metadata.rb | 14 | ||||
-rw-r--r-- | app/models/synthetic_note.rb | 1 | ||||
-rw-r--r-- | app/models/work_items/type.rb | 55 | ||||
-rw-r--r-- | app/models/work_items/widgets/notes.rb | 14 |
7 files changed, 91 insertions, 9 deletions
diff --git a/app/models/ml/candidate.rb b/app/models/ml/candidate.rb index f7da4418624..56b468f8286 100644 --- a/app/models/ml/candidate.rb +++ b/app/models/ml/candidate.rb @@ -11,6 +11,7 @@ module Ml belongs_to :user has_many :metrics, class_name: 'Ml::CandidateMetric' has_many :params, class_name: 'Ml::CandidateParam' + has_many :metadata, class_name: 'Ml::CandidateMetadata' has_many :latest_metrics, -> { latest }, class_name: 'Ml::CandidateMetric', inverse_of: :candidate attribute :iid, default: -> { SecureRandom.uuid } diff --git a/app/models/ml/candidate_metadata.rb b/app/models/ml/candidate_metadata.rb new file mode 100644 index 00000000000..06b893c211f --- /dev/null +++ b/app/models/ml/candidate_metadata.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Ml + class CandidateMetadata < ApplicationRecord + validates :candidate, presence: true + validates :name, + length: { maximum: 250 }, + presence: true, + uniqueness: { scope: :candidate, message: ->(candidate, _) { "'#{candidate.name}' already taken" } } + validates :value, length: { maximum: 5000 }, presence: true + + belongs_to :candidate, class_name: 'Ml::Candidate' + end +end diff --git a/app/models/ml/experiment.rb b/app/models/ml/experiment.rb index 05b238b960d..0a326b0e005 100644 --- a/app/models/ml/experiment.rb +++ b/app/models/ml/experiment.rb @@ -10,6 +10,7 @@ module Ml belongs_to :project belongs_to :user has_many :candidates, class_name: 'Ml::Candidate' + has_many :metadata, class_name: 'Ml::ExperimentMetadata' has_internal_id :iid, scope: :project diff --git a/app/models/ml/experiment_metadata.rb b/app/models/ml/experiment_metadata.rb new file mode 100644 index 00000000000..93496807e1a --- /dev/null +++ b/app/models/ml/experiment_metadata.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Ml + class ExperimentMetadata < ApplicationRecord + validates :experiment, presence: true + validates :name, + length: { maximum: 250 }, + presence: true, + uniqueness: { scope: :experiment, message: ->(exp, _) { "'#{exp.name}' already taken" } } + validates :value, length: { maximum: 5000 }, presence: true + + belongs_to :experiment, class_name: 'Ml::Experiment' + end +end diff --git a/app/models/synthetic_note.rb b/app/models/synthetic_note.rb index dea7165af9f..a60c0d2f3bc 100644 --- a/app/models/synthetic_note.rb +++ b/app/models/synthetic_note.rb @@ -10,6 +10,7 @@ class SyntheticNote < Note system: true, author: event.user, created_at: event.created_at, + updated_at: event.created_at, discussion_id: event.discussion_id, noteable: resource, event: event, diff --git a/app/models/work_items/type.rb b/app/models/work_items/type.rb index 51ec5676ae6..9d2f3b552e6 100644 --- a/app/models/work_items/type.rb +++ b/app/models/work_items/type.rb @@ -36,15 +36,52 @@ module WorkItems }.freeze WIDGETS_FOR_TYPE = { - issue: [Widgets::Assignees, Widgets::Labels, Widgets::Description, Widgets::Hierarchy, Widgets::StartAndDueDate, - Widgets::Milestone], - incident: [Widgets::Description, Widgets::Hierarchy], - test_case: [Widgets::Description], - requirement: [Widgets::Description], - task: [Widgets::Assignees, Widgets::Labels, Widgets::Description, Widgets::Hierarchy, Widgets::StartAndDueDate, - Widgets::Milestone], - objective: [Widgets::Assignees, Widgets::Labels, Widgets::Description, Widgets::Hierarchy, Widgets::Milestone], - key_result: [Widgets::Assignees, Widgets::Labels, Widgets::Description, Widgets::StartAndDueDate] + issue: [ + Widgets::Assignees, + Widgets::Labels, + Widgets::Description, + Widgets::Hierarchy, + Widgets::StartAndDueDate, + Widgets::Milestone, + Widgets::Notes + ], + incident: [ + Widgets::Description, + Widgets::Hierarchy, + Widgets::Notes + ], + test_case: [ + Widgets::Description, + Widgets::Notes + ], + requirement: [ + Widgets::Description, + Widgets::Notes + ], + task: [ + Widgets::Assignees, + Widgets::Labels, + Widgets::Description, + Widgets::Hierarchy, + Widgets::StartAndDueDate, + Widgets::Milestone, + Widgets::Notes + ], + objective: [ + Widgets::Assignees, + Widgets::Labels, + Widgets::Description, + Widgets::Hierarchy, + Widgets::Milestone, + Widgets::Notes + ], + key_result: [ + Widgets::Assignees, + Widgets::Labels, + Widgets::Description, + Widgets::StartAndDueDate, + Widgets::Notes + ] }.freeze WI_TYPES_WITH_CREATED_HEADER = %w[issue incident].freeze diff --git a/app/models/work_items/widgets/notes.rb b/app/models/work_items/widgets/notes.rb new file mode 100644 index 00000000000..bde94ea8f43 --- /dev/null +++ b/app/models/work_items/widgets/notes.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module WorkItems + module Widgets + class Notes < Base + delegate :notes, to: :work_item + delegate_missing_to :work_item + + def declarative_policy_delegate + work_item + end + end + end +end |