@mongoosejs/studio 0.0.117 → 0.0.119
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/Dashboard/getDashboard.js +16 -3
- package/backend/actions/Dashboard/updateDashboard.js +2 -9
- package/frontend/public/app.js +58 -20
- package/frontend/public/tw.css +18 -16
- package/frontend/src/dashboard/dashboard.html +19 -15
- package/frontend/src/dashboard/dashboard.js +3 -13
- package/frontend/src/dashboard/edit-dashboard/edit-dashboard.js +5 -5
- package/frontend/src/dashboard-result/dashboard-grid/dashboard-grid.html +9 -0
- package/frontend/src/dashboard-result/dashboard-grid/dashboard-grid.js +20 -0
- package/frontend/src/dashboard-result/dashboard-result.js +3 -0
- package/package.json +1 -1
|
@@ -38,7 +38,19 @@ module.exports = ({ db }) => async function getDashboard(params) {
|
|
|
38
38
|
try {
|
|
39
39
|
result = await dashboard.evaluate();
|
|
40
40
|
} catch (error) {
|
|
41
|
-
|
|
41
|
+
const { dashboardResult } = await startExec.then(({ dashboardResult }) => {
|
|
42
|
+
if (!dashboardResult) {
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
return completeDashboardEvaluate(
|
|
46
|
+
dashboardResult._id,
|
|
47
|
+
$workspaceId,
|
|
48
|
+
authorization,
|
|
49
|
+
null,
|
|
50
|
+
{ message: error.message }
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
return { dashboard, dashboardResult, error: { message: error.message } };
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
try {
|
|
@@ -64,7 +76,7 @@ module.exports = ({ db }) => async function getDashboard(params) {
|
|
|
64
76
|
}
|
|
65
77
|
};
|
|
66
78
|
|
|
67
|
-
async function completeDashboardEvaluate(dashboardResultId, workspaceId, authorization, result) {
|
|
79
|
+
async function completeDashboardEvaluate(dashboardResultId, workspaceId, authorization, result, error) {
|
|
68
80
|
if (!workspaceId) {
|
|
69
81
|
return {};
|
|
70
82
|
}
|
|
@@ -79,7 +91,8 @@ async function completeDashboardEvaluate(dashboardResultId, workspaceId, authori
|
|
|
79
91
|
dashboardResultId,
|
|
80
92
|
workspaceId,
|
|
81
93
|
finishedEvaluatingAt: new Date(),
|
|
82
|
-
result
|
|
94
|
+
result,
|
|
95
|
+
error
|
|
83
96
|
})
|
|
84
97
|
}).then(response => {
|
|
85
98
|
if (response.status < 200 || response.status >= 400) {
|
|
@@ -24,7 +24,7 @@ const UpdateDashboardParams = new Archetype({
|
|
|
24
24
|
}).compile('UpdateDashboardParams');
|
|
25
25
|
|
|
26
26
|
module.exports = ({ db }) => async function updateDashboard(params) {
|
|
27
|
-
const { dashboardId, code, title, description, roles } = new UpdateDashboardParams(params);
|
|
27
|
+
const { dashboardId, code, title, description, roles, evaluate } = new UpdateDashboardParams(params);
|
|
28
28
|
|
|
29
29
|
const Dashboard = db.models['__Studio_Dashboard'];
|
|
30
30
|
|
|
@@ -43,12 +43,5 @@ module.exports = ({ db }) => async function updateDashboard(params) {
|
|
|
43
43
|
const doc = await Dashboard.
|
|
44
44
|
findByIdAndUpdate(dashboardId, updateObj, { sanitizeFilter: true, returnDocument: 'after', overwriteImmutable: true });
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
result = await doc.evaluate();
|
|
49
|
-
} catch (error) {
|
|
50
|
-
return { doc, error: { message: error.message } };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return { doc, result };
|
|
46
|
+
return { doc };
|
|
54
47
|
};
|
package/frontend/public/app.js
CHANGED
|
@@ -1018,6 +1018,37 @@ module.exports = app => app.component('dashboard-document', {
|
|
|
1018
1018
|
});
|
|
1019
1019
|
|
|
1020
1020
|
|
|
1021
|
+
/***/ }),
|
|
1022
|
+
|
|
1023
|
+
/***/ "./frontend/src/dashboard-result/dashboard-grid/dashboard-grid.js":
|
|
1024
|
+
/*!************************************************************************!*\
|
|
1025
|
+
!*** ./frontend/src/dashboard-result/dashboard-grid/dashboard-grid.js ***!
|
|
1026
|
+
\************************************************************************/
|
|
1027
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1028
|
+
|
|
1029
|
+
"use strict";
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
const template = __webpack_require__(/*! ./dashboard-grid.html */ "./frontend/src/dashboard-result/dashboard-grid/dashboard-grid.html");
|
|
1033
|
+
|
|
1034
|
+
module.exports = app => app.component('dashboard-grid', {
|
|
1035
|
+
template: template,
|
|
1036
|
+
props: ['value'],
|
|
1037
|
+
computed: {
|
|
1038
|
+
columns() {
|
|
1039
|
+
const grid = this.value && this.value.$grid;
|
|
1040
|
+
if (!Array.isArray(grid) || grid.length === 0) {
|
|
1041
|
+
return 1;
|
|
1042
|
+
}
|
|
1043
|
+
return Math.max(1, ...grid.map(row => Array.isArray(row) ? row.length : 0));
|
|
1044
|
+
},
|
|
1045
|
+
gridTemplateColumns() {
|
|
1046
|
+
return `repeat(${this.columns}, minmax(0, 1fr))`;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
|
|
1021
1052
|
/***/ }),
|
|
1022
1053
|
|
|
1023
1054
|
/***/ "./frontend/src/dashboard-result/dashboard-map/dashboard-map.js":
|
|
@@ -1139,6 +1170,9 @@ module.exports = app => app.component('dashboard-result', {
|
|
|
1139
1170
|
if (value.$text) {
|
|
1140
1171
|
return 'dashboard-text';
|
|
1141
1172
|
}
|
|
1173
|
+
if (value.$grid) {
|
|
1174
|
+
return 'dashboard-grid';
|
|
1175
|
+
}
|
|
1142
1176
|
}
|
|
1143
1177
|
}
|
|
1144
1178
|
});
|
|
@@ -1201,17 +1235,13 @@ module.exports = app => app.component('dashboard', {
|
|
|
1201
1235
|
this.code = update.doc.code;
|
|
1202
1236
|
this.title = update.doc.title;
|
|
1203
1237
|
this.description = update.doc.description;
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
} else {
|
|
1207
|
-
this.errorMessage = update.error.message;
|
|
1208
|
-
}
|
|
1238
|
+
|
|
1239
|
+
await this.evaluateDashboard();
|
|
1209
1240
|
},
|
|
1210
1241
|
async evaluateDashboard() {
|
|
1211
1242
|
this.status = 'evaluating';
|
|
1212
|
-
this.errorMessage = null;
|
|
1213
1243
|
try {
|
|
1214
|
-
const { dashboard, dashboardResult
|
|
1244
|
+
const { dashboard, dashboardResult } = await api.Dashboard.getDashboard({ dashboardId: this.dashboardId, evaluate: true });
|
|
1215
1245
|
this.dashboard = dashboard;
|
|
1216
1246
|
this.code = this.dashboard.code;
|
|
1217
1247
|
this.title = this.dashboard.title;
|
|
@@ -1219,9 +1249,6 @@ module.exports = app => app.component('dashboard', {
|
|
|
1219
1249
|
if (dashboardResult) {
|
|
1220
1250
|
this.dashboardResults.unshift(dashboardResult);
|
|
1221
1251
|
}
|
|
1222
|
-
if (error) {
|
|
1223
|
-
this.errorMessage = error.message;
|
|
1224
|
-
}
|
|
1225
1252
|
} finally {
|
|
1226
1253
|
this.status = 'loaded';
|
|
1227
1254
|
}
|
|
@@ -1239,9 +1266,6 @@ module.exports = app => app.component('dashboard', {
|
|
|
1239
1266
|
return;
|
|
1240
1267
|
}
|
|
1241
1268
|
this.dashboard = dashboard;
|
|
1242
|
-
if (error) {
|
|
1243
|
-
this.errorMessage = error.message;
|
|
1244
|
-
}
|
|
1245
1269
|
this.code = this.dashboard.code;
|
|
1246
1270
|
this.title = this.dashboard.title;
|
|
1247
1271
|
this.description = this.dashboard.description ?? '';
|
|
@@ -1268,7 +1292,7 @@ const template = __webpack_require__(/*! ./edit-dashboard.html */ "./frontend/sr
|
|
|
1268
1292
|
module.exports = app => app.component('edit-dashboard', {
|
|
1269
1293
|
template: template,
|
|
1270
1294
|
props: ['dashboardId', 'code', 'currentDescription', 'currentTitle'],
|
|
1271
|
-
emits: ['close'
|
|
1295
|
+
emits: ['close'],
|
|
1272
1296
|
data: function() {
|
|
1273
1297
|
return {
|
|
1274
1298
|
status: 'loaded',
|
|
@@ -1282,16 +1306,16 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
1282
1306
|
this.$emit('close');
|
|
1283
1307
|
},
|
|
1284
1308
|
async updateCode() {
|
|
1285
|
-
this.$emit('clearError');
|
|
1286
1309
|
this.status = 'loading';
|
|
1287
1310
|
try {
|
|
1288
|
-
const { doc
|
|
1311
|
+
const { doc } = await api.Dashboard.updateDashboard({
|
|
1289
1312
|
dashboardId: this.dashboardId,
|
|
1290
1313
|
code: this.editor.getValue(),
|
|
1291
1314
|
title: this.title,
|
|
1292
|
-
description: this.description
|
|
1315
|
+
description: this.description,
|
|
1316
|
+
evaluate: false
|
|
1293
1317
|
});
|
|
1294
|
-
this.$emit('update', { doc
|
|
1318
|
+
this.$emit('update', { doc });
|
|
1295
1319
|
this.editor.setValue(doc.code);
|
|
1296
1320
|
this.closeEditor();
|
|
1297
1321
|
} catch (err) {
|
|
@@ -3449,6 +3473,9 @@ var map = {
|
|
|
3449
3473
|
"./dashboard-result/dashboard-document/dashboard-document": "./frontend/src/dashboard-result/dashboard-document/dashboard-document.js",
|
|
3450
3474
|
"./dashboard-result/dashboard-document/dashboard-document.html": "./frontend/src/dashboard-result/dashboard-document/dashboard-document.html",
|
|
3451
3475
|
"./dashboard-result/dashboard-document/dashboard-document.js": "./frontend/src/dashboard-result/dashboard-document/dashboard-document.js",
|
|
3476
|
+
"./dashboard-result/dashboard-grid/dashboard-grid": "./frontend/src/dashboard-result/dashboard-grid/dashboard-grid.js",
|
|
3477
|
+
"./dashboard-result/dashboard-grid/dashboard-grid.html": "./frontend/src/dashboard-result/dashboard-grid/dashboard-grid.html",
|
|
3478
|
+
"./dashboard-result/dashboard-grid/dashboard-grid.js": "./frontend/src/dashboard-result/dashboard-grid/dashboard-grid.js",
|
|
3452
3479
|
"./dashboard-result/dashboard-map/dashboard-map": "./frontend/src/dashboard-result/dashboard-map/dashboard-map.js",
|
|
3453
3480
|
"./dashboard-result/dashboard-map/dashboard-map.html": "./frontend/src/dashboard-result/dashboard-map/dashboard-map.html",
|
|
3454
3481
|
"./dashboard-result/dashboard-map/dashboard-map.js": "./frontend/src/dashboard-result/dashboard-map/dashboard-map.js",
|
|
@@ -4316,6 +4343,17 @@ module.exports = "<div class=\"py-2\">\n <div v-if=\"header\" class=\"border-b
|
|
|
4316
4343
|
|
|
4317
4344
|
/***/ }),
|
|
4318
4345
|
|
|
4346
|
+
/***/ "./frontend/src/dashboard-result/dashboard-grid/dashboard-grid.html":
|
|
4347
|
+
/*!**************************************************************************!*\
|
|
4348
|
+
!*** ./frontend/src/dashboard-result/dashboard-grid/dashboard-grid.html ***!
|
|
4349
|
+
\**************************************************************************/
|
|
4350
|
+
/***/ ((module) => {
|
|
4351
|
+
|
|
4352
|
+
"use strict";
|
|
4353
|
+
module.exports = "<div class=\"grid gap-2\" :style=\"{ gridTemplateColumns: gridTemplateColumns }\">\n <template v-for=\"(row, rowIndex) in value.$grid\" :key=\"rowIndex\">\n <dashboard-result\n v-for=\"(cell, colIndex) in row\"\n :key=\"rowIndex + '-' + colIndex\"\n :result=\"cell\">\n </dashboard-result>\n </template>\n</div>\n";
|
|
4354
|
+
|
|
4355
|
+
/***/ }),
|
|
4356
|
+
|
|
4319
4357
|
/***/ "./frontend/src/dashboard-result/dashboard-map/dashboard-map.html":
|
|
4320
4358
|
/*!************************************************************************!*\
|
|
4321
4359
|
!*** ./frontend/src/dashboard-result/dashboard-map/dashboard-map.html ***!
|
|
@@ -4367,7 +4405,7 @@ module.exports = "<div class=\"py-2\">\n <div v-if=\"header\" class=\"border-b
|
|
|
4367
4405
|
/***/ ((module) => {
|
|
4368
4406
|
|
|
4369
4407
|
"use strict";
|
|
4370
|
-
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 !== 'loading'\" class=\"max-w-5xl mx-auto\">\n <div class=\"flex items-center w-full\" v-if=\"!showEditor\">\n <h2 class=\"mt-4 mb-4 text-gray-900 font-semibold text-xl grow shrink\">{{title}}</h2>\n <div class=\"flex gap-2\">\n <button\n @click=\"showEditor = true\"\n type=\"button\"\n :disabled=\"status === 'evaluating'\"\n class=\"flex items-center rounded-md bg-ultramarine-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-ultramarine-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ultramarine-600 disabled:cursor-not-allowed disabled:bg-gray-600\">\n <img src=\"images/edit.svg\" class=\"inline h-[1.25em] mr-1\" /> Edit\n </button>\n\n <async-button\n @click=\"evaluateDashboard\"\n type=\"button\"\n :disabled=\"status === 'evaluating'\"\n class=\"flex items-center rounded-md bg-ultramarine-600 px-4 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-ultramarine-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ultramarine-600 disabled:cursor-not-allowed disabled:bg-gray-600\"\n >\n <svg class=\"inline h-[1.25em] mr-1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"m670-140 160-100-160-100v200ZM240-600h480v-80H240v80ZM720-40q-83 0-141.5-58.5T520-240q0-83 58.5-141.5T720-440q83 0 141.5 58.5T920-240q0 83-58.5 141.5T720-40ZM120-80v-680q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v267q-19-9-39-15t-41-9v-243H200v562h243q5 31 15.5 59T486-86l-6 6-60-60-60 60-60-60-60 60-60-60-60 60Zm120-200h203q3-21 9-41t15-39H240v80Zm0-160h284q38-37 88.5-58.5T720-520H240v80Zm-40 242v-562 562Z\"/></svg>\n Evaluate\n </async-button>\n </div>\n </div>\n <div v-if=\"!showEditor\" class=\"mt-4 mb-4\">\n <div v-if=\"dashboardResults.length === 0\">\n <div class=\"flex flex-col items-center justify-center py-8\">\n <p class=\"text-gray-700 text-base mb-4\">This dashboard hasn't been evaluated yet.</p>\n <async-button\n @click=\"evaluateDashboard\"\n type=\"button\"\n :disabled=\"status === 'evaluating'\"\n class=\"rounded-md bg-ultramarine-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-ultramarine-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ultramarine-600 disabled:cursor-not-allowed disabled:bg-gray-600\"\n >\n Evaluate Dashboard\n </async-button>\n </div>\n </div>\n <div v-else>\n <div class=\"relative\">\n <
|
|
4408
|
+
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 !== 'loading'\" class=\"max-w-5xl mx-auto\">\n <div class=\"flex items-center w-full\" v-if=\"!showEditor\">\n <h2 class=\"mt-4 mb-4 text-gray-900 font-semibold text-xl grow shrink\">{{title}}</h2>\n <div class=\"flex gap-2\">\n <button\n @click=\"showEditor = true\"\n type=\"button\"\n :disabled=\"status === 'evaluating'\"\n class=\"flex items-center rounded-md bg-ultramarine-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-ultramarine-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ultramarine-600 disabled:cursor-not-allowed disabled:bg-gray-600\">\n <img src=\"images/edit.svg\" class=\"inline h-[1.25em] mr-1\" /> Edit\n </button>\n\n <async-button\n @click=\"evaluateDashboard\"\n type=\"button\"\n :disabled=\"status === 'evaluating'\"\n class=\"flex items-center rounded-md bg-ultramarine-600 px-4 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-ultramarine-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ultramarine-600 disabled:cursor-not-allowed disabled:bg-gray-600\"\n >\n <svg class=\"inline h-[1.25em] mr-1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"m670-140 160-100-160-100v200ZM240-600h480v-80H240v80ZM720-40q-83 0-141.5-58.5T520-240q0-83 58.5-141.5T720-440q83 0 141.5 58.5T920-240q0 83-58.5 141.5T720-40ZM120-80v-680q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v267q-19-9-39-15t-41-9v-243H200v562h243q5 31 15.5 59T486-86l-6 6-60-60-60 60-60-60-60 60-60-60-60 60Zm120-200h203q3-21 9-41t15-39H240v80Zm0-160h284q38-37 88.5-58.5T720-520H240v80Zm-40 242v-562 562Z\"/></svg>\n Evaluate\n </async-button>\n </div>\n </div>\n <div v-if=\"!showEditor\" class=\"mt-4 mb-4\">\n <div v-if=\"dashboardResults.length === 0\">\n <div class=\"flex flex-col items-center justify-center py-8\">\n <p class=\"text-gray-700 text-base mb-4\">This dashboard hasn't been evaluated yet.</p>\n <async-button\n @click=\"evaluateDashboard\"\n type=\"button\"\n :disabled=\"status === 'evaluating'\"\n class=\"rounded-md bg-ultramarine-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-ultramarine-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ultramarine-600 disabled:cursor-not-allowed disabled:bg-gray-600\"\n >\n Evaluate Dashboard\n </async-button>\n </div>\n </div>\n <div v-else-if=\"dashboardResult\">\n <div class=\"relative\">\n <div v-if=\"status === 'evaluating'\" class=\"absolute inset-0 flex items-center justify-center bg-white bg-opacity-60 z-10 flex flex-col gap-2\">\n <div>Evaluating Dashboard...</div>\n <img src=\"images/loader.gif\" class=\"h-12 w-12\" alt=\"Loading...\" />\n </div>\n <div v-else-if=\"dashboardResult.error\" class=\"rounded-md bg-red-50 p-4 mt-4\">\n <div class=\"flex\">\n <div class=\"flex-shrink-0\">\n <svg class=\"h-5 w-5 text-red-400\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n <path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z\" clip-rule=\"evenodd\" />\n </svg>\n </div>\n <div class=\"ml-3\">\n <h3 class=\"text-sm font-medium text-red-800\">{{dashboardResult.error.message || 'Unknown Error'}}</h3>\n </div>\n </div>\n </div>\n <dashboard-result\n v-else\n :key=\"dashboardResult.finishedEvaluatingAt\"\n :result=\"dashboardResult.result\"\n :finishedEvaluatingAt=\"dashboardResult.finishedEvaluatingAt\"\n @fullscreen=\"showDetailModal = true\"\n class=\"h-[40vh]\"\n >\n </dashboard-result>\n </div>\n </div>\n </div>\n <div v-if=\"showEditor\" class=\"mt-4\">\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 !== 'loading'\">\n No dashboard with the given id could be found.\n </div>\n</div>\n\n<modal\n v-if=\"showDetailModal\"\n containerClass=\"!h-[90vh] !w-[90vw]\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Dashboard Details\"\n>\n <template #body>\n <div class=\"absolute font-mono right-1 top-1 cursor-pointer text-xl\" @click=\"showDetailModal = false;\" role=\"button\" aria-label=\"Close modal\">×</div>\n <div class=\"h-full overflow-auto\">\n <dashboard-result\n v-if=\"dashboardResult\"\n :result=\"dashboardResult.result\"\n :finishedEvaluatingAt=\"dashboardResult.finishedEvaluatingAt\"\n :fullscreen=\"true\"\n :responsive=\"true\">\n </dashboard-result>\n </div>\n </template>\n</modal>\n";
|
|
4371
4409
|
|
|
4372
4410
|
/***/ }),
|
|
4373
4411
|
|
|
@@ -14881,7 +14919,7 @@ var bson = /*#__PURE__*/Object.freeze({
|
|
|
14881
14919
|
/***/ ((module) => {
|
|
14882
14920
|
|
|
14883
14921
|
"use strict";
|
|
14884
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.0.
|
|
14922
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.0.119","description":"A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.","homepage":"https://studio.mongoosejs.io/","repository":{"type":"git","url":"https://github.com/mongoosejs/studio"},"dependencies":{"archetype":"0.13.1","csv-stringify":"6.3.0","ejson":"^2.2.3","extrovert":"0.0.26","marked":"15.0.12","node-inspect-extracted":"3.x","tailwindcss":"3.4.0","vanillatoasts":"^1.6.0","vue":"3.x","webpack":"5.x"},"peerDependencies":{"bson":"^5.5.1 || 6.x","express":"4.x","mongoose":"7.x || 8.x"},"devDependencies":{"@masteringjs/eslint-config":"0.1.1","axios":"1.2.2","dedent":"^1.6.0","eslint":"9.30.0","express":"4.x","mocha":"10.2.0","mongoose":"8.x"},"scripts":{"lint":"eslint .","tailwind":"tailwindcss -o ./frontend/public/tw.css","tailwind:watch":"tailwindcss -o ./frontend/public/tw.css --watch","test":"mocha test/*.test.js"}}');
|
|
14885
14923
|
|
|
14886
14924
|
/***/ })
|
|
14887
14925
|
|
package/frontend/public/tw.css
CHANGED
|
@@ -842,6 +842,10 @@ video {
|
|
|
842
842
|
height: 90vh !important;
|
|
843
843
|
}
|
|
844
844
|
|
|
845
|
+
.h-12 {
|
|
846
|
+
height: 3rem;
|
|
847
|
+
}
|
|
848
|
+
|
|
845
849
|
.h-16 {
|
|
846
850
|
height: 4rem;
|
|
847
851
|
}
|
|
@@ -926,6 +930,10 @@ video {
|
|
|
926
930
|
width: 0px;
|
|
927
931
|
}
|
|
928
932
|
|
|
933
|
+
.w-12 {
|
|
934
|
+
width: 3rem;
|
|
935
|
+
}
|
|
936
|
+
|
|
929
937
|
.w-16 {
|
|
930
938
|
width: 4rem;
|
|
931
939
|
}
|
|
@@ -1500,6 +1508,10 @@ video {
|
|
|
1500
1508
|
--tw-bg-opacity: 0.4;
|
|
1501
1509
|
}
|
|
1502
1510
|
|
|
1511
|
+
.bg-opacity-60 {
|
|
1512
|
+
--tw-bg-opacity: 0.6;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1503
1515
|
.p-1 {
|
|
1504
1516
|
padding: 0.25rem;
|
|
1505
1517
|
}
|
|
@@ -1786,9 +1798,9 @@ video {
|
|
|
1786
1798
|
color: rgb(7 89 133 / var(--tw-text-opacity));
|
|
1787
1799
|
}
|
|
1788
1800
|
|
|
1789
|
-
.text-
|
|
1801
|
+
.text-ultramarine-600 {
|
|
1790
1802
|
--tw-text-opacity: 1;
|
|
1791
|
-
color: rgb(
|
|
1803
|
+
color: rgb(24 35 255 / var(--tw-text-opacity));
|
|
1792
1804
|
}
|
|
1793
1805
|
|
|
1794
1806
|
.text-ultramarine-700 {
|
|
@@ -1806,23 +1818,18 @@ video {
|
|
|
1806
1818
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1807
1819
|
}
|
|
1808
1820
|
|
|
1809
|
-
.text-ultramarine-600 {
|
|
1810
|
-
--tw-text-opacity: 1;
|
|
1811
|
-
color: rgb(24 35 255 / var(--tw-text-opacity));
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
1821
|
.accent-sky-600 {
|
|
1815
1822
|
accent-color: #0284c7;
|
|
1816
1823
|
}
|
|
1817
1824
|
|
|
1818
|
-
.opacity-50 {
|
|
1819
|
-
opacity: 0.5;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
1825
|
.opacity-25 {
|
|
1823
1826
|
opacity: 0.25;
|
|
1824
1827
|
}
|
|
1825
1828
|
|
|
1829
|
+
.opacity-50 {
|
|
1830
|
+
opacity: 0.5;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1826
1833
|
.opacity-75 {
|
|
1827
1834
|
opacity: 0.75;
|
|
1828
1835
|
}
|
|
@@ -2099,11 +2106,6 @@ video {
|
|
|
2099
2106
|
color: rgb(55 65 81 / var(--tw-text-opacity));
|
|
2100
2107
|
}
|
|
2101
2108
|
|
|
2102
|
-
.hover\:text-teal-900:hover {
|
|
2103
|
-
--tw-text-opacity: 1;
|
|
2104
|
-
color: rgb(10 87 87 / var(--tw-text-opacity));
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
2109
|
.hover\:text-ultramarine-900:hover {
|
|
2108
2110
|
--tw-text-opacity: 1;
|
|
2109
2111
|
color: rgb(6 14 172 / var(--tw-text-opacity));
|
|
@@ -39,9 +39,26 @@
|
|
|
39
39
|
</async-button>
|
|
40
40
|
</div>
|
|
41
41
|
</div>
|
|
42
|
-
<div v-else>
|
|
42
|
+
<div v-else-if="dashboardResult">
|
|
43
43
|
<div class="relative">
|
|
44
|
+
<div v-if="status === 'evaluating'" class="absolute inset-0 flex items-center justify-center bg-white bg-opacity-60 z-10 flex flex-col gap-2">
|
|
45
|
+
<div>Evaluating Dashboard...</div>
|
|
46
|
+
<img src="images/loader.gif" class="h-12 w-12" alt="Loading..." />
|
|
47
|
+
</div>
|
|
48
|
+
<div v-else-if="dashboardResult.error" class="rounded-md bg-red-50 p-4 mt-4">
|
|
49
|
+
<div class="flex">
|
|
50
|
+
<div class="flex-shrink-0">
|
|
51
|
+
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
|
|
52
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z" clip-rule="evenodd" />
|
|
53
|
+
</svg>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="ml-3">
|
|
56
|
+
<h3 class="text-sm font-medium text-red-800">{{dashboardResult.error.message || 'Unknown Error'}}</h3>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
44
60
|
<dashboard-result
|
|
61
|
+
v-else
|
|
45
62
|
:key="dashboardResult.finishedEvaluatingAt"
|
|
46
63
|
:result="dashboardResult.result"
|
|
47
64
|
:finishedEvaluatingAt="dashboardResult.finishedEvaluatingAt"
|
|
@@ -59,20 +76,7 @@
|
|
|
59
76
|
:currentDescription="description"
|
|
60
77
|
:currentTitle="title"
|
|
61
78
|
@close="showEditor=false;"
|
|
62
|
-
@update="updateCode"
|
|
63
|
-
@clearError="errorMessage = null"></edit-dashboard>
|
|
64
|
-
</div>
|
|
65
|
-
<div v-if="errorMessage" class="rounded-md bg-red-50 p-4 mt-4">
|
|
66
|
-
<div class="flex">
|
|
67
|
-
<div class="flex-shrink-0">
|
|
68
|
-
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
|
|
69
|
-
<path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z" clip-rule="evenodd" />
|
|
70
|
-
</svg>
|
|
71
|
-
</div>
|
|
72
|
-
<div class="ml-3">
|
|
73
|
-
<h3 class="text-sm font-medium text-red-800">{{errorMessage}}</h3>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
79
|
+
@update="updateCode"></edit-dashboard>
|
|
76
80
|
</div>
|
|
77
81
|
|
|
78
82
|
</div>
|
|
@@ -27,17 +27,13 @@ module.exports = app => app.component('dashboard', {
|
|
|
27
27
|
this.code = update.doc.code;
|
|
28
28
|
this.title = update.doc.title;
|
|
29
29
|
this.description = update.doc.description;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} else {
|
|
33
|
-
this.errorMessage = update.error.message;
|
|
34
|
-
}
|
|
30
|
+
|
|
31
|
+
await this.evaluateDashboard();
|
|
35
32
|
},
|
|
36
33
|
async evaluateDashboard() {
|
|
37
34
|
this.status = 'evaluating';
|
|
38
|
-
this.errorMessage = null;
|
|
39
35
|
try {
|
|
40
|
-
const { dashboard, dashboardResult
|
|
36
|
+
const { dashboard, dashboardResult } = await api.Dashboard.getDashboard({ dashboardId: this.dashboardId, evaluate: true });
|
|
41
37
|
this.dashboard = dashboard;
|
|
42
38
|
this.code = this.dashboard.code;
|
|
43
39
|
this.title = this.dashboard.title;
|
|
@@ -45,9 +41,6 @@ module.exports = app => app.component('dashboard', {
|
|
|
45
41
|
if (dashboardResult) {
|
|
46
42
|
this.dashboardResults.unshift(dashboardResult);
|
|
47
43
|
}
|
|
48
|
-
if (error) {
|
|
49
|
-
this.errorMessage = error.message;
|
|
50
|
-
}
|
|
51
44
|
} finally {
|
|
52
45
|
this.status = 'loaded';
|
|
53
46
|
}
|
|
@@ -65,9 +58,6 @@ module.exports = app => app.component('dashboard', {
|
|
|
65
58
|
return;
|
|
66
59
|
}
|
|
67
60
|
this.dashboard = dashboard;
|
|
68
|
-
if (error) {
|
|
69
|
-
this.errorMessage = error.message;
|
|
70
|
-
}
|
|
71
61
|
this.code = this.dashboard.code;
|
|
72
62
|
this.title = this.dashboard.title;
|
|
73
63
|
this.description = this.dashboard.description ?? '';
|
|
@@ -6,7 +6,7 @@ const template = require('./edit-dashboard.html');
|
|
|
6
6
|
module.exports = app => app.component('edit-dashboard', {
|
|
7
7
|
template: template,
|
|
8
8
|
props: ['dashboardId', 'code', 'currentDescription', 'currentTitle'],
|
|
9
|
-
emits: ['close'
|
|
9
|
+
emits: ['close'],
|
|
10
10
|
data: function() {
|
|
11
11
|
return {
|
|
12
12
|
status: 'loaded',
|
|
@@ -20,16 +20,16 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
20
20
|
this.$emit('close');
|
|
21
21
|
},
|
|
22
22
|
async updateCode() {
|
|
23
|
-
this.$emit('clearError');
|
|
24
23
|
this.status = 'loading';
|
|
25
24
|
try {
|
|
26
|
-
const { doc
|
|
25
|
+
const { doc } = await api.Dashboard.updateDashboard({
|
|
27
26
|
dashboardId: this.dashboardId,
|
|
28
27
|
code: this.editor.getValue(),
|
|
29
28
|
title: this.title,
|
|
30
|
-
description: this.description
|
|
29
|
+
description: this.description,
|
|
30
|
+
evaluate: false
|
|
31
31
|
});
|
|
32
|
-
this.$emit('update', { doc
|
|
32
|
+
this.$emit('update', { doc });
|
|
33
33
|
this.editor.setValue(doc.code);
|
|
34
34
|
this.closeEditor();
|
|
35
35
|
} catch (err) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<div class="grid gap-2" :style="{ gridTemplateColumns: gridTemplateColumns }">
|
|
2
|
+
<template v-for="(row, rowIndex) in value.$grid" :key="rowIndex">
|
|
3
|
+
<dashboard-result
|
|
4
|
+
v-for="(cell, colIndex) in row"
|
|
5
|
+
:key="rowIndex + '-' + colIndex"
|
|
6
|
+
:result="cell">
|
|
7
|
+
</dashboard-result>
|
|
8
|
+
</template>
|
|
9
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const template = require('./dashboard-grid.html');
|
|
4
|
+
|
|
5
|
+
module.exports = app => app.component('dashboard-grid', {
|
|
6
|
+
template: template,
|
|
7
|
+
props: ['value'],
|
|
8
|
+
computed: {
|
|
9
|
+
columns() {
|
|
10
|
+
const grid = this.value && this.value.$grid;
|
|
11
|
+
if (!Array.isArray(grid) || grid.length === 0) {
|
|
12
|
+
return 1;
|
|
13
|
+
}
|
|
14
|
+
return Math.max(1, ...grid.map(row => Array.isArray(row) ? row.length : 0));
|
|
15
|
+
},
|
|
16
|
+
gridTemplateColumns() {
|
|
17
|
+
return `repeat(${this.columns}, minmax(0, 1fr))`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongoosejs/studio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.119",
|
|
4
4
|
"description": "A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.",
|
|
5
5
|
"homepage": "https://studio.mongoosejs.io/",
|
|
6
6
|
"repository": {
|