review updates to svg rendering

This commit is contained in:
John Anderson
2019-12-11 13:39:10 -05:00
parent c09aefd509
commit 7f788eaa06
7 changed files with 137 additions and 109 deletions

View File

@@ -54,9 +54,19 @@ By default, this endpoint returns a paginated JSON response representing each ra
/api/dcim/racks/<id>/units/
```
All internal use of the rack units endpoint has been updated to use the new rack elevation endpoint.
In order to render the elevation as an SVG, include the `render_format=svg` query parameter in the request. You may also control the width of the elevation drawing in pixels with `unit_width=<width in pixels>` and the height of each rack unit with `unit_height=<height in pixels>`. The `unit_width` defaults to `230` and the `unit_height` default to `20` which produces elevations the same size as those that appear in the NetBox Web UI. The query parameter `face` is used to request either the `front` or `rear` of the elevation and defaults to `front`.
In order to render the elevation as an SVG, include the `render_format=svg` query parameter in the request. You may also control the width of the elevation drawing in pixels with `width=<width in pixels>` and the height of each rack unit with `unit_height=<height in pixels>`. The `width` defaults to `230` and the `unit_height` default to `20` which produces elevations the same size as those that appear in the NetBox Web UI. The query parameter `face` is used to request either the `front` or `rear` of the elevation and defaults to `front`.
Here is an example of the request url for an SVG rendering using the default parameters to render the front of the elevation:
```
/api/dcim/racks/<id>/elevation/?render_format=svg
```
Here is an example of the request url for an SVG rendering of the rear of the elevation having a width of 300 pixels and per unit height of 35 pixels:
```
/api/dcim/racks/<id>/elevation/?render_format=svg&face=rear&unit_width=300&unit_height=35
```
Thanks to [@hellerve](https://github.com/hellerve) for doing the heavy lifting on this!