@mongoosejs/studio 0.0.93 → 0.0.95
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/.github/workflows/lint.yml +18 -0
- package/backend/actions/ChatThread/createChatMessage.js +1 -1
- package/backend/actions/ChatThread/createChatThread.js +2 -2
- package/backend/actions/Dashboard/getDashboards.js +1 -1
- package/backend/actions/Dashboard/updateDashboard.js +1 -1
- package/backend/actions/Model/createDocument.js +1 -1
- package/backend/actions/Model/deleteDocument.js +3 -3
- package/backend/actions/Model/deleteDocuments.js +2 -2
- package/backend/actions/Model/exportQueryResults.js +1 -1
- package/backend/actions/Model/getDocument.js +1 -1
- package/backend/actions/Model/getDocuments.js +2 -2
- package/backend/actions/Model/getIndexes.js +1 -1
- package/backend/actions/Model/index.js +1 -1
- package/backend/actions/Model/updateDocument.js +1 -1
- package/backend/actions/Model/updateDocuments.js +1 -1
- package/backend/authorize.js +1 -3
- package/backend/db/dashboardSchema.js +2 -2
- package/backend/helpers/removeSpecifiedPaths.js +1 -1
- package/backend/netlify.js +3 -3
- package/backend/next.js +1 -1
- package/eslint.config.js +46 -0
- package/frontend/index.js +1 -1
- package/frontend/public/app.js +122 -115
- package/frontend/src/api.js +16 -16
- package/frontend/src/chat/chat-message/chat-message.js +1 -1
- package/frontend/src/chat/chat.js +1 -1
- package/frontend/src/clone-document/clone-document.js +8 -8
- package/frontend/src/create-dashboard/create-dashboard.js +7 -7
- package/frontend/src/create-document/create-document.js +10 -10
- package/frontend/src/dashboard/dashboard.js +1 -1
- package/frontend/src/dashboard/edit-dashboard/edit-dashboard.js +3 -3
- package/frontend/src/dashboards/dashboards.js +1 -1
- package/frontend/src/document/confirm-changes/confirm-changes.js +2 -2
- package/frontend/src/document/confirm-delete/confirm-delete.js +2 -2
- package/frontend/src/document/document.js +2 -2
- package/frontend/src/document-details/document-details.js +3 -3
- package/frontend/src/document-details/document-property/document-property.js +3 -3
- package/frontend/src/edit-array/edit-array.js +1 -1
- package/frontend/src/edit-subdocument/edit-subdocument.js +1 -1
- package/frontend/src/index.js +3 -1
- package/frontend/src/list-default/list-default.js +3 -3
- package/frontend/src/models/models.js +11 -11
- package/frontend/src/navbar/navbar.js +3 -3
- package/frontend/src/update-document/update-document.js +25 -25
- package/package.json +4 -1
package/frontend/src/api.js
CHANGED
|
@@ -43,9 +43,9 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
43
43
|
return client.post('', { action: 'Dashboard.getDashboards', ...params }).then(res => res.data);
|
|
44
44
|
},
|
|
45
45
|
updateDashboard(params) {
|
|
46
|
-
return client.post('', { action: 'Dashboard.updateDashboard', ...params}).then(res => res.data);
|
|
46
|
+
return client.post('', { action: 'Dashboard.updateDashboard', ...params }).then(res => res.data);
|
|
47
47
|
}
|
|
48
|
-
}
|
|
48
|
+
};
|
|
49
49
|
exports.ChatThread = {
|
|
50
50
|
createChatMessage(params) {
|
|
51
51
|
return client.post('', { action: 'ChatThread.createChatMessage', ...params }).then(res => res.data);
|
|
@@ -59,24 +59,24 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
59
59
|
listChatThreads(params) {
|
|
60
60
|
return client.post('', { action: 'ChatThread.listChatThreads', ...params }).then(res => res.data);
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
};
|
|
63
63
|
exports.ChatMessage = {
|
|
64
64
|
executeScript(params) {
|
|
65
65
|
return client.post('', { action: 'ChatMessage.executeScript', ...params }).then(res => res.data);
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
};
|
|
68
68
|
exports.Model = {
|
|
69
69
|
createChart(params) {
|
|
70
|
-
return client.post('', { action: 'Model.createChart', ...params}).then(res => res.data);
|
|
70
|
+
return client.post('', { action: 'Model.createChart', ...params }).then(res => res.data);
|
|
71
71
|
},
|
|
72
72
|
createDocument(params) {
|
|
73
|
-
return client.post('', { action: 'Model.createDocument', ...params}).then(res => res.data);
|
|
73
|
+
return client.post('', { action: 'Model.createDocument', ...params }).then(res => res.data);
|
|
74
74
|
},
|
|
75
75
|
deleteDocument(params) {
|
|
76
|
-
return client.post('', { action: 'Model.deleteDocument', ...params}).then(res => res.data);
|
|
76
|
+
return client.post('', { action: 'Model.deleteDocument', ...params }).then(res => res.data);
|
|
77
77
|
},
|
|
78
78
|
deleteDocuments(params) {
|
|
79
|
-
return client.post('', { action: 'Model.deleteDocuments', ...params}).then(res => res.data);
|
|
79
|
+
return client.post('', { action: 'Model.deleteDocuments', ...params }).then(res => res.data);
|
|
80
80
|
},
|
|
81
81
|
exportQueryResults(params) {
|
|
82
82
|
const accessToken = window.localStorage.getItem('_mongooseStudioAccessToken') || null;
|
|
@@ -84,8 +84,8 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
84
84
|
return fetch(window.MONGOOSE_STUDIO_CONFIG.baseURL + new URLSearchParams({ ...params, action: 'Model.exportQueryResults' }).toString(), {
|
|
85
85
|
method: 'GET',
|
|
86
86
|
headers: {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
Authorization: `${accessToken}`, // Set your authorization token here
|
|
88
|
+
Accept: 'text/csv'
|
|
89
89
|
}
|
|
90
90
|
})
|
|
91
91
|
.then(response => {
|
|
@@ -136,7 +136,7 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
136
136
|
return client.post('/Dashboard/createDashboard', params).then(res => res.data);
|
|
137
137
|
},
|
|
138
138
|
deleteDashboard: function deleteDashboard(params) {
|
|
139
|
-
return client.post('/Dashboard/deleteDashboard', params).then(res => res.data)
|
|
139
|
+
return client.post('/Dashboard/deleteDashboard', params).then(res => res.data);
|
|
140
140
|
},
|
|
141
141
|
getDashboard: function getDashboard(params) {
|
|
142
142
|
return client.put('/Dashboard/getDashboard', params).then(res => res.data);
|
|
@@ -147,7 +147,7 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
147
147
|
updateDashboard: function updateDashboard(params) {
|
|
148
148
|
return client.post('/Dashboard/updateDashboard', params).then(res => res.data);
|
|
149
149
|
}
|
|
150
|
-
}
|
|
150
|
+
};
|
|
151
151
|
exports.ChatThread = {
|
|
152
152
|
createChatMessage: function createChatMessage(params) {
|
|
153
153
|
return client.post('/ChatThread/createChatMessage', params).then(res => res.data);
|
|
@@ -168,13 +168,13 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
exports.Model = {
|
|
171
|
-
createChart: function
|
|
171
|
+
createChart: function(params) {
|
|
172
172
|
return client.post('/Model/createChart', params).then(res => res.data);
|
|
173
173
|
},
|
|
174
174
|
createDocument: function(params) {
|
|
175
175
|
return client.post('/Model/createDocument', params).then(res => res.data);
|
|
176
176
|
},
|
|
177
|
-
deleteDocument: function
|
|
177
|
+
deleteDocument: function(params) {
|
|
178
178
|
return client.post('/Model/deleteDocument', params).then(res => res.data);
|
|
179
179
|
},
|
|
180
180
|
deleteDocuments: function(params) {
|
|
@@ -186,8 +186,8 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
186
186
|
return fetch(window.MONGOOSE_STUDIO_CONFIG.baseURL + '/Model/exportQueryResults?' + new URLSearchParams(params).toString(), {
|
|
187
187
|
method: 'GET',
|
|
188
188
|
headers: {
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
Authorization: `${accessToken}`, // Set your authorization token here
|
|
190
|
+
Accept: 'text/csv'
|
|
191
191
|
}
|
|
192
192
|
})
|
|
193
193
|
.then(response => {
|
|
@@ -5,7 +5,7 @@ const api = require('../api');
|
|
|
5
5
|
const { BSON, EJSON } = require('bson');
|
|
6
6
|
|
|
7
7
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
8
|
-
apply
|
|
8
|
+
apply(target, thisArg, argumentsList) {
|
|
9
9
|
return new target(...argumentsList);
|
|
10
10
|
}
|
|
11
11
|
});
|
|
@@ -14,7 +14,7 @@ const appendCSS = require('../appendCSS');
|
|
|
14
14
|
|
|
15
15
|
appendCSS(require('./clone-document.css'));
|
|
16
16
|
|
|
17
|
-
const template = require('./clone-document.html')
|
|
17
|
+
const template = require('./clone-document.html');
|
|
18
18
|
|
|
19
19
|
module.exports = app => app.component('clone-document', {
|
|
20
20
|
props: ['currentModel', 'doc', 'schemaPaths'],
|
|
@@ -24,7 +24,7 @@ module.exports = app => app.component('clone-document', {
|
|
|
24
24
|
documentData: '',
|
|
25
25
|
editor: null,
|
|
26
26
|
errors: []
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
},
|
|
29
29
|
methods: {
|
|
30
30
|
async cloneDocument() {
|
|
@@ -32,17 +32,17 @@ module.exports = app => app.component('clone-document', {
|
|
|
32
32
|
const { doc } = await api.Model.createDocument({ model: this.currentModel, data }).catch(err => {
|
|
33
33
|
if (err.response?.data?.message) {
|
|
34
34
|
console.log(err.response.data);
|
|
35
|
-
const message = err.response.data.message.split(
|
|
35
|
+
const message = err.response.data.message.split(': ').slice(1).join(': ');
|
|
36
36
|
this.errors = message.split(',').map(error => {
|
|
37
37
|
return error.split(': ').slice(1).join(': ').trim();
|
|
38
|
-
})
|
|
38
|
+
});
|
|
39
39
|
throw new Error(err.response?.data?.message);
|
|
40
40
|
}
|
|
41
41
|
throw err;
|
|
42
42
|
});
|
|
43
43
|
this.errors.length = 0;
|
|
44
44
|
this.$emit('close', doc);
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
},
|
|
47
47
|
mounted: function() {
|
|
48
48
|
const pathsToClone = this.schemaPaths.map(x => x.path);
|
|
@@ -68,5 +68,5 @@ module.exports = app => app.component('clone-document', {
|
|
|
68
68
|
lineNumbers: true,
|
|
69
69
|
smartIndent: false
|
|
70
70
|
});
|
|
71
|
-
}
|
|
72
|
-
})
|
|
71
|
+
}
|
|
72
|
+
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
|
|
5
|
-
const template = require('./create-dashboard.html')
|
|
5
|
+
const template = require('./create-dashboard.html');
|
|
6
6
|
|
|
7
7
|
module.exports = app => app.component('create-dashboard', {
|
|
8
8
|
template,
|
|
@@ -11,7 +11,7 @@ module.exports = app => app.component('create-dashboard', {
|
|
|
11
11
|
title: '',
|
|
12
12
|
code: '',
|
|
13
13
|
errors: []
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
},
|
|
16
16
|
methods: {
|
|
17
17
|
async createDashboard() {
|
|
@@ -19,22 +19,22 @@ module.exports = app => app.component('create-dashboard', {
|
|
|
19
19
|
const { dashboard } = await api.Dashboard.createDashboard({ code: this.code, title: this.title }).catch(err => {
|
|
20
20
|
if (err.response?.data?.message) {
|
|
21
21
|
console.log(err.response.data);
|
|
22
|
-
const message = err.response.data.message.split(
|
|
22
|
+
const message = err.response.data.message.split(': ').slice(1).join(': ');
|
|
23
23
|
this.errors = message.split(',').map(error => {
|
|
24
24
|
return error.split(': ').slice(1).join(': ').trim();
|
|
25
|
-
})
|
|
25
|
+
});
|
|
26
26
|
throw new Error(err.response?.data?.message);
|
|
27
27
|
}
|
|
28
28
|
throw err;
|
|
29
29
|
});
|
|
30
30
|
this.errors.length = 0;
|
|
31
31
|
this.$emit('close', dashboard);
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
},
|
|
34
34
|
mounted: function() {
|
|
35
35
|
this._editor = CodeMirror.fromTextArea(this.$refs.codeEditor, {
|
|
36
36
|
mode: 'javascript',
|
|
37
37
|
lineNumbers: true
|
|
38
38
|
});
|
|
39
|
-
}
|
|
40
|
-
})
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -5,7 +5,7 @@ const api = require('../api');
|
|
|
5
5
|
const { BSON, EJSON } = require('bson');
|
|
6
6
|
|
|
7
7
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
8
|
-
apply
|
|
8
|
+
apply(target, thisArg, argumentsList) {
|
|
9
9
|
return new target(...argumentsList);
|
|
10
10
|
}
|
|
11
11
|
});
|
|
@@ -14,7 +14,7 @@ const appendCSS = require('../appendCSS');
|
|
|
14
14
|
|
|
15
15
|
appendCSS(require('./create-document.css'));
|
|
16
16
|
|
|
17
|
-
const template = require('./create-document.html')
|
|
17
|
+
const template = require('./create-document.html');
|
|
18
18
|
|
|
19
19
|
module.exports = app => app.component('create-document', {
|
|
20
20
|
props: ['currentModel', 'paths'],
|
|
@@ -24,7 +24,7 @@ module.exports = app => app.component('create-document', {
|
|
|
24
24
|
documentData: '',
|
|
25
25
|
editor: null,
|
|
26
26
|
errors: []
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
},
|
|
29
29
|
methods: {
|
|
30
30
|
async createDocument() {
|
|
@@ -32,24 +32,24 @@ module.exports = app => app.component('create-document', {
|
|
|
32
32
|
const { doc } = await api.Model.createDocument({ model: this.currentModel, data }).catch(err => {
|
|
33
33
|
if (err.response?.data?.message) {
|
|
34
34
|
console.log(err.response.data);
|
|
35
|
-
const message = err.response.data.message.split(
|
|
35
|
+
const message = err.response.data.message.split(': ').slice(1).join(': ');
|
|
36
36
|
this.errors = message.split(',').map(error => {
|
|
37
37
|
return error.split(': ').slice(1).join(': ').trim();
|
|
38
|
-
})
|
|
38
|
+
});
|
|
39
39
|
throw new Error(err.response?.data?.message);
|
|
40
40
|
}
|
|
41
41
|
throw err;
|
|
42
42
|
});
|
|
43
43
|
this.errors.length = 0;
|
|
44
44
|
this.$emit('close', doc);
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
},
|
|
47
47
|
mounted: function() {
|
|
48
48
|
const requiredPaths = this.paths.filter(x => x.required);
|
|
49
|
-
this.documentData =
|
|
49
|
+
this.documentData = '{\n';
|
|
50
50
|
for (let i = 0; i < requiredPaths.length; i++) {
|
|
51
51
|
const isLast = i + 1 >= requiredPaths.length;
|
|
52
|
-
this.documentData += ` ${requiredPaths[i].path}: ${isLast ? '': ','}\n
|
|
52
|
+
this.documentData += ` ${requiredPaths[i].path}: ${isLast ? '' : ','}\n`;
|
|
53
53
|
}
|
|
54
54
|
this.documentData += '}';
|
|
55
55
|
this.$refs.codeEditor.value = this.documentData;
|
|
@@ -58,5 +58,5 @@ module.exports = app => app.component('create-document', {
|
|
|
58
58
|
lineNumbers: true,
|
|
59
59
|
smartIndent: false
|
|
60
60
|
});
|
|
61
|
-
}
|
|
62
|
-
})
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -12,11 +12,11 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
12
12
|
editor: null,
|
|
13
13
|
title: '',
|
|
14
14
|
description: ''
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
},
|
|
17
17
|
methods: {
|
|
18
18
|
closeEditor() {
|
|
19
|
-
|
|
19
|
+
this.$emit('close');
|
|
20
20
|
},
|
|
21
21
|
async updateCode() {
|
|
22
22
|
this.status = 'loading';
|
|
@@ -47,7 +47,7 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
47
47
|
indentWithTabs: true,
|
|
48
48
|
cursorBlinkRate: 300,
|
|
49
49
|
lineWrapping: true,
|
|
50
|
-
showCursorWhenSelecting: true
|
|
50
|
+
showCursorWhenSelecting: true
|
|
51
51
|
});
|
|
52
52
|
// this.editor.focus();
|
|
53
53
|
// this.editor.refresh(); // if anything weird happens on load, this usually fixes it. However, this breaks it in this case.
|
|
@@ -84,11 +84,11 @@ module.exports = app => app.component('document', {
|
|
|
84
84
|
timeout: 3000,
|
|
85
85
|
positionClass: 'bottomRight'
|
|
86
86
|
});
|
|
87
|
-
this.$router.push({ path: `/model/${this.model}`});
|
|
87
|
+
this.$router.push({ path: `/model/${this.model}` });
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
showClonedDocument(doc) {
|
|
91
|
-
this.$router.push({ path: `/model/${this.model}/document/${doc._id}`});
|
|
91
|
+
this.$router.push({ path: `/model/${this.model}/document/${doc._id}` });
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const mpath = require('mpath');
|
|
4
|
-
const template = require('./document-details.html')
|
|
4
|
+
const template = require('./document-details.html');
|
|
5
5
|
|
|
6
6
|
const appendCSS = require('../appendCSS');
|
|
7
7
|
|
|
@@ -28,6 +28,6 @@ module.exports = app => app.component('document-details', {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
return result;
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
}
|
|
33
|
-
})
|
|
33
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const mpath = require('mpath');
|
|
4
|
-
const template = require('./document-property.html')
|
|
4
|
+
const template = require('./document-property.html');
|
|
5
5
|
|
|
6
6
|
const appendCSS = require('../../appendCSS');
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ module.exports = app => app.component('document-property', {
|
|
|
12
12
|
data: function() {
|
|
13
13
|
return {
|
|
14
14
|
dateType: 'picker' // picker, iso
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
},
|
|
17
17
|
props: ['path', 'document', 'schemaPaths', 'editting', 'changes', 'invalid'],
|
|
18
18
|
methods: {
|
|
@@ -53,4 +53,4 @@ module.exports = app => app.component('document-property', {
|
|
|
53
53
|
return path in this.changes ? this.changes[path] : mpath.get(path, this.document);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
})
|
|
56
|
+
});
|
|
@@ -5,7 +5,7 @@ const template = require('./edit-array.html');
|
|
|
5
5
|
const { BSON } = require('bson');
|
|
6
6
|
|
|
7
7
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
8
|
-
apply
|
|
8
|
+
apply(target, thisArg, argumentsList) {
|
|
9
9
|
return new target(...argumentsList);
|
|
10
10
|
}
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ const template = require('./edit-subdocument.html');
|
|
|
5
5
|
const { BSON, EJSON } = require('bson');
|
|
6
6
|
|
|
7
7
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
8
|
-
apply
|
|
8
|
+
apply(target, thisArg, argumentsList) {
|
|
9
9
|
return new target(...argumentsList);
|
|
10
10
|
}
|
|
11
11
|
});
|
package/frontend/src/index.js
CHANGED
|
@@ -67,7 +67,9 @@ app.component('app-component', {
|
|
|
67
67
|
window.state = this;
|
|
68
68
|
|
|
69
69
|
if (mothership.hasAPIKey) {
|
|
70
|
-
const
|
|
70
|
+
const hash = window.location.hash.replace(/^#?\/?\??/, '') || '';
|
|
71
|
+
const hashQuery = hash.split('?')[1] || '';
|
|
72
|
+
const hashParams = new URLSearchParams(hashQuery);
|
|
71
73
|
if (hashParams.has('code')) {
|
|
72
74
|
const code = hashParams.get('code');
|
|
73
75
|
const provider = hashParams.get('provider');
|
|
@@ -13,7 +13,7 @@ module.exports = app => app.component('list-default', {
|
|
|
13
13
|
copyText(value) {
|
|
14
14
|
const storage = document.createElement('textarea');
|
|
15
15
|
storage.value = value;
|
|
16
|
-
const elem = this.$refs.itemData
|
|
16
|
+
const elem = this.$refs.itemData;
|
|
17
17
|
elem.appendChild(storage);
|
|
18
18
|
storage.select();
|
|
19
19
|
storage.setSelectionRange(0, 99999);
|
|
@@ -28,7 +28,7 @@ module.exports = app => app.component('list-default', {
|
|
|
28
28
|
});
|
|
29
29
|
},
|
|
30
30
|
goToDoc(id) {
|
|
31
|
-
this.$router.push({ path: `/model/${this.allude}/document/${id}`});
|
|
31
|
+
this.$router.push({ path: `/model/${this.allude}/document/${id}` });
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
computed: {
|
|
@@ -40,7 +40,7 @@ module.exports = app => app.component('list-default', {
|
|
|
40
40
|
return 'undefined';
|
|
41
41
|
}
|
|
42
42
|
if (this.value.length > 30) {
|
|
43
|
-
return this.value.substring(0,30) + '...';
|
|
43
|
+
return this.value.substring(0, 30) + '...';
|
|
44
44
|
}
|
|
45
45
|
return this.value;
|
|
46
46
|
},
|
|
@@ -8,7 +8,7 @@ const { BSON, EJSON } = require('bson');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
11
|
-
apply
|
|
11
|
+
apply(target, thisArg, argumentsList) {
|
|
12
12
|
return new target(...argumentsList);
|
|
13
13
|
}
|
|
14
14
|
});
|
|
@@ -86,7 +86,7 @@ module.exports = app => app.component('models', {
|
|
|
86
86
|
}
|
|
87
87
|
if (this.$route.query?.fields) {
|
|
88
88
|
const filter = this.$route.query.fields.split(',');
|
|
89
|
-
this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path))
|
|
89
|
+
this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path));
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
|
|
@@ -121,7 +121,7 @@ module.exports = app => app.component('models', {
|
|
|
121
121
|
|
|
122
122
|
this.$nextTick(() => {
|
|
123
123
|
const input = this.$refs.searchInput;
|
|
124
|
-
const cursorIndex = this.searchText.lastIndexOf(
|
|
124
|
+
const cursorIndex = this.searchText.lastIndexOf(':') + 2; // Move cursor after ": "
|
|
125
125
|
|
|
126
126
|
input.focus();
|
|
127
127
|
input.setSelectionRange(cursorIndex, cursorIndex);
|
|
@@ -136,7 +136,7 @@ module.exports = app => app.component('models', {
|
|
|
136
136
|
},
|
|
137
137
|
filterDocument(doc) {
|
|
138
138
|
const filteredDoc = {};
|
|
139
|
-
console.log(doc, this.filteredPaths)
|
|
139
|
+
console.log(doc, this.filteredPaths);
|
|
140
140
|
for (let i = 0; i < this.filteredPaths.length; i++) {
|
|
141
141
|
filteredDoc[this.filteredPaths[i].path] = doc[this.filteredPaths[i].path];
|
|
142
142
|
}
|
|
@@ -175,7 +175,7 @@ module.exports = app => app.component('models', {
|
|
|
175
175
|
}
|
|
176
176
|
if (!sorted) {
|
|
177
177
|
this.sortBy[path] = num;
|
|
178
|
-
this.query.sort = `{${path}:${num}}
|
|
178
|
+
this.query.sort = `{${path}:${num}}`;
|
|
179
179
|
this.$router.push({ query: this.query });
|
|
180
180
|
}
|
|
181
181
|
await this.loadMoreDocuments();
|
|
@@ -201,11 +201,11 @@ module.exports = app => app.component('models', {
|
|
|
201
201
|
},
|
|
202
202
|
checkIndexLocation(indexName) {
|
|
203
203
|
if (this.schemaIndexes.find(x => x.name == indexName) && this.mongoDBIndexes.find(x => x.name == indexName)) {
|
|
204
|
-
return 'text-gray-500'
|
|
204
|
+
return 'text-gray-500';
|
|
205
205
|
} else if (this.schemaIndexes.find(x => x.name == indexName)) {
|
|
206
|
-
return 'text-forest-green-500'
|
|
206
|
+
return 'text-forest-green-500';
|
|
207
207
|
} else {
|
|
208
|
-
return 'text-valencia-500'
|
|
208
|
+
return 'text-valencia-500';
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
211
|
async getDocuments() {
|
|
@@ -269,7 +269,7 @@ module.exports = app => app.component('models', {
|
|
|
269
269
|
openFieldSelection() {
|
|
270
270
|
if (this.$route.query?.fields) {
|
|
271
271
|
this.selectedPaths.length = 0;
|
|
272
|
-
console.log('there are fields in play', this.$route.query.fields)
|
|
272
|
+
console.log('there are fields in play', this.$route.query.fields);
|
|
273
273
|
const fields = this.$route.query.fields.split(',');
|
|
274
274
|
for (let i = 0; i < fields.length; i++) {
|
|
275
275
|
this.selectedPaths.push({ path: fields[i] });
|
|
@@ -342,7 +342,7 @@ module.exports = app => app.component('models', {
|
|
|
342
342
|
handleDocumentClick(document) {
|
|
343
343
|
console.log(this.selectedDocuments);
|
|
344
344
|
if (this.selectMultiple) {
|
|
345
|
-
const exists = this.selectedDocuments.find(x => x._id.toString() == document._id.toString())
|
|
345
|
+
const exists = this.selectedDocuments.find(x => x._id.toString() == document._id.toString());
|
|
346
346
|
if (exists) {
|
|
347
347
|
const index = this.selectedDocuments.findIndex(x => x._id.toString() == document._id.toString());
|
|
348
348
|
if (index !== -1) {
|
|
@@ -352,7 +352,7 @@ module.exports = app => app.component('models', {
|
|
|
352
352
|
this.selectedDocuments.push(document);
|
|
353
353
|
}
|
|
354
354
|
} else {
|
|
355
|
-
|
|
355
|
+
this.$router.push('/model/' + this.currentModel + '/document/' + document._id);
|
|
356
356
|
}
|
|
357
357
|
},
|
|
358
358
|
async deleteDocuments() {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const mothership = require('../mothership');
|
|
5
5
|
const template = require('./navbar.html');
|
|
6
|
-
const
|
|
6
|
+
const { routes, hasAccess } = require('../routes');
|
|
7
7
|
|
|
8
8
|
const appendCSS = require('../appendCSS');
|
|
9
9
|
|
|
@@ -25,7 +25,7 @@ module.exports = app => app.component('navbar', {
|
|
|
25
25
|
},
|
|
26
26
|
computed: {
|
|
27
27
|
dashboardView() {
|
|
28
|
-
return routes.filter(x => x.name.startsWith('dashboard')).map(x => x.name).includes(this.$route.name)
|
|
28
|
+
return routes.filter(x => x.name.startsWith('dashboard')).map(x => x.name).includes(this.$route.name);
|
|
29
29
|
},
|
|
30
30
|
documentView() {
|
|
31
31
|
return ['root', 'model', 'document'].includes(this.$route.name);
|
|
@@ -66,7 +66,7 @@ module.exports = app => app.component('navbar', {
|
|
|
66
66
|
logout() {
|
|
67
67
|
window.localStorage.setItem('_mongooseStudioAccessToken', '');
|
|
68
68
|
window.location.reload();
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
},
|
|
71
71
|
directives: {
|
|
72
72
|
clickOutside: {
|