OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
chore[#50212]: Begin layout
Kabiru Mwenjabfb123234c1b
diff --git a/modules/storages/app/components/_index.sass b/modules/storages/app/components/_index.sassindex 5c9ffb88c36..825223117e9 100644--- a/modules/storages/app/components/_index.sass+++ b/modules/storages/app/components/_index.sass@@ -1 +1,2 @@@import "storages/admin/storage_list_component"+@import "storages/admin/storage_view_component"diff --git a/modules/storages/app/components/storages/admin/delete_storage_button_component.html.erb b/modules/storages/app/components/storages/admin/delete_storage_button_component.html.erbnew file mode 100644index 00000000000..d0d61eaf5fc--- /dev/null+++ b/modules/storages/app/components/storages/admin/delete_storage_button_component.html.erb@@ -0,0 +1,6 @@+<%=+ render(Primer::Beta::Button.new(**button_options)) do |button|+ button.with_leading_visual_icon(icon: :trash)+ label+ end+%>diff --git a/modules/storages/app/components/storages/admin/delete_storage_button_component.rb b/modules/storages/app/components/storages/admin/delete_storage_button_component.rbnew file mode 100644index 00000000000..a7d900c5a40--- /dev/null+++ b/modules/storages/app/components/storages/admin/delete_storage_button_component.rb@@ -0,0 +1,56 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 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.+#+++#+module Storages::Admin+ class DeleteStorageButtonComponent < ApplicationComponent+ options scheme: :danger,+ size: :medium,+ tag: :a++ alias_method :storage, :model++ private++ def button_options+ { scheme:,+ size:,+ tag:,+ role: :button,+ href: admin_settings_storage_path(storage),+ aria: { label: I18n.t("storages.label_delete_storage") },+ data: { confirm: I18n.t('storages.delete_warning.storage') },+ method: :delete }+ end++ def label+ I18n.t('button_delete')+ end+ end+enddiff --git a/modules/storages/app/components/storages/admin/storage_view_component.html.erb b/modules/storages/app/components/storages/admin/storage_view_component.html.erbnew file mode 100644index 00000000000..b769364081a--- /dev/null+++ b/modules/storages/app/components/storages/admin/storage_view_component.html.erb@@ -0,0 +1,115 @@+<%=+ render(Primer::Beta::BorderBox.new) do |component|+ component.with_header(color: :default) do+ grid_layout('op-storage-view--header', tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div) do+ render(Primer::Beta::Text.new(font_weight: :semibold)) { I18n.t('storages.file_storage_view.general_information') }+ end+ end+ end++ component.with_row(scheme: :default) do+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div, mr: 3) do+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.storage_provider') })++ if storage.configured?+ concat(render(Primer::Beta::Label.new(scheme: :success, data: { 'test-selector': 'label-configuration-status' })) { I18n.t('storages.label_completed') })+ else+ concat(render(Primer::Beta::Label.new(scheme: :attention, data: { 'test-selector': 'label-configuration-status' })) { I18n.t('storages.label_incomplete') })+ end+ end++ grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-description' }) do+ render(Primer::Beta::Truncate.new(font_weight: :light)) { storage_description }+ end++ grid.with_area(:"icon-button", tag: :div, color: :subtle, mr: 3, justify_self: :end) do+ render(Primer::Beta::IconButton.new(icon: :pencil, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , data: { 'test-selector': 'storage-edit-button' }))+ end+ end+ end++ component.with_row(scheme: :neutral) do+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div, mr: 3) do+ render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.oauth_applications') }+ end+ end+ end++ component.with_row(scheme: :default) do+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div, mr: 3) do+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.openproject_oauth') })++ if storage.configured?+ concat(render(Primer::Beta::Label.new(scheme: :success, data: { 'test-selector': 'label-configuration-status' })) { I18n.t('storages.label_completed') })+ else+ concat(render(Primer::Beta::Label.new(scheme: :attention, data: { 'test-selector': 'label-configuration-status' })) { I18n.t('storages.label_incomplete') })+ end+ end++ grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-openproject-oauth-client-description' }) do+ render(Primer::Beta::Truncate.new(font_weight: :light)) { openproject_oauth_client_description }+ end++ grid.with_area(:"icon-button", tag: :div, color: :subtle, mr: 3, justify_self: :end) do+ render(Primer::Beta::IconButton.new(icon: :sync, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , data: { 'test-selector': 'storage-edit-button' }))+ end+ end+ end++ component.with_row(scheme: :default) do+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div, mr: 3) do+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.nextcloud_oauth') })++ if storage.configured?+ concat(render(Primer::Beta::Label.new(scheme: :success, data: { 'test-selector': 'label-configuration-status' })) { I18n.t('storages.label_completed') })+ else+ concat(render(Primer::Beta::Label.new(scheme: :attention, data: { 'test-selector': 'label-configuration-status' })) { I18n.t('storages.label_incomplete') })+ end+ end++ grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-oauth-client-id-description' }) do+ render(Primer::Beta::Truncate.new(font_weight: :light)) { provider_oauth_client_description }+ end++ grid.with_area(:"icon-button", tag: :div, color: :subtle, mr: 3, justify_self: :end) do+ render(Primer::Beta::IconButton.new(icon: :sync, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , data: { 'test-selector': 'storage-edit-button' }))+ end+ end+ end++ component.with_row(scheme: :neutral) do+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div) do+ render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.project_folders') }+ end+ end+ end++ component.with_row(scheme: :default) do+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div, mr: 3) do+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.automatically_managed_folders') })++ if storage.configured?+ concat(render(Primer::Beta::Label.new(scheme: :success, data: { 'test-selector': 'label-configuration-status' })) { I18n.t('storages.label_active') })+ else+ concat(render(Primer::Beta::Label.new(scheme: :attention, data: { 'test-selector': 'label-configuration-status' })) { I18n.t('storages.label_incomplete') })+ end+ end++ grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-oauth-client-id-description' }) do+ render(Primer::Beta::Truncate.new(font_weight: :light)) { I18n.t('storages.page_titles.managed_project_folders.subtitle_short') }+ end++ grid.with_area(:"icon-button", tag: :div, color: :subtle, mr: 3, justify_self: :end) do+ render(Primer::Beta::IconButton.new(icon: :pencil, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , data: { 'test-selector': 'storage-edit-button' }))+ end+ end+ end+ end+%>diff --git a/modules/storages/app/components/storages/admin/storage_view_component.rb b/modules/storages/app/components/storages/admin/storage_view_component.rbnew file mode 100644index 00000000000..c9b5ade84ad--- /dev/null+++ b/modules/storages/app/components/storages/admin/storage_view_component.rb@@ -0,0 +1,56 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 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.+#+++#+module Storages::Admin+ class StorageViewComponent < ApplicationComponent+ include OpPrimer::ComponentHelpers+ alias_method :storage, :model++ private++ def storage_description+ [storage.short_provider_type.capitalize,+ storage.name,+ storage.host].compact.join(' - ')+ end++ def openproject_oauth_client_description+ return unless storage.oauth_application++ "#{I18n.t('storages.label_oauth_client_id')}: #{storage.oauth_application.uid}"+ end++ def provider_oauth_client_description+ return unless storage.oauth_client++ "#{I18n.t('storages.label_oauth_client_id')}: #{storage.oauth_client.client_id}"+ end+ end+enddiff --git a/modules/storages/app/components/storages/admin/storage_view_component.sass b/modules/storages/app/components/storages/admin/storage_view_component.sassnew file mode 100644index 00000000000..34dd64cc293--- /dev/null+++ b/modules/storages/app/components/storages/admin/storage_view_component.sass@@ -0,0 +1,8 @@+.op-storage-view--header+ display: grid+ grid-template-columns: 1fr+ grid-template-areas: "item"+.op-storage-view--row+ display: grid+ grid-template-columns: 3fr 1fr+ grid-template-areas: "item icon-button" "description icon-button"diff --git a/modules/storages/app/views/storages/admin/storages/edit.html.erb b/modules/storages/app/views/storages/admin/storages/edit.html.erbindex 1bed51f010e..183143788b2 100644--- a/modules/storages/app/views/storages/admin/storages/edit.html.erb+++ b/modules/storages/app/views/storages/admin/storages/edit.html.erb@@ -28,57 +28,72 @@ See COPYRIGHT and LICENSE files for more details.++#%><% html_title t(:label_administration), t("project_module_storages"), t('label_edit_x', x: @storage.name) %>-<% local_assigns[:additional_breadcrumb] = @storage.name %>-<%= toolbar title: t('label_edit_x', x: @storage.name) %>-<%= render(::Storages::Admin::ConfigurationChecksComponent.new(storage: @storage)) %>+<% if OpenProject::FeatureDecisions.storage_primer_design_active? %>+ <%= render(Primer::OpenProject::PageHeader.new) do |header| %>+ <% header.with_title do %>+ <%= @storage.name %>+ <% end %>-<%= labelled_tabular_form_for @storage, url: admin_settings_storage_path(@storage), as: :storages_storage do |f| -%>- <%= render partial: "storages/admin/storages/#{@storage.short_provider_type}/edit", locals: { f: f } %>- <%= styled_button_tag t(:button_save), class: "-highlight -with-icon icon-checkmark" %>-<% end %>+ <% header.with_actions do %>+ <%= render(Storages::Admin::DeleteStorageButtonComponent.new(@storage)) %>+ <% end %>+ <% end %>-<% if @storage.oauth_application %>- <%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>- <% component.with_header(title: "OpenProject #{t(:'storages.label_oauth_application_details')}") %>+ <%= render(::Storages::Admin::StorageViewComponent.new(@storage)) %>+<% else %>+ <% local_assigns[:additional_breadcrumb] = @storage.name %>+ <%= toolbar title: t('label_edit_x', x: @storage.name) %>- <% component.with_attributes([- { key: "OpenProject #{Storages::Admin::LABEL_OAUTH_CLIENT_ID}", value: @storage.oauth_application.uid },- { key: "OpenProject #{Storages::Admin::LABEL_OAUTH_CLIENT_SECRET}", value: "●●●●●●●●●●●●●●●●" },- ]) %>+ <%= render(::Storages::Admin::ConfigurationChecksComponent.new(storage: @storage)) %>- <%= link_to(t("storages.buttons.replace_openproject_oauth"),- replace_oauth_application_admin_settings_storage_path(@storage),- method: :delete,- data: { confirm: t(:'storages.confirm_replace_oauth_application') },- class: 'button -with-icon icon-reload') %>+ <%= labelled_tabular_form_for @storage, url: admin_settings_storage_path(@storage), as: :storages_storage do |f| -%>+ <%= render partial: "storages/admin/storages/#{@storage.short_provider_type}/edit", locals: { f: f } %>+ <%= styled_button_tag t(:button_save), class: "-highlight -with-icon icon-checkmark" %><% end %>-<% end %>-<%= render partial: "storages/admin/storages/#{@storage.short_provider_type}/oauth_client_section" %>+ <% if @storage.oauth_application %>+ <%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>+ <% component.with_header(title: "OpenProject #{t(:'storages.label_oauth_application_details')}") %>-<% if @storage.provider_type_nextcloud? %>- <%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>- <% component.with_header(title: t("storages.page_titles.managed_project_folders.title")) %>+ <% component.with_attributes([+ { key: "OpenProject #{Storages::Admin::LABEL_OAUTH_CLIENT_ID}", value: @storage.oauth_application.uid },+ { key: "OpenProject #{Storages::Admin::LABEL_OAUTH_CLIENT_SECRET}", value: "●●●●●●●●●●●●●●●●" },+ ]) %>- <% if @storage.automatic_management_unspecified? %>- <%= link_to(t("storages.buttons.configure"), new_admin_settings_storage_automatically_managed_project_folders_path(@storage), class: 'button -with-icon icon-add') %>- <% else %>- <% component.with_attribute(- key: t(:"storages.label_managed_project_folders.automatically_managed_folders"),- value: @storage.automatically_managed? ? t(:"storages.label_active") : t(:"storages.label_inactive")- ) %>+ <%= link_to(t("storages.buttons.replace_openproject_oauth"),+ replace_oauth_application_admin_settings_storage_path(@storage),+ method: :delete,+ data: { confirm: t(:'storages.confirm_replace_oauth_application') },+ class: 'button -with-icon icon-reload') %>+ <% end %>+ <% end %>++ <%= render partial: "storages/admin/storages/#{@storage.short_provider_type}/oauth_client_section" %>- <% if @storage.automatically_managed? %>+ <% if @storage.provider_type_nextcloud? %>+ <%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>+ <% component.with_header(title: t("storages.page_titles.managed_project_folders.title")) %>++ <% if @storage.automatic_management_unspecified? %>+ <%= link_to(t("storages.buttons.configure"), new_admin_settings_storage_automatically_managed_project_folders_path(@storage), class: 'button -with-icon icon-add') %>+ <% else %><% component.with_attribute(- key: t(:"storages.label_managed_project_folders.application_password"),- value: "●●●●●●●●●●●●●●●●"- ) %>+ key: t(:"storages.label_managed_project_folders.automatically_managed_folders"),+ value: @storage.automatically_managed? ? t(:"storages.label_active") : t(:"storages.label_inactive")+ ) %>++ <% if @storage.automatically_managed? %>+ <% component.with_attribute(+ key: t(:"storages.label_managed_project_folders.application_password"),+ value: "●●●●●●●●●●●●●●●●"+ ) %>+ <% end %>++ <%= link_to(t("storages.buttons.edit_automatically_managed_project_folders"),+ edit_admin_settings_storage_automatically_managed_project_folders_path(@storage),+ class: 'button -with-icon icon-edit') %><% end %>-- <%= link_to(t("storages.buttons.edit_automatically_managed_project_folders"),- edit_admin_settings_storage_automatically_managed_project_folders_path(@storage),- class: 'button -with-icon icon-edit') %><% end %><% end %><% end %>diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex a6b998aab51..351adb3d05f 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -75,11 +75,20 @@ en:save_and_complete_setup: "Save and complete setup"select_folder: "Select folder"configure: "Configure"+ file_storage_view:+ general_information: "General information"+ oauth_applications: "OAuth applications"+ project_folders: "Project folders"+ storage_provider: "Storage provider"+ openproject_oauth: "OpenProject OAuth"+ nextcloud_oauth: "Nextcloud OAuth"+ automatically_managed_folders: "Automatically managed folders"page_titles:file_storages:subtitle: "Add an external file storage in order to upload, link and manage files in work packages."managed_project_folders:title: "Automatically managed project folders"+ subtitle_short: "Let OpenProject create folders per project automatically."subtitle: >Let OpenProject create folders per project automatically. This is recommended as it ensures that every team member always has the correct access permissions.project_settings:@@ -144,12 +153,14 @@ en:description: "Add a storage to see them here."label_active: "Active"label_add_new_storage: "Add new storage"+ label_delete_storage: "Delete storage"label_inactive: "Inactive"label_creator: "Creator"label_provider: "Provider"label_file_link: "File link"label_file_links: "File links"label_creation_time: "Creation time"+ label_completed: "Completed"label_incomplete: "Incomplete"label_name: "Name"label_host: "Host URL"@@ -163,6 +174,7 @@ en:one_drive: "OneDrive OAuth"label_oauth_application_details: "OAuth application details"label_oauth_client_details: "OAuth client details"+ label_oauth_client_id: "OAuth Client ID"label_provider_type: "Provider type"label_project_folder: "Project folder"label_new_storage: "New storage"