@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/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,24 +1005,29 @@ 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';
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1016
|
+
try {
|
|
1017
|
+
const { doc, result, error } = await api.Dashboard.updateDashboard({
|
|
1018
|
+
dashboardId: this.dashboardId,
|
|
1019
|
+
code: this.editor.getValue(),
|
|
1020
|
+
title: this.title,
|
|
1021
|
+
description: this.description
|
|
1022
|
+
});
|
|
1023
|
+
this.$emit('update', { doc, result, error });
|
|
1024
|
+
this.editor.setValue(doc.code);
|
|
1025
|
+
this.closeEditor();
|
|
1026
|
+
} catch (err) {
|
|
1027
|
+
this.$emit('update', { error: { message: err.message } });
|
|
1028
|
+
} finally {
|
|
1029
|
+
this.status = 'loaded';
|
|
1030
|
+
}
|
|
1026
1031
|
}
|
|
1027
1032
|
},
|
|
1028
1033
|
mounted: async function() {
|
|
@@ -1035,7 +1040,7 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
1035
1040
|
indentWithTabs: true,
|
|
1036
1041
|
cursorBlinkRate: 300,
|
|
1037
1042
|
lineWrapping: true,
|
|
1038
|
-
showCursorWhenSelecting: true
|
|
1043
|
+
showCursorWhenSelecting: true
|
|
1039
1044
|
});
|
|
1040
1045
|
// this.editor.focus();
|
|
1041
1046
|
// this.editor.refresh(); // if anything weird happens on load, this usually fixes it. However, this breaks it in this case.
|
|
@@ -1087,7 +1092,7 @@ module.exports = app => app.component('dashboards', {
|
|
|
1087
1092
|
const { dashboards } = await api.Dashboard.getDashboards();
|
|
1088
1093
|
this.dashboards = dashboards;
|
|
1089
1094
|
this.status = 'loaded';
|
|
1090
|
-
}
|
|
1095
|
+
}
|
|
1091
1096
|
});
|
|
1092
1097
|
|
|
1093
1098
|
|
|
@@ -1162,7 +1167,7 @@ module.exports = app => app.component('detail-default', {
|
|
|
1162
1167
|
|
|
1163
1168
|
|
|
1164
1169
|
const mpath = __webpack_require__(/*! mpath */ "./node_modules/mpath/index.js");
|
|
1165
|
-
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");
|
|
1166
1171
|
|
|
1167
1172
|
const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
|
|
1168
1173
|
|
|
@@ -1189,9 +1194,9 @@ module.exports = app => app.component('document-details', {
|
|
|
1189
1194
|
}
|
|
1190
1195
|
|
|
1191
1196
|
return result;
|
|
1192
|
-
}
|
|
1197
|
+
}
|
|
1193
1198
|
}
|
|
1194
|
-
})
|
|
1199
|
+
});
|
|
1195
1200
|
|
|
1196
1201
|
/***/ }),
|
|
1197
1202
|
|
|
@@ -1205,7 +1210,7 @@ module.exports = app => app.component('document-details', {
|
|
|
1205
1210
|
|
|
1206
1211
|
|
|
1207
1212
|
const mpath = __webpack_require__(/*! mpath */ "./node_modules/mpath/index.js");
|
|
1208
|
-
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");
|
|
1209
1214
|
|
|
1210
1215
|
const appendCSS = __webpack_require__(/*! ../../appendCSS */ "./frontend/src/appendCSS.js");
|
|
1211
1216
|
|
|
@@ -1216,7 +1221,7 @@ module.exports = app => app.component('document-property', {
|
|
|
1216
1221
|
data: function() {
|
|
1217
1222
|
return {
|
|
1218
1223
|
dateType: 'picker' // picker, iso
|
|
1219
|
-
}
|
|
1224
|
+
};
|
|
1220
1225
|
},
|
|
1221
1226
|
props: ['path', 'document', 'schemaPaths', 'editting', 'changes', 'invalid'],
|
|
1222
1227
|
methods: {
|
|
@@ -1257,7 +1262,7 @@ module.exports = app => app.component('document-property', {
|
|
|
1257
1262
|
return path in this.changes ? this.changes[path] : mpath.get(path, this.document);
|
|
1258
1263
|
}
|
|
1259
1264
|
}
|
|
1260
|
-
})
|
|
1265
|
+
});
|
|
1261
1266
|
|
|
1262
1267
|
/***/ }),
|
|
1263
1268
|
|
|
@@ -1282,10 +1287,10 @@ module.exports = app => app.component('confirm-changes', {
|
|
|
1282
1287
|
},
|
|
1283
1288
|
methods: {
|
|
1284
1289
|
closeConfirm() {
|
|
1285
|
-
|
|
1290
|
+
this.$emit('close');
|
|
1286
1291
|
},
|
|
1287
1292
|
startSave() {
|
|
1288
|
-
|
|
1293
|
+
this.$emit('save');
|
|
1289
1294
|
}
|
|
1290
1295
|
},
|
|
1291
1296
|
mounted() {
|
|
@@ -1316,10 +1321,10 @@ module.exports = app => app.component('confirm-delete', {
|
|
|
1316
1321
|
},
|
|
1317
1322
|
methods: {
|
|
1318
1323
|
closeDelete() {
|
|
1319
|
-
|
|
1324
|
+
this.$emit('close');
|
|
1320
1325
|
},
|
|
1321
1326
|
startDelete() {
|
|
1322
|
-
|
|
1327
|
+
this.$emit('remove');
|
|
1323
1328
|
}
|
|
1324
1329
|
},
|
|
1325
1330
|
mounted() {
|
|
@@ -1422,11 +1427,11 @@ module.exports = app => app.component('document', {
|
|
|
1422
1427
|
timeout: 3000,
|
|
1423
1428
|
positionClass: 'bottomRight'
|
|
1424
1429
|
});
|
|
1425
|
-
this.$router.push({ path: `/model/${this.model}`});
|
|
1430
|
+
this.$router.push({ path: `/model/${this.model}` });
|
|
1426
1431
|
}
|
|
1427
1432
|
},
|
|
1428
1433
|
showClonedDocument(doc) {
|
|
1429
|
-
this.$router.push({ path: `/model/${this.model}/document/${doc._id}`});
|
|
1434
|
+
this.$router.push({ path: `/model/${this.model}/document/${doc._id}` });
|
|
1430
1435
|
}
|
|
1431
1436
|
}
|
|
1432
1437
|
});
|
|
@@ -1448,7 +1453,7 @@ const template = __webpack_require__(/*! ./edit-array.html */ "./frontend/src/ed
|
|
|
1448
1453
|
const { BSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
1449
1454
|
|
|
1450
1455
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
1451
|
-
apply
|
|
1456
|
+
apply(target, thisArg, argumentsList) {
|
|
1452
1457
|
return new target(...argumentsList);
|
|
1453
1458
|
}
|
|
1454
1459
|
});
|
|
@@ -1642,7 +1647,7 @@ const template = __webpack_require__(/*! ./edit-subdocument.html */ "./frontend/
|
|
|
1642
1647
|
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
1643
1648
|
|
|
1644
1649
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
1645
|
-
apply
|
|
1650
|
+
apply(target, thisArg, argumentsList) {
|
|
1646
1651
|
return new target(...argumentsList);
|
|
1647
1652
|
}
|
|
1648
1653
|
});
|
|
@@ -1809,7 +1814,9 @@ app.component('app-component', {
|
|
|
1809
1814
|
window.state = this;
|
|
1810
1815
|
|
|
1811
1816
|
if (mothership.hasAPIKey) {
|
|
1812
|
-
const
|
|
1817
|
+
const hash = window.location.hash.replace(/^#?\/?\??/, '') || '';
|
|
1818
|
+
const hashQuery = hash.split('?')[1] || '';
|
|
1819
|
+
const hashParams = new URLSearchParams(hashQuery);
|
|
1813
1820
|
if (hashParams.has('code')) {
|
|
1814
1821
|
const code = hashParams.get('code');
|
|
1815
1822
|
const provider = hashParams.get('provider');
|
|
@@ -1934,7 +1941,7 @@ module.exports = app => app.component('list-default', {
|
|
|
1934
1941
|
copyText(value) {
|
|
1935
1942
|
const storage = document.createElement('textarea');
|
|
1936
1943
|
storage.value = value;
|
|
1937
|
-
const elem = this.$refs.itemData
|
|
1944
|
+
const elem = this.$refs.itemData;
|
|
1938
1945
|
elem.appendChild(storage);
|
|
1939
1946
|
storage.select();
|
|
1940
1947
|
storage.setSelectionRange(0, 99999);
|
|
@@ -1949,7 +1956,7 @@ module.exports = app => app.component('list-default', {
|
|
|
1949
1956
|
});
|
|
1950
1957
|
},
|
|
1951
1958
|
goToDoc(id) {
|
|
1952
|
-
this.$router.push({ path: `/model/${this.allude}/document/${id}`});
|
|
1959
|
+
this.$router.push({ path: `/model/${this.allude}/document/${id}` });
|
|
1953
1960
|
}
|
|
1954
1961
|
},
|
|
1955
1962
|
computed: {
|
|
@@ -1961,7 +1968,7 @@ module.exports = app => app.component('list-default', {
|
|
|
1961
1968
|
return 'undefined';
|
|
1962
1969
|
}
|
|
1963
1970
|
if (this.value.length > 30) {
|
|
1964
|
-
return this.value.substring(0,30) + '...';
|
|
1971
|
+
return this.value.substring(0, 30) + '...';
|
|
1965
1972
|
}
|
|
1966
1973
|
return this.value;
|
|
1967
1974
|
},
|
|
@@ -2217,7 +2224,7 @@ const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib
|
|
|
2217
2224
|
|
|
2218
2225
|
|
|
2219
2226
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
2220
|
-
apply
|
|
2227
|
+
apply(target, thisArg, argumentsList) {
|
|
2221
2228
|
return new target(...argumentsList);
|
|
2222
2229
|
}
|
|
2223
2230
|
});
|
|
@@ -2295,7 +2302,7 @@ module.exports = app => app.component('models', {
|
|
|
2295
2302
|
}
|
|
2296
2303
|
if (this.$route.query?.fields) {
|
|
2297
2304
|
const filter = this.$route.query.fields.split(',');
|
|
2298
|
-
this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path))
|
|
2305
|
+
this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path));
|
|
2299
2306
|
}
|
|
2300
2307
|
|
|
2301
2308
|
|
|
@@ -2330,7 +2337,7 @@ module.exports = app => app.component('models', {
|
|
|
2330
2337
|
|
|
2331
2338
|
this.$nextTick(() => {
|
|
2332
2339
|
const input = this.$refs.searchInput;
|
|
2333
|
-
const cursorIndex = this.searchText.lastIndexOf(
|
|
2340
|
+
const cursorIndex = this.searchText.lastIndexOf(':') + 2; // Move cursor after ": "
|
|
2334
2341
|
|
|
2335
2342
|
input.focus();
|
|
2336
2343
|
input.setSelectionRange(cursorIndex, cursorIndex);
|
|
@@ -2345,7 +2352,7 @@ module.exports = app => app.component('models', {
|
|
|
2345
2352
|
},
|
|
2346
2353
|
filterDocument(doc) {
|
|
2347
2354
|
const filteredDoc = {};
|
|
2348
|
-
console.log(doc, this.filteredPaths)
|
|
2355
|
+
console.log(doc, this.filteredPaths);
|
|
2349
2356
|
for (let i = 0; i < this.filteredPaths.length; i++) {
|
|
2350
2357
|
filteredDoc[this.filteredPaths[i].path] = doc[this.filteredPaths[i].path];
|
|
2351
2358
|
}
|
|
@@ -2384,7 +2391,7 @@ module.exports = app => app.component('models', {
|
|
|
2384
2391
|
}
|
|
2385
2392
|
if (!sorted) {
|
|
2386
2393
|
this.sortBy[path] = num;
|
|
2387
|
-
this.query.sort = `{${path}:${num}}
|
|
2394
|
+
this.query.sort = `{${path}:${num}}`;
|
|
2388
2395
|
this.$router.push({ query: this.query });
|
|
2389
2396
|
}
|
|
2390
2397
|
await this.loadMoreDocuments();
|
|
@@ -2410,11 +2417,11 @@ module.exports = app => app.component('models', {
|
|
|
2410
2417
|
},
|
|
2411
2418
|
checkIndexLocation(indexName) {
|
|
2412
2419
|
if (this.schemaIndexes.find(x => x.name == indexName) && this.mongoDBIndexes.find(x => x.name == indexName)) {
|
|
2413
|
-
return 'text-gray-500'
|
|
2420
|
+
return 'text-gray-500';
|
|
2414
2421
|
} else if (this.schemaIndexes.find(x => x.name == indexName)) {
|
|
2415
|
-
return 'text-forest-green-500'
|
|
2422
|
+
return 'text-forest-green-500';
|
|
2416
2423
|
} else {
|
|
2417
|
-
return 'text-valencia-500'
|
|
2424
|
+
return 'text-valencia-500';
|
|
2418
2425
|
}
|
|
2419
2426
|
},
|
|
2420
2427
|
async getDocuments() {
|
|
@@ -2478,7 +2485,7 @@ module.exports = app => app.component('models', {
|
|
|
2478
2485
|
openFieldSelection() {
|
|
2479
2486
|
if (this.$route.query?.fields) {
|
|
2480
2487
|
this.selectedPaths.length = 0;
|
|
2481
|
-
console.log('there are fields in play', this.$route.query.fields)
|
|
2488
|
+
console.log('there are fields in play', this.$route.query.fields);
|
|
2482
2489
|
const fields = this.$route.query.fields.split(',');
|
|
2483
2490
|
for (let i = 0; i < fields.length; i++) {
|
|
2484
2491
|
this.selectedPaths.push({ path: fields[i] });
|
|
@@ -2551,7 +2558,7 @@ module.exports = app => app.component('models', {
|
|
|
2551
2558
|
handleDocumentClick(document) {
|
|
2552
2559
|
console.log(this.selectedDocuments);
|
|
2553
2560
|
if (this.selectMultiple) {
|
|
2554
|
-
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());
|
|
2555
2562
|
if (exists) {
|
|
2556
2563
|
const index = this.selectedDocuments.findIndex(x => x._id.toString() == document._id.toString());
|
|
2557
2564
|
if (index !== -1) {
|
|
@@ -2561,7 +2568,7 @@ module.exports = app => app.component('models', {
|
|
|
2561
2568
|
this.selectedDocuments.push(document);
|
|
2562
2569
|
}
|
|
2563
2570
|
} else {
|
|
2564
|
-
|
|
2571
|
+
this.$router.push('/model/' + this.currentModel + '/document/' + document._id);
|
|
2565
2572
|
}
|
|
2566
2573
|
},
|
|
2567
2574
|
async deleteDocuments() {
|
|
@@ -2674,7 +2681,7 @@ exports.hasAPIKey = client.hasAPIKey;
|
|
|
2674
2681
|
const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
2675
2682
|
const mothership = __webpack_require__(/*! ../mothership */ "./frontend/src/mothership.js");
|
|
2676
2683
|
const template = __webpack_require__(/*! ./navbar.html */ "./frontend/src/navbar/navbar.html");
|
|
2677
|
-
const
|
|
2684
|
+
const { routes, hasAccess } = __webpack_require__(/*! ../routes */ "./frontend/src/routes.js");
|
|
2678
2685
|
|
|
2679
2686
|
const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
|
|
2680
2687
|
|
|
@@ -2696,7 +2703,7 @@ module.exports = app => app.component('navbar', {
|
|
|
2696
2703
|
},
|
|
2697
2704
|
computed: {
|
|
2698
2705
|
dashboardView() {
|
|
2699
|
-
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);
|
|
2700
2707
|
},
|
|
2701
2708
|
documentView() {
|
|
2702
2709
|
return ['root', 'model', 'document'].includes(this.$route.name);
|
|
@@ -2737,7 +2744,7 @@ module.exports = app => app.component('navbar', {
|
|
|
2737
2744
|
logout() {
|
|
2738
2745
|
window.localStorage.setItem('_mongooseStudioAccessToken', '');
|
|
2739
2746
|
window.location.reload();
|
|
2740
|
-
}
|
|
2747
|
+
}
|
|
2741
2748
|
},
|
|
2742
2749
|
directives: {
|
|
2743
2750
|
clickOutside: {
|
|
@@ -3008,7 +3015,7 @@ const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
|
3008
3015
|
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
3009
3016
|
|
|
3010
3017
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
3011
|
-
apply
|
|
3018
|
+
apply(target, thisArg, argumentsList) {
|
|
3012
3019
|
return new target(...argumentsList);
|
|
3013
3020
|
}
|
|
3014
3021
|
});
|
|
@@ -3017,7 +3024,7 @@ const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/append
|
|
|
3017
3024
|
|
|
3018
3025
|
appendCSS(__webpack_require__(/*! ./update-document.css */ "./frontend/src/update-document/update-document.css"));
|
|
3019
3026
|
|
|
3020
|
-
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");
|
|
3021
3028
|
|
|
3022
3029
|
module.exports = app => app.component('update-document', {
|
|
3023
3030
|
props: ['currentModel', 'document', 'multiple'],
|
|
@@ -3026,7 +3033,7 @@ module.exports = app => app.component('update-document', {
|
|
|
3026
3033
|
return {
|
|
3027
3034
|
editor: null,
|
|
3028
3035
|
errors: []
|
|
3029
|
-
}
|
|
3036
|
+
};
|
|
3030
3037
|
},
|
|
3031
3038
|
methods: {
|
|
3032
3039
|
async updateDocument() {
|
|
@@ -3034,43 +3041,43 @@ module.exports = app => app.component('update-document', {
|
|
|
3034
3041
|
if (this.multiple) {
|
|
3035
3042
|
const ids = this.document.map(x => x._id);
|
|
3036
3043
|
await api.Model.updateDocuments({ model: this.currentModel, _id: ids, update: data }).catch(err => {
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
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;
|
|
3046
3053
|
});
|
|
3047
3054
|
} else {
|
|
3048
3055
|
await api.Model.updateDocument({ model: this.currentModel, _id: this.document._id, update: data }).catch(err => {
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
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;
|
|
3058
3065
|
});
|
|
3059
3066
|
}
|
|
3060
3067
|
this.errors.length = 0;
|
|
3061
3068
|
this.$emit('update');
|
|
3062
3069
|
this.$emit('close');
|
|
3063
|
-
}
|
|
3070
|
+
}
|
|
3064
3071
|
},
|
|
3065
3072
|
mounted: function() {
|
|
3066
|
-
this.$refs.codeEditor.value =
|
|
3073
|
+
this.$refs.codeEditor.value = '{\n \n}';
|
|
3067
3074
|
this.editor = CodeMirror.fromTextArea(this.$refs.codeEditor, {
|
|
3068
3075
|
mode: 'javascript',
|
|
3069
3076
|
lineNumbers: true,
|
|
3070
3077
|
smartIndent: false
|
|
3071
3078
|
});
|
|
3072
|
-
}
|
|
3073
|
-
})
|
|
3079
|
+
}
|
|
3080
|
+
});
|
|
3074
3081
|
|
|
3075
3082
|
/***/ }),
|
|
3076
3083
|
|