Skip to content

Commit

Permalink
[#53620] add feature flag for buit-in apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharonus committed Sep 13, 2024
1 parent 820c4ab commit cf4c7c3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
36 changes: 19 additions & 17 deletions app/components/oauth/applications/index_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
<%=
component_wrapper do
flex_layout do |index_container|
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")
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
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")
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
end

@built_in_applications.each do |application|
component.with_row { render(OAuth::Applications::ApplicationRowComponent.new(application:)) }
@built_in_applications.each do |application|
component.with_row { render(OAuth::Applications::ApplicationRowComponent.new(application:)) }
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/feature_decisions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@
OpenProject::FeatureDecisions.add :enable_custom_field_for_multiple_projects,
description: "Allow a custom field to be enabled for multiple projects at once. " \
"See work package #56909 for more details."

OpenProject::FeatureDecisions.add :built_in_oauth_applications,
description: "Allows the display and use of built-in OAuth applications."
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
expect(page).to have_test_selector("op-admin-oauth--applications-placeholder")
end

context "with a seeded application" do
context "with a seeded application", with_flag: { built_in_oauth_applications: true } do
before do
OAuthApplicationsSeeder.new.seed_data!
end
Expand Down

0 comments on commit cf4c7c3

Please sign in to comment.