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

Fix #365: Render a JSON diff for history entries. #380

Merged
merged 4 commits into from
Feb 2, 2017

Conversation

n1k0
Copy link
Contributor

@n1k0 n1k0 commented Feb 1, 2017

@n1k0 n1k0 requested a review from leplatrem February 1, 2017 09:06
@n1k0
Copy link
Contributor Author

n1k0 commented Feb 1, 2017

This is wrong, it computes diffs with the immediate previous entry in the list, we need to find the appropriate resource instead. Will rework.

@leplatrem
Copy link
Contributor

Yeah, unfortunately because of pagination I guess that the easiest to achieve this is to issue a request when the details panel is opened...

With something like ?uri={uri}&_before={last_modified}&_limit=1

@n1k0
Copy link
Contributor Author

n1k0 commented Feb 1, 2017

Would it be hard to eventually have the previous version of the resource attached to the change event on the server?

@leplatrem
Copy link
Contributor

Would it be hard to eventually have the previous version of the resource attached to the change event on the server?

It's more a matter of duplication than complexity... I'd rather be honest, unless someone comes with a nice plan and implements it, we probably won't spend time to change that :|

@n1k0
Copy link
Contributor Author

n1k0 commented Feb 1, 2017

I'd rather be honest, unless someone comes with a nice plan and implements it, we probably won't spend time to change that :|

So that's delegating the tedious work to client implementers, that's fine by me but still I feel this would be nice to have an option or smthg. No big deal, I'll do the atomic request thing to compute the diff.

@leplatrem
Copy link
Contributor

So that's delegating the tedious work to client implementers

Yeah I know... not that the server stuff was not tedious to implement huh ;)

We discarded the option to duplicate both previous and current in every entry. If we would have done something on the server side, it would have been to store the diffs only. But then the clients would have to apply every diff on top of each other to obtain previous versions. So we found that compromise...

@n1k0
Copy link
Contributor Author

n1k0 commented Feb 1, 2017

No problem, at least that keeps me busy ;)

@n1k0
Copy link
Contributor Author

n1k0 commented Feb 1, 2017

@leplatrem made the changes, r=?

Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

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

The result is awesome!!

if (this.state.previous) {
return this.setState({open: true});
}
fetchPreviousVersion(bid, entry)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can avoid this when action == create (no history) or delete (contains deleted object already)

? <Diff source={entry.target} target={previous.target} />
: error
? <p className="alert alert-danger">{error}</p>
: <p className="alert alert-info">This resource has no previous versions.</p>}
Copy link
Contributor

Choose a reason for hiding this comment

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

When clicking on the details of create, we may want to keep <pre>{JSON.stringify(entry, null, 2)}</pre> no?

}
fetchPreviousVersion(bid, entry)
.then((previous) => this.setState({open: true, previous, error: null}))
.catch((error) => this.setState({open: true, previous: null, error}));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can add a comment here why it is acceptable not to use redux here :)

@n1k0
Copy link
Contributor Author

n1k0 commented Feb 2, 2017

@leplatrem final r=?

@n1k0 n1k0 dismissed leplatrem’s stale review February 2, 2017 08:25

I think it's perfectly fine to land.

@n1k0 n1k0 merged commit c825ed0 into master Feb 2, 2017
@n1k0 n1k0 deleted the 365-history-change-diff branch February 2, 2017 08:25
@leplatrem
Copy link
Contributor

I really like it :) GG!

n1k0 added a commit that referenced this pull request Feb 16, 2017
New features

* Fix #377, #378: Allow dropping edited resource properties. (#379)
* Fix #365: Render a JSON diff for history entries. (#380)
* Fix #376: Denote readonly buckets & collections in the sidebar. (#382)
* Fix #384: Live-searchable/filterable sidebar entries. (#385)
* Hide auth method selector when a single one is configured.

Bugfixes

* Do not store passwords. Fixes #364 (#386)
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.

None yet

2 participants