-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15541 from opf/feature/53620/builtin-oauth-app-mo…
…bile Add OAuth application flow for builtin mobile app
- Loading branch information
Showing
40 changed files
with
1,141 additions
and
212 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
app/components/oauth/applications/application_row_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<%= | ||
component_wrapper(data: { 'test-selector': "op-admin-oauth--application" }) do | ||
flex_layout(align_items: :center, justify_content: :space_between) do |oauth_application_container| | ||
oauth_application_container.with_column(flex_layout: true) do |application_information| | ||
application_information.with_column(mr: 2) do | ||
render(Primer::Beta::Link.new(href: oauth_application_path(@application), font_weight: :bold)) do | ||
@application.name | ||
end | ||
end | ||
|
||
application_information.with_column(mr: 2) do | ||
render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do | ||
if @application.builtin? | ||
t("oauth.application.builtin") | ||
else | ||
t(:label_created_by, user: @application.owner) | ||
end | ||
end | ||
end | ||
|
||
unless @application.builtin? | ||
application_information.with_column do | ||
render(Primer::Beta::Label.new) do | ||
@application.confidential? ? t("oauth.application.confidential") : t("oauth.application.non_confidential") | ||
end | ||
end | ||
end | ||
end | ||
|
||
# Actions | ||
oauth_application_container.with_column do | ||
render(Primer::Alpha::ToggleSwitch.new( | ||
src: toggle_oauth_application_path(@application), | ||
csrf_token: form_authenticity_token, | ||
checked: @application.enabled?, | ||
data: { | ||
'test-selector': "op-admin-oauth--application-enabled-toggle-switch" | ||
} | ||
)) | ||
end | ||
end | ||
end | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
app/components/oauth/applications/index_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<%= | ||
component_wrapper do | ||
flex_layout do |index_container| | ||
if OpenProject::FeatureDecisions.built_in_oauth_applications_active? | ||
index_container.with_row do | ||
render(border_box_container(mb: 4, data: { | ||
'test-selector': "op-admin-oauth--built-in-applications" | ||
})) do |component| | ||
component.with_header(font_weight: :bold) do | ||
render(Primer::Beta::Text.new) do | ||
t("oauth.header.builtin_applications") | ||
end | ||
end | ||
|
||
if @built_in_applications.empty? | ||
component.with_row do | ||
render(Primer::Beta::Text.new(data: { | ||
'test-selector': "op-admin-oauth--built-in-applications-placeholder" | ||
})) do | ||
t("oauth.empty_application_lists") | ||
end | ||
end | ||
end | ||
|
||
@built_in_applications.each do |application| | ||
component.with_row { render(OAuth::Applications::ApplicationRowComponent.new(application:)) } | ||
end | ||
end | ||
end | ||
end | ||
|
||
index_container.with_row do | ||
render(border_box_container(mb: 4)) do |component| | ||
component.with_header(font_weight: :bold) do | ||
render(Primer::Beta::Text.new) do | ||
t("oauth.header.other_applications") | ||
end | ||
end | ||
|
||
if @other_applications.empty? | ||
component.with_row do | ||
render(Primer::Beta::Text.new(data: { 'test-selector': "op-admin-oauth--applications-placeholder" })) do | ||
t("oauth.empty_application_lists") | ||
end | ||
end | ||
end | ||
|
||
@other_applications.each do |application| | ||
component.with_row { render(OAuth::Applications::ApplicationRowComponent.new(application:)) } | ||
end | ||
end | ||
end | ||
end | ||
end | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 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 OAuth | ||
module Applications | ||
class IndexComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
include OpTurbo::Streamable | ||
|
||
def initialize(oauth_applications:) | ||
@built_in_applications = oauth_applications.select(&:builtin?) | ||
@other_applications = oauth_applications.reject(&:builtin?) | ||
|
||
super | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.