Skip to content

Commit

Permalink
Display a deprecated message when Service uses plugin deployment (#1391)
Browse files Browse the repository at this point in the history
* Display a deprecated message when Service uses plugin deployment

THREESCALE-2395
Our plugin deployment option is deprecated. To avoid needing some data
migration in database, this commit sets the deployment option as hosted
if the current option is set to plugins and also displays a message to
the user to update their configuration.

* minimal height form

* Display a deprecated message when Service uses plugin deployment
  • Loading branch information
duduribeiro authored Dec 13, 2019
1 parent e2195df commit 6302212
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/models/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,11 @@ def can_use_backends?
proxy.apicast_configuration_driven && !proxy.service_mesh_integration?
end

# TODO: Remove this when no one use plugins
def plugin_deployment?
DeploymentOption.plugins.include?(deployment_option)
end

private

def archive_as_deleted
Expand Down
1 change: 1 addition & 0 deletions app/views/api/services/settings_apiap.html.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- content_for :sublayout_title, 'Settings'

= semantic_form_for @service, :url => admin_service_path(@service) do |form|
= render :partial => 'api/services/forms/integration_settings_apiap', :locals => {:form => form}
= form.buttons do
Expand Down
3 changes: 3 additions & 0 deletions app/views/layouts/api/_service.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
h1
= yield :sublayout_title

/ TODO: Remove this when no one use plugins
= render 'shared/service/deprecated_plugin_warning'

= yield
4 changes: 4 additions & 0 deletions app/views/shared/service/_deprecated_plugin_warning.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- if @service&.plugin_deployment?
.deprecated_plugin_message
p.InfoBox--notice.InfoBox
i This Product currently uses a plugin as the deployment option. Your integration will keep on working but we no longer support plugins.
3 changes: 0 additions & 3 deletions test/unit/helpers/services_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ def test_show_mappings?

@service.deployment_option = 'hosted'
assert show_mappings?

@service.deployment_option = 'plugin_java'
refute show_mappings?
end
end
10 changes: 10 additions & 0 deletions test/unit/service_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ def test_update_account_default_service
assert_raise(ActiveRecord::RecordNotFound) { service.reload }
end

test '#plugin_deployment? returns true when using a plugin as deployment option' do
service = FactoryBot.build(:service, deployment_option: 'plugin_ruby')

assert service.plugin_deployment?

service = FactoryBot.build(:service, deployment_option: 'hosted')

refute service.plugin_deployment?
end

def test_default_service_plan
service = FactoryBot.build(:simple_service)
service.account.settings.service_plans_ui_visible = true
Expand Down

0 comments on commit 6302212

Please sign in to comment.