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

Show comparisons between versions in history viewer #33

Merged

Conversation

NightJar
Copy link
Contributor

@NightJar NightJar commented Aug 1, 2018

Adds the ability to enter "compare mode" when viewing the history for a particular record, allowing a user to select two versions and be presented with a visual comparison between them, according to value by default.

For example "The Title" becoming "Title Story" would show "The" struck out on a red background (indicating removal), "Title" as normal text, and "Story" on a green background (indicating insertion).

These comparisons are always from the older version to the newer one, chronologically.

Resolves silverstripe/silverstripe-versioned#96, resolves #30, resolves #20 and resolves #17

Dylan Wagstaff and others added 30 commits August 1, 2018 09:59
In order to compare two form fields, there needs to be a way to load
data in such a way that it will allow comparison between two values. To
achieve this a form transformation has been added to faciliatate both
loading two sets of data values, and rendering a differential of those
values in a read only field.
In order to inform a user that they are in compare mode, and are either
viewing the difference between two versions, or are required to select
two version to compare. The notice includes a handy exit button to leave
compare mode.
In order to allow a user to enter or exit compare mode there is a button
on the heading row that will reveal more actions when clicked. At
current the only action present is a toggle to enter or exit compare
mode, and reflect the state (check means compare mode is active).
History viewer is the parent of all fields related to comparison mode
viewing, and begins the process by deciding whether to render a detail
view or a list of versions. It now must also factor comparison mode into
this, and so alter the way it handles the list or the detail view.
And add to detail view as well as the list view.
Enable compare mode handling for list view/selection, and detail
views, then connect the PHP diff form to history view comparison
so the components can actually serve real data. This results in
being able to open a comparison.
NEW Add pointer cursor for versions in the list on hover

FIX Ensure toolbar--condensed class is correctly removed when component unmounts

FIX Correct eslint violations and provide component in broken unit test
Updating implementation to not adjust the reducer, and preserve the state before you entered compare mode.

Fixing up CSS specificity & removing !important.

Fix the UI when choosing to select two versions to compare from the list screen.

I also made the actions column always render, because is was causing some awkward jittering as things became visible.
Major refactor of Diff Form Transformation
The original approach was implmented as a "get it functional" state, and
a bit of an attempt to circumvent the complexities involved with the
logical order of operations, the nature of a failover (see
ViewableData), and having form fields work in more than one display
facet. However there were limitations in handling more complex data
structures such as when a value from the database was NULL, this would
fail a data comparison check between loaded data and transformation
data. In order to work around this we now simply ignore all these
complexities and pass off to normal errors or exceptions that will be
output with such use. There is now a diff field that will handle the
data explicitly, rather than having the entire transformation happen in
the transformer class. This was originally avoided due to a failover
being an underlay, not an overlay, so only methods that didn't exist on
the superclass would be passed off to the form field we're tryign to
transform, instead of for any method not defined on the class. To
circumvent this issue, we now simply don't (cicumvent this issue), and
rely on users not e.g. transforming a form then attempting to
update one of the old fields.
As well, component class names are updated to use BEM conventions and reduce
CSS nesting levels
Copy link
Contributor

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

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

I had another look. The padding issue are gone.

However this acceptance criteria is still not met: "I can share this view by URL to other CMS authors"

@robbieaverill
Copy link
Contributor

However this acceptance criteria is still not met: "I can share this view by URL to other CMS authors"

We've been subtasking this A/C out of each ticket so far into #1

@robbieaverill
Copy link
Contributor

I've added aria roles to the list and list items, as well as the columns and cells within it, and ensured that it's keyboard accessible (#20).

The Behat tests are failing because the GraphQL queries are no longer running since GraphQL v3 was introduced. I'll need to update this again I think.

@robbieaverill
Copy link
Contributor

robbieaverill commented Aug 8, 2018

Ok @maxime-rainville I've investigated this.

Recapping that permalinked URL A/Cs (from all history viewer epics/stories) so far have been removed and subtasked to #1 for future consideration.

Note that there are 5 PRs unmerged for this issue, testing should include them all

@robbieaverill
Copy link
Contributor

Wait, I've done bad things with the keyboard accessibility... please hold caller

@robbieaverill
Copy link
Contributor

I've updated to switch using an anchor for a span inside list items so that (A) it isn't an anchor with no href and (B) using tabindex=0 is justified

@raissanorth
Copy link
Contributor

raissanorth commented Aug 10, 2018

I fixed #35 and added the commit 0d3208b

@robbieaverill
Copy link
Contributor

Thanks for the review @maxime-rainville! I'd like to get Travis green before we merge

@robbieaverill robbieaverill force-pushed the pulls/1/different-rebase branch from 0d3208b to 8611e47 Compare August 12, 2018 21:43
@robbieaverill
Copy link
Contributor

@raissanorth FYI I've run rebuilt the dist files from your last commit and squashed it, new hash 8611e47

@robbieaverill
Copy link
Contributor

I've updated the behat tests.

There's one scenario which is still correctly failing since required dependency silverstripe/silverstripe-cms#2221 hasn't been merged yet.

@robbieaverill
Copy link
Contributor

Builds restarted, should be green now

@robbieaverill robbieaverill merged commit deec926 into silverstripe:1 Aug 13, 2018
@robbieaverill robbieaverill deleted the pulls/1/different-rebase branch August 13, 2018 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants