Skip to content

Commit 593eed8

Browse files
authored
Merge pull request #408 from 10gen/INT-1160-CRUD
[DNM] INT-1160: CRUD Support
2 parents 767b36b + 2a26eac commit 593eed8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3013
-169
lines changed

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,16 @@
100100
"electron-squirrel-startup": "^0.1.4",
101101
"font-awesome": "https://github.com/FortAwesome/Font-Awesome/archive/v4.4.0.tar.gz",
102102
"get-object-path": "azer/get-object-path#74eb42de0cfd02c14ffdd18552f295aba723d394",
103-
"hadron-action": "^0.0.2",
103+
"hadron-action": "^0.0.4",
104104
"hadron-auto-update-manager": "^0.0.12",
105105
"hadron-compile-cache": "^0.1.0",
106-
"hadron-component-registry": "^0.2.0",
106+
"hadron-component-registry": "^0.3.0",
107+
"hadron-document": "^0.12.0",
107108
"hadron-ipc": "^0.0.7",
108109
"hadron-module-cache": "^0.0.3",
109110
"hadron-package-manager": "0.1.0",
110111
"hadron-reflux-store": "^0.0.2",
112+
"hadron-type-checker": "^0.3.0",
111113
"highlight.js": "^8.9.1",
112114
"jquery": "^2.1.4",
113115
"kerberos": "mongodb-js/kerberos#bc619b1b9213eb4cdae786cf3fb916fc7be66758",
@@ -120,8 +122,8 @@
120122
"marky-mark": "^1.2.1",
121123
"moment": "^2.10.6",
122124
"mongodb-collection-model": "^0.2.3",
123-
"mongodb-connection-model": "^4.2.0",
124-
"mongodb-data-service": "^0.2.1",
125+
"mongodb-connection-model": "^4.3.0",
126+
"mongodb-data-service": "^0.3.0",
125127
"mongodb-database-model": "^0.1.2",
126128
"mongodb-explain-plan-model": "^0.2.0",
127129
"mongodb-extended-json": "^1.6.0",
@@ -137,6 +139,7 @@
137139
"qs": "^5.2.0",
138140
"raf": "^3.1.0",
139141
"react": "^0.14.8",
142+
"react-bootstrap": "0.29.5",
140143
"react-dom": "^0.14.8",
141144
"semver": "^5.1.0",
142145
"storage-mixin": "^0.6.2",

