Skip to content

Commit 2d316c2

Browse files
authored
Merge pull request #430 from 10gen/fix-non-oid-ids
Fix non object id ids when editing
2 parents 71d83bc + a8d3ea0 commit 2d316c2

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

src/internal-packages/crud/lib/component/document.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class Document extends React.Component {
7272
* Update the document in the database.
7373
*
7474
* @param {Object} object - The replacement document.
75+
*
76+
* @todo: Durran: Determine shard key.
7577
*/
7678
update: function(object) {
7779
app.dataService.findOneAndReplace(

src/internal-packages/crud/lib/component/editable-element.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class EditableElement extends React.Component {
255255
* @returns {Component} The value component.
256256
*/
257257
valueComponent(type) {
258-
return require(VALUE_MAPPINGS[type]);
258+
return require(VALUE_MAPPINGS[type] || './non-editable-value');
259259
}
260260
}
261261

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use strict';
2+
3+
const React = require('react');
4+
5+
/**
6+
* The document value class.
7+
*/
8+
const VALUE_CLASS = 'document-property-value';
9+
10+
/**
11+
* Non editable value component.
12+
*/
13+
class NonEditableValue extends React.Component {
14+
15+
/**
16+
* The component constructor.
17+
*
18+
* @param {Object} props - The properties.
19+
*/
20+
constructor(props) {
21+
super(props);
22+
this.value = props.element.currentValue;
23+
}
24+
25+
/**
26+
* Render a single non editable value.
27+
*
28+
* @returns {React.Component} The element component.
29+
*/
30+
render() {
31+
return (
32+
<div className={VALUE_CLASS}>
33+
{String(this.value)}
34+
</div>
35+
);
36+
}
37+
}
38+
39+
NonEditableValue.displayName = 'NonEditableValue';
40+
41+
module.exports = NonEditableValue;

0 commit comments

Comments
 (0)