Projet

Général

Profil

0001-misc-separate-endpoint-s-HTTP-method-display-logic.patch

Serghei Mihai, 17 février 2020 10:46

Télécharger (4,42 ko)

Voir les différences:

Subject: [PATCH 1/2] misc: separate endpoint's HTTP method display logic

 passerelle/static/css/style.css               | 77 +++++++++++--------
 .../passerelle/manage/service_view.html       |  3 +-
 2 files changed, 47 insertions(+), 33 deletions(-)
passerelle/static/css/style.css
217 217
}
218 218

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

  
223
#endpoints > div > ul {
223
ul.get-params li {
224
	margin: 0;
225
}
226

  
227
div.section > div > ul.endpoints {
224 228
	padding: 0;
225 229
}
226 230

  
227
#endpoints > div > ul li {
231
.endpoints li {
228 232
	list-style-type: none;
233
}
234

  
235
.endpoints > li {
229 236
	margin: 0.75em 0;
230 237
	position: relative;
231 238
	min-height: 2em;
232 239
}
233 240

  
234
#endpoints .get-method .method-name {
235
	background: hsl(207, 85%, 38%);
241
.endpoints > li::after {
242
	color: hsl(0, 0%, 100%);
243
	display: inline-block;
244
	padding: 0.3em 0.75em;
245
	width: 4em;
246
	text-align: center;
247
	position: absolute;
248
	right: 0;
249
	top: 0;
250
	margin: -1px -1px 0 0;
236 251
}
237 252

  
238
#endpoints .get-method {
253
.endpoints .get-method {
239 254
	background: hsl(207, 85%, 95%);
240 255
	border: 1px solid hsl(207, 85%, 87%);
241 256
}
257
.endpoints .get-method::after {
258
	content: "GET";
259
	background: hsl(207, 85%, 38%);
260
}
242 261

  
243
#endpoints .post-method .method-name {
262
.endpoints .post-method::after {
263
	content: "POST";
244 264
	background: hsl(143, 82%, 35%);
245 265
}
246 266

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

  
252
#endpoints .put-method .method-name {
272
.endpoints .put-method::after {
273
	content: "PUT";
253 274
	background: hsl(35, 64%, 47%)
254 275
}
255 276

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

  
261
#endpoints .delete-method .method-name {
282
.endpoints .delete-method::after {
283
	content: "DELETE";
262 284
	background: hsl(358, 69%, 38%);
263 285
}
264 286

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

  
270
#endpoints .patch-method .method-name {
292
.endpoints .patch-method::after {
293
	content: "PATCH";
271 294
	background: hsl(14, 100%, 63%);
272 295
}
273 296

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

  
279
#endpoints .method-name {
280
	color: hsl(0, 0%, 100%);
281
	padding: 0.3em 0.75em;
282
	width: 4em;
302
.endpoints .description, .endpoints .long-description {
283 303
	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;
304
	font-weight: bold;
290 305
}
291 306

  
292
#endpoints .description, #endpoints .long-description {
307
.endpoints .description,
308
.endpoints .long-description,
309
.endpoints .body-schemas {
293 310
	margin: 0.3em 0.3em 0.3em 0.75em;
294
	display: inline-block;
295
	font-weight: bold;
296 311
}
297 312

  
298
#endpoints .params {
313
.endpoints .params {
299 314
	padding: 0 0.3em;
300 315
	background: hsla(0, 100%, 100%, 0.65);
301 316
	margin: 0.3em 0.75em;
302 317
}
303 318

  
304
#endpoints .params .params-title {
319
.endpoints .params .params-title {
305 320
	font-weight: bold;
306 321
}
307 322

  
308
#endpoints .params .param-name {
323
.endpoints .params .param-name {
309 324
	font-family: Monospace;
310 325
}
311 326

  
312
#endpoints .params .param-optional {
327
.endpoints .params .param-optional {
313 328
	font-style: italic;
314 329
}
passerelle/templates/passerelle/manage/service_view.html
62 62
  <div>
63 63
  {% if object.api_description %}<p>{{object.api_description|safe}}</p>{% endif %}
64 64
  {% block endpoints %}
65
    <ul>
65
    <ul class="endpoints">
66 66
    {% for endpoint in object.get_endpoints_infos %}
67 67
    <li class="{{ endpoint.http_method|default:"get" }}-method">{% if endpoint.description %}<span class="description">{{endpoint.description}}{% trans ':' %}</span>{% endif %}
68 68
       <a href="{{endpoint.example_url}}" class="example-url">{{ site_base_uri }}{{endpoint.example_url_as_html}}</a>
69
       <span class="method-name">{{endpoint.http_method|upper}}</span>
70 69
       <ul class="params">
71 70
       {% if endpoint.get_params %}
72 71
         <li>{% trans "Query parameters" %}
73
-