@mongoosejs/studio 0.0.94 → 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 +104 -104
- 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/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/public/app.js
CHANGED
|
@@ -53,9 +53,9 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
53
53
|
return client.post('', { action: 'Dashboard.getDashboards', ...params }).then(res => res.data);
|
|
54
54
|
},
|
|
55
55
|
updateDashboard(params) {
|
|
56
|
-
return client.post('', { action: 'Dashboard.updateDashboard', ...params}).then(res => res.data);
|
|
56
|
+
return client.post('', { action: 'Dashboard.updateDashboard', ...params }).then(res => res.data);
|
|
57
57
|
}
|
|
58
|
-
}
|
|
58
|
+
};
|
|
59
59
|
exports.ChatThread = {
|
|
60
60
|
createChatMessage(params) {
|
|
61
61
|
return client.post('', { action: 'ChatThread.createChatMessage', ...params }).then(res => res.data);
|
|
@@ -69,24 +69,24 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
69
69
|
listChatThreads(params) {
|
|
70
70
|
return client.post('', { action: 'ChatThread.listChatThreads', ...params }).then(res => res.data);
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
};
|
|
73
73
|
exports.ChatMessage = {
|
|
74
74
|
executeScript(params) {
|
|
75
75
|
return client.post('', { action: 'ChatMessage.executeScript', ...params }).then(res => res.data);
|
|
76
76
|
}
|
|
77
|
-
}
|
|
77
|
+
};
|
|
78
78
|
exports.Model = {
|
|
79
79
|
createChart(params) {
|
|
80
|
-
return client.post('', { action: 'Model.createChart', ...params}).then(res => res.data);
|
|
80
|
+
return client.post('', { action: 'Model.createChart', ...params }).then(res => res.data);
|
|
81
81
|
},
|
|
82
82
|
createDocument(params) {
|
|
83
|
-
return client.post('', { action: 'Model.createDocument', ...params}).then(res => res.data);
|
|
83
|
+
return client.post('', { action: 'Model.createDocument', ...params }).then(res => res.data);
|
|
84
84
|
},
|
|
85
85
|
deleteDocument(params) {
|
|
86
|
-
return client.post('', { action: 'Model.deleteDocument', ...params}).then(res => res.data);
|
|
86
|
+
return client.post('', { action: 'Model.deleteDocument', ...params }).then(res => res.data);
|
|
87
87
|
},
|
|
88
88
|
deleteDocuments(params) {
|
|
89
|
-
return client.post('', { action: 'Model.deleteDocuments', ...params}).then(res => res.data);
|
|
89
|
+
return client.post('', { action: 'Model.deleteDocuments', ...params }).then(res => res.data);
|
|
90
90
|
},
|
|
91
91
|
exportQueryResults(params) {
|
|
92
92
|
const accessToken = window.localStorage.getItem('_mongooseStudioAccessToken') || null;
|
|
@@ -94,8 +94,8 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
94
94
|
return fetch(window.MONGOOSE_STUDIO_CONFIG.baseURL + new URLSearchParams({ ...params, action: 'Model.exportQueryResults' }).toString(), {
|
|
95
95
|
method: 'GET',
|
|
96
96
|
headers: {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
Authorization: `${accessToken}`, // Set your authorization token here
|
|
98
|
+
Accept: 'text/csv'
|
|
99
99
|
}
|
|
100
100
|
})
|
|
101
101
|
.then(response => {
|
|
@@ -146,7 +146,7 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
146
146
|
return client.post('/Dashboard/createDashboard', params).then(res => res.data);
|
|
147
147
|
},
|
|
148
148
|
deleteDashboard: function deleteDashboard(params) {
|
|
149
|
-
return client.post('/Dashboard/deleteDashboard', params).then(res => res.data)
|
|
149
|
+
return client.post('/Dashboard/deleteDashboard', params).then(res => res.data);
|
|
150
150
|
},
|
|
151
151
|
getDashboard: function getDashboard(params) {
|
|
152
152
|
return client.put('/Dashboard/getDashboard', params).then(res => res.data);
|
|
@@ -157,7 +157,7 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
157
157
|
updateDashboard: function updateDashboard(params) {
|
|
158
158
|
return client.post('/Dashboard/updateDashboard', params).then(res => res.data);
|
|
159
159
|
}
|
|
160
|
-
}
|
|
160
|
+
};
|
|
161
161
|
exports.ChatThread = {
|
|
162
162
|
createChatMessage: function createChatMessage(params) {
|
|
163
163
|
return client.post('/ChatThread/createChatMessage', params).then(res => res.data);
|
|
@@ -178,13 +178,13 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
180
|
exports.Model = {
|
|
181
|
-
createChart: function
|
|
181
|
+
createChart: function(params) {
|
|
182
182
|
return client.post('/Model/createChart', params).then(res => res.data);
|
|
183
183
|
},
|
|
184
184
|
createDocument: function(params) {
|
|
185
185
|
return client.post('/Model/createDocument', params).then(res => res.data);
|
|
186
186
|
},
|
|
187
|
-
deleteDocument: function
|
|
187
|
+
deleteDocument: function(params) {
|
|
188
188
|
return client.post('/Model/deleteDocument', params).then(res => res.data);
|
|
189
189
|
},
|
|
190
190
|
deleteDocuments: function(params) {
|
|
@@ -196,8 +196,8 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
|
|
|
196
196
|
return fetch(window.MONGOOSE_STUDIO_CONFIG.baseURL + '/Model/exportQueryResults?' + new URLSearchParams(params).toString(), {
|
|
197
197
|
method: 'GET',
|
|
198
198
|
headers: {
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
Authorization: `${accessToken}`, // Set your authorization token here
|
|
200
|
+
Accept: 'text/csv'
|
|
201
201
|
}
|
|
202
202
|
})
|
|
203
203
|
.then(response => {
|
|
@@ -441,7 +441,7 @@ module.exports = app => app.component('chat-message', {
|
|
|
441
441
|
});
|
|
442
442
|
message.executionResult = chatMessage.executionResult;
|
|
443
443
|
console.log(message);
|
|
444
|
-
}
|
|
444
|
+
}
|
|
445
445
|
}
|
|
446
446
|
});
|
|
447
447
|
|
|
@@ -543,7 +543,7 @@ module.exports = app => app.component('chat', {
|
|
|
543
543
|
});
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
|
-
}
|
|
546
|
+
}
|
|
547
547
|
});
|
|
548
548
|
|
|
549
549
|
|
|
@@ -563,7 +563,7 @@ const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
|
563
563
|
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
564
564
|
|
|
565
565
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
566
|
-
apply
|
|
566
|
+
apply(target, thisArg, argumentsList) {
|
|
567
567
|
return new target(...argumentsList);
|
|
568
568
|
}
|
|
569
569
|
});
|
|
@@ -572,7 +572,7 @@ const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/append
|
|
|
572
572
|
|
|
573
573
|
appendCSS(__webpack_require__(/*! ./clone-document.css */ "./frontend/src/clone-document/clone-document.css"));
|
|
574
574
|
|
|
575
|
-
const template = __webpack_require__(/*! ./clone-document.html */ "./frontend/src/clone-document/clone-document.html")
|
|
575
|
+
const template = __webpack_require__(/*! ./clone-document.html */ "./frontend/src/clone-document/clone-document.html");
|
|
576
576
|
|
|
577
577
|
module.exports = app => app.component('clone-document', {
|
|
578
578
|
props: ['currentModel', 'doc', 'schemaPaths'],
|
|
@@ -582,7 +582,7 @@ module.exports = app => app.component('clone-document', {
|
|
|
582
582
|
documentData: '',
|
|
583
583
|
editor: null,
|
|
584
584
|
errors: []
|
|
585
|
-
}
|
|
585
|
+
};
|
|
586
586
|
},
|
|
587
587
|
methods: {
|
|
588
588
|
async cloneDocument() {
|
|
@@ -590,17 +590,17 @@ module.exports = app => app.component('clone-document', {
|
|
|
590
590
|
const { doc } = await api.Model.createDocument({ model: this.currentModel, data }).catch(err => {
|
|
591
591
|
if (err.response?.data?.message) {
|
|
592
592
|
console.log(err.response.data);
|
|
593
|
-
const message = err.response.data.message.split(
|
|
593
|
+
const message = err.response.data.message.split(': ').slice(1).join(': ');
|
|
594
594
|
this.errors = message.split(',').map(error => {
|
|
595
595
|
return error.split(': ').slice(1).join(': ').trim();
|
|
596
|
-
})
|
|
596
|
+
});
|
|
597
597
|
throw new Error(err.response?.data?.message);
|
|
598
598
|
}
|
|
599
599
|
throw err;
|
|
600
600
|
});
|
|
601
601
|
this.errors.length = 0;
|
|
602
602
|
this.$emit('close', doc);
|
|
603
|
-
}
|
|
603
|
+
}
|
|
604
604
|
},
|
|
605
605
|
mounted: function() {
|
|
606
606
|
const pathsToClone = this.schemaPaths.map(x => x.path);
|
|
@@ -626,8 +626,8 @@ module.exports = app => app.component('clone-document', {
|
|
|
626
626
|
lineNumbers: true,
|
|
627
627
|
smartIndent: false
|
|
628
628
|
});
|
|
629
|
-
}
|
|
630
|
-
})
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
631
|
|
|
632
632
|
/***/ }),
|
|
633
633
|
|
|
@@ -642,7 +642,7 @@ module.exports = app => app.component('clone-document', {
|
|
|
642
642
|
|
|
643
643
|
const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
644
644
|
|
|
645
|
-
const template = __webpack_require__(/*! ./create-dashboard.html */ "./frontend/src/create-dashboard/create-dashboard.html")
|
|
645
|
+
const template = __webpack_require__(/*! ./create-dashboard.html */ "./frontend/src/create-dashboard/create-dashboard.html");
|
|
646
646
|
|
|
647
647
|
module.exports = app => app.component('create-dashboard', {
|
|
648
648
|
template,
|
|
@@ -651,7 +651,7 @@ module.exports = app => app.component('create-dashboard', {
|
|
|
651
651
|
title: '',
|
|
652
652
|
code: '',
|
|
653
653
|
errors: []
|
|
654
|
-
}
|
|
654
|
+
};
|
|
655
655
|
},
|
|
656
656
|
methods: {
|
|
657
657
|
async createDashboard() {
|
|
@@ -659,25 +659,25 @@ module.exports = app => app.component('create-dashboard', {
|
|
|
659
659
|
const { dashboard } = await api.Dashboard.createDashboard({ code: this.code, title: this.title }).catch(err => {
|
|
660
660
|
if (err.response?.data?.message) {
|
|
661
661
|
console.log(err.response.data);
|
|
662
|
-
const message = err.response.data.message.split(
|
|
662
|
+
const message = err.response.data.message.split(': ').slice(1).join(': ');
|
|
663
663
|
this.errors = message.split(',').map(error => {
|
|
664
664
|
return error.split(': ').slice(1).join(': ').trim();
|
|
665
|
-
})
|
|
665
|
+
});
|
|
666
666
|
throw new Error(err.response?.data?.message);
|
|
667
667
|
}
|
|
668
668
|
throw err;
|
|
669
669
|
});
|
|
670
670
|
this.errors.length = 0;
|
|
671
671
|
this.$emit('close', dashboard);
|
|
672
|
-
}
|
|
672
|
+
}
|
|
673
673
|
},
|
|
674
674
|
mounted: function() {
|
|
675
675
|
this._editor = CodeMirror.fromTextArea(this.$refs.codeEditor, {
|
|
676
676
|
mode: 'javascript',
|
|
677
677
|
lineNumbers: true
|
|
678
678
|
});
|
|
679
|
-
}
|
|
680
|
-
})
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
681
|
|
|
682
682
|
/***/ }),
|
|
683
683
|
|
|
@@ -695,7 +695,7 @@ const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
|
695
695
|
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
696
696
|
|
|
697
697
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
698
|
-
apply
|
|
698
|
+
apply(target, thisArg, argumentsList) {
|
|
699
699
|
return new target(...argumentsList);
|
|
700
700
|
}
|
|
701
701
|
});
|
|
@@ -704,7 +704,7 @@ const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/append
|
|
|
704
704
|
|
|
705
705
|
appendCSS(__webpack_require__(/*! ./create-document.css */ "./frontend/src/create-document/create-document.css"));
|
|
706
706
|
|
|
707
|
-
const template = __webpack_require__(/*! ./create-document.html */ "./frontend/src/create-document/create-document.html")
|
|
707
|
+
const template = __webpack_require__(/*! ./create-document.html */ "./frontend/src/create-document/create-document.html");
|
|
708
708
|
|
|
709
709
|
module.exports = app => app.component('create-document', {
|
|
710
710
|
props: ['currentModel', 'paths'],
|
|
@@ -714,7 +714,7 @@ module.exports = app => app.component('create-document', {
|
|
|
714
714
|
documentData: '',
|
|
715
715
|
editor: null,
|
|
716
716
|
errors: []
|
|
717
|
-
}
|
|
717
|
+
};
|
|
718
718
|
},
|
|
719
719
|
methods: {
|
|
720
720
|
async createDocument() {
|
|
@@ -722,24 +722,24 @@ module.exports = app => app.component('create-document', {
|
|
|
722
722
|
const { doc } = await api.Model.createDocument({ model: this.currentModel, data }).catch(err => {
|
|
723
723
|
if (err.response?.data?.message) {
|
|
724
724
|
console.log(err.response.data);
|
|
725
|
-
const message = err.response.data.message.split(
|
|
725
|
+
const message = err.response.data.message.split(': ').slice(1).join(': ');
|
|
726
726
|
this.errors = message.split(',').map(error => {
|
|
727
727
|
return error.split(': ').slice(1).join(': ').trim();
|
|
728
|
-
})
|
|
728
|
+
});
|
|
729
729
|
throw new Error(err.response?.data?.message);
|
|
730
730
|
}
|
|
731
731
|
throw err;
|
|
732
732
|
});
|
|
733
733
|
this.errors.length = 0;
|
|
734
734
|
this.$emit('close', doc);
|
|
735
|
-
}
|
|
735
|
+
}
|
|
736
736
|
},
|
|
737
737
|
mounted: function() {
|
|
738
738
|
const requiredPaths = this.paths.filter(x => x.required);
|
|
739
|
-
this.documentData =
|
|
739
|
+
this.documentData = '{\n';
|
|
740
740
|
for (let i = 0; i < requiredPaths.length; i++) {
|
|
741
741
|
const isLast = i + 1 >= requiredPaths.length;
|
|
742
|
-
this.documentData += ` ${requiredPaths[i].path}: ${isLast ? '': ','}\n
|
|
742
|
+
this.documentData += ` ${requiredPaths[i].path}: ${isLast ? '' : ','}\n`;
|
|
743
743
|
}
|
|
744
744
|
this.documentData += '}';
|
|
745
745
|
this.$refs.codeEditor.value = this.documentData;
|
|
@@ -748,8 +748,8 @@ module.exports = app => app.component('create-document', {
|
|
|
748
748
|
lineNumbers: true,
|
|
749
749
|
smartIndent: false
|
|
750
750
|
});
|
|
751
|
-
}
|
|
752
|
-
})
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
753
|
|
|
754
754
|
/***/ }),
|
|
755
755
|
|
|
@@ -946,7 +946,7 @@ module.exports = app => app.component('dashboard', {
|
|
|
946
946
|
dashboard: null,
|
|
947
947
|
result: null,
|
|
948
948
|
errorMessage: null
|
|
949
|
-
}
|
|
949
|
+
};
|
|
950
950
|
},
|
|
951
951
|
methods: {
|
|
952
952
|
toggleEditor() {
|
|
@@ -1005,11 +1005,11 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
1005
1005
|
editor: null,
|
|
1006
1006
|
title: '',
|
|
1007
1007
|
description: ''
|
|
1008
|
-
}
|
|
1008
|
+
};
|
|
1009
1009
|
},
|
|
1010
1010
|
methods: {
|
|
1011
1011
|
closeEditor() {
|
|
1012
|
-
|
|
1012
|
+
this.$emit('close');
|
|
1013
1013
|
},
|
|
1014
1014
|
async updateCode() {
|
|
1015
1015
|
this.status = 'loading';
|
|
@@ -1040,7 +1040,7 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
1040
1040
|
indentWithTabs: true,
|
|
1041
1041
|
cursorBlinkRate: 300,
|
|
1042
1042
|
lineWrapping: true,
|
|
1043
|
-
showCursorWhenSelecting: true
|
|
1043
|
+
showCursorWhenSelecting: true
|
|
1044
1044
|
});
|
|
1045
1045
|
// this.editor.focus();
|
|
1046
1046
|
// this.editor.refresh(); // if anything weird happens on load, this usually fixes it. However, this breaks it in this case.
|
|
@@ -1092,7 +1092,7 @@ module.exports = app => app.component('dashboards', {
|
|
|
1092
1092
|
const { dashboards } = await api.Dashboard.getDashboards();
|
|
1093
1093
|
this.dashboards = dashboards;
|
|
1094
1094
|
this.status = 'loaded';
|
|
1095
|
-
}
|
|
1095
|
+
}
|
|
1096
1096
|
});
|
|
1097
1097
|
|
|
1098
1098
|
|
|
@@ -1167,7 +1167,7 @@ module.exports = app => app.component('detail-default', {
|
|
|
1167
1167
|
|
|
1168
1168
|
|
|
1169
1169
|
const mpath = __webpack_require__(/*! mpath */ "./node_modules/mpath/index.js");
|
|
1170
|
-
const template = __webpack_require__(/*! ./document-details.html */ "./frontend/src/document-details/document-details.html")
|
|
1170
|
+
const template = __webpack_require__(/*! ./document-details.html */ "./frontend/src/document-details/document-details.html");
|
|
1171
1171
|
|
|
1172
1172
|
const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
|
|
1173
1173
|
|
|
@@ -1194,9 +1194,9 @@ module.exports = app => app.component('document-details', {
|
|
|
1194
1194
|
}
|
|
1195
1195
|
|
|
1196
1196
|
return result;
|
|
1197
|
-
}
|
|
1197
|
+
}
|
|
1198
1198
|
}
|
|
1199
|
-
})
|
|
1199
|
+
});
|
|
1200
1200
|
|
|
1201
1201
|
/***/ }),
|
|
1202
1202
|
|
|
@@ -1210,7 +1210,7 @@ module.exports = app => app.component('document-details', {
|
|
|
1210
1210
|
|
|
1211
1211
|
|
|
1212
1212
|
const mpath = __webpack_require__(/*! mpath */ "./node_modules/mpath/index.js");
|
|
1213
|
-
const template = __webpack_require__(/*! ./document-property.html */ "./frontend/src/document-details/document-property/document-property.html")
|
|
1213
|
+
const template = __webpack_require__(/*! ./document-property.html */ "./frontend/src/document-details/document-property/document-property.html");
|
|
1214
1214
|
|
|
1215
1215
|
const appendCSS = __webpack_require__(/*! ../../appendCSS */ "./frontend/src/appendCSS.js");
|
|
1216
1216
|
|
|
@@ -1221,7 +1221,7 @@ module.exports = app => app.component('document-property', {
|
|
|
1221
1221
|
data: function() {
|
|
1222
1222
|
return {
|
|
1223
1223
|
dateType: 'picker' // picker, iso
|
|
1224
|
-
}
|
|
1224
|
+
};
|
|
1225
1225
|
},
|
|
1226
1226
|
props: ['path', 'document', 'schemaPaths', 'editting', 'changes', 'invalid'],
|
|
1227
1227
|
methods: {
|
|
@@ -1262,7 +1262,7 @@ module.exports = app => app.component('document-property', {
|
|
|
1262
1262
|
return path in this.changes ? this.changes[path] : mpath.get(path, this.document);
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
|
-
})
|
|
1265
|
+
});
|
|
1266
1266
|
|
|
1267
1267
|
/***/ }),
|
|
1268
1268
|
|
|
@@ -1287,10 +1287,10 @@ module.exports = app => app.component('confirm-changes', {
|
|
|
1287
1287
|
},
|
|
1288
1288
|
methods: {
|
|
1289
1289
|
closeConfirm() {
|
|
1290
|
-
|
|
1290
|
+
this.$emit('close');
|
|
1291
1291
|
},
|
|
1292
1292
|
startSave() {
|
|
1293
|
-
|
|
1293
|
+
this.$emit('save');
|
|
1294
1294
|
}
|
|
1295
1295
|
},
|
|
1296
1296
|
mounted() {
|
|
@@ -1321,10 +1321,10 @@ module.exports = app => app.component('confirm-delete', {
|
|
|
1321
1321
|
},
|
|
1322
1322
|
methods: {
|
|
1323
1323
|
closeDelete() {
|
|
1324
|
-
|
|
1324
|
+
this.$emit('close');
|
|
1325
1325
|
},
|
|
1326
1326
|
startDelete() {
|
|
1327
|
-
|
|
1327
|
+
this.$emit('remove');
|
|
1328
1328
|
}
|
|
1329
1329
|
},
|
|
1330
1330
|
mounted() {
|
|
@@ -1427,11 +1427,11 @@ module.exports = app => app.component('document', {
|
|
|
1427
1427
|
timeout: 3000,
|
|
1428
1428
|
positionClass: 'bottomRight'
|
|
1429
1429
|
});
|
|
1430
|
-
this.$router.push({ path: `/model/${this.model}`});
|
|
1430
|
+
this.$router.push({ path: `/model/${this.model}` });
|
|
1431
1431
|
}
|
|
1432
1432
|
},
|
|
1433
1433
|
showClonedDocument(doc) {
|
|
1434
|
-
this.$router.push({ path: `/model/${this.model}/document/${doc._id}`});
|
|
1434
|
+
this.$router.push({ path: `/model/${this.model}/document/${doc._id}` });
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
1437
|
});
|
|
@@ -1453,7 +1453,7 @@ const template = __webpack_require__(/*! ./edit-array.html */ "./frontend/src/ed
|
|
|
1453
1453
|
const { BSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
1454
1454
|
|
|
1455
1455
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
1456
|
-
apply
|
|
1456
|
+
apply(target, thisArg, argumentsList) {
|
|
1457
1457
|
return new target(...argumentsList);
|
|
1458
1458
|
}
|
|
1459
1459
|
});
|
|
@@ -1647,7 +1647,7 @@ const template = __webpack_require__(/*! ./edit-subdocument.html */ "./frontend/
|
|
|
1647
1647
|
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
1648
1648
|
|
|
1649
1649
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
1650
|
-
apply
|
|
1650
|
+
apply(target, thisArg, argumentsList) {
|
|
1651
1651
|
return new target(...argumentsList);
|
|
1652
1652
|
}
|
|
1653
1653
|
});
|
|
@@ -1941,7 +1941,7 @@ module.exports = app => app.component('list-default', {
|
|
|
1941
1941
|
copyText(value) {
|
|
1942
1942
|
const storage = document.createElement('textarea');
|
|
1943
1943
|
storage.value = value;
|
|
1944
|
-
const elem = this.$refs.itemData
|
|
1944
|
+
const elem = this.$refs.itemData;
|
|
1945
1945
|
elem.appendChild(storage);
|
|
1946
1946
|
storage.select();
|
|
1947
1947
|
storage.setSelectionRange(0, 99999);
|
|
@@ -1956,7 +1956,7 @@ module.exports = app => app.component('list-default', {
|
|
|
1956
1956
|
});
|
|
1957
1957
|
},
|
|
1958
1958
|
goToDoc(id) {
|
|
1959
|
-
this.$router.push({ path: `/model/${this.allude}/document/${id}`});
|
|
1959
|
+
this.$router.push({ path: `/model/${this.allude}/document/${id}` });
|
|
1960
1960
|
}
|
|
1961
1961
|
},
|
|
1962
1962
|
computed: {
|
|
@@ -1968,7 +1968,7 @@ module.exports = app => app.component('list-default', {
|
|
|
1968
1968
|
return 'undefined';
|
|
1969
1969
|
}
|
|
1970
1970
|
if (this.value.length > 30) {
|
|
1971
|
-
return this.value.substring(0,30) + '...';
|
|
1971
|
+
return this.value.substring(0, 30) + '...';
|
|
1972
1972
|
}
|
|
1973
1973
|
return this.value;
|
|
1974
1974
|
},
|
|
@@ -2224,7 +2224,7 @@ const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib
|
|
|
2224
2224
|
|
|
2225
2225
|
|
|
2226
2226
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
2227
|
-
apply
|
|
2227
|
+
apply(target, thisArg, argumentsList) {
|
|
2228
2228
|
return new target(...argumentsList);
|
|
2229
2229
|
}
|
|
2230
2230
|
});
|
|
@@ -2302,7 +2302,7 @@ module.exports = app => app.component('models', {
|
|
|
2302
2302
|
}
|
|
2303
2303
|
if (this.$route.query?.fields) {
|
|
2304
2304
|
const filter = this.$route.query.fields.split(',');
|
|
2305
|
-
this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path))
|
|
2305
|
+
this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path));
|
|
2306
2306
|
}
|
|
2307
2307
|
|
|
2308
2308
|
|
|
@@ -2337,7 +2337,7 @@ module.exports = app => app.component('models', {
|
|
|
2337
2337
|
|
|
2338
2338
|
this.$nextTick(() => {
|
|
2339
2339
|
const input = this.$refs.searchInput;
|
|
2340
|
-
const cursorIndex = this.searchText.lastIndexOf(
|
|
2340
|
+
const cursorIndex = this.searchText.lastIndexOf(':') + 2; // Move cursor after ": "
|
|
2341
2341
|
|
|
2342
2342
|
input.focus();
|
|
2343
2343
|
input.setSelectionRange(cursorIndex, cursorIndex);
|
|
@@ -2352,7 +2352,7 @@ module.exports = app => app.component('models', {
|
|
|
2352
2352
|
},
|
|
2353
2353
|
filterDocument(doc) {
|
|
2354
2354
|
const filteredDoc = {};
|
|
2355
|
-
console.log(doc, this.filteredPaths)
|
|
2355
|
+
console.log(doc, this.filteredPaths);
|
|
2356
2356
|
for (let i = 0; i < this.filteredPaths.length; i++) {
|
|
2357
2357
|
filteredDoc[this.filteredPaths[i].path] = doc[this.filteredPaths[i].path];
|
|
2358
2358
|
}
|
|
@@ -2391,7 +2391,7 @@ module.exports = app => app.component('models', {
|
|
|
2391
2391
|
}
|
|
2392
2392
|
if (!sorted) {
|
|
2393
2393
|
this.sortBy[path] = num;
|
|
2394
|
-
this.query.sort = `{${path}:${num}}
|
|
2394
|
+
this.query.sort = `{${path}:${num}}`;
|
|
2395
2395
|
this.$router.push({ query: this.query });
|
|
2396
2396
|
}
|
|
2397
2397
|
await this.loadMoreDocuments();
|
|
@@ -2417,11 +2417,11 @@ module.exports = app => app.component('models', {
|
|
|
2417
2417
|
},
|
|
2418
2418
|
checkIndexLocation(indexName) {
|
|
2419
2419
|
if (this.schemaIndexes.find(x => x.name == indexName) && this.mongoDBIndexes.find(x => x.name == indexName)) {
|
|
2420
|
-
return 'text-gray-500'
|
|
2420
|
+
return 'text-gray-500';
|
|
2421
2421
|
} else if (this.schemaIndexes.find(x => x.name == indexName)) {
|
|
2422
|
-
return 'text-forest-green-500'
|
|
2422
|
+
return 'text-forest-green-500';
|
|
2423
2423
|
} else {
|
|
2424
|
-
return 'text-valencia-500'
|
|
2424
|
+
return 'text-valencia-500';
|
|
2425
2425
|
}
|
|
2426
2426
|
},
|
|
2427
2427
|
async getDocuments() {
|
|
@@ -2485,7 +2485,7 @@ module.exports = app => app.component('models', {
|
|
|
2485
2485
|
openFieldSelection() {
|
|
2486
2486
|
if (this.$route.query?.fields) {
|
|
2487
2487
|
this.selectedPaths.length = 0;
|
|
2488
|
-
console.log('there are fields in play', this.$route.query.fields)
|
|
2488
|
+
console.log('there are fields in play', this.$route.query.fields);
|
|
2489
2489
|
const fields = this.$route.query.fields.split(',');
|
|
2490
2490
|
for (let i = 0; i < fields.length; i++) {
|
|
2491
2491
|
this.selectedPaths.push({ path: fields[i] });
|
|
@@ -2558,7 +2558,7 @@ module.exports = app => app.component('models', {
|
|
|
2558
2558
|
handleDocumentClick(document) {
|
|
2559
2559
|
console.log(this.selectedDocuments);
|
|
2560
2560
|
if (this.selectMultiple) {
|
|
2561
|
-
const exists = this.selectedDocuments.find(x => x._id.toString() == document._id.toString())
|
|
2561
|
+
const exists = this.selectedDocuments.find(x => x._id.toString() == document._id.toString());
|
|
2562
2562
|
if (exists) {
|
|
2563
2563
|
const index = this.selectedDocuments.findIndex(x => x._id.toString() == document._id.toString());
|
|
2564
2564
|
if (index !== -1) {
|
|
@@ -2568,7 +2568,7 @@ module.exports = app => app.component('models', {
|
|
|
2568
2568
|
this.selectedDocuments.push(document);
|
|
2569
2569
|
}
|
|
2570
2570
|
} else {
|
|
2571
|
-
|
|
2571
|
+
this.$router.push('/model/' + this.currentModel + '/document/' + document._id);
|
|
2572
2572
|
}
|
|
2573
2573
|
},
|
|
2574
2574
|
async deleteDocuments() {
|
|
@@ -2681,7 +2681,7 @@ exports.hasAPIKey = client.hasAPIKey;
|
|
|
2681
2681
|
const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
2682
2682
|
const mothership = __webpack_require__(/*! ../mothership */ "./frontend/src/mothership.js");
|
|
2683
2683
|
const template = __webpack_require__(/*! ./navbar.html */ "./frontend/src/navbar/navbar.html");
|
|
2684
|
-
const
|
|
2684
|
+
const { routes, hasAccess } = __webpack_require__(/*! ../routes */ "./frontend/src/routes.js");
|
|
2685
2685
|
|
|
2686
2686
|
const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
|
|
2687
2687
|
|
|
@@ -2703,7 +2703,7 @@ module.exports = app => app.component('navbar', {
|
|
|
2703
2703
|
},
|
|
2704
2704
|
computed: {
|
|
2705
2705
|
dashboardView() {
|
|
2706
|
-
return routes.filter(x => x.name.startsWith('dashboard')).map(x => x.name).includes(this.$route.name)
|
|
2706
|
+
return routes.filter(x => x.name.startsWith('dashboard')).map(x => x.name).includes(this.$route.name);
|
|
2707
2707
|
},
|
|
2708
2708
|
documentView() {
|
|
2709
2709
|
return ['root', 'model', 'document'].includes(this.$route.name);
|
|
@@ -2744,7 +2744,7 @@ module.exports = app => app.component('navbar', {
|
|
|
2744
2744
|
logout() {
|
|
2745
2745
|
window.localStorage.setItem('_mongooseStudioAccessToken', '');
|
|
2746
2746
|
window.location.reload();
|
|
2747
|
-
}
|
|
2747
|
+
}
|
|
2748
2748
|
},
|
|
2749
2749
|
directives: {
|
|
2750
2750
|
clickOutside: {
|
|
@@ -3015,7 +3015,7 @@ const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
|
3015
3015
|
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
3016
3016
|
|
|
3017
3017
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
3018
|
-
apply
|
|
3018
|
+
apply(target, thisArg, argumentsList) {
|
|
3019
3019
|
return new target(...argumentsList);
|
|
3020
3020
|
}
|
|
3021
3021
|
});
|
|
@@ -3024,7 +3024,7 @@ const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/append
|
|
|
3024
3024
|
|
|
3025
3025
|
appendCSS(__webpack_require__(/*! ./update-document.css */ "./frontend/src/update-document/update-document.css"));
|
|
3026
3026
|
|
|
3027
|
-
const template = __webpack_require__(/*! ./update-document.html */ "./frontend/src/update-document/update-document.html")
|
|
3027
|
+
const template = __webpack_require__(/*! ./update-document.html */ "./frontend/src/update-document/update-document.html");
|
|
3028
3028
|
|
|
3029
3029
|
module.exports = app => app.component('update-document', {
|
|
3030
3030
|
props: ['currentModel', 'document', 'multiple'],
|
|
@@ -3033,7 +3033,7 @@ module.exports = app => app.component('update-document', {
|
|
|
3033
3033
|
return {
|
|
3034
3034
|
editor: null,
|
|
3035
3035
|
errors: []
|
|
3036
|
-
}
|
|
3036
|
+
};
|
|
3037
3037
|
},
|
|
3038
3038
|
methods: {
|
|
3039
3039
|
async updateDocument() {
|
|
@@ -3041,43 +3041,43 @@ module.exports = app => app.component('update-document', {
|
|
|
3041
3041
|
if (this.multiple) {
|
|
3042
3042
|
const ids = this.document.map(x => x._id);
|
|
3043
3043
|
await api.Model.updateDocuments({ model: this.currentModel, _id: ids, update: data }).catch(err => {
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3044
|
+
if (err.response?.data?.message) {
|
|
3045
|
+
console.log(err.response.data);
|
|
3046
|
+
const message = err.response.data.message.split(': ').slice(1).join(': ');
|
|
3047
|
+
this.errors = message.split(',').map(error => {
|
|
3048
|
+
return error.split(': ').slice(1).join(': ').trim();
|
|
3049
|
+
});
|
|
3050
|
+
throw new Error(err.response?.data?.message);
|
|
3051
|
+
}
|
|
3052
|
+
throw err;
|
|
3053
3053
|
});
|
|
3054
3054
|
} else {
|
|
3055
3055
|
await api.Model.updateDocument({ model: this.currentModel, _id: this.document._id, update: data }).catch(err => {
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3056
|
+
if (err.response?.data?.message) {
|
|
3057
|
+
console.log(err.response.data);
|
|
3058
|
+
const message = err.response.data.message.split(': ').slice(1).join(': ');
|
|
3059
|
+
this.errors = message.split(',').map(error => {
|
|
3060
|
+
return error.split(': ').slice(1).join(': ').trim();
|
|
3061
|
+
});
|
|
3062
|
+
throw new Error(err.response?.data?.message);
|
|
3063
|
+
}
|
|
3064
|
+
throw err;
|
|
3065
3065
|
});
|
|
3066
3066
|
}
|
|
3067
3067
|
this.errors.length = 0;
|
|
3068
3068
|
this.$emit('update');
|
|
3069
3069
|
this.$emit('close');
|
|
3070
|
-
}
|
|
3070
|
+
}
|
|
3071
3071
|
},
|
|
3072
3072
|
mounted: function() {
|
|
3073
|
-
this.$refs.codeEditor.value =
|
|
3073
|
+
this.$refs.codeEditor.value = '{\n \n}';
|
|
3074
3074
|
this.editor = CodeMirror.fromTextArea(this.$refs.codeEditor, {
|
|
3075
3075
|
mode: 'javascript',
|
|
3076
3076
|
lineNumbers: true,
|
|
3077
3077
|
smartIndent: false
|
|
3078
3078
|
});
|
|
3079
|
-
}
|
|
3080
|
-
})
|
|
3079
|
+
}
|
|
3080
|
+
});
|
|
3081
3081
|
|
|
3082
3082
|
/***/ }),
|
|
3083
3083
|
|