Chunk events by day

Scanning the page is difficult at the moment because it’s hard to tell
how far apart in time events are, and thereby determine which events
might be related.

Grouping the events by day quickly lets users narrow their focus to
a meaningful subset of the events.
This commit is contained in:
Chris Hill-Scott
2019-10-18 16:43:52 +01:00
parent 59b4d60c91
commit b2ebaf153a
7 changed files with 121 additions and 23 deletions

View File

@@ -7,16 +7,46 @@ def test_history(
):
page = client_request.get('main.history', service_id=SERVICE_ONE_ID)
assert normalize_spaces(
page.select_one('main').text
) == (
'Service and API key history '
'11 November at 12:12pm 6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'
' Revoked the Bad key API key '
'11 November at 11:11am 6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'
' Created an API key called Bad key '
'10 October at 11:10am 6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'
' Created an API key called Good key '
'10 October at 11:10am 6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'
' Created this service and called it Example service'
)
assert page.select_one('h1').text == 'Service and API key history'
headings = page.select('main h2')
events = page.select('main ul')
assert len(headings) == len(events)
assert [
(
normalize_spaces(headings[index].text),
normalize_spaces(events[index].text),
) for index in range(len(headings))
] == [
(
'12 December',
(
'6ce466d0-fd6a-11e5-82f5-e0accb9d11a6 12:12pm '
'Renamed this service from Example service to Real service'
),
),
(
'11 November',
(
'6ce466d0-fd6a-11e5-82f5-e0accb9d11a6 12:12pm '
'Revoked the Bad key API key'
),
),
(
'11 November',
(
'6ce466d0-fd6a-11e5-82f5-e0accb9d11a6 11:11am '
'Created an API key called Bad key'
),
),
(
'10 October',
(
'6ce466d0-fd6a-11e5-82f5-e0accb9d11a6 11:10am '
'Created an API key called Good key '
'6ce466d0-fd6a-11e5-82f5-e0accb9d11a6 11:10am '
'Created this service and called it Example service'
),
),
]

View File

@@ -3514,9 +3514,10 @@ def mock_get_service_history(mocker):
'created_by_id': sample_uuid(),
},
{
'name': 'Real service',
'created_at': '2010-10-10T10:10:10.000000Z',
'updated_at': '2012-12-12T12:12:12.000000Z',
'created_by_id': uuid4(),
'created_by_id': sample_uuid(),
},
],
'api_key_history': [