Commit Graph

952 Commits

Author SHA1 Message Date
Jenny Duckett
c88a961e04 Add option to exclude test key stats on platform admin page
This page currently includes all notifications for all services, including
those sent using a test key. Stats on all other pages exclude test key usage,
though, which can lead to confusion for admins comparing numbers between
pages. Adding the option to toggle between including and excluding test key
usage on the platform admin page gives context for this difference, and allows
admins to see live usage of the platform as well as load associated with test
key usage.
2016-12-06 12:42:27 +00:00
Chris Hill-Scott
18d11aa013 Move code for rendering messages/templates → utils
Utils is better structured to handle the logic of what thing to show
for what template type, especially now that what we show for different
template types in different contexts has diverged significantly.

See https://github.com/alphagov/notifications-utils/commit/6b39c1a for
an example of this code moving into utils

Depends on and implements:
https://github.com/alphagov/notifications-utils/pull/84

The main reason for doing this is to get Paul’s fix for the misaligned
CSV columns: https://github.com/alphagov/notifications-utils/pull/87
2016-12-05 12:11:54 +00:00
Leo Hemsted
08881e5bd1 add get_active_services method
* all current invocations of get_services now call get_active_services
  EXCEPT for platform admin page (where we want to see inactive services
* cleaned up parameter names and unpacking (since *params is unhelpful)
* fixed incorrect kwarg name in conftest
2016-11-16 11:08:20 +00:00
Leo Hemsted
b885ce9cf4 clean up some usage of active in tests and remove it from service_api_client.create_service (created services are always active) 2016-11-16 11:08:20 +00:00
Leo Hemsted
045864f052 Merge pull request #1022 from alphagov/deactivate-services-plat-admin
Deactivate services plat admin
2016-11-16 11:07:52 +00:00
Chris Hill-Scott
48496eefde Merge pull request #1024 from alphagov/add-letters-templates-2
Let users upload a CSV file of addresses against a letter template
2016-11-15 17:57:28 +01:00
Leo Hemsted
5edb8cd086 revert platform admin statistics
was erroneously using 'requested' rather than calculating 'sending'
2016-11-15 11:12:19 +00:00
Leo Hemsted
d26f7ac441 Merge branch 'master' of github.com:alphagov/notifications-admin into deactivate-services-plat-admin 2016-11-14 17:15:05 +00:00
imdadahad
6a9973d1b6 Merge pull request #1025 from alphagov/show-email-sms-stats-platform-admin
Show email and sms counts for each service on platform admin
2016-11-14 16:56:00 +00:00
imdadahad
49082ab646 Revert user_profile back original
This change shouldn't be in this PR and got in somehow :(
2016-11-14 16:49:25 +00:00
Imdad Ahad
5ce0cbe1db Refactor stats into a macro and add format number red on failure 2016-11-14 16:42:08 +00:00
Chris Hill-Scott
a108165e47 Give more realistic example address data
Posit that examples of where you can put different parts of the address
is more helpful than ‘example, example, example’. Also shows that you
don’t have to fill all of the address columns.

Spot the Easter egg 🎅
2016-11-14 14:53:07 +00:00
Chris Hill-Scott
69ad5fe156 Handle multi-column recipients
Implements https://github.com/alphagov/notifications-utils/pull/81

Handles addresses as multiple columns:
- in ‘Send yourself a test’
- in example CSV files
- in validating that a CSV file has recipients (eg at least an ‘address
  line 1’ and ‘postcode’ column)
- when showing the contents of a CSV file

As few UI changes as possible, once we have the thing working end-to-end
we can think about how the UI might need to work differently.
2016-11-14 14:53:06 +00:00
Chris Hill-Scott
5772fd34fe Remove placeholder letters page
👋 emoji
2016-11-14 14:51:28 +00:00
Chris Hill-Scott
70eec8fe73 Don’t let people actually start a letter job
Who knows what would happen if a job with a letter template actually
got into the database. `403`ing the page is a quick and dirty hack to
stop this from happening.
2016-11-14 14:51:27 +00:00
Chris Hill-Scott
88631a680c Sprinkle letter throughout the app
Let users create/edit/delete letter templates.

Let them upload a CSV file or send a test against a letter template.

Big assumption at the moment is that addresses only have one line, and
therefore one column in the CSV file.
2016-11-14 14:51:26 +00:00
Imdad Ahad
ec7ec77b69 Return the email and sms stats instead of summing them 2016-11-14 14:45:41 +00:00
Chris Hill-Scott
e164c4d5b1 Merge pull request #1023 from alphagov/sms-sender-fix
Fix errant service name in text messages
2016-11-14 15:04:25 +01:00
Chris Hill-Scott
b68ebbb107 Fix errant service name in text messages
Was missed as part of:
https://github.com/alphagov/notifications-admin/pull/905
2016-11-14 13:08:27 +00:00
Leo Hemsted
63de598d31 Merge pull request #1008 from alphagov/deactivate-service
Deactivate service
2016-11-14 11:41:13 +00:00
imdadahad
115cbe67e5 Merge pull request #1011 from alphagov/update-user-profile
Update user profile
2016-11-11 14:47:13 +00:00
Imdad Ahad
e5ea81b184 Fix pep issues and refactor tests 2016-11-10 10:45:09 +00:00
Imdad Ahad
c28aea2de1 Update user profile attributes with new method 2016-11-09 15:05:06 +00:00
Leo Hemsted
defa93809a show archived label on platform admin page, and sort last 2016-11-08 15:00:44 +00:00
Leo Hemsted
7a48e25dbb flash up prompt when archiving a service
same way as we do when deleting templates

(also rename button from deactivate -> archive)
2016-11-08 14:33:53 +00:00
Chris Hill-Scott
dae10429e6 Use radio button desc. pattern on go live page
Nicer than using en dashes.
2016-11-04 14:05:31 +00:00
Chris Hill-Scott
4ae28386a6 Always show live key, reword key labels
This is trying to resolve these confusions:

- that you’re in trial mode, which means you can’t have a live key yet (
  or you can but it wont work, which is what we used to have)
- what does simulate mean

The create key page is the right place to resolve these confusions
because it’s where users are actively reading.

This commit also removes the trial mode banner from API integration
page because this where users _aren’t_ actively reading. A whole bunch
of users weren’t seeing this banner at all.

The implementation of the disabled API key options is kinda clunky
because WTForms doesn’t have a native way of doing this.

¯\_(ツ)_/¯
2016-11-04 14:05:30 +00:00
Chris Hill-Scott
6a07b8bac2 Merge pull request #1006 from alphagov/request-to-go-live-improvements
Make certain questions on request to go live radio buttons
2016-11-04 14:05:54 +01:00
Leo Hemsted
a216259a8e Merge pull request #1005 from alphagov/letters-nav
allow users to see letters even if they dont have edit permissions
2016-11-04 09:46:27 +00:00
Imdad Ahad
f14c3dbfa5 Stop passing the 'whole' user object when making changes to profile 2016-11-03 11:20:24 +00:00
Chris Hill-Scott
274b2893f7 Merge pull request #979 from alphagov/4-days-scheduled
Allow a job to be scheduled any time in next 4 days
2016-11-03 10:24:07 +01:00
Leo Hemsted
a982144821 add deactivate service button on the service settings page
only visible for platform admins looking at active services.
no way to undo. no confirm button.
2016-11-02 16:53:40 +00:00
Leo Hemsted
e89f89bd11 remove unused delete service functionality 2016-11-02 10:29:44 +00:00
Chris Hill-Scott
82064ca4d0 Make MOU a multiple choice question not a banner
If we want someone to read something (ie that they need to have the MOU
signed), then the best way is to make them interact with it.

And if someone doesn’t have the MOU in place, then we need to know to
send them a copy. The best way of them telling us this is in this form,
rather than sending them to the generic contact form and have them
compose a message saying ‘please send me the MOU thanks’, which we
haven’t seen anyone actually do.
2016-11-01 12:23:49 +00:00
Chris Hill-Scott
84c2fcddff Add hint text for volumes questions
We’ve had some non-helpful answers to these questions, eg ‘3’.

This commit adds examples of the kind of response we’re looking for, to
help users write good answers.
2016-11-01 12:19:50 +00:00
Chris Hill-Scott
270e3c17dd Reword questions to make sense with radio buttons 2016-11-01 11:39:57 +00:00
Chris Hill-Scott
d832a9107c Use radio buttons not textboxes for multi-choice
No need to make people type when they can click, and gives us consistent
data.
2016-11-01 11:39:22 +00:00
Leo Hemsted
93cdaf1811 allow users to see letters even if they dont have edit permissions
same way as we handle seeing emails/sms
2016-10-31 18:01:31 +00:00
Leo Hemsted
96c592be10 add user permissions to the letters endpoints
you can get in with either "manage_templates" or "send_letters"

also improve running of a bunch of tests, by parametrising rather than
looping and by cleaning up some mock imports
2016-10-31 14:43:40 +00:00
Leo Hemsted
e0fcb79b9b Merge branch 'master' of github.com:alphagov/notifications-admin into letters-flag 2016-10-31 14:04:05 +00:00
Chris Hill-Scott
8a01e6af36 Make it say later today
Categories before:

> Now, today, tomorrow, Friday…

Categories after:

> Now, later today, tomorrow Friday…

This reduces the ambiguity of ‘now’ vs ‘today’, and keeping the word
‘later’ suggests what this features is about.

This implementation here is a bit hacky, but it works…
2016-10-31 09:14:05 +00:00
Chris Hill-Scott
a78d9d5048 Group choices for scheduling a job by day
The options for scheduling a job by time should be grouped by day,
because a long list of 96 options is not very usable.

On the server side, this commit generates label for the next 4 days in
a friendly format (ie today/tomorrow/Sunday/Monday)

The Javascript component for choosing a time was built in a kind of
old-school jQuery way, where it manipulated the elements on the page.
The complexity of introducing groups of options was just too much for
this pattern, because it involves storing a lot of state in the DOM.

This commit completely rewrites the JS to:

- read the initial options and groups from the HTML and store them
  in the object
- use Hogan to completely re-render the UI from a series of Mustache
  templates, each of which represents a state of the UI and takes the
  inital options and groups
- filter the choices to show when the today/tomorrow/… buttons are
  clicked
2016-10-31 09:14:05 +00:00
Chris Hill-Scott
324e1f9ef4 Allow a job to be scheduled any time in next 96hrs
If you want to send a job on Monday morning, you should be able to
schedule it on Friday. You shouldn’t need to work on the weekend.

96 hours is a full 4 days, so you can schedule a job at any time on
Friday for any time on Monday.

We’ve checked with the information assurance people, and they’re OK
with us holding the data for this extra amount of time.

This commit changes the choose time form from showing one radio button
for each of the next 24 hours to one for each of the next 96 hours. It
changes the labels from ‘9am’ to ‘Monday at 9am’ so it’s clear which
day you’re choosing.
2016-10-31 09:14:04 +00:00
Chris Hill-Scott
fc60016566 Remove ‘all services’ page
It’s not needed any more, because the platform admin page does the same
thing better.
2016-10-30 09:16:46 +00:00
Chris Hill-Scott
14b99e5a24 Go to platform admin page when logging in
If you’re a platform admin, you should go straight to the platform admin
page when you log in.

The all services page is just a crappier version of the same thing,
without all the stats, etc.
2016-10-30 09:16:35 +00:00
Imdad Ahad
f3a4432ed7 Stop non-gov user seeing/changing email and add test 2016-10-28 11:45:05 +01:00
Imdad Ahad
2676ee9bcf Add additional tests and refactor 2016-10-28 10:47:32 +01:00
Imdad Ahad
5ecdbb8596 Refactor to use a cleaner and lean regex 2016-10-28 10:45:05 +01:00
Leo Hemsted
f039397533 make letters error if user not logged in
also added tests for the various hiding logic points

also added new logged_in_client in conftest - so you dont need to
patch all those stupid API calls for get user and get service
2016-10-27 16:46:51 +01:00
Leo Hemsted
730719b61f platform admins can toggle services from seeing letters 2016-10-26 16:56:51 +01:00