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

[WIP] Diff editor #16

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import withParams from './containers/withParams'
import cache from './utils/cache'
import { parseUrl } from './utils/utils'
import fetcher from 'utils/fetcher'
import DiffEditor from './components/DiffEditor'

import 'app-classes.css'
import 'app-tags.css'
Expand Down Expand Up @@ -56,6 +57,7 @@ class UserRoutes extends Component {
<div>
<div className='page'>
<Switch>
<Route path='/:couch/:dbName/diff/:docId' component={withParams(DiffEditor)} />
<Route path='/:couch/:dbName/:docId/editing' component={withParams(EditDocContainer)} />
<Route exact path='/:couch/:dbName/query' component={withParams(QueryContainer)} />
<Route exact path='/:couch/_node/couchdb@localhost/_config' component={withParams(DatabaseDocContainer)} />
Expand Down
40 changes: 40 additions & 0 deletions app/components/DiffEditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React, { Component } from 'react'

import { diff as DiffEditor } from 'react-ace'

export default class extends Component {
render () {
const r1 = {
'_id': 'product:bcg:manufacturer:amgen:batchNo:037G5022',
'_rev': '3-f3545542389a1956ff15239c3188331a',
'type': 'batch',
'version': '1.0.0',
'createdAt': '2018-05-30T15:56:26.029Z',
'updatedAt': '2018-05-30T15:56:26.029Z',
'createdBy': 'VAN backend service',
'manufacturer': 'Amgen',
'productId': 'product:bcg',
'expiry': '2025-01-01T00:00:00.000Z'
}

const r2 = {
'_id': 'product:bcg:manufacturer:amgen:batchNo:037G5022',
'_rev': '3-f3545542389a1956ff15239c3188331a',
'type': 'batch',
'version': '1.5.0',
'createdAt': '2018-05-30T15:56:26.029Z',
'updatedAt': '2018-05-30T15:56:26.029Z',
'createdBy': 'VAN backend service',
'manufacturer': 'Amgen hygen',
'productId': 'product:bcg',
'expiry': '2025-01-01T00:00:00.000Z'
}

return <DiffEditor
value={[JSON.stringify(r1).toString(), JSON.stringify(r2).toString()]}
height='1000px'
width='1000px'
mode='text'
/>
}
}
47 changes: 35 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.