diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-28 12:14:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-28 12:14:21 +0300 |
commit | 41ad919dfa526556bf7a3981ee740e236df5a8e7 (patch) | |
tree | f3c79f35820f9d27faf156d8533d45d4f28f9c0a /app | |
parent | 3e8e61e285711de3525d65165000cca347315e89 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
7 files changed, 45 insertions, 17 deletions
diff --git a/app/assets/javascripts/performance_bar/components/detailed_metric.vue b/app/assets/javascripts/performance_bar/components/detailed_metric.vue index ab10283b3c4..f23b6d4596a 100644 --- a/app/assets/javascripts/performance_bar/components/detailed_metric.vue +++ b/app/assets/javascripts/performance_bar/components/detailed_metric.vue @@ -141,7 +141,7 @@ export default { v-if="currentRequest.details && metricDetails" :id="`peek-view-${metric}`" class="gl-display-flex gl-align-items-baseline view" - data-qa-selector="detailed_metric_content" + data-testid="detailed-metric-content" > <gl-button v-gl-tooltip.viewport diff --git a/app/assets/javascripts/performance_bar/components/performance_bar_app.vue b/app/assets/javascripts/performance_bar/components/performance_bar_app.vue index c5f8fd1904f..9711610d0e2 100644 --- a/app/assets/javascripts/performance_bar/components/performance_bar_app.vue +++ b/app/assets/javascripts/performance_bar/components/performance_bar_app.vue @@ -175,7 +175,7 @@ export default { <div v-if="currentRequest" class="gl-display-flex container-fluid gl-overflow-x-auto" - data-qa-selector="performance_bar" + data-testid="performance-bar" > <div class="gl-display-flex gl-flex-shrink-0 view-performance-container"> <div v-if="hasHost" id="peek-view-host" class="gl-display-flex gl-gap-2 view"> diff --git a/app/assets/javascripts/performance_bar/components/request_selector.vue b/app/assets/javascripts/performance_bar/components/request_selector.vue index 2914b9762ac..b4f2140945f 100644 --- a/app/assets/javascripts/performance_bar/components/request_selector.vue +++ b/app/assets/javascripts/performance_bar/components/request_selector.vue @@ -28,13 +28,13 @@ export default { }; </script> <template> - <div id="peek-request-selector" data-qa-selector="request_dropdown" class="view gl-mr-5"> + <div id="peek-request-selector" data-testid="request-dropdown" class="view gl-mr-5"> <gl-form-select v-model="currentRequestId" class="gl-px-3! gl-py-2!"> <option v-for="request in requests" :key="request.id" :value="request.id" - data-qa-selector="request_dropdown_option" + data-testid="request-dropdown-option" > {{ request.displayName }} </option> diff --git a/app/graphql/mutations/organizations/create.rb b/app/graphql/mutations/organizations/create.rb index 0d1b204a4c1..2e26184b9fe 100644 --- a/app/graphql/mutations/organizations/create.rb +++ b/app/graphql/mutations/organizations/create.rb @@ -20,16 +20,29 @@ module Mutations required: true, description: 'Path for the organization.' + argument :description, GraphQL::Types::String, + required: false, + description: 'Description of the organization.' + def resolve(args) authorize!(:global) result = ::Organizations::CreateService.new( current_user: current_user, - params: args + params: create_params(args) ).execute { organization: result.payload, errors: result.errors } end + + private + + def create_params(params) + return params unless params.key?(:description) + + params[:organization_detail_attributes] = { description: params.delete(:description) } + params + end end end end diff --git a/app/graphql/types/organizations/organization_type.rb b/app/graphql/types/organizations/organization_type.rb index 01d5bd7b635..664bf7acc33 100644 --- a/app/graphql/types/organizations/organization_type.rb +++ b/app/graphql/types/organizations/organization_type.rb @@ -17,9 +17,7 @@ module Types field :description, GraphQL::Types::String, null: true, - description: - 'Description of the organization. `null` until ' \ - '[#422078](https://gitlab.com/gitlab-org/gitlab/-/issues/422078) is complete.', + description: 'Description of the organization.', alpha: { milestone: '16.7' } field :groups, Types::GroupType.connection_type, @@ -47,14 +45,13 @@ module Types null: false, description: 'Path of the organization.', alpha: { milestone: '16.4' } - field :web_url, GraphQL::Types::String, + field :web_url, + GraphQL::Types::String, null: false, description: 'Web URL of the organization.', alpha: { milestone: '16.6' } - # Returns empty string until https://gitlab.com/gitlab-org/gitlab/-/issues/422078 is complete. - markdown_field :description_html, - null: true + markdown_field :description_html, null: true, alpha: { milestone: '16.7' }, &:organization_detail # TODO - update to return real avatar url when https://gitlab.com/gitlab-org/gitlab/-/issues/422418 is complete. def avatar_url diff --git a/app/models/organizations/organization.rb b/app/models/organizations/organization.rb index 4244f51bb2e..38c1c65ee54 100644 --- a/app/models/organizations/organization.rb +++ b/app/models/organizations/organization.rb @@ -13,6 +13,7 @@ module Organizations has_many :projects has_one :settings, class_name: "OrganizationSetting" + has_one :organization_detail, inverse_of: :organization, autosave: true has_many :organization_users, inverse_of: :organization has_many :users, through: :organization_users, inverse_of: :organizations @@ -26,10 +27,18 @@ module Organizations 'organizations/path': true, length: { minimum: 2, maximum: 255 } + delegate :description, to: :organization_detail + + accepts_nested_attributes_for :organization_detail + def self.default_organization find_by(id: DEFAULT_ORGANIZATION_ID) end + def organization_detail + super.presence || build_organization_detail + end + def default? id == DEFAULT_ORGANIZATION_ID end @@ -46,11 +55,6 @@ module Organizations Gitlab::UrlBuilder.build(self, only_path: only_path) end - # TODO - update to return real description when https://gitlab.com/gitlab-org/gitlab/-/issues/422078 is complete. - def description - nil - end - private def check_if_default_organization diff --git a/app/models/organizations/organization_detail.rb b/app/models/organizations/organization_detail.rb new file mode 100644 index 00000000000..2814f412d59 --- /dev/null +++ b/app/models/organizations/organization_detail.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Organizations + class OrganizationDetail < ApplicationRecord + include CacheMarkdownField + + cache_markdown_field :description + + belongs_to :organization, inverse_of: :organization_detail + + validates :organization, presence: true + validates :description, length: { maximum: 1024 } + end +end |