Commit Graph

515 Commits

Author SHA1 Message Date
Chris Hill-Scott
8bb23e09f2 Refactor to reduce nesting and repetition 2018-09-24 14:52:32 +01:00
Chris Hill-Scott
f29c6c90c0 Add info about checklist to ticket
So that someone picking up a ticket can be warned that they should be
checking these things.
2018-09-24 14:52:31 +01:00
Chris Hill-Scott
45b1b11abb Refactor go-live readyness into service model
All this info is info about the service. So it’s better to put it on
the service model because:
- encapsulation
- later reuse
2018-09-24 14:52:30 +01:00
Katie Smith
9660f372f3 Change naming in code to use 'postage'
Renamed everything that was previously called 'letter class' or 'postage
class' to 'postage', which is the new name we have decided to use.
2018-09-19 09:20:09 +01:00
Katie Smith
de9759b99a Add letter class row to settings page, visible to platform admin
Added a new row to the settings table, 'Post class', which shows the
default letter class of a service and is only visible to Platform Admin.

Also added a new page to enable Platform Admin users to change the
default letter class for a service - this only has two options at the
moment, 1st class only and 2nd class only.
2018-09-18 10:31:01 +01:00
Alexey Bezhan
b75681dfbc Add a platform admin page to submit returned letter references
A platform admin form accepts a list of references (one per line)
received from DVLA and sends them to the API to update notification
statuses.

References we get from DVLA start with `NOTIFY00\d`, which isn't
part of the reference we store in the database, so we remove them
before sending the data to the API.

The new `returned-letter` status should be treated as `delivered`
for now until we decide a way to display returned letters to users.
2018-09-07 11:13:01 +01:00
Chris Hill-Scott
243fdb0260 Assign email branding based on user’s email domain
When a user creates a service we can take a pretty good guess at what
organisation they’re from.

For many organisations, especially local councils, GOV.UK branding is
not appropriate for their service. But right now every service:
- gets created with GOV.UK branding
- has to ask us to change it, even if they’ve already done so for other
  services they run

This commit starts using the `domain` field on the email branding table
to lookup what email branding to assign to a service automatically,
where we’re sure there’s a sensible default.
2018-09-05 10:32:44 +01:00
Chris Hill-Scott
28b80856df Cache email branding in Redis
If we’re going to be referring to email branding as part of the service
creation journey then we should make sure it doesn’t slow things down
too much by adding an extra API call. Caching things in Redis is a way
of avoiding unneeded API calls.
2018-09-03 14:46:48 +01:00
Chris Hill-Scott
631c3478ae Remove branding attribute from service model
To correspond with us dropping this column from the database.

Remove the attribute from the model gives us more confidence that it’s
not being used (because it will raise exceptions in any tests that refer
to it).
2018-08-31 14:05:33 +01:00
Rebecca Law
34d938ce18 Add brand type to email branding.
Removed banner_colour and single_id_colour.
We only really need one colour now.
2018-08-23 14:21:41 +01:00
Rebecca Law
3fda171f80 New columns for email branding
Added banner_colour, single_id_colour and domain to email branding view. Now able to set the fields.

However, the new fields are not being used yet.
2018-08-20 13:27:17 +01:00
Tom Byers
6249f4826b Merge pull request #2235 from alphagov/sort-branding-radios-alphabetically
Sort branding radios alphabetically
2018-08-16 16:49:12 +01:00
Alexey Bezhan
3a00574034 Merge pull request #2224 from alphagov/notifications-page-data-retention-period
Notifications page data retention period
2018-08-16 13:55:55 +01:00
Tom Byers
f85a9306a6 Move brandings sort into email_branding_client 2018-08-16 13:40:24 +01:00
Sakis
85ec7a28cb Merge pull request #2231 from alphagov/zipkin-headers
Both trace_id and span_id headers must be present
2018-08-15 16:10:09 +01:00
Athanasios Voutsadakis
984e09cc6a Both trace_id and span_id headers must be present 2018-08-14 18:12:06 +01:00
Tom Byers
8ba8606963 Merge pull request #2230 from alphagov/add-branding-name-to-ui
Show the 'name' of the email branding in the adding and editing screens
2018-08-14 16:05:56 +01:00
Tom Byers
1269071da2 Add 'name' field to brand creation/edit page 2018-08-14 14:18:16 +01:00
Tom Byers
eb64033ff3 Update selection radios before edit/create new
They were already using the 'name' field in their
label but we don't want any other part of the
branding to appear now.
2018-08-14 14:18:16 +01:00
Athanasios Voutsadakis
6786ff8fde Use the zipkin headers from utils version 30.0.0 2018-08-14 13:20:21 +01:00
Alexey Bezhan
52d48ad679 Add API client method to fetch service data retention by type 2018-08-13 17:06:16 +01:00
Alexey Bezhan
28b03fe748 Add limit_days argument to statistics API client method
Allows getting notification counts for a given number of days to
support services with custom data retention periods (admin
dashboard page should still display counts for the last 7 days,
while the notifications page displays all stored notifications).
2018-08-13 17:04:40 +01:00
Chris Hill-Scott
89795186ec Merge pull request #2217 from alphagov/remove-basic-view
Remove basic view setting and preview
2018-08-10 17:04:19 +01:00
Chris Hill-Scott
ec69aa6c39 Merge pull request #2214 from alphagov/sort-services-alpha-on-copy
Sort services alphabetically when copying template
2018-08-10 16:59:00 +01:00
Chris Hill-Scott
fdf3670661 Remove basic view setting and preview 2018-08-09 17:51:34 +01:00
Chris Hill-Scott
61507fda8f Make the permission labels shorter
They were feeling a bit heavy on the _Team members_ page. We can remove
some words without losing any meaning.
2018-08-09 13:49:06 +01:00
Chris Hill-Scott
347912876c Relabel existing permissions
Since we have added a new, 5th permission the existing permissions
should be relabelled so that the five make sense as a coherent set.

