@mongoosejs/studio 0.0.117 → 0.0.118

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.
@@ -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
- return { dashboard, error: { message: error.message } };
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
- let result = null;
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
  };
@@ -1201,17 +1201,13 @@ module.exports = app => app.component('dashboard', {
1201
1201
  this.code = update.doc.code;
1202
1202
  this.title = update.doc.title;
1203
1203
  this.description = update.doc.description;
1204
- if (update.result) {
1205
- this.result = update.result;
1206
- } else {
1207
- this.errorMessage = update.error.message;
1208
- }
1204
+
1205
+ await this.evaluateDashboard();
1209
1206
  },
1210
1207
  async evaluateDashboard() {
1211
1208
  this.status = 'evaluating';
1212
- this.errorMessage = null;
1213
1209
  try {
1214
- const { dashboard, dashboardResult, error } = await api.Dashboard.getDashboard({ dashboardId: this.dashboardId, evaluate: true });
1210
+ const { dashboard, dashboardResult } = await api.Dashboard.getDashboard({ dashboardId: this.dashboardId, evaluate: true });
1215
1211
  this.dashboard = dashboard;
1216
1212
  this.code = this.dashboard.code;
1217
1213
  this.title = this.dashboard.title;
@@ -1219,9 +1215,6 @@ module.exports = app => app.component('dashboard', {
1219
1215
  if (dashboardResult) {
1220
1216
  this.dashboardResults.unshift(dashboardResult);
1221
1217
  }
1222
- if (error) {
1223
- this.errorMessage = error.message;
1224
- }
1225
1218
  } finally {
1226
1219
  this.status = 'loaded';
1227
1220
  }
@@ -1239,9 +1232,6 @@ module.exports = app => app.component('dashboard', {
1239
1232
  return;
1240
1233
  }
1241
1234
  this.dashboard = dashboard;
1242
- if (error) {
1243
- this.errorMessage = error.message;
1244
- }
1245
1235
  this.code = this.dashboard.code;
1246
1236
  this.title = this.dashboard.title;
1247
1237
  this.description = this.dashboard.description ?? '';
@@ -1268,7 +1258,7 @@ const template = __webpack_require__(/*! ./edit-dashboard.html */ "./frontend/sr
1268
1258
  module.exports = app => app.component('edit-dashboard', {
1269
1259
  template: template,
1270
1260
  props: ['dashboardId', 'code', 'currentDescription', 'currentTitle'],
1271
- emits: ['close', 'clearError'],
1261
+ emits: ['close'],
1272
1262
  data: function() {
1273
1263
  return {
1274
1264
  status: 'loaded',
@@ -1282,16 +1272,16 @@ module.exports = app => app.component('edit-dashboard', {
1282
1272
  this.$emit('close');
1283
1273
  },
1284
1274
  async updateCode() {
1285
- this.$emit('clearError');
1286
1275
  this.status = 'loading';
1287
1276
  try {
1288
- const { doc, result, error } = await api.Dashboard.updateDashboard({
1277
+ const { doc } = await api.Dashboard.updateDashboard({
1289
1278
  dashboardId: this.dashboardId,
1290
1279
  code: this.editor.getValue(),
1291
1280
  title: this.title,
1292
- description: this.description
1281
+ description: this.description,
1282
+ evaluate: false
1293
1283
  });
1294
- this.$emit('update', { doc, result, error });
1284
+ this.$emit('update', { doc });
1295
1285
  this.editor.setValue(doc.code);
1296
1286
  this.closeEditor();
1297
1287
  } catch (err) {
@@ -4367,7 +4357,7 @@ module.exports = "<div class=\"py-2\">\n <div v-if=\"header\" class=\"border-b
4367
4357
  /***/ ((module) => {
4368
4358
 
4369
4359
  "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 <dashboard-result\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\"\n @clearError=\"errorMessage = null\"></edit-dashboard>\n </div>\n <div v-if=\"errorMessage\" 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\">{{errorMessage}}</h3>\n </div>\n </div>\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\">&times;</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";
4360
+ 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\">&times;</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
4361
 
4372
4362
  /***/ }),
4373
4363
 
@@ -14881,7 +14871,7 @@ var bson = /*#__PURE__*/Object.freeze({
14881
14871
  /***/ ((module) => {
14882
14872
 
14883
14873
  "use strict";
14884
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.0.117","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"}}');
14874
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.0.118","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
14875
 
14886
14876
  /***/ })
14887
14877
 
@@ -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-teal-600 {
1801
+ .text-ultramarine-600 {
1790
1802
  --tw-text-opacity: 1;
1791
- color: rgb(0 168 165 / var(--tw-text-opacity));
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
- if (update.result) {
31
- this.result = update.result;
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, error } = await api.Dashboard.getDashboard({ dashboardId: this.dashboardId, evaluate: true });
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', 'clearError'],
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, result, error } = await api.Dashboard.updateDashboard({
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, result, error });
32
+ this.$emit('update', { doc });
33
33
  this.editor.setValue(doc.code);
34
34
  this.closeEditor();
35
35
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.0.117",
3
+ "version": "0.0.118",
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": {