opf/openproject

View on GitHub
app/views/admin/info.html.erb

Summary

Maintainability
Test Coverage
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2024 the OpenProject GmbH

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.

OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

See COPYRIGHT and LICENSE files for more details.

++#%>

<% html_title(t(:label_administration), t(:label_information_plural)) -%>

<%= call_hook(:view_admin_info_top) %>

<%= render(AttributeGroups::AttributeGroupComponent.new) do |component|
  component.with_header(title: I18n.t('label_information_plural'))

  if Setting.show_product_version?
    core_link = linked_sha_reference(OpenProject::VERSION.core_sha, OpenProject::VERSION.core_url)
    component.with_attribute(key: t(:label_core_build), value: core_link) if core_link.present?

    product_link = linked_sha_reference(OpenProject::VERSION.product_sha, OpenProject::VERSION.product_url)
    component.with_attribute(key: t(:label_product_version), value: product_link) if product_link.present?
  end

  component.with_attribute(key: t(:label_core_version), value: OpenProject::Info.versioned_name)
  component.with_attribute(key: t(:label_database_version), value: @db_version)

  if display_security_badge_graphic?
    content = content_tag :object, nil, data: security_badge_url, type: "image/svg+xml"
    content += link_to '',
                       ::OpenProject::Static::Links[:security_badge_documentation][:href],
                       title: t(:label_what_is_this),
                       class: 'security-badge--help-icon icon-context icon-help1',
                       target: '_blank'
    component.with_attribute(key: '', value: content)
  end

  if OpenProject::Database.version_deprecated?
    value = <<~STR.html_safe
     <p>
       Starting with OpenProject 12.0, PostgreSQL 13 is required to use OpenProject.
       <br/>
       We have prepared #{static_link_to(:postgres_13_upgrade, label: 'upgrade guides for all installation methods')}.
      You can perform the upgrade ahead of the release at any time by following the guides.
      </p>
    STR
    component.with_attribute(key: 'Deprecation warning', value:)
  end


  if (updated_on = OpenProject::VERSION.updated_on).present?
    component.with_attribute(key: t(:label_last_change_on), value: format_time(updated_on))
  end
end %>

<%= render(AttributeGroups::AttributeGroupComponent.new) do |component|
  component.with_header(title: I18n.t(:label_system))

  @checklist.each do |label, result|
    value = icon_wrapper((result ? 'icon-context icon-checkmark' : 'icon-context icon-bug'), (result ? t(:general_text_Yes) : t(:general_text_No)))
    component.with_attribute(key: I18n.t(label), value:)
  end
end %>

<% @storage_information.each_with_index do |(_, entries), i| %>
  <%=
    render(AttributeGroups::AttributeGroupComponent.new) do |component|
      component.with_header(title: t(:label_storage_group, identifier: i + 1))

      component.with_attribute(key: t(:label_storage_for),
                               value: safe_join(entries[:labels], '<br/>'.html_safe))

      component.with_attribute(key: t(:label_storage_free_space),
                               value: number_to_human_size(entries[:data][:free], precision: 2))

      value = number_to_human_size(entries[:data][:used], precision: 2)
      value += "(#{entries[:data][:percent_used].round(2)})"
      component.with_attribute(key: t(:label_storage_used_space), value:)
    end %>
<% end %>

<%= call_hook(:view_admin_info_bottom) %>