@mongoosejs/studio 0.0.38 → 0.0.40
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/index.js +1 -2
- package/frontend/public/app.js +10 -65
- package/frontend/src/index.js +0 -1
- package/frontend/src/routes.js +0 -5
- package/index.d.ts +7 -0
- package/index.js +3 -0
- package/package.json +6 -6
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
exports.createChart = require('./createChart');
|
|
4
3
|
exports.createDocument = require('./createDocument')
|
|
5
4
|
exports.deleteDocument = require('./deleteDocument');
|
|
6
5
|
exports.exportQueryResults = require('./exportQueryResults');
|
|
7
6
|
exports.getDocument = require('./getDocument');
|
|
8
7
|
exports.getDocuments = require('./getDocuments');
|
|
9
8
|
exports.listModels = require('./listModels');
|
|
10
|
-
exports.updateDocument = require('./updateDocument');
|
|
9
|
+
exports.updateDocument = require('./updateDocument');
|
package/frontend/public/app.js
CHANGED
|
@@ -165,35 +165,6 @@ module.exports = app => app.component('async-button', {
|
|
|
165
165
|
|
|
166
166
|
/***/ }),
|
|
167
167
|
|
|
168
|
-
/***/ "./frontend/src/charts/charts.js":
|
|
169
|
-
/*!***************************************!*\
|
|
170
|
-
!*** ./frontend/src/charts/charts.js ***!
|
|
171
|
-
\***************************************/
|
|
172
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
173
|
-
|
|
174
|
-
"use strict";
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
178
|
-
const template = __webpack_require__(/*! ./charts.html */ "./frontend/src/charts/charts.html");
|
|
179
|
-
|
|
180
|
-
const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
|
|
181
|
-
|
|
182
|
-
appendCSS(__webpack_require__(/*! ./charts.css */ "./frontend/src/charts/charts.css"));
|
|
183
|
-
|
|
184
|
-
module.exports = app => app.component('charts', {
|
|
185
|
-
template: template,
|
|
186
|
-
data: () => ({ description: '', code: '' }),
|
|
187
|
-
methods: {
|
|
188
|
-
async createChart() {
|
|
189
|
-
const data = await api.Model.createChart({ description: this.description });
|
|
190
|
-
this.code = data.content;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
/***/ }),
|
|
196
|
-
|
|
197
168
|
/***/ "./frontend/src/create-dashboard/create-dashboard.js":
|
|
198
169
|
/*!***********************************************************!*\
|
|
199
170
|
!*** ./frontend/src/create-dashboard/create-dashboard.js ***!
|
|
@@ -753,7 +724,7 @@ module.exports = app => app.component('document-property', {
|
|
|
753
724
|
dateType: 'picker' // picker, iso
|
|
754
725
|
}
|
|
755
726
|
},
|
|
756
|
-
props: ['document', 'schemaPaths', 'editting', 'changes', 'invalid'],
|
|
727
|
+
props: ['path', 'document', 'schemaPaths', 'editting', 'changes', 'invalid'],
|
|
757
728
|
methods: {
|
|
758
729
|
getComponentForPath(schemaPath) {
|
|
759
730
|
if (schemaPath.instance === 'Array') {
|
|
@@ -1673,9 +1644,8 @@ module.exports = app => app.component('models', {
|
|
|
1673
1644
|
} else {
|
|
1674
1645
|
this.filter = {};
|
|
1675
1646
|
delete this.query.search;
|
|
1676
|
-
this.$router.push({ query: this.query });
|
|
1677
1647
|
}
|
|
1678
|
-
await this.loadMoreDocuments();
|
|
1648
|
+
await this.loadMoreDocuments(true);
|
|
1679
1649
|
},
|
|
1680
1650
|
async getDocuments() {
|
|
1681
1651
|
const { docs, schemaPaths, numDocs } = await api.Model.getDocuments({
|
|
@@ -1707,7 +1677,7 @@ module.exports = app => app.component('models', {
|
|
|
1707
1677
|
this.filteredPaths = [...this.schemaPaths];
|
|
1708
1678
|
this.selectedPaths = [...this.schemaPaths];
|
|
1709
1679
|
},
|
|
1710
|
-
async loadMoreDocuments() {
|
|
1680
|
+
async loadMoreDocuments(updateQuery) {
|
|
1711
1681
|
const { docs } = await api.Model.getDocuments({
|
|
1712
1682
|
model: this.currentModel,
|
|
1713
1683
|
filter: this.filter,
|
|
@@ -1718,6 +1688,9 @@ module.exports = app => app.component('models', {
|
|
|
1718
1688
|
if (docs.length < limit) {
|
|
1719
1689
|
this.loadedAllDocs = true;
|
|
1720
1690
|
}
|
|
1691
|
+
if (updateQuery) {
|
|
1692
|
+
this.$router.push({ query: this.query });
|
|
1693
|
+
}
|
|
1721
1694
|
},
|
|
1722
1695
|
addOrRemove(path) {
|
|
1723
1696
|
const exists = this.selectedPaths.findIndex(x => x.path == path.path);
|
|
@@ -1841,11 +1814,6 @@ module.exports = [
|
|
|
1841
1814
|
name: 'model',
|
|
1842
1815
|
component: 'models'
|
|
1843
1816
|
},
|
|
1844
|
-
{
|
|
1845
|
-
path: '/charts',
|
|
1846
|
-
name: 'charts',
|
|
1847
|
-
component: 'charts'
|
|
1848
|
-
},
|
|
1849
1817
|
{
|
|
1850
1818
|
path: '/model/:model/document/:documentId',
|
|
1851
1819
|
name: 'document',
|
|
@@ -2476,28 +2444,6 @@ module.exports = "<button v-bind=\"attrsToBind\" :disabled=\"isDisabled\" @click
|
|
|
2476
2444
|
|
|
2477
2445
|
/***/ }),
|
|
2478
2446
|
|
|
2479
|
-
/***/ "./frontend/src/charts/charts.css":
|
|
2480
|
-
/*!****************************************!*\
|
|
2481
|
-
!*** ./frontend/src/charts/charts.css ***!
|
|
2482
|
-
\****************************************/
|
|
2483
|
-
/***/ ((module) => {
|
|
2484
|
-
|
|
2485
|
-
"use strict";
|
|
2486
|
-
module.exports = ".charts {\n padding: 10px;\n}\n\n.charts .chart-description textarea {\n width: 100%;\n height: 4em;\n border-radius: 4px;\n border: 1px solid #ddd;\n margin-top: 0.5em;\n padding: 0.5em;\n line-height: 1.5em;\n}\n\n.charts .chart-description button {\n margin-top: 0.5em;\n}";
|
|
2487
|
-
|
|
2488
|
-
/***/ }),
|
|
2489
|
-
|
|
2490
|
-
/***/ "./frontend/src/charts/charts.html":
|
|
2491
|
-
/*!*****************************************!*\
|
|
2492
|
-
!*** ./frontend/src/charts/charts.html ***!
|
|
2493
|
-
\*****************************************/
|
|
2494
|
-
/***/ ((module) => {
|
|
2495
|
-
|
|
2496
|
-
"use strict";
|
|
2497
|
-
module.exports = "<div class=\"charts\">\n <h1>Charts</h1>\n <div>\n Describe your chart\n </div>\n <div class=\"chart-description\">\n <textarea\n v-model=\"description\"\n placeholder=\"Please create a bar chart showing users createdAt per day\" />\n <div>\n <async-button @click=\"createChart\">Create Chart</async-button>\n </div>\n </div>\n</div>";
|
|
2498
|
-
|
|
2499
|
-
/***/ }),
|
|
2500
|
-
|
|
2501
2447
|
/***/ "./frontend/src/create-dashboard/create-dashboard.html":
|
|
2502
2448
|
/*!*************************************************************!*\
|
|
2503
2449
|
!*** ./frontend/src/create-dashboard/create-dashboard.html ***!
|
|
@@ -2582,7 +2528,7 @@ module.exports = "<div>\n <div v-if=\"Array.isArray(result)\">\n <div v-for=
|
|
|
2582
2528
|
/***/ ((module) => {
|
|
2583
2529
|
|
|
2584
2530
|
"use strict";
|
|
2585
|
-
module.exports = "<div class=\"dashboard px-1\">\n <div v-if=\"status === 'loading'\" class=\"max-w-5xl mx-auto text-center\">\n <img src=\"images/loader.gif\" class=\"inline\">\n </div>\n <div v-if=\"dashboard && status === 'loaded'\" class=\"max-w-5xl mx-auto\">\n <div class=\"flex items-center w-full\">\n <h2 class=\"mt-4 mb-4 text-gray-900 font-semibold text-xl grow shrink\">{{title}}</h2>\n <div>\n <button\n v-if=\"!showEditor\"\n @click=\"showEditor = true\"\n type=\"button\"\n class=\"rounded-md bg-teal-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-teal-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-teal-600\">\n <img src=\"images/edit.svg\" class=\"inline h-[1em]\" /> Edit\n </button>\n </div>\n </div>\n <div v-if=\"!showEditor\" class=\"mt-4 mb-4\">\n <dashboard-result :result=\"result\"></dashboard-result>\n </div>\n <div v-if=\"showEditor\">\n <edit-dashboard\n :dashboardId=\"dashboard._id\"\n :code=\"code\"\n :currentDescription=\"description\"\n :currentTitle=\"title\"\n @close=\"showEditor=false;\"\n @update=\"updateCode\"></edit-dashboard>\n </div>\n \n </div>\n <div v-if=\"!dashboard && status === 'loaded'\">\n No dashboard with the given id could be found.\n </div>\n</div>\n";
|
|
2531
|
+
module.exports = "<div class=\"dashboard px-1\">\n <div v-if=\"status === 'loading'\" class=\"max-w-5xl mx-auto text-center\">\n <img src=\"images/loader.gif\" class=\"inline mt-10\">\n </div>\n <div v-if=\"dashboard && status === 'loaded'\" class=\"max-w-5xl mx-auto\">\n <div class=\"flex items-center w-full\">\n <h2 class=\"mt-4 mb-4 text-gray-900 font-semibold text-xl grow shrink\">{{title}}</h2>\n <div>\n <button\n v-if=\"!showEditor\"\n @click=\"showEditor = true\"\n type=\"button\"\n class=\"rounded-md bg-teal-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-teal-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-teal-600\">\n <img src=\"images/edit.svg\" class=\"inline h-[1em]\" /> Edit\n </button>\n </div>\n </div>\n <div v-if=\"!showEditor\" class=\"mt-4 mb-4\">\n <dashboard-result :result=\"result\"></dashboard-result>\n </div>\n <div v-if=\"showEditor\">\n <edit-dashboard\n :dashboardId=\"dashboard._id\"\n :code=\"code\"\n :currentDescription=\"description\"\n :currentTitle=\"title\"\n @close=\"showEditor=false;\"\n @update=\"updateCode\"></edit-dashboard>\n </div>\n \n </div>\n <div v-if=\"!dashboard && status === 'loaded'\">\n No dashboard with the given id could be found.\n </div>\n</div>\n";
|
|
2586
2532
|
|
|
2587
2533
|
/***/ }),
|
|
2588
2534
|
|
|
@@ -2648,7 +2594,7 @@ module.exports = ".document-details {\n width: 100%;\n}\n\n.document-details .v
|
|
|
2648
2594
|
/***/ ((module) => {
|
|
2649
2595
|
|
|
2650
2596
|
"use strict";
|
|
2651
|
-
module.exports = "<div class=\"document-details\">\n <document-property\n
|
|
2597
|
+
module.exports = "<div class=\"document-details\">\n <div v-for=\"path in schemaPaths\" class=\"value\">\n <document-property\n :path=\"path\"\n :document=\"document\"\n :schemaPaths=\"schemaPaths\"\n :editting=\"editting\"\n :changes=\"changes\"\n :invalid=\"invalid\"></document-property>\n </div>\n <div v-for=\"path in virtuals\" class=\"mb-2\">\n <div class=\"p-1 mb-1 bg-slate-100\">\n {{path.name}}\n <span class=\"path-type\">\n (virtual)\n </span>\n </div>\n <div v-if=\"path.value == null\" class=\"text-sky-800\">\n {{'' + path.value}}\n </div>\n <div v-else>\n {{path.value}}\n </div>\n </div>\n</div>";
|
|
2652
2598
|
|
|
2653
2599
|
/***/ }),
|
|
2654
2600
|
|
|
@@ -2670,7 +2616,7 @@ module.exports = ".document-details {\n width: 100%;\n }\n \n .document-de
|
|
|
2670
2616
|
/***/ ((module) => {
|
|
2671
2617
|
|
|
2672
2618
|
"use strict";
|
|
2673
|
-
module.exports = "<div>\n <div
|
|
2619
|
+
module.exports = "<div>\n <div class=\"relative path-key p-1 flex\">\n <div class=\"grow\">\n {{path.path}}\n <span class=\"path-type\">\n ({{(path.instance || 'unknown').toLowerCase()}})\n </span>\n </div>\n <div v-if=\"editting && path.instance === 'Date'\" class=\"flex gap-1.5\">\n <div\n @click=\"dateType = 'picker'\"\n :class=\"dateType === 'picker' ? 'bg-teal-600' : ''\"\n class=\"self-stretch px-2 py-1 rounded-sm justify-center items-center gap-1.5 flex cursor-pointer\">\n <div\n :class=\"dateType === 'picker' ? 'text-white' : ''\"\n class=\"text-xs font-medium font-['Lato'] capitalize leading-tight\">\n Date Picker\n </div>\n </div>\n <div\n @click=\"dateType = 'iso'\"\n :class=\"dateType === 'iso' ? 'bg-teal-600' : ''\"\n class=\"self-stretch px-2 py-1 rounded-sm justify-center items-center gap-1.5 flex cursor-pointer\">\n <div\n :class=\"dateType === 'iso' ? 'text-white' : ''\"\n class=\"text-xs font-medium font-['Lato'] capitalize leading-tight\">\n ISO String\n </div>\n </div>\n </div>\n </div>\n <div v-if=\"editting && path.path !== '_id'\" class=\"pl-1\">\n <component\n :is=\"getEditComponentForPath(path)\"\n :value=\"getEditValueForPath(path)\"\n :format=\"dateType\"\n @input=\"changes[path.path] = $event; delete invalid[path.path];\"\n @error=\"invalid[path.path] = $event;\"\n >\n </component>\n </div>\n <div v-else class=\"pl-1\">\n <component :is=\"getComponentForPath(path)\" :value=\"getValueForPath(path.path)\"></component>\n </div>\n</div>";
|
|
2674
2620
|
|
|
2675
2621
|
/***/ }),
|
|
2676
2622
|
|
|
@@ -10646,7 +10592,6 @@ const app = Vue.createApp({
|
|
|
10646
10592
|
});
|
|
10647
10593
|
|
|
10648
10594
|
__webpack_require__(/*! ./async-button/async-button */ "./frontend/src/async-button/async-button.js")(app);
|
|
10649
|
-
__webpack_require__(/*! ./charts/charts */ "./frontend/src/charts/charts.js")(app);
|
|
10650
10595
|
__webpack_require__(/*! ./create-dashboard/create-dashboard */ "./frontend/src/create-dashboard/create-dashboard.js")(app);
|
|
10651
10596
|
__webpack_require__(/*! ./create-document/create-document */ "./frontend/src/create-document/create-document.js")(app);
|
|
10652
10597
|
__webpack_require__(/*! ./dashboards/dashboards */ "./frontend/src/dashboards/dashboards.js")(app);
|
|
@@ -10689,7 +10634,7 @@ app.component('app-component', {
|
|
|
10689
10634
|
`,
|
|
10690
10635
|
errorCaptured(err) {
|
|
10691
10636
|
vanillatoasts.create({
|
|
10692
|
-
title: `Error: ${err.message}`,
|
|
10637
|
+
title: `Error: ${err.response?.data?.message || err.message}`,
|
|
10693
10638
|
icon: 'images/failure.jpg',
|
|
10694
10639
|
timeout: 10000,
|
|
10695
10640
|
positionClass: 'bottomRight'
|
package/frontend/src/index.js
CHANGED
|
@@ -11,7 +11,6 @@ const app = Vue.createApp({
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
require('./async-button/async-button')(app);
|
|
14
|
-
require('./charts/charts')(app);
|
|
15
14
|
require('./create-dashboard/create-dashboard')(app);
|
|
16
15
|
require('./create-document/create-document')(app);
|
|
17
16
|
require('./dashboards/dashboards')(app);
|
package/frontend/src/routes.js
CHANGED
package/index.d.ts
ADDED
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongoosejs/studio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"archetype": "0.13.0",
|
|
6
6
|
"csv-stringify": "6.3.0",
|
|
7
7
|
"ejson": "^2.2.3",
|
|
8
8
|
"extrovert": "0.0.24",
|
|
9
9
|
"node-inspect-extracted": "3.x",
|
|
10
|
-
"
|
|
10
|
+
"tailwindcss": "3.4.0",
|
|
11
|
+
"vanillatoasts": "^1.6.0",
|
|
12
|
+
"vue": "3.x",
|
|
13
|
+
"webpack": "5.x"
|
|
11
14
|
},
|
|
12
15
|
"peerDependencies": {
|
|
13
16
|
"bson": "^5.5.1 || 6.x",
|
|
@@ -18,10 +21,7 @@
|
|
|
18
21
|
"axios": "1.2.2",
|
|
19
22
|
"express": "4.x",
|
|
20
23
|
"mocha": "10.2.0",
|
|
21
|
-
"mongoose": "8.x"
|
|
22
|
-
"tailwindcss": "3.4.0",
|
|
23
|
-
"vue": "3.x",
|
|
24
|
-
"webpack": "5.75.0"
|
|
24
|
+
"mongoose": "8.x"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"tailwind": "tailwindcss -o ./frontend/public/tw.css",
|