|
1 | | -- # TODO: When APIAP is default, adjust the old settings cukes to usage rules |
| 1 | +- content_for :title, 'Usage Rules' |
2 | 2 | - content_for :page_header_title, 'Usage Rules' |
3 | 3 |
|
4 | | -/ TODO: is this ever used? If so, replace with a DefaultPlanSelect (React) and forget about autosubmit |
5 | | -- if (can? :manage, :service_plans) && !current_account.settings.service_plans_ui_visible? |
6 | | - = form_tag polymorphic_path([:masterize, :admin, @service, ServicePlan]), :method => :post, :class => 'service autosubmit formtastic', :remote => true do |
7 | | - fieldset.inputs |
8 | | - legend Default Service Plan |
9 | | - ol |
10 | | - li.string.optional |
11 | | - label for="default_plan" Default plan |
12 | | - - service_plans_exists = @service.service_plans.exists? |
13 | | - = select_tag :id, options_from_collection_for_select(@service.service_plans.not_custom, "id", "name", lambda { |p| p.master? }), |
14 | | - :include_blank => true, :id => "default_plan", disabled: !service_plans_exists |
15 | | - - if service_plans_exists |
16 | | - p.inline-hints= @service.service_plans.first.class.human_attribute_name 'default_plan_hint' |
17 | | - - else |
18 | | - p.inline-hints Please create a service plan first. |
19 | | - |
20 | | -= semantic_form_for @service, :url => admin_service_path(@service) do |form| |
21 | | - = render :partial => 'api/services/forms/usage_rules', :locals => { :form => form } |
22 | | - = form.actions do |
23 | | - = form.commit_button 'Update Product' |
| 4 | +- content_for :javascripts do |
| 5 | + = stylesheet_packs_chunks_tag 'pf_form', 'usage_rules' |
| 6 | + |
| 7 | +div class="pf-c-card" |
| 8 | + div class="pf-c-card__body" |
| 9 | + / TODO: THREESCALE-12093: remove autosubmit |
| 10 | + - if (can? :manage, :service_plans) && !current_account.settings.service_plans_ui_visible? || true |
| 11 | + = form_tag polymorphic_path([:masterize, :admin, @service, ServicePlan]), method: :post, |
| 12 | + class: 'autosubmit pf-c-form pf-m-limit-width', |
| 13 | + remote: true |
| 14 | + section class="pf-c-form__section" role="group" aria-labelledby="settings-section-users" |
| 15 | + div class="pf-c-form__section-title" id="settings-section-users" aria-hidden="true" Default service plan |
| 16 | + div class="pf-c-form__group" |
| 17 | + div class="pf-c-form__group-control" |
| 18 | + - service_plans_exists = @service.service_plans.exists? |
| 19 | + = select_tag :id, options_from_collection_for_select(@service.service_plans.not_custom, "id", "name", lambda { |p| p.master? }), |
| 20 | + prompt: '', |
| 21 | + class: "pf-c-form-control #{'pf-m-warning' unless service_plans_exists}", |
| 22 | + id: 'default_plan', |
| 23 | + disabled: !service_plans_exists |
| 24 | + - if service_plans_exists |
| 25 | + p class="pf-c-form__helper-text" |
| 26 | + = @service.service_plans.first.class.human_attribute_name('default_plan_hint') |
| 27 | + - else |
| 28 | + p class="pf-c-form__helper-text pf-m-warning" |
| 29 | + | Please create a service plan first |
| 30 | + |
| 31 | + = semantic_form_for @service, url: admin_service_path(@service), |
| 32 | + builder: Fields::PatternflyFormBuilder, |
| 33 | + html: { class: "pf-c-form pf-m-limit-width" } do |form| |
| 34 | + - multiple_applications = current_account.multiple_applications_allowed? && false |
| 35 | + = form.inputs multiple_applications ? 'Application Requirements' : 'Signup & Use' do |
| 36 | + / very old TODO: remove intentions_required and make it an extra_field? Or how about just remove it? |
| 37 | + - unless multiple_applications |
| 38 | + = form.input :intentions_required, as: :patternfly_checkbox |
| 39 | + |
| 40 | + = form.input :buyers_manage_apps, as: :patternfly_checkbox |
| 41 | + |
| 42 | + - if @service.backend_version.v2? |
| 43 | + = form.input :buyers_manage_keys, as: :patternfly_checkbox |
| 44 | + = form.input :mandatory_app_key, as: :patternfly_checkbox |
| 45 | + |
| 46 | + - if @service.oauth? |
| 47 | + = form.input :buyer_key_regenerate_enabled, as: :patternfly_checkbox |
| 48 | + |
| 49 | + = form.input :referrer_filters_required, as: :patternfly_checkbox |
| 50 | + = form.input :custom_keys_enabled, as: :patternfly_checkbox |
| 51 | + |
| 52 | + = form.inputs "Application Plans" do |
| 53 | + = form.input :buyer_can_select_plan, as: :patternfly_checkbox |
| 54 | + |
| 55 | + = form.inputs "Application Plan Changing" do |
| 56 | + p = t('sites.usage_rules.edit.plans_info') |
| 57 | + div class="pf-c-form__group" role="radiogroup" aria-labelledby="change-plan-radio-group" |
| 58 | + div class="pf-c-form__group-label" id="change-plan-radio-group" |
| 59 | + label class="pf-c-form__label" |
| 60 | + span class="pf-c-form__label-text" |
| 61 | + = t('sites.usage_rules.edit.plans_label') |
| 62 | + = render 'shared/plan_change_settings', setting: :buyer_plan_change_permission, |
| 63 | + current: @service.buyer_plan_change_permission.to_sym |
| 64 | + |
| 65 | + = form.inputs 'Alerts' do |
| 66 | + div class="pf-c-content" |
| 67 | + p |
| 68 | + ' Here you can set at which utilization levels you want to trigger alerts, whom you want to send these alerts to (admins and/or developers) and by which means (web and/or email). |
| 69 | + em In order for an application to trigger usage alerts, usage limit(s) need to be set up in the Application Plan to which the application is subscribed. |
| 70 | + |
| 71 | + table class="pf-c-table pf-m-grid-lg" role="grid" |
| 72 | + thead |
| 73 | + tr role="row" |
| 74 | + th |
| 75 | + - alert_limits.each do |level| |
| 76 | + th role="columnheader" scope="col" |
| 77 | + = level |
| 78 | + | % |
| 79 | + |
| 80 | + tbody |
| 81 | + = row_for_alert_levels 'Show Web Alerts to Admins of this Account', :web_provider |
| 82 | + = row_for_alert_levels 'Send Email Alerts to Admins of this Account', :email_provider |
| 83 | + = row_for_alert_levels 'Show Web Alerts to Admins of the Developer Account', :web_buyer |
| 84 | + = row_for_alert_levels 'Send Email Alerts to Admins of the Developer Account', :email_buyer |
| 85 | + |
| 86 | + = form.actions do |
| 87 | + = form.commit_button 'Update product' |
0 commit comments