@mongoosejs/studio 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/actions/Model/getDocument.js +1 -1
- package/frontend/src/document/document.html +2 -2
- package/frontend/src/document/document.js +6 -2
- package/frontend/src/index.js +1 -0
- package/frontend/src/list-array/list-array.css +2 -2
- package/frontend/src/list-array/list-array.js +2 -7
- package/frontend/src/list-default/list-default.css +4 -0
- package/frontend/src/list-default/list-default.html +2 -2
- package/frontend/src/list-default/list-default.js +3 -0
- package/frontend/src/list-mixed/list-mixed.css +5 -0
- package/frontend/src/list-mixed/list-mixed.html +7 -0
- package/frontend/src/list-mixed/list-mixed.js +41 -0
- package/frontend/src/list-subdocument/list-subdocument.css +4 -0
- package/frontend/src/list-subdocument/list-subdocument.html +6 -3
- package/frontend/src/list-subdocument/list-subdocument.js +27 -0
- package/frontend/src/models/models.js +3 -0
- package/package.json +1 -1
|
@@ -36,5 +36,5 @@ module.exports = ({ db }) => async function getDocument(params) {
|
|
|
36
36
|
}
|
|
37
37
|
removeSpecifiedPaths(schemaPaths, '.$*');
|
|
38
38
|
|
|
39
|
-
return { doc: doc.toJSON({ virtuals:
|
|
39
|
+
return { doc: doc.toJSON({ virtuals: true, getters: false, transform: false }), schemaPaths };
|
|
40
40
|
};
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
</component>
|
|
39
39
|
</div>
|
|
40
40
|
<div v-else>
|
|
41
|
-
<component :is="getComponentForPath(path)" :value="
|
|
41
|
+
<component :is="getComponentForPath(path)" :value="getValueForPath(path.path)"></component>
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
44
|
</div>
|
|
45
|
-
</div>
|
|
45
|
+
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
|
+
const mpath = require('mpath');
|
|
4
5
|
const template = require('./document.html');
|
|
5
6
|
const vanillatoast = require('vanillatoasts');
|
|
6
7
|
|
|
@@ -52,8 +53,11 @@ module.exports = app => app.component('document', {
|
|
|
52
53
|
}
|
|
53
54
|
return 'edit-default';
|
|
54
55
|
},
|
|
56
|
+
getValueForPath(path) {
|
|
57
|
+
return mpath.get(path, this.document);
|
|
58
|
+
},
|
|
55
59
|
getEditValueForPath({ path }) {
|
|
56
|
-
return path in this.changes ? this.changes[path] : this.document
|
|
60
|
+
return path in this.changes ? this.changes[path] : mpath.get(path, this.document);
|
|
57
61
|
},
|
|
58
62
|
cancelEdit() {
|
|
59
63
|
this.changes = {};
|
|
@@ -87,4 +91,4 @@ module.exports = app => app.component('document', {
|
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
|
-
});
|
|
94
|
+
});
|
package/frontend/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ require('./edit-date/edit-date')(app);
|
|
|
16
16
|
require('./export-query-results/export-query-results')(app);
|
|
17
17
|
require('./list-array/list-array')(app);
|
|
18
18
|
require('./list-default/list-default')(app);
|
|
19
|
+
require('./list-mixed/list-mixed')(app);
|
|
19
20
|
require('./list-string/list-string')(app);
|
|
20
21
|
require('./list-subdocument/list-subdocument')(app);
|
|
21
22
|
require('./modal/modal')(app);
|
|
@@ -9,15 +9,10 @@ module.exports = app => app.component('list-array', {
|
|
|
9
9
|
props: ['value'],
|
|
10
10
|
computed: {
|
|
11
11
|
displayValue() {
|
|
12
|
-
return
|
|
13
|
-
if (typeof value === 'string' && value.length > 30) {
|
|
14
|
-
return value.slice(0, 27) + '...';
|
|
15
|
-
}
|
|
16
|
-
return value;
|
|
17
|
-
}, ' ').trim();
|
|
12
|
+
return this.value;
|
|
18
13
|
}
|
|
19
14
|
},
|
|
20
15
|
mounted() {
|
|
21
16
|
Prism.highlightElement(this.$refs.code);
|
|
22
17
|
}
|
|
23
|
-
});
|
|
18
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<div ref="itemData" class="tooltip">
|
|
1
|
+
<div class="list-default" ref="itemData" class="tooltip">
|
|
2
2
|
{{displayValue}}
|
|
3
3
|
<div class="tooltiptext" style="display:flex; width: 100%; justify-content: space-around; align-items: center; min-width: 180px;">
|
|
4
4
|
<div class="tooltiptextchild" v-if="allude" @click.stop="goToDoc(value)">View Document</div>
|
|
5
5
|
<div class="tooltiptextchild" @click.stop="copyText(value)">copy 📋</div>
|
|
6
6
|
</div>
|
|
7
|
-
</div>
|
|
7
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const api = require('../api');
|
|
4
|
+
const template = require('./list-mixed.html');
|
|
5
|
+
|
|
6
|
+
const vanillatoast = require('vanillatoasts');
|
|
7
|
+
|
|
8
|
+
require('../appendCSS')(require('./list-mixed.css'));
|
|
9
|
+
|
|
10
|
+
module.exports = app => app.component('list-mixed', {
|
|
11
|
+
template: template,
|
|
12
|
+
props: ['value'],
|
|
13
|
+
computed: {
|
|
14
|
+
shortenValue() {
|
|
15
|
+
return this.value;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
methods: {
|
|
19
|
+
copyText(value) {
|
|
20
|
+
const storage = document.createElement('textarea');
|
|
21
|
+
storage.value = JSON.stringify(value);
|
|
22
|
+
const elem = this.$refs.MixedCode;
|
|
23
|
+
elem.appendChild(storage);
|
|
24
|
+
storage.select();
|
|
25
|
+
storage.setSelectionRange(0, 99999);
|
|
26
|
+
document.execCommand('copy');
|
|
27
|
+
elem.removeChild(storage);
|
|
28
|
+
vanillatoast.create({
|
|
29
|
+
title: 'Text copied!',
|
|
30
|
+
type: 'success',
|
|
31
|
+
timeout: 3000,
|
|
32
|
+
icon: 'images/success.png',
|
|
33
|
+
positionClass: 'bottomRight'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
mounted: function() {
|
|
38
|
+
Prism.highlightElement(this.$refs.MixedCode);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
<div>
|
|
2
|
-
<pre
|
|
3
|
-
</
|
|
1
|
+
<div class="list-subdocument tooltip">
|
|
2
|
+
<pre>
|
|
3
|
+
<code ref="SubDocCode" class="language-javascript">{{shortenValue}}</code>
|
|
4
|
+
<span class="tooltiptext" @click.stop="copyText(value)">copy 📋</span>
|
|
5
|
+
</pre>
|
|
6
|
+
</div>
|
|
@@ -2,10 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const template = require('./list-subdocument.html');
|
|
5
|
+
const vanillatoast = require('vanillatoasts');
|
|
6
|
+
|
|
7
|
+
require('../appendCSS')(require('./list-subdocument.css'));
|
|
5
8
|
|
|
6
9
|
module.exports = app => app.component('list-subdocument', {
|
|
7
10
|
template: template,
|
|
8
11
|
props: ['value'],
|
|
12
|
+
computed: {
|
|
13
|
+
shortenValue() {
|
|
14
|
+
return this.value;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
copyText(value) {
|
|
19
|
+
const storage = document.createElement('textarea');
|
|
20
|
+
storage.value = JSON.stringify(value);
|
|
21
|
+
const elem = this.$refs.SubDocCode;
|
|
22
|
+
elem.appendChild(storage);
|
|
23
|
+
storage.select();
|
|
24
|
+
storage.setSelectionRange(0, 99999);
|
|
25
|
+
document.execCommand('copy');
|
|
26
|
+
elem.removeChild(storage);
|
|
27
|
+
vanillatoast.create({
|
|
28
|
+
title: 'Text copied!',
|
|
29
|
+
type: 'success',
|
|
30
|
+
timeout: 3000,
|
|
31
|
+
icon: 'images/success.png',
|
|
32
|
+
positionClass: 'bottomRight'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
},
|
|
9
36
|
mounted: function() {
|
|
10
37
|
Prism.highlightElement(this.$refs.SubDocCode);
|
|
11
38
|
}
|
|
@@ -154,6 +154,9 @@ module.exports = app => app.component('models', {
|
|
|
154
154
|
if (schemaPath.instance == 'Embedded') {
|
|
155
155
|
return 'list-subdocument';
|
|
156
156
|
}
|
|
157
|
+
if (schemaPath.instance == 'Mixed') {
|
|
158
|
+
return 'list-mixed';
|
|
159
|
+
}
|
|
157
160
|
return 'list-default';
|
|
158
161
|
},
|
|
159
162
|
getReferenceModel(schemaPath) {
|