Projet

Général

Profil

0001-misc-beautify-endpoints-pr-sentation-34790.patch

Serghei Mihai (congés, retour 15/05), 16 décembre 2019 18:22

Télécharger (4,91 ko)

Voir les différences:

Subject: [PATCH] =?UTF-8?q?misc:=20beautify=20endpoints=20pr=C3=A9sentatio?=
 =?UTF-8?q?n=20(#34790)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 passerelle/static/css/style.css               | 86 +++++++++++++++++++
 .../passerelle/manage/service_view.html       | 22 ++---
 2 files changed, 97 insertions(+), 11 deletions(-)
passerelle/static/css/style.css
204 204
.sftp-widget label {
205 205
	display: block;
206 206
}
207

  
208
#endpoints > div > ul li {
209
	list-style-type: none;
210
	margin: 5px 0;
211
}
212

  
213
#endpoints li.get-method {
214
	background: #e7f0f7;
215
	border: 1px solid #c3d9ec;
216
}
217

  
218
#endpoints li.post-method {
219
	background: #e7f6ec;
220
	border: 1px solid #c3e8d1;
221
}
222

  
223
#endpoints li.put-method {
224
	background: #f9f2e9;
225
	border: 1px solid #f0e0ca;
226
}
227

  
228
#endpoints li.delete-method {
229
	background: #f5e8e8;
230
	border: 1px solid #e8c6c7;
231
}
232

  
233
#endpoints li.patch-method {
234
	background: #fdede8;
235
	border: 1px solid #fbcec1;
236
}
237

  
238
#endpoints span.method-name {
239
	color: #ffffff;
240
	padding: 3px 10px;
241
	width: 50px;
242
	display: inline-block;
243
	text-align: center;
244
}
245

  
246
span.method-name {
247
	cursor: pointer;
248
	float: right;
249
}
250

  
251
#endpoints li.get-method span.method-name {
252
	background: #0f6ab4;
253
}
254

  
255
#endpoints li span.description, #endpoints span.long-description {
256
	margin: 3px;
257
	display: inline-block;
258
}
259

  
260
#endpoints li.post-method span.method-name {
261
	background: #10a54a;
262
}
263

  
264
#endpoints li.put-method span.method-name {
265
	background: #c5862b;
266
}
267

  
268
#endpoints li.delete-method span.method-name {
269
	background: #a41e22;
270
}
271

  
272
#endpoints li.patch-method span.method-name {
273
	background: #ff6d40;
274
}
275

  
276
#endpoints ul.params {
277
	padding: 0 3px;
278
	background: #fffefe;
279
	margin: 3px 10px;
280
}
281

  
282
#endpoints ul.params span.params-title {
283
	font-weight: bold;
284
}
285

  
286
#endpoints ul.params span.param-name {
287
	font-family: Monospace;
288
}
289

  
290
#endpoints ul.params span.param-optional {
291
	font-style: italic;
292
}
passerelle/templates/passerelle/manage/service_view.html
60 60
  {% block endpoints %}
61 61
    <ul>
62 62
    {% for endpoint in object.get_endpoints_infos %}
63
    <li>{% if endpoint.description %}{{endpoint.description}}{% trans ':' %}{% endif %}
64
       <a href="{{endpoint.example_url}}">{{ site_base_uri }}{{endpoint.example_url_as_html}}</a>
65
       {% if endpoint.methods|length > 1 %}
66
         ({{endpoint.http_method|upper}})
67
       {% endif %}
63
    <li class="{{ endpoint.http_method|default:"get" }}-method">{% if endpoint.description %}<span class="description">{{endpoint.description}}{% trans ':' %}</span>{% endif %}
64
      <a href="{{endpoint.example_url}}">{{ site_base_uri }}{{endpoint.example_url_as_html}}</a>
65
      <span class="method-name">{{endpoint.http_method|upper}}</span>
66
      {% if endpoint.get_params %}
68 67
       <ul class="params">
69 68
         {% if endpoint.get_params %}
70
           <li>{% trans "Query parameters" %}
69
           <li><span class="params-title">{% trans "Query parameters" %}</span>
71 70
             <ul class="get-params">
72 71
               {% for param in endpoint.get_params %}
73
                 <li>{{param.name}}
74
                     {% if param.optional %}({% trans 'optional' %}{% if param.default_value %},
72
                 <li><span class="param-name">{{param.name}}</span>
73
                     {% if param.optional %}<span class="param-optional">({% trans 'optional' %}</span>{% if param.default_value %},
75 74
                       {% trans 'default value:' %} {{param.default_value}}{% endif %}){% endif %}
76 75
                       {% if param.description %}{% trans ':' %} {{param.description}}{% endif %}
77 76
                       <b class="type">{% if param.type %}{{ param.type }}{% else %}string{% endif %}</b>
......
81 80
           </li>
82 81
         {% endif %}
83 82
         {% if endpoint.body_schemas %}
84
           <li>{% trans "Request body" %}
83
           <li><span class="params-title">{% trans "Request body" %}</span>
85 84
             <div class="body-schemas">
86 85
             {% render_body_schemas body_schemas=endpoint.body_schemas %}
87 86
             </div>
88 87
           </li>
89 88
         {% endif %}
90 89
       </ul>
90
       {% endif %}
91 91
       {% if endpoint.long_description %}
92
         <div class="long-description">
92
         <span class="long-description">
93 93
           {{ endpoint.long_description }}
94
         </div>
94
         </span>
95 95
       {% endif %}
96 96
    </li>
97 97
    {% endfor %}
98
-