src/app/documents/document-list.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ var DocumentListView = View.extend({
2525
Action.filterChanged(app.queryOptions.query.serialize());
2626
},
2727
render: function() {
28-
ReactDOM.render(React.createElement(this.documentList), this.el.parentNode);
28+
var container = this.el.parentNode.parentNode.parentNode;
29+
ReactDOM.render(React.createElement(this.documentList), container);
2930
return this;
3031
},
3132
reset: function() {

src/app/documents/index.less

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.truncate-text-mixin() {
2-
overflow-x: hidden;
2+
// overflow-x: hidden; // commenting out to make the dropdowns work
33
text-overflow: ellipsis;
44
white-space: nowrap;
55
max-width: 100%;
@@ -31,6 +31,7 @@ ol.document-list {
3131
}
3232

3333
li.document-list-item {
34+
position: relative;
3435
font-family: @font-family-monospace;
3536
font-size: 11px;
3637
padding-bottom: 10px;
@@ -97,6 +98,15 @@ ol.document-list {
9798
}
9899
}
99100

101+
.document-property.code > .document-property-value {
102+
&::before {
103+
content: "Code('";
104+
}
105+
&::after {
106+
content: "')";
107+
}
108+
}
109+
100110
li.document-property.array, li.document-property.object {
101111
display: block;
102112
margin-left: -16px;
@@ -114,8 +124,8 @@ ol.document-list {
114124
display: inline-block;
115125
width: 12px;
116126
height: 1em;
117-
margin-left: 2px;
118-
margin-right: 10px;
127+
margin-left: -8px !important; // remove important hack later
128+
margin-right: 4px;
119129
.caret-right;
120130
}
121131

@@ -130,18 +140,21 @@ ol.document-list {
130140
}
131141

132142
ol.document-property-body {
133-
// margin-left: 21px;
134-
padding-left: 36px;
135-
// border-left: 1px dotted @gray6;
143+
padding-left: 0;
136144
display: none;
145+
146+
.document-property-key,
147+
.editable-key {
148+
margin-left: 16px;
149+
}
137150
}
138151
&.expanded {
139152
> .document-property-header {
140153
> .caret {
141154
.caret-down;
142155
vertical-align: bottom;
143-
margin-left: 4px;
144-
margin-right: 8px;
156+
margin-left: -10px !important; // remove important hack later
157+
margin-right: 2px;
145158
}
146159
}
147160
> ol.document-property-body {

src/app/explain-plan/index.less

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
.explain-container {
22

3+
// hacks for json view on explain tab
4+
ol.document-list li.document-list-item ol.document-property-body li.document-property.array ol.document-property-body .document-property-key,
5+
ol.document-list li.document-list-item ol.document-property-body li.document-property.object ol.document-property-body .document-property-key {
6+
margin-left: 0;
7+
}
8+
9+
ol.document-list li.document-list-item ol.document-property-body li.document-property.array.expanded > ol.document-property-body,
10+
ol.document-list li.document-list-item ol.document-property-body li.document-property.object.expanded > ol.document-property-body {
11+
margin-left: 16px;
12+
}
13+
14+
ol.document-list li.document-list-item ol.document-property-body li.document-property.array.expanded,
15+
ol.document-list li.document-list-item ol.document-property-body li.document-property.object.expanded {
16+
margin-left: 0;
17+
}
18+
19+
ol.document-list li.document-list-item ol.document-property-body li.document-property.array,
20+
ol.document-list li.document-list-item ol.document-property-body li.document-property.object {
21+
margin-left: 0;
22+
}
23+
// end hacks
24+
325
.summary-container {
426
background: @pw;
527
padding: 12px;
@@ -59,7 +81,6 @@
5981
float: left;
6082
margin-right: 24px;
6183
}
62-
6384
}
6485

6586
i.link {

src/app/index.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@
2222
@import "../auto-update/index.less";
2323
@import "../help/index.less";
2424
@import "metrics/index.less";
25+
26+
@import "../internal-packages/crud/styles/crud.less";

src/app/models/preferences.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ var Preferences = Model.extend(storageMixin, {
144144
required: true,
145145
default: false
146146
},
147+
/**
148+
* Allow single document CRUD.
149+
*/
150+
singleDocumentCrud: {
151+
type: 'boolean',
152+
required: true,
153+
default: false
154+
},
147155
/**
148156
* Switches to enable/disable various authentication / ssl types
149157
*

src/app/styles/caret.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
display: inline-block;
33
width: 0;
44
height: 0;
5-
margin-left: 2px;
65
vertical-align: middle;
76
}
87
.caret-down {

src/app/styles/palette.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
@pw: #fff;
4545
@cautionOrange: @alertOrange;
4646
@errorBackground: #fdd0d1;
47+
@greenBg: #e9f2e3;
4748

4849
/* Text Colors */
4950
/* default text color is @gray1 */
@@ -76,7 +77,10 @@
7677

7778
/* Alert Colors */
7879
@alertOrange: #fbb129;
80+
@alertOrangeBg: #fff4dc;
81+
@alertOrangeBorder: #a06c29;
7982
@alertRed: #ef4c4c;
83+
@alertRedBg: #feeded;
8084
@alertBlue: #43b1e5;
8185

8286
/* Semantic Colors */
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
const Reflux = require('reflux');
4+
5+
const Actions = Reflux.createActions([
6+
'documentRemoved',
7+
'openInsertDocumentDialog',
8+
'insertDocument'
9+
]);
10+
11+
module.exports = Actions;
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
'use strict';
2+
3+
const React = require('react');
4+
const truncate = require('hadron-component-registry').truncate;
5+
6+
/**
7+
* Base 64 constant.
8+
*/
9+
const BASE_64 = 'base64';
10+
11+
/**
12+
* The new UUID type.
13+
*/
14+
const UUID = 4;
15+
16+
/**
17+
* The old UUID type.
18+
*/
19+
const UUID_OLD = 3;
20+
21+
/**
22+
* The document value class.
23+
*/
24+
const VALUE_CLASS = 'document-property-value';
25+
26+
/**
27+
* Binary value component.
28+
*/
29+
class BinaryValue extends React.Component {
30+
31+
/**
32+
* The component constructor.
33+
*
34+
* @param {Object} props - The properties.
35+
*/
36+
constructor(props) {
37+
super(props);
38+
this.value = props.element.currentValue;
39+
}
40+
41+
/**
42+
* Render a single binary value.
43+
*
44+
* @returns {React.Component} The element component.
45+
*/
46+
render() {
47+
return (
48+
<div className={VALUE_CLASS}>
49+
{this.renderValue()}
50+
</div>
51+
);
52+
}
53+
54+
/**
55+
* Render the value.
56+
*
57+
* @returns {Component} The component.
58+
*/
59+
renderValue() {
60+
var type = this.value.sub_type;
61+
var buffer = this.value.buffer;
62+
if (type === UUID || type === UUID_OLD) {
63+
return `Binary('${truncate(buffer.toString())}')`;
64+
}
65+
return `Binary('${truncate(buffer.toString(BASE_64))}')`;
66+
}
67+
}
68+
69+
BinaryValue.displayName = 'BinaryValue';
70+
71+
module.exports = BinaryValue;

0 commit comments

Comments
 (0)