We especially want to make sure that:
- the labels work against the checkboxes and against the tick/crosses on
  the manage users page (a long time ago this page was layed out
  differently so didn’t have space for full labels)
- there is no confusion between usage and reports

This commit also:
- re-adds a line about what all users can see (‘sent messages’) but
  continues to omit the additional bullet points about templates and
  team members (because we think this is clear enough from reading the
  permissions)
- refactors the `Form` subclass so that the content and order of the
  permissions only have to be defined once
- brings back the ‘permissions’ legend on the `fieldset`
2018-08-09 13:49:06 +01:00
Chris Hill-Scott
646ba6e8c3 Add a ‘See dashboard’ permission
Our research and prototyping around ‘basic view’ found that:
- a lot of users who send messages rarely or never look at the dashboard
  (yet it’s the first page they see when they sign in)
- team managers like the idea of taking away things that users don’t
  need in order to make the interface simpler

We’ve disentangled the simpler way of sending messages from being part
of ‘basic view’. This means we can give managers the option of taking
away the dashboard as an independent choice, not something that’s
wrapped up in a separate ‘view’.

I think that this checkbox is a more straightforward proposition than
‘basic view’ ever was (despite all the work we did to explain it and
develop the nested checkbox pattern). In research users would often
explain the feature back to us as being about hiding the dashboard – we
should try to make Notify operate in terms of concepts that come
naturally to people wherever possible.
2018-08-09 13:49:06 +01:00
Chris Hill-Scott
55d051d95a Sort services alphabetically when copying template
If you have a lot of services it’s hard to find the one you’re looking
for if the sort order is a mixture of `created_by` and which ones belong
to an organisation.

Since the templates within the services are sorted alphabetically it
makes sense to also sort the services alphabetically.
2018-08-09 13:33:08 +01:00
Chris Hill-Scott
bbdbe61cad Let users with empty permissions see certain pages
We’re going to make it possible for some users to be members of a
service, but not have any permissions (not even `view_activity`).

There are some pages that these users should still be able to see
These are the pages that a user with ‘basic view’ would have been able
to see, excluding those that let them send messages.
2018-08-09 11:56:15 +01:00
Rebecca Law
18750585c4 Reduced the size of the pull request by only dealing with adding the data retention form. 2018-08-06 16:04:31 +01:00
Rebecca Law
ae1f1c95d6 Merge branch 'master' into flexible-data-retention 2018-08-06 15:37:11 +01:00
Chris Hill-Scott
c551ce9a42 Show jobs in basic view
There are some teams who send jobs on a daily/weekly basis. They have
team members who only use Notify for this purpose. So they would
probably benefit from basic view, because they don’t need to see the
dashboard.

This commit:
- adds a new item (uploaded files) to the basic view navigation for
  teams that have sent at least one job
- makes the job pages visible to basic view users

I think we should do this now, rather than as a later enhancement to
basic view. We only have one chance to announce the feature, so teams
who do send jobs may otherwise discount it as not useful for them and
the opportunity to have them use it is lost.
2018-08-01 10:45:02 +01:00
Chris Hill-Scott
b35f6e9d5f Merge pull request #2180 from alphagov/service-model
Make a service model
2018-07-31 13:31:09 +01:00
Chris Hill-Scott
45579c59cd Store boolean values in Redis as valid JSON
Calling `.set()` with `True` stores the byte string `'True'` which
cannot subsequently be decoded from JSON (because boolean values in
JSON are lowercase, ie `true`).
2018-07-31 12:17:28 +01:00
Chris Hill-Scott
1073b8f178 Merge pull request #2178 from alphagov/cache-has-jobs
Check if any jobs exist before querying jobs
2018-07-31 11:17:42 +01:00
Chris Hill-Scott
eb8e433820 Rename variable to be more descriptive
> "normal" is a word that does not really tell much, could we maybe name
> this constant better?

