mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 10:54:11 -04:00
Inbound number admin page
This commit is contained in:
@@ -54,6 +54,7 @@ from app.notify_client.provider_client import ProviderClient
|
||||
from app.notify_client.organisations_client import OrganisationsClient
|
||||
from app.notify_client.models import AnonymousUser
|
||||
from app.notify_client.letter_jobs_client import LetterJobsClient
|
||||
from app.notify_client.inbound_number_client import InboundNumberClient
|
||||
from app.utils import get_cdn_domain
|
||||
|
||||
from app.utils import gmt_timezones
|
||||
@@ -75,6 +76,7 @@ organisations_client = OrganisationsClient()
|
||||
asset_fingerprinter = AssetFingerprinter()
|
||||
statsd_client = StatsdClient()
|
||||
letter_jobs_client = LetterJobsClient()
|
||||
inbound_number_client = InboundNumberClient()
|
||||
|
||||
# The current service attached to the request stack.
|
||||
current_service = LocalProxy(partial(_lookup_req_object, 'service'))
|
||||
@@ -107,6 +109,7 @@ def create_app():
|
||||
provider_client.init_app(application)
|
||||
organisations_client.init_app(application)
|
||||
letter_jobs_client.init_app(application)
|
||||
inbound_number_client.init_app(application)
|
||||
|
||||
login_manager.init_app(application)
|
||||
login_manager.login_view = 'main.sign_in'
|
||||
|
||||
@@ -29,5 +29,6 @@ from app.main.views import (
|
||||
platform_admin,
|
||||
letter_jobs,
|
||||
conversation,
|
||||
notifications
|
||||
notifications,
|
||||
inbound_number
|
||||
)
|
||||
|
||||
32
app/main/views/inbound_number.py
Normal file
32
app/main/views/inbound_number.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from flask import (
|
||||
render_template,
|
||||
redirect,
|
||||
session,
|
||||
url_for,
|
||||
request
|
||||
)
|
||||
|
||||
from flask_login import login_required
|
||||
from app.main import main
|
||||
from app import inbound_number_client
|
||||
from app.utils import user_has_permissions
|
||||
|
||||
|
||||
@main.route('/inbound-sms-admin', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions(admin_override=True)
|
||||
def inbound_sms_admin():
|
||||
#data = user_api_client.get_inboundsms_number_service()
|
||||
data = inbound_number_client.get_inbound_sms_number_service()
|
||||
|
||||
# return jsonify(data)
|
||||
|
||||
return render_template('views/inbound_sms_admin.html',
|
||||
inbound_num_list = data)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
15
app/notify_client/inbound_number_client.py
Normal file
15
app/notify_client/inbound_number_client.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from app.notify_client import NotifyAdminAPIClient
|
||||
|
||||
class InboundNumberClient(NotifyAdminAPIClient):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("a" * 73, "b")
|
||||
|
||||
def init_app(self, app):
|
||||
self.base_url = app.config['API_HOST_NAME']
|
||||
self.service_id = app.config['ADMIN_CLIENT_USER_NAME']
|
||||
self.api_key = app.config['ADMIN_CLIENT_SECRET']
|
||||
|
||||
def get_inbound_sms_number_service(self):
|
||||
endpoint = '/inbound_number'
|
||||
return self.get(endpoint)
|
||||
85
app/templates/views/inbound_sms_admin.html
Normal file
85
app/templates/views/inbound_sms_admin.html
Normal file
@@ -0,0 +1,85 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/table.html" import list_table, row, field, hidden_field_heading %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Inbound Numbers
|
||||
{% endblock %}
|
||||
|
||||
{% set table_headings = {
|
||||
'field_headings': [
|
||||
'', 'Number', 'Status', 'Service', 'Created on'
|
||||
],
|
||||
'field_headings_visible': True,
|
||||
'caption_visible': True
|
||||
} %}
|
||||
|
||||
{% set phone_number = {
|
||||
'num':['012345560', '012345561', '012345562', '012345563', '012345564', '012345564', '012345564', '012345564', '012345564'
|
||||
, '012345564', '012345564'],
|
||||
'field_headings_visible': True,
|
||||
'caption_visible': True
|
||||
} %}
|
||||
|
||||
{% set service = {
|
||||
'name':['GOV.UK', 'DVLA', 'Passport office', 'Fishing Dept', 'Gov Wifi', 'Test', '', '', ''
|
||||
, '', ''],
|
||||
'field_headings_visible': True,
|
||||
'caption_visible': True
|
||||
} %}
|
||||
|
||||
{% set active = {
|
||||
'state':['active', 'active', 'active', 'active', 'active', 'active', '', '', ''
|
||||
, '', ''],
|
||||
'field_headings_visible': True,
|
||||
'caption_visible': True
|
||||
} %}
|
||||
|
||||
.inbound {
|
||||
font-style:normal;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="grid-row bottom-gutter">
|
||||
<div class="column-two-thirds">
|
||||
<h1 class="heading-large">
|
||||
Inbound SMS
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<table class="inbound">
|
||||
<col style="width:8%">
|
||||
<col style="width:20%">
|
||||
<col style="width:17%">
|
||||
<col style="width:30%">
|
||||
<thread>
|
||||
<tr>
|
||||
<th>{{table_headings.field_headings[0]}}</th>
|
||||
<th>{{table_headings.field_headings[1]}}</th>
|
||||
<th>{{table_headings.field_headings[2]}}</th>
|
||||
<th>{{table_headings.field_headings[3]}}</th>
|
||||
</tr>
|
||||
</thread>
|
||||
<tbody>
|
||||
|
||||
{% for value in inbound_num_list.data: %}
|
||||
<tr>
|
||||
<th style="font-weight:normal;">{{loop.index}}</th>
|
||||
<th style="font-weight:normal;">{{value.number}}</th>
|
||||
<th style="font-weight:normal;">
|
||||
{% if value.active %}
|
||||
Active
|
||||
{% else %}Inactive
|
||||
{% endif %}
|
||||
</th>
|
||||
<th style="font-weight:normal;">{{value.service.name}}</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user