UI: Pluralize URLs for resources to match API

When querying the API for playbooks, the url would be:
    /api/v1/playbooks
And when querying the details of a playbook, the url would be:
    /api/v1/playbooks/<id>

With that in mind, it makes sense to align the UI so that when viewing
the details of a playbook, the url would be:
    /playbooks/1
instead of:
    /playbook/1

Change-Id: I3e7ee6a25e5f15518208b0b0a5f46c61e5ca89cb
This commit is contained in:
David Moreau Simard 2020-07-11 17:26:51 -04:00
parent eb8102a0c7
commit d247f6c0f8
No known key found for this signature in database
GPG Key ID: 7D4729EC4E64E8B7
5 changed files with 24 additions and 24 deletions

View File

@ -140,7 +140,7 @@
{{ playbook.ansible_version }}
</td>
<td role="cell" data-label="Name (or path)" class="pf-m-fit-content">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html" title="{{ playbook.path }}">
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html" title="{{ playbook.path }}">
{% if playbook.name is not None %}{{ playbook.name }}{% else %}{{ playbook.path | truncatepath:50 }}{% endif %}
</a>
</td>
@ -158,19 +158,19 @@
</div>
</td>
<td role="cell" data-label="Hosts" class="pf-m-fit-content">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#hosts">{{ playbook.items.hosts }}</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#hosts">{{ playbook.items.hosts }}</a>
</td>
<td role="cell" data-label="Plays" class="pf-m-fit-content">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#plays">{{ playbook.items.plays }}</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#plays">{{ playbook.items.plays }}</a>
</td>
<td role="cell" data-label="Results" class="pf-m-fit-content">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#results">{{ playbook.items.results }}</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#results">{{ playbook.items.results }}</a>
</td>
<td role="cell" data-label="Files" class="pf-m-fit-content">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#files">{{ playbook.items.files }}</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#files">{{ playbook.items.files }}</a>
</td>
<td role="cell" data-label="Records" class="pf-m-fit-content">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#records">{{ playbook.items.records }}</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#records">{{ playbook.items.records }}</a>
</td>
<td role="cell" data-label="CLI arguments">
<details id="cli-arguments-details">

View File

@ -38,34 +38,34 @@
</div>
<div class="pf-c-data-list__cell pf-m-flex-5">
<div style="padding-top:1em;" title="{{ playbook.path }}">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html">
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html">
{% if playbook.name is not None %}{{ playbook.name }}{% else %}{{ playbook.path | truncatepath:50 }}{% endif %}
</a>
</div>
</div>
<div class="pf-c-data-list__cell pf-m-flex-1">
<div style="padding-top:1em;">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#hosts">{{ playbook.items.hosts }} hosts</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#hosts">{{ playbook.items.hosts }} hosts</a>
</div>
</div>
<div class="pf-c-data-list__cell pf-m-flex-1">
<div style="padding-top:1em;">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#plays">{{ playbook.items.plays }} plays</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#plays">{{ playbook.items.plays }} plays</a>
</div>
</div>
<div class="pf-c-data-list__cell pf-m-flex-1">
<div style="padding-top:1em;">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#results">{{ playbook.items.results }} results</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#results">{{ playbook.items.results }} results</a>
</div>
</div>
<div class="pf-c-data-list__cell pf-m-flex-1">
<div style="padding-top:1em;">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#files">{{ playbook.items.files }} files</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#files">{{ playbook.items.files }} files</a>
</div>
</div>
<div class="pf-c-data-list__cell pf-m-flex-1">
<div style="padding-top:1em;">
<a href="{% if page != "index" %}../{% endif %}playbook/{{ playbook.id }}.html#records">{{ playbook.items.records }} records</a>
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html#records">{{ playbook.items.records }} records</a>
</div>
</div>
<div class="pf-c-data-list__cell pf-m-flex-1">

View File

@ -10,7 +10,7 @@
{% if playbook.items.records %}
<ul class="pf-c-list">
{% for record in playbook.records %}
<li><a href="../record/{{ record.id }}.html">{{ record.key }}</a></li>
<li><a href="../records/{{ record.id }}.html">{{ record.key }}</a></li>
{% endfor %}
</ul>
{% else %}
@ -21,7 +21,7 @@
<summary>Files</summary>
<ul class="pf-c-list">
{% for file in playbook.files %}
<li><a href="../file/{{ file.id }}.html">{{ file.path }}</a></li>
<li><a href="../files/{{ file.id }}.html">{{ file.path }}</a></li>
{% endfor %}
</ul>
</details>
@ -77,7 +77,7 @@
{% for host in playbook.hosts %}
<tr>
<td role="cell" data-label="Hostname" class="pf-m-fit-content">
<a href="../host/{{ host.id }}.html">{{ host.name }}</a>
<a href="../hosts/{{ host.id }}.html">{{ host.name }}</a>
</td>
<td role="cell" data-label="Changed" class="pf-m-fit-content">
{{ host.changed }}
@ -128,10 +128,10 @@
{{ result.host.name }}
</td>
<td role="cell" data-label="Name" class="pf-m-fit-content">
<a href="../result/{{ result.id }}.html">{{ task.name }}</a>
<a href="../results/{{ result.id }}.html">{{ task.name }}</a>
</td>
<td role="cell" data-label="Action" class="pf-m-fit-content">
<a href="../file/{{ task.file.id }}.html#{{ task.lineno }}">{{ task.action }}</a>
<a href="../files/{{ task.file.id }}.html#{{ task.lineno }}">{{ task.action }}</a>
</td>
<td role="cell" data-label="Duration" class="pf-m-fit-content">
{{ result.duration | format_duration }}

View File

@ -10,8 +10,8 @@
<ul class="pf-c-list">
<li><strong>Task</strong>: {{ result.task.name }}</a></li>
<li><strong>Action</strong>: {{ result.task.action }}</li>
<li><strong>Path</strong>: <a href="../file/{{ result.task.file }}.html#{{ result.task.lineno }}">{{ result.task.path }}:{{ result.task.lineno }}</a>
<li><strong>Host</strong>: <a href="../host/{{ result.host.id }}.html">{{ result.host.name }}</a></li>
<li><strong>Path</strong>: <a href="../files/{{ result.task.file }}.html#{{ result.task.lineno }}">{{ result.task.path }}:{{ result.task.lineno }}</a>
<li><strong>Host</strong>: <a href="../hosts/{{ result.host.id }}.html">{{ result.host.name }}</a></li>
<li><strong>Status</strong>: {{ result.status }}</li>
<li><strong>Started</strong>: {{ result.started | format_date }}</li>
<li><strong>Ended</strong>: {{ result.ended | format_date }}</li>

View File

@ -7,9 +7,9 @@ app_name = "ui"
urlpatterns = [
path("", views.Index.as_view(), name="index"),
path("robots.txt", TemplateView.as_view(template_name="robots.txt", content_type="text/plain")),
path("playbook/<int:pk>.html", views.Playbook.as_view(), name="playbook"),
path("result/<int:pk>.html", views.Result.as_view(), name="result"),
path("file/<int:pk>.html", views.File.as_view(), name="file"),
path("host/<int:pk>.html", views.Host.as_view(), name="host"),
path("record/<int:pk>.html", views.Record.as_view(), name="record"),
path("playbooks/<int:pk>.html", views.Playbook.as_view(), name="playbook"),
path("results/<int:pk>.html", views.Result.as_view(), name="result"),
path("files/<int:pk>.html", views.File.as_view(), name="file"),
path("hosts/<int:pk>.html", views.Host.as_view(), name="host"),
path("records/<int:pk>.html", views.Record.as_view(), name="record"),
]