‘Non-scheduled’ more explicitly describes that statues in this set.
2018-07-31 09:57:55 +01:00
Chris Hill-Scott
41e0f7941f Refactor to avoid duplicated method definitions
Each of these methods does the same thing, so this refactors into an
attribute lookup, which saves writing boilerplate code and makes it
easier to add new properties.
2018-07-30 14:56:36 +01:00
Chris Hill-Scott
1304561a70 Use service model to look up service attributes
This is better than just keying into the JSON because it means you get
an exception straight away when looking up a key that doesn’t exist
(which via mocking you could ordinarily miss).
2018-07-30 14:56:36 +01:00
Chris Hill-Scott
036923c382 Make a service model and use for permissions
Having the service floating about as JSON is a bit flakey. Could easily
introduce a mistake where you mistype the name of a key and silently
get `None`.

Also means doing awkward things like `if 'permission' in
current_service['permissions']`, whereas for users we can do the
much cleaner `user.has_permission()`.

So this commit:
- introduces a model
- adds a `.has_permission` method similar to the one we have for users
2018-07-30 14:56:36 +01:00
Chris Hill-Scott
19632ea4ab Add option to copy existing template when adding
Sometimes when setting up a service you might have a few very similar
templates, in which only a small amount of content. Or you might even
have a few of services, which are used by different teams but have
similar templates.

Copy and pasting, especially from one service to another, is a pain.
This commit makes it easier by allowing users to copy an existing
template when choosing to add a new one, instead of starting from
scratch.
2018-07-30 11:31:51 +01:00
Chris Hill-Scott
505de52d38 Check if any jobs exist before querying jobs
At the moment the dashboard does two API calls to find out if a service
has:

1. Scheduled jobs
2. Normal jobs

API calls are slow because they are synchronous, go over the network and
touch the database. We can’t cache these API calls because:
- a scheduled job could become a normal job at any time
- the statistics on a normal job are constantly updating

However there are plenty of services which don’t have any jobs, and
probably never will. And finding out if a service has any jobs is
reliably cacheable (because as soon as a service creates its first job
it has some jobs).

So this commit:
- refactors the way we get scheduled/normal jobs into the job_api_client
  to make the view a bit slimmer
- makes an additional, Redis-wrapped call to find out if any jobs exist
  before trying to get the jobs

This should result in a speedup on the dashboard, and can be used in the
future if there’s anywhere else we want to show or hide something
depending on whether a service has created any jobs (I have some ideas).
2018-07-30 11:14:01 +01:00
Pea Tyczynska
6d2aad5561 Remove functions and comments redundant after monthly_billing removal 2018-07-25 11:48:17 +01:00
Rebecca Law
0081a70d4b Fix the link on the data-retention/edit.html
Adding new service_api_client methods to get data for the right amount of days.
2018-07-19 17:09:52 +01:00
Katie Smith
eb9e9fac3b Ensure one-off jobs do not appear on message log page
Upcoming changes to API will mean that by default its
`get_notifications_for_service` DAO function will return one-off
notifications. In most cases this is what we want, but the message log
page should not show one-off notifications. By passing in the `include_one_off=False`
option to API we can ensure that this page will stay the same when API
changes.
2018-07-18 08:11:42 +01:00
Rebecca Law
13d05c5461 Allow a platform admin user to set flexible data retention for a service for a specified notification type.
Still a work in progress
2018-07-13 16:47:26 +01:00
Pea Tyczynska
4cd465753a Add view that displays user information, including:
- name
- email
- phone number
- services
- last login
- failed login attempts if any

The view can be accessed from results of find_users_by_email

logged_in_at added to User serialization on admin frontend as
a part of this work
2018-07-13 16:01:52 +01:00
Pea Tyczynska
d1a05e2ec5 find_users_by_email view calls API and feeds results to template
Template then displays the results.

Page displays a message if no results found
2018-07-13 11:58:29 +01:00
Katie Smith
3f117bd7b1 Merge pull request #2152 from alphagov/remove-old-platform-stats
Use new platform-admin page
2018-07-11 11:15:59 +01:00
Katie Smith
3bbc73dfd2 Use new platform-admin page
We had kept the original platform-admin page at `/platform-admin` and
created a new page, `/platform-admin-new` for the new platform admin
page. Now that the numbers on both pages look ok we no longer need both
pages, so can replace the original page.
2018-07-10 14:39:54 +01:00