Skip to content

Commit

Permalink
Merge pull request #1618 from etalab/API-3269-alerte-arret-rbe
Browse files Browse the repository at this point in the history
API-3595 Crée un composant pour ajouter des messages d'alerte sur les API
  • Loading branch information
DorineLam authored Oct 8, 2024
2 parents e823f9e + 01ef3e0 commit 6d49334
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/models/abstract_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class AbstractEndpoint < ApplicationAlgoliaSearchableActiveModel
attr_accessor :uid,
:path,
:beta,
:alert,
:novelty,
:ping_url,
:new_version,
Expand Down
13 changes: 13 additions & 0 deletions app/views/api_entreprise/endpoints/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,21 @@

<hr class="separator fr-unhidden-md fr-hidden">


<div class="fr-grid-row">
<div class="fr-col-md-<%= layout_main_bloc %> fr-col-12 fr-pt-2w fr-mt-md-0 fr-pr-md-2w fr-pr-0">
<% if @endpoint.alert.present? %>
<div class="fr-mt-4w fr-mb-4w">
<div class="fr-alert fr-alert--warning fr-mb-2w">
<h3 class="fr-alert__title">
<%= raw @endpoint.alert['title'] %>
</h3>
<p>
<%= markdown_to_html(@endpoint.alert['description']) %>
</p>
</div>
</div>
<% end %>
<% if @endpoint.dummy? %>
<%= @endpoint.open_api_definition['disclaimer'].html_safe %>
<% elsif @endpoint.deprecated? %>
Expand Down
12 changes: 12 additions & 0 deletions app/views/api_particulier/endpoints/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@

<div class="fr-grid-row">
<div class="fr-col-md-<%= layout_main_bloc %> fr-col-12 fr-pt-2w fr-mt-md-0 fr-pr-md-2w fr-pr-0">
<% if @endpoint.alert.present? %>
<div class="fr-mt-4w fr-mb-4w">
<div class="fr-alert fr-alert--warning fr-mb-2w">
<h3 class="fr-alert__title">
<%= raw @endpoint.alert['title'] %>
</h3>
<p>
<%= markdown_to_html(@endpoint.alert['description']) %>
</p>
</div>
</div>
<% end %>
<% if @endpoint.deprecated? %>
<div class="fr-alert fr-alert--error fr-mb-2w">
<p class="fr-alert__title">
Expand Down
2 changes: 0 additions & 2 deletions config/endpoints/api_entreprise/5_inpi_rne_beneficiaires.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
Cette API restitue une partie des données, les bénéficiaires effectifs, de l'API Base RNE de l'Inpi :
- [Informations de l'Inpi concernant le registre national des entreprises](https://www.inpi.fr/le-registre-national-des-entreprises){:target="_blank"} ;
- [Documentation technique de l'API base RNE](https://www.inpi.fr/sites/default/files/documentation%20technique%20API%20formalit%C3%A9s_v2.3.pdf){:target="_blank"}.
entities:
- entreprises
call_id: "SIREN"
Expand Down
4 changes: 4 additions & 0 deletions config/endpoints/template.entreprise.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
path: '/v3/provider/resource/{siren}'
# Position au sein de l'index
position: 501
alert:
title: "Titre de l'alerte"
description: |+
Message en markdown de l'alerte.
extra_description: |+
Texte directement en dessous de la description. Ce champ peut-être omis (optionnel). Le markdown GFM est supporté ici.
perimeter:
Expand Down

0 comments on commit 6d49334

Please sign in to comment.