Projet

Général

Profil

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

Serghei Mihai (congés, retour 15/05), 06 janvier 2020 11:04

Télécharger (5,21 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               | 102 ++++++++++++++++++
 .../passerelle/manage/service_view.html       |  18 ++--
 2 files changed, 111 insertions(+), 9 deletions(-)
passerelle/static/css/style.css
209 209
    color: grey;
210 210
    font-style: italic;
211 211
}
212

  
213
@media screen and (max-width: 760px) {
214
	.example-url {
215
		margin: 0 7em 0 0.75em;
216
		display: inline-block;
217
	}
218
}
219

  
220
ul.get-params {
221
	padding-left: 1em;
222
}
223

  
224
#endpoints > div > ul {
225
	padding: 0;
226
}
227

  
228
#endpoints > div > ul li {
229
	list-style-type: none;
230
	margin: 0.75em 0;
231
	position: relative;
232
}
233

  
234
#endpoints .get-method .method-name {
235
	background: hsl(207, 85%, 38%);
236
}
237

  
238
#endpoints .get-method {
239
	background: hsl(207, 85%, 95%);
240
	border: 1px solid hsl(207, 85%, 87%);
241
}
242

  
243
#endpoints .post-method .method-name {
244
	background: hsl(143, 82%, 35%);
245
}
246

  
247
#endpoints .post-method {
248
	background: hsl(143, 82%, 95%);
249
	border: 1px solid hsl(143, 82%, 87%);
250
}
251

  
252
#endpoints .put-method .method-name {
253
	background: hsl(35, 64%, 47%)
254
}
255

  
256
#endpoints .put-method {
257
	background: hsl(35, 64%, 95%)
258
	border: hsl(35, 64%, 87%)
259
}
260

  
261
#endpoints .delete-method .method-name {
262
	background: hsl(358, 69%, 38%);
263
}
264

  
265
#endpoints .delete-method {
266
	background: hsl(358, 69%, 95%)
267
	border: 1px solid hsl(358, 69%, 87%);
268
}
269

  
270
#endpoints .patch-method .method-name {
271
	background: hsl(14, 100%, 63%);
272
}
273

  
274
#endpoints .patch-method {
275
	background: hsl(14, 100%, 95%);
276
	border: 1px solid hsl(14, 100%, 87%);
277
}
278

  
279
#endpoints .method-name {
280
	color: hsl(0, 0%, 100%);
281
	padding: 0.3em 0.75em;
282
	width: 4em;
283
	display: inline-block;
284
	text-align: center;
285
	margin: -1px -1px 0 0;
286
	cursor: pointer;
287
	position: absolute;
288
	right: 0;
289
	top: 0;
290
}
291

  
292
#endpoints .description, #endpoints .long-description {
293
	margin: 0.3em 0.3em 0.3em 0.75em;
294
	display: inline-block;
295
}
296

  
297
#endpoints .params {
298
	padding: 0 0.3em;
299
	background: hsla(0, 100%, 100%, 0.65);
300
	margin: 0.3em 0.75em;
301
}
302

  
303
#endpoints .params .params-title {
304
	font-weight: bold;
305
}
306

  
307
#endpoints .params .param-name {
308
	font-family: Monospace;
309
}
310

  
311
#endpoints .params .param-optional {
312
	font-style: italic;
313
}
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}}" class="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 69
           <li>{% trans "Query parameters" %}
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 %},
75
                       {% trans 'default value:' %} {{param.default_value}}{% endif %}){% endif %}
72
                 <li><span class="param-name">{{param.name}}</span>
73
                     {% if param.optional %}<span class="param-optional">({% trans 'optional' %}{% if param.default_value %},
74
                       {% trans 'default value:' %} {{param.default_value}}{% endif %})</span>{% endif %}
76 75
                       {% if param.description %}{% trans ':' %} {{param.description}}{% endif %}
77 76
                       <span class="type">({% if param.type %}{{ param.type }}{% else %}string{% endif %})</span>
78 77
                 </li>
......
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 92
         <div class="long-description">
93 93
           {{ endpoint.long_description }}
94
-