Skip to content

Commit

Permalink
Add Workflow tab in Operation
Browse files Browse the repository at this point in the history
  • Loading branch information
a-belhadj committed Sep 22, 2023
1 parent 0f1f292 commit b83acd8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion service_catalog/models/approval_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class ApprovalWorkflow(SquestModel):
'profiles.Scope',
related_name='approval_workflows',
blank=True,
verbose_name="Restricted scopes"
verbose_name="Restricted scopes",
help_text="This workflow will be triggered for the following scopes. Leave empty to trigger for all scopes"
)

@property
Expand Down
5 changes: 4 additions & 1 deletion service_catalog/views/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from Squest.utils.squest_views import *
from service_catalog.filters.operation_filter import OperationFilter, OperationFilterLimited
from service_catalog.forms import ServiceOperationForm
from service_catalog.models import Operation, Service, OperationType
from service_catalog.models import Operation, Service, OperationType, ApprovalWorkflow
from service_catalog.tables.approval_workflow_table import ApprovalWorkflowTable
from service_catalog.tables.operation_tables import OperationTable, CreateOperationTable


Expand Down Expand Up @@ -78,6 +79,8 @@ def get_context_data(self, **kwargs):
}
]
context['extra_html_button_path'] = "service_catalog/buttons/operation_survey_button.html"
if self.request.user.has_perm('service_catalog.view_approvalworkflow'):
context['workflows_table'] = ApprovalWorkflowTable(ApprovalWorkflow.objects.filter(operation=self.get_object()),exclude=['operation'])
return context


Expand Down
10 changes: 10 additions & 0 deletions templates/service_catalog/operation_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{% include 'service_catalog/buttons/delete_operation_button.html' %}
{% endblock %}
{% block main %}
{% load django_tables2 %}
<div class="container-fluid">
<div class="row">
<section class="col-lg-3">
Expand Down Expand Up @@ -57,13 +58,22 @@ <h3 class="card-title">Details</h3>
<ul class="nav nav-pills squest-default-active" id="tabs">
<li class="nav-item"><a class="nav-link" href="#extra_vars" data-toggle="tab">Extra vars</a>
</li>
{% if workflows_table %}
<li class="nav-item"><a class="nav-link" href="#workflows"
data-toggle="tab">Workflows</a></li>
{% endif %}
</ul>
</div>
<div class="card-body">
<div class="tab-content">
<div class="tab-pane" id="extra_vars">
<pre><code class="language-json">{{ object.extra_vars | pretty_json }}</code></pre>
</div>
{% if workflows_table %}
<div class="tab-pane" id="workflows">
{% render_table workflows_table %}
</div>
{% endif %}
</div>
</div>
</div>
Expand Down

0 comments on commit b83acd8

Please sign in to comment.