Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2319 add sidebar to admin decision data page #630

Merged
merged 5 commits into from
May 3, 2022

Conversation

richpjames
Copy link
Contributor

@richpjames richpjames commented Apr 29, 2022

Changes in this PR

This PR adds a sidebar to the admin decision data page which contains:

  • The status of the decision data (published/draft/submitted)
  • The date that the data was last changed
  • The user that last changed the data
  • A publicly facing link for the data (currently intentionally blank until functionality has been developed)
  • A button to edit the data

A button to download the dataset will be added in a subsequent PR

Screenshots of UI changes

Before

image

After

image

@richpjames richpjames force-pushed the 2319-add-sidebar-to-admin-decision-data-page branch 8 times, most recently from e8a8225 to d6667a6 Compare April 29, 2022 14:45
@richpjames richpjames marked this pull request as ready for review April 29, 2022 14:52
@@ -433,11 +433,30 @@ describe('DecisionsController', () => {
mockTables,
);

Object.defineProperties(DecisionDatasetPresenter.prototype, {
changedBy: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround for this bug: jestjs/jest#9675
TLDR: Jest's spyOn doesn't work for instance getters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means we can't assert that the presenter has been called with the expected values as we can't spy on the getters but this functionality is tested, at a higher level, in the e2e tests

Copy link
Contributor

@Gweaton Gweaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me - a few minor things but this is good to go after that!

@@ -63,7 +63,7 @@ describe('formatStatus', () => {
it('returns a yellow tag', () => {
const i18nService = createMockI18nService();

const result = formatStatus(OrganisationVersionStatus.Draft, i18nService);
const result = formatStatus(DecisionDatasetStatus.Draft, i18nService);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unclear on the reason behind this change. The commit message suggests this is adding a new status, but weren't we already showing the status in the decision data table? I think we can probably remove this commit.

If you're keen on having a test for this status, it's probably an idea to either do it in its own test, or test a couple of variables in this test with different Draft statuses, but I don't think it's necessary here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looking back I think this test is redundant and removing this change is the best option.

});
});

it("if the dataset doesn't have a user it returns their name and email address", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be returns null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

);
});

it('I can publish the data by clicking the publish button', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is covered by the publish.spec now, so I think we can remove it from here.

@@ -26,7 +51,7 @@
}}
</li>
{% endif %}
{% if 'submitDecisionData' in permissions and not (datasetStatus === 'submitted') %}
{% if 'submitDecisionData' in permissions and not(datasetStatus === 'submitted') %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this not working as expected before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was formatted automatically on save by Prettier. I opted to go with it as it doesn't seem to make a difference semantically and it's easier to not be fighting Prettier but I am happy to back it out if you'd prefer

Copy link
Contributor

@Gweaton Gweaton May 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how reliable Prettier is with njk files (we've been struggling to find a reliable config), but it might be better to commit things like this in their own commit (e.g. Format file with prettier) so it doesn't introduce overhead in another commit. I don't mind this going in now though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - in future I will add formatting in a seperate commit.
I am going to re-add the space so it's consistent with the rest of the codebase

@richpjames richpjames force-pushed the 2319-add-sidebar-to-admin-decision-data-page branch 3 times, most recently from c1ffc13 to c250ec0 Compare May 3, 2022 09:44
rich added 5 commits May 3, 2022 11:11
we will need users to enable showing who edited the data last
containing status, last modified date, changed by, link to currently published version and edit button
@richpjames richpjames force-pushed the 2319-add-sidebar-to-admin-decision-data-page branch from c250ec0 to f0a5977 Compare May 3, 2022 10:11
@richpjames richpjames merged commit 2b2bc12 into main May 3, 2022
@richpjames richpjames deleted the 2319-add-sidebar-to-admin-decision-data-page branch May 3, 2022 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants