diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-14 12:08:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-14 12:08:45 +0300 |
commit | 6f9218ac84f0de0ebfddf2d4fbd79db881b2d46a (patch) | |
tree | 77315600c53ab077c7effd3ddf3f630dff6ea081 /app | |
parent | 3612694ce3931fe7fd225d9c2df42dbd513121df (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
20 files changed, 163 insertions, 412 deletions
diff --git a/app/finders/serverless_domain_finder.rb b/app/finders/serverless_domain_finder.rb deleted file mode 100644 index 661cd0ca363..00000000000 --- a/app/finders/serverless_domain_finder.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class ServerlessDomainFinder - attr_reader :match, :serverless_domain_cluster, :environment - - def initialize(uri) - @match = ::Serverless::Domain::REGEXP.match(uri) - end - - def execute - return unless serverless? - - @serverless_domain_cluster = ::Serverless::DomainCluster.for_uuid(serverless_domain_cluster_uuid) - return unless serverless_domain_cluster&.knative&.external_ip - - @environment = ::Environment.for_id_and_slug(match[:environment_id].to_i(16), match[:environment_slug]) - return unless environment - - ::Serverless::Domain.new( - function_name: match[:function_name], - serverless_domain_cluster: serverless_domain_cluster, - environment: environment - ) - end - - def serverless_domain_cluster_uuid - return unless serverless? - - match[:cluster_left] + match[:cluster_middle] + match[:cluster_right] - end - - def serverless? - !!match - end -end diff --git a/app/models/clusters/applications/knative.rb b/app/models/clusters/applications/knative.rb index 64366594583..41f6bf67ba8 100644 --- a/app/models/clusters/applications/knative.rb +++ b/app/models/clusters/applications/knative.rb @@ -13,8 +13,6 @@ module Clusters self.table_name = 'clusters_applications_knative' - has_one :serverless_domain_cluster, class_name: '::Serverless::DomainCluster', foreign_key: 'clusters_applications_knative_id', inverse_of: :knative - include ::Clusters::Concerns::ApplicationCore include ::Clusters::Concerns::ApplicationStatus include ::Clusters::Concerns::ApplicationVersion @@ -49,8 +47,6 @@ module Clusters scope :for_cluster, -> (cluster) { where(cluster: cluster) } - has_one :pages_domain, through: :serverless_domain_cluster - def chart 'knative/knative' end diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 071759318c7..0c3146fba0b 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -363,12 +363,6 @@ module Clusters end end - def serverless_domain - strong_memoize(:serverless_domain) do - self.application_knative&.serverless_domain_cluster - end - end - def prometheus_adapter integration_prometheus end diff --git a/app/models/pages_domain.rb b/app/models/pages_domain.rb index 554753dd4b2..446c4a6187c 100644 --- a/app/models/pages_domain.rb +++ b/app/models/pages_domain.rb @@ -15,7 +15,6 @@ class PagesDomain < ApplicationRecord belongs_to :project has_many :acme_orders, class_name: "PagesDomainAcmeOrder" - has_many :serverless_domain_clusters, class_name: 'Serverless::DomainCluster', inverse_of: :pages_domain after_initialize :set_verification_code before_validation :clear_auto_ssl_failure, unless: :auto_ssl_enabled diff --git a/app/models/serverless/domain.rb b/app/models/serverless/domain.rb deleted file mode 100644 index 164f93afa9a..00000000000 --- a/app/models/serverless/domain.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -module Serverless - class Domain - include ActiveModel::Model - - REGEXP = %r{^(?<scheme>https?://)?(?<function_name>[^.]+)-(?<cluster_left>\h{2})a1(?<cluster_middle>\h{10})f2(?<cluster_right>\h{2})(?<environment_id>\h+)-(?<environment_slug>[^.]+)\.(?<pages_domain_name>.+)}.freeze - UUID_LENGTH = 14 - - attr_accessor :function_name, :serverless_domain_cluster, :environment - - validates :function_name, presence: true, allow_blank: false - validates :serverless_domain_cluster, presence: true - validates :environment, presence: true - - def self.generate_uuid - SecureRandom.hex(UUID_LENGTH / 2) - end - - def uri - URI("https://#{function_name}-#{serverless_domain_cluster_uuid}#{"%x" % environment.id}-#{environment.slug}.#{serverless_domain_cluster.domain}") - end - - def knative_uri - URI("http://#{function_name}.#{namespace}.#{serverless_domain_cluster.knative.hostname}") - end - - private - - def namespace - serverless_domain_cluster.cluster.kubernetes_namespace_for(environment) - end - - def serverless_domain_cluster_uuid - [ - serverless_domain_cluster.uuid[0..1], - 'a1', - serverless_domain_cluster.uuid[2..-3], - 'f2', - serverless_domain_cluster.uuid[-2..] - ].join - end - end -end diff --git a/app/models/serverless/domain_cluster.rb b/app/models/serverless/domain_cluster.rb deleted file mode 100644 index 561bfc65b2b..00000000000 --- a/app/models/serverless/domain_cluster.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -module Serverless - class DomainCluster < ApplicationRecord - self.table_name = 'serverless_domain_cluster' - - HEX_REGEXP = %r{\A\h+\z}.freeze - - belongs_to :pages_domain - belongs_to :knative, class_name: 'Clusters::Applications::Knative', foreign_key: 'clusters_applications_knative_id' - belongs_to :creator, class_name: 'User', optional: true - - attr_encrypted :key, - mode: :per_attribute_iv, - key: Settings.attr_encrypted_db_key_base_32, - algorithm: 'aes-256-gcm' - - validates :pages_domain, :knative, presence: true - validates :uuid, presence: true, uniqueness: true, length: { is: ::Serverless::Domain::UUID_LENGTH }, - format: { with: HEX_REGEXP, message: 'only allows hex characters' } - - after_initialize :set_uuid, if: :new_record? - - delegate :domain, to: :pages_domain - delegate :cluster, to: :knative - - def self.for_uuid(uuid) - joins(:pages_domain, :knative) - .includes(:pages_domain, :knative) - .find_by(uuid: uuid) - end - - private - - def set_uuid - self.uuid = ::Serverless::Domain.generate_uuid - end - end -end diff --git a/app/models/serverless/function.rb b/app/models/serverless/function.rb deleted file mode 100644 index 5d4f8e0c9e2..00000000000 --- a/app/models/serverless/function.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module Serverless - class Function - attr_accessor :name, :namespace - - def initialize(project, name, namespace) - @project = project - @name = name - @namespace = namespace - end - - def id - @project.id.to_s + "/" + @name + "/" + @namespace - end - - def self.find_by_id(id) - array = id.split("/") - project = Project.find_by_id(array[0]) - name = array[1] - namespace = array[2] - - self.new(project, name, namespace) - end - end -end diff --git a/app/models/serverless/lookup_path.rb b/app/models/serverless/lookup_path.rb deleted file mode 100644 index c09b3718651..00000000000 --- a/app/models/serverless/lookup_path.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module Serverless - class LookupPath - attr_reader :serverless_domain - - delegate :serverless_domain_cluster, to: :serverless_domain - delegate :knative, to: :serverless_domain_cluster - delegate :certificate, to: :serverless_domain_cluster - delegate :key, to: :serverless_domain_cluster - - def initialize(serverless_domain) - @serverless_domain = serverless_domain - end - - def source - { - type: 'serverless', - service: serverless_domain.knative_uri.host, - cluster: { - hostname: knative.hostname, - address: knative.external_ip, - port: 443, - cert: certificate, - key: key - } - } - end - end -end diff --git a/app/models/serverless/virtual_domain.rb b/app/models/serverless/virtual_domain.rb deleted file mode 100644 index d6a23a4c0ce..00000000000 --- a/app/models/serverless/virtual_domain.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module Serverless - class VirtualDomain - attr_reader :serverless_domain - - delegate :serverless_domain_cluster, to: :serverless_domain - delegate :pages_domain, to: :serverless_domain_cluster - delegate :certificate, to: :pages_domain - delegate :key, to: :pages_domain - - def initialize(serverless_domain) - @serverless_domain = serverless_domain - end - - def lookup_paths - [ - ::Serverless::LookupPath.new(serverless_domain) - ] - end - end -end diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 5da0655d21a..79c1946f3d2 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -34,9 +34,7 @@ module Ci def runner_variables variables - .sort_and_expand_all(keep_undefined: true, - expand_file_refs: false, - expand_raw_refs: false) + .sort_and_expand_all(keep_undefined: true, expand_file_refs: false, expand_raw_refs: false) .to_runner_variables end diff --git a/app/presenters/label_presenter.rb b/app/presenters/label_presenter.rb index e60cdf4088c..56d986a9c23 100644 --- a/app/presenters/label_presenter.rb +++ b/app/presenters/label_presenter.rb @@ -27,14 +27,18 @@ class LabelPresenter < Gitlab::View::Presenter::Delegated def filter_path(type: :issue) case context_subject when Group - send("#{type.to_s.pluralize}_group_path", # rubocop:disable GitlabSecurity/PublicSend - context_subject, - label_name: [label.name]) + send( # rubocop:disable GitlabSecurity/PublicSend + "#{type.to_s.pluralize}_group_path", + context_subject, + label_name: [label.name] + ) when Project - send("namespace_project_#{type.to_s.pluralize}_path", # rubocop:disable GitlabSecurity/PublicSend - context_subject.namespace, - context_subject, - label_name: [label.name]) + send( # rubocop:disable GitlabSecurity/PublicSend + "namespace_project_#{type.to_s.pluralize}_path", + context_subject.namespace, + context_subject, + label_name: [label.name] + ) end end diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb index 353e0fad6fb..12f4b0496e4 100644 --- a/app/presenters/merge_request_presenter.rb +++ b/app/presenters/merge_request_presenter.rb @@ -57,9 +57,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated notice_now: edit_in_new_fork_notice_now } - project_forks_path(merge_request.project, - namespace_key: current_user.namespace.id, - continue: continue_params) + project_forks_path(merge_request.project, namespace_key: current_user.namespace.id, continue: continue_params) end end @@ -71,9 +69,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated notice_now: edit_in_new_fork_notice_now } - project_forks_path(project, - namespace_key: current_user.namespace.id, - continue: continue_params) + project_forks_path(project, namespace_key: current_user.namespace.id, continue: continue_params) end end @@ -155,12 +151,12 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated def assign_to_closing_issues_count # rubocop: disable CodeReuse/ServiceClass - issues = MergeRequests::AssignIssuesService.new(project: project, - current_user: current_user, - params: { - merge_request: merge_request, - closes_issues: closing_issues - }).assignable_issues + issues = MergeRequests::AssignIssuesService.new( + project: project, + current_user: current_user, + params: { merge_request: merge_request, closes_issues: closing_issues } + ).assignable_issues + issues.count # rubocop: enable CodeReuse/ServiceClass end diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 392a2fcd390..c02f3021069 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -99,11 +99,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated def contribution_guide_path if project && contribution_guide = repository.contribution_guide - project_blob_path( - project, - tree_join(project.default_branch, - contribution_guide.name) - ) + project_blob_path(project, tree_join(project.default_branch, contribution_guide.name)) end end @@ -166,14 +162,16 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated def storage_anchor_data can_show_quota = can?(current_user, :admin_project, project) && !empty_repo? - AnchorData.new(true, - statistic_icon('disk') + - _('%{strong_start}%{human_size}%{strong_end} Project Storage').html_safe % { - human_size: storage_counter(statistics.storage_size), - strong_start: '<strong class="project-stat-value">'.html_safe, - strong_end: '</strong>'.html_safe - }, - can_show_quota ? project_usage_quotas_path(project) : nil) + AnchorData.new( + true, + statistic_icon('disk') + + _('%{strong_start}%{human_size}%{strong_end} Project Storage').html_safe % { + human_size: storage_counter(statistics.storage_size), + strong_start: '<strong class="project-stat-value">'.html_safe, + strong_end: '</strong>'.html_safe + }, + can_show_quota ? project_usage_quotas_path(project) : nil + ) end def releases_anchor_data @@ -182,14 +180,16 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated releases_count = project.releases.count return if releases_count < 1 - AnchorData.new(true, - statistic_icon('deployments') + - n_('%{strong_start}%{release_count}%{strong_end} Release', '%{strong_start}%{release_count}%{strong_end} Releases', releases_count).html_safe % { - release_count: number_with_delimiter(releases_count), - strong_start: '<strong class="project-stat-value">'.html_safe, - strong_end: '</strong>'.html_safe - }, - project_releases_path(project)) + AnchorData.new( + true, + statistic_icon('deployments') + + n_('%{strong_start}%{release_count}%{strong_end} Release', '%{strong_start}%{release_count}%{strong_end} Releases', releases_count).html_safe % { + release_count: number_with_delimiter(releases_count), + strong_start: '<strong class="project-stat-value">'.html_safe, + strong_end: '</strong>'.html_safe + }, + project_releases_path(project) + ) end def environments_anchor_data @@ -198,67 +198,76 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated environments_count = project.environments.available.count return if environments_count == 0 - AnchorData.new(true, - statistic_icon('environment') + - n_('%{strong_start}%{count}%{strong_end} Environment', '%{strong_start}%{count}%{strong_end} Environments', environments_count).html_safe % { - count: number_with_delimiter(environments_count), - strong_start: '<strong class="project-stat-value">'.html_safe, - strong_end: '</strong>'.html_safe - }, - project_environments_path(project)) + AnchorData.new( + true, + statistic_icon('environment') + + n_('%{strong_start}%{count}%{strong_end} Environment', '%{strong_start}%{count}%{strong_end} Environments', environments_count).html_safe % { + count: number_with_delimiter(environments_count), + strong_start: '<strong class="project-stat-value">'.html_safe, + strong_end: '</strong>'.html_safe + }, + project_environments_path(project) + ) end def commits_anchor_data - AnchorData.new(true, - statistic_icon('commit') + - n_('%{strong_start}%{commit_count}%{strong_end} Commit', '%{strong_start}%{commit_count}%{strong_end} Commits', statistics.commit_count).html_safe % { - commit_count: number_with_delimiter(statistics.commit_count), - strong_start: '<strong class="project-stat-value">'.html_safe, - strong_end: '</strong>'.html_safe - }, - empty_repo? ? nil : project_commits_path(project, default_branch_or_main)) + AnchorData.new( + true, + statistic_icon('commit') + + n_('%{strong_start}%{commit_count}%{strong_end} Commit', '%{strong_start}%{commit_count}%{strong_end} Commits', statistics.commit_count).html_safe % { + commit_count: number_with_delimiter(statistics.commit_count), + strong_start: '<strong class="project-stat-value">'.html_safe, + strong_end: '</strong>'.html_safe + }, + empty_repo? ? nil : project_commits_path(project, default_branch_or_main) + ) end def branches_anchor_data - AnchorData.new(true, - statistic_icon('branch') + - n_('%{strong_start}%{branch_count}%{strong_end} Branch', '%{strong_start}%{branch_count}%{strong_end} Branches', repository.branch_count).html_safe % { - branch_count: number_with_delimiter(repository.branch_count), - strong_start: '<strong class="project-stat-value">'.html_safe, - strong_end: '</strong>'.html_safe - }, - empty_repo? ? nil : project_branches_path(project)) + AnchorData.new( + true, + statistic_icon('branch') + + n_('%{strong_start}%{branch_count}%{strong_end} Branch', '%{strong_start}%{branch_count}%{strong_end} Branches', repository.branch_count).html_safe % { + branch_count: number_with_delimiter(repository.branch_count), + strong_start: '<strong class="project-stat-value">'.html_safe, + strong_end: '</strong>'.html_safe + }, + empty_repo? ? nil : project_branches_path(project) + ) end def tags_anchor_data - AnchorData.new(true, - statistic_icon('label') + - n_('%{strong_start}%{tag_count}%{strong_end} Tag', '%{strong_start}%{tag_count}%{strong_end} Tags', repository.tag_count).html_safe % { - tag_count: number_with_delimiter(repository.tag_count), - strong_start: '<strong class="project-stat-value">'.html_safe, - strong_end: '</strong>'.html_safe - }, - empty_repo? ? nil : project_tags_path(project)) + AnchorData.new( + true, + statistic_icon('label') + + n_('%{strong_start}%{tag_count}%{strong_end} Tag', '%{strong_start}%{tag_count}%{strong_end} Tags', repository.tag_count).html_safe % { + tag_count: number_with_delimiter(repository.tag_count), + strong_start: '<strong class="project-stat-value">'.html_safe, + strong_end: '</strong>'.html_safe + }, + empty_repo? ? nil : project_tags_path(project) + ) end def upload_anchor_data strong_memoize(:upload_anchor_data) do next unless can_current_user_push_to_default_branch? - AnchorData.new(false, - statistic_icon('upload') + _('Upload file'), - '#modal-upload-blob', - 'js-upload-file-trigger', - nil, - nil, - { - 'target_branch' => default_branch_or_main, - 'original_branch' => default_branch_or_main, - 'can_push_code' => 'true', - 'path' => project_create_blob_path(project, default_branch_or_main), - 'project_path' => project.full_path - } - ) + AnchorData.new( + false, + statistic_icon('upload') + _('Upload file'), + '#modal-upload-blob', + 'js-upload-file-trigger', + nil, + nil, + { + 'target_branch' => default_branch_or_main, + 'original_branch' => default_branch_or_main, + 'can_push_code' => 'true', + 'path' => project_create_blob_path(project, default_branch_or_main), + 'project_path' => project.full_path + } + ) end end @@ -266,37 +275,38 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated if can_current_user_push_to_default_branch? new_file_path = empty_repo? ? ide_edit_path(project, default_branch_or_main) : project_new_blob_path(project, default_branch_or_main) - AnchorData.new(false, - statistic_icon + _('New file'), - new_file_path, - 'btn-dashed') + AnchorData.new(false, statistic_icon + _('New file'), new_file_path, 'btn-dashed') end end def readme_anchor_data if can_current_user_push_to_default_branch? && readme_path.nil? - AnchorData.new(false, - statistic_icon + _('Add README'), - empty_repo? ? add_readme_ide_path : add_readme_path) + AnchorData.new(false, statistic_icon + _('Add README'), empty_repo? ? add_readme_ide_path : add_readme_path) elsif readme_path - AnchorData.new(false, - statistic_icon('doc-text') + _('README'), - default_view != 'readme' ? readme_path : '#readme', - 'btn-default', - 'doc-text') + AnchorData.new( + false, + statistic_icon('doc-text') + _('README'), + default_view != 'readme' ? readme_path : '#readme', + 'btn-default', + 'doc-text' + ) end end def changelog_anchor_data if can_current_user_push_to_default_branch? && repository.changelog.blank? - AnchorData.new(false, - statistic_icon + _('Add CHANGELOG'), - empty_repo? ? add_changelog_ide_path : add_changelog_path) + AnchorData.new( + false, + statistic_icon + _('Add CHANGELOG'), + empty_repo? ? add_changelog_ide_path : add_changelog_path + ) elsif repository.changelog.present? - AnchorData.new(false, - statistic_icon('doc-text') + _('CHANGELOG'), - changelog_path, - 'btn-default') + AnchorData.new( + false, + statistic_icon('doc-text') + _('CHANGELOG'), + changelog_path, + 'btn-default' + ) end end @@ -304,29 +314,37 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated icon = statistic_icon('scale') if repository.license_blob.present? - AnchorData.new(false, - icon + content_tag(:span, license_short_name, class: 'project-stat-value'), - license_path, - 'btn-default', - nil, - 'license') + AnchorData.new( + false, + icon + content_tag(:span, license_short_name, class: 'project-stat-value'), + license_path, + 'btn-default', + nil, + 'license' + ) elsif can_current_user_push_to_default_branch? - AnchorData.new(false, - content_tag(:span, statistic_icon + _('Add LICENSE'), class: 'add-license-link d-flex'), - empty_repo? ? add_license_ide_path : add_license_path) + AnchorData.new( + false, + content_tag(:span, statistic_icon + _('Add LICENSE'), class: 'add-license-link d-flex'), + empty_repo? ? add_license_ide_path : add_license_path + ) end end def contribution_guide_anchor_data if can_current_user_push_to_default_branch? && repository.contribution_guide.blank? - AnchorData.new(false, - statistic_icon + _('Add CONTRIBUTING'), - empty_repo? ? add_contribution_guide_ide_path : add_contribution_guide_path) + AnchorData.new( + false, + statistic_icon + _('Add CONTRIBUTING'), + empty_repo? ? add_contribution_guide_ide_path : add_contribution_guide_path + ) elsif repository.contribution_guide.present? - AnchorData.new(false, - statistic_icon('doc-text') + _('CONTRIBUTING'), - contribution_guide_path, - 'btn-default') + AnchorData.new( + false, + statistic_icon('doc-text') + _('CONTRIBUTING'), + contribution_guide_path, + 'btn-default' + ) end end @@ -335,35 +353,32 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated if current_user && can?(current_user, :admin_pipeline, project) && repository.gitlab_ci_yml.blank? && !show_auto_devops_callout if auto_devops_enabled? - AnchorData.new(false, - statistic_icon('settings') + _('Auto DevOps enabled'), - project_settings_ci_cd_path(project, anchor: 'autodevops-settings'), - 'btn-default') + AnchorData.new( + false, + statistic_icon('settings') + _('Auto DevOps enabled'), + project_settings_ci_cd_path(project, anchor: 'autodevops-settings'), + 'btn-default' + ) else - AnchorData.new(false, - statistic_icon + _('Enable Auto DevOps'), - project_settings_ci_cd_path(project, anchor: 'autodevops-settings')) + AnchorData.new( + false, + statistic_icon + _('Enable Auto DevOps'), + project_settings_ci_cd_path(project, anchor: 'autodevops-settings') + ) end elsif auto_devops_enabled? - AnchorData.new(false, - _('Auto DevOps enabled'), - nil) + AnchorData.new(false, _('Auto DevOps enabled'), nil) end end def kubernetes_cluster_anchor_data if can_instantiate_cluster? if clusters.empty? - AnchorData.new(false, - statistic_icon + _('Add Kubernetes cluster'), - project_clusters_path(project)) + AnchorData.new(false, statistic_icon + _('Add Kubernetes cluster'), project_clusters_path(project)) else cluster_link = clusters.count == 1 ? project_cluster_path(project, clusters.first) : project_clusters_path(project) - AnchorData.new(false, - _('Kubernetes'), - cluster_link, - 'btn-default') + AnchorData.new(false, _('Kubernetes'), cluster_link, 'btn-default') end end end @@ -372,14 +387,9 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated return unless can_view_pipeline_editor?(project) if cicd_missing? - AnchorData.new(false, - statistic_icon + _('Set up CI/CD'), - project_ci_pipeline_editor_path(project)) + AnchorData.new(false, statistic_icon + _('Set up CI/CD'), project_ci_pipeline_editor_path(project)) elsif repository.gitlab_ci_yml.present? - AnchorData.new(false, - statistic_icon('doc-text') + _('CI/CD configuration'), - project_ci_pipeline_editor_path(project), - 'btn-default') + AnchorData.new(false, statistic_icon('doc-text') + _('CI/CD configuration'), project_ci_pipeline_editor_path(project), 'btn-default') end end diff --git a/app/presenters/snippet_blob_presenter.rb b/app/presenters/snippet_blob_presenter.rb index 2e5d3ae21d9..84e98e18e32 100644 --- a/app/presenters/snippet_blob_presenter.rb +++ b/app/presenters/snippet_blob_presenter.rb @@ -40,9 +40,11 @@ class SnippetBlobPresenter < BlobPresenter end def render_rich_partial - renderer.render("projects/blob/viewers/_#{blob.rich_viewer.partial_name}", - locals: { viewer: blob.rich_viewer, blob: blob, blob_raw_path: raw_path, blob_raw_url: raw_url, parent_dir_raw_path: raw_directory }, - layout: false) + renderer.render( + "projects/blob/viewers/_#{blob.rich_viewer.partial_name}", + locals: { viewer: blob.rich_viewer, blob: blob, blob_raw_path: raw_path, blob_raw_url: raw_url, parent_dir_raw_path: raw_directory }, + layout: false + ) end def renderer diff --git a/app/serializers/cluster_application_entity.rb b/app/serializers/cluster_application_entity.rb deleted file mode 100644 index f57ac4af113..00000000000 --- a/app/serializers/cluster_application_entity.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class ClusterApplicationEntity < Grape::Entity - expose :name - expose :status_name, as: :status - expose :status_reason - expose :version, if: -> (e, _) { e.respond_to?(:version) } - expose :external_ip, if: -> (e, _) { e.respond_to?(:external_ip) } - expose :external_hostname, if: -> (e, _) { e.respond_to?(:external_hostname) } - expose :hostname, if: -> (e, _) { e.respond_to?(:hostname) } - expose :email, if: -> (e, _) { e.respond_to?(:email) } - expose :stack, if: -> (e, _) { e.respond_to?(:stack) } - expose :update_available?, as: :update_available, if: -> (e, _) { e.respond_to?(:update_available?) } - expose :can_uninstall?, as: :can_uninstall - expose :available_domains, using: Serverless::DomainEntity, if: -> (e, _) { e.respond_to?(:available_domains) } - expose :pages_domain, using: Serverless::DomainEntity, if: -> (e, _) { e.respond_to?(:pages_domain) } - expose :host, if: -> (e, _) { e.respond_to?(:host) } - expose :port, if: -> (e, _) { e.respond_to?(:port) } - expose :protocol, if: -> (e, _) { e.respond_to?(:protocol) } -end diff --git a/app/serializers/cluster_entity.rb b/app/serializers/cluster_entity.rb index 8e256863bcd..161758debca 100644 --- a/app/serializers/cluster_entity.rb +++ b/app/serializers/cluster_entity.rb @@ -13,7 +13,6 @@ class ClusterEntity < Grape::Entity expose :provider_type expose :status_name, as: :status expose :status_reason - expose :applications, using: ClusterApplicationEntity expose :path do |cluster| Clusters::ClusterPresenter.new(cluster).show_path # rubocop: disable CodeReuse/Presenter diff --git a/app/serializers/cluster_serializer.rb b/app/serializers/cluster_serializer.rb index 30b8863efa2..a4e12e51f69 100644 --- a/app/serializers/cluster_serializer.rb +++ b/app/serializers/cluster_serializer.rb @@ -22,6 +22,6 @@ class ClusterSerializer < BaseSerializer end def represent_status(resource) - represent(resource, { only: [:status, :status_reason, :applications] }) + represent(resource, { only: [:status, :status_reason] }) end end diff --git a/app/services/serverless/associate_domain_service.rb b/app/services/serverless/associate_domain_service.rb deleted file mode 100644 index 0c6ee58924c..00000000000 --- a/app/services/serverless/associate_domain_service.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module Serverless - class AssociateDomainService - PLACEHOLDER_HOSTNAME = 'example.com' - - def initialize(knative, pages_domain_id:, creator:) - @knative = knative - @pages_domain_id = pages_domain_id - @creator = creator - end - - def execute - return if unchanged? - - knative.hostname ||= PLACEHOLDER_HOSTNAME - - knative.pages_domain = knative.find_available_domain(pages_domain_id) - knative.serverless_domain_cluster.update(creator: creator) if knative.pages_domain - end - - private - - attr_reader :knative, :pages_domain_id, :creator - - def unchanged? - knative.pages_domain&.id == pages_domain_id - end - end -end diff --git a/app/views/admin/sessions/two_factor.html.haml b/app/views/admin/sessions/two_factor.html.haml index 86bc5af6c2a..d05cc51af41 100644 --- a/app/views/admin/sessions/two_factor.html.haml +++ b/app/views/admin/sessions/two_factor.html.haml @@ -1,4 +1,3 @@ -- @hide_breadcrumbs = true - page_title _('Enter 2FA for Admin Mode') .row.justify-content-center diff --git a/app/views/devise/shared/_sign_in_link.html.haml b/app/views/devise/shared/_sign_in_link.html.haml index 0a48c342502..a1d10898c5b 100644 --- a/app/views/devise/shared/_sign_in_link.html.haml +++ b/app/views/devise/shared/_sign_in_link.html.haml @@ -1,6 +1,6 @@ %p.text-center %span.light - = _('Already have login and password?') + = _('Already have an account?') - path_params = { redirect_to_referer: 'yes' } - path_params[:invite_email] = @invite_email if @invite_email.present? = link_to _('Sign in'), new_session_path(:user, path_params) |