Update delete app button and section
This commit is contained in:
1
Pipfile
1
Pipfile
@@ -26,6 +26,7 @@ azure-storage = "*"
|
|||||||
azure-storage-common = "*"
|
azure-storage-common = "*"
|
||||||
boto3 = "*"
|
boto3 = "*"
|
||||||
celery = "*"
|
celery = "*"
|
||||||
|
inflect = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
bandit = "*"
|
bandit = "*"
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
import datetime
|
import datetime
|
||||||
|
import inflect
|
||||||
from atst.utils.localization import translate
|
from atst.utils.localization import translate
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from jinja2 import contextfilter
|
from jinja2 import contextfilter
|
||||||
@@ -67,6 +68,14 @@ def renderAuditEvent(event):
|
|||||||
return render_template("audit_log/events/default.html", event=event)
|
return render_template("audit_log/events/default.html", event=event)
|
||||||
|
|
||||||
|
|
||||||
|
def numberToWords(integer):
|
||||||
|
return inflect.engine().number_to_words(integer)
|
||||||
|
|
||||||
|
|
||||||
|
def pluralize(word, number):
|
||||||
|
return inflect.engine().plural(word, number)
|
||||||
|
|
||||||
|
|
||||||
def register_filters(app):
|
def register_filters(app):
|
||||||
app.jinja_env.filters["iconSvg"] = iconSvg
|
app.jinja_env.filters["iconSvg"] = iconSvg
|
||||||
app.jinja_env.filters["dollars"] = dollars
|
app.jinja_env.filters["dollars"] = dollars
|
||||||
@@ -76,6 +85,8 @@ def register_filters(app):
|
|||||||
app.jinja_env.filters["pageWindow"] = pageWindow
|
app.jinja_env.filters["pageWindow"] = pageWindow
|
||||||
app.jinja_env.filters["renderAuditEvent"] = renderAuditEvent
|
app.jinja_env.filters["renderAuditEvent"] = renderAuditEvent
|
||||||
app.jinja_env.filters["withExtraParams"] = with_extra_params
|
app.jinja_env.filters["withExtraParams"] = with_extra_params
|
||||||
|
app.jinja_env.filters["numberToWords"] = numberToWords
|
||||||
|
app.jinja_env.filters["pluralize"] = pluralize
|
||||||
|
|
||||||
@contextfilter
|
@contextfilter
|
||||||
def translateWithoutCache(context, *kwargs):
|
def translateWithoutCache(context, *kwargs):
|
||||||
|
@@ -176,15 +176,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
{% if user_can(permissions.DELETE_APPLICATION) %}
|
{% if user_can(permissions.DELETE_APPLICATION) %}
|
||||||
<div class="usa-input">
|
{% set env_count = application.environments | length %}
|
||||||
<input
|
{% set pluralized_env = "environment" | pluralize(env_count) %}
|
||||||
id="delete-application"
|
|
||||||
type="button"
|
<div class='subheading'>
|
||||||
v-on:click="openModal('delete-application')"
|
{{ "portfolios.applications.delete.subheading" | translate }}
|
||||||
class='usa-button button-danger-outline'
|
</div>
|
||||||
value="{{ 'portfolios.applications.delete.button' | translate }}"
|
|
||||||
>
|
<div class="panel">
|
||||||
|
<div class="panel__content">
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-col form-col--two-thirds">
|
||||||
|
{{ "portfolios.applications.delete.panel_text" | translate({"name": application.name, "env_count": env_count | numberToWords, "pluralized_env": pluralized_env}) | safe }}
|
||||||
|
</div>
|
||||||
|
<div class="form-col form-col--third">
|
||||||
|
<div class="usa-input">
|
||||||
|
<input
|
||||||
|
id="delete-application"
|
||||||
|
type="button"
|
||||||
|
v-on:click="openModal('delete-application')"
|
||||||
|
class='usa-button button-danger-outline'
|
||||||
|
value="{{ 'portfolios.applications.delete.button' | translate }}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% call Modal(name="delete-application") %}
|
{% call Modal(name="delete-application") %}
|
||||||
|
@@ -298,6 +298,8 @@ portfolios:
|
|||||||
message: You will lose access to this application and all environments will be removed from the CSP. Your reporting and activity will still be accessible.
|
message: You will lose access to this application and all environments will be removed from the CSP. Your reporting and activity will still be accessible.
|
||||||
button: Delete application
|
button: Delete application
|
||||||
header: Are you sure you want to delete this application?
|
header: Are you sure you want to delete this application?
|
||||||
|
panel_text: 'Deleting {name} will delete this applicaiton along with all {env_count} {pluralized_env}. <strong>This cannot be undone.</strong>'
|
||||||
|
subheading: Delete Application
|
||||||
enter_env_name: "Enter environment name:"
|
enter_env_name: "Enter environment name:"
|
||||||
environments:
|
environments:
|
||||||
name: Name
|
name: Name
|
||||||
|
Reference in New Issue
Block a user