@mongoosejs/studio 0.0.20 → 0.0.22

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.
Files changed (39) hide show
  1. package/backend/actions/Dashboard/getDashboards.js +10 -0
  2. package/backend/actions/Dashboard/index.js +3 -0
  3. package/backend/actions/Model/createDocument.js +28 -0
  4. package/backend/actions/Model/getDocuments.js +2 -1
  5. package/backend/actions/Model/index.js +1 -0
  6. package/backend/actions/Model/listModels.js +3 -1
  7. package/backend/actions/Model/updateDocument.js +1 -1
  8. package/backend/actions/index.js +1 -0
  9. package/backend/db/dashboardSchema.js +16 -0
  10. package/backend/index.js +5 -1
  11. package/frontend/public/app.js +30567 -467
  12. package/frontend/public/images/json.svg +2 -0
  13. package/frontend/public/images/table.svg +1 -0
  14. package/frontend/public/tw.css +197 -22
  15. package/frontend/src/api.js +16 -0
  16. package/frontend/src/create-document/create-document.css +0 -0
  17. package/frontend/src/create-document/create-document.html +6 -0
  18. package/frontend/src/create-document/create-document.js +75 -0
  19. package/frontend/src/dashboard/dashboard.html +8 -0
  20. package/frontend/src/dashboard/dashboard.js +22 -0
  21. package/frontend/src/dashboard-details/dashboard-details.html +8 -0
  22. package/frontend/src/dashboard-details/dashboard-details.js +10 -0
  23. package/frontend/src/document/document.html +2 -1
  24. package/frontend/src/document/document.js +3 -1
  25. package/frontend/src/edit-date/edit-date.html +18 -1
  26. package/frontend/src/edit-date/edit-date.js +12 -0
  27. package/frontend/src/index.js +4 -0
  28. package/frontend/src/list-json/list-json.css +3 -0
  29. package/frontend/src/list-json/list-json.html +4 -0
  30. package/frontend/src/list-json/list-json.js +40 -0
  31. package/frontend/src/models/models.css +2 -6
  32. package/frontend/src/models/models.html +42 -10
  33. package/frontend/src/models/models.js +26 -1
  34. package/frontend/src/navbar/navbar.css +9 -0
  35. package/frontend/src/navbar/navbar.html +11 -3
  36. package/frontend/src/navbar/navbar.js +6 -1
  37. package/frontend/src/routes.js +5 -0
  38. package/package.json +8 -3
  39. package/tailwind.config.js +27 -1
@@ -27,10 +27,6 @@
27
27
  max-height: calc(100vh - 56px);
28
28
  }
29
29
 
30
- .models .documents .documents-container {
31
- margin-top: 60px;
32
- }
33
-
34
30
  .models .documents table {
35
31
  /* max-width: -moz-fit-content;
36
32
  max-width: fit-content; */
@@ -97,12 +93,12 @@
97
93
  .models .documents-menu {
98
94
  display: flex;
99
95
  margin: 0.25em;
100
- position: fixed;
101
96
  width: calc(100vw - 220px);
102
97
  }
103
98
 
104
99
  .models .documents-menu .search-input {
105
100
  flex-grow: 1;
101
+ align-items: center;
106
102
  }
107
103
 
108
104
  .models .search-input input {
@@ -130,5 +126,5 @@
130
126
  .models .documents .buttons {
131
127
  display: inline-flex;
132
128
  justify-content: space-around;
133
- align-items: baseline;
129
+ align-items: center;
134
130
  }
@@ -12,7 +12,7 @@
12
12
  <router-link
13
13
  :to="'/model/' + model"
14
14
  class="block rounded-md py-2 pr-2 pl-2 text-sm font-semibold text-gray-700"
15
- :class="model === currentModel ? 'bg-puerto-rico-100 font-bold' : 'hover:bg-puerto-rico-100'">
15
+ :class="model === currentModel ? 'bg-teal-100 font-bold' : 'hover:bg-teal-100'">
16
16
  {{model}}
17
17
  </router-link>
18
18
  </li>
@@ -26,33 +26,53 @@
26
26
  <div class="documents" ref="documentsList">
27
27
  <div>
28
28
  <div class="documents-menu">
29
- <div class="search-input">
30
- <form @submit.prevent="search">
31
- <input class="search-text" type="text" placeholder="Filter or text" v-model="searchText" />
29
+ <div class="flex flex-row items-center w-full gap-2">
30
+ <form @submit.prevent="search" class="flex-grow m-0">
31
+ <input class="w-full rounded-md p-1 outline-gray-300 text-lg" type="text" placeholder="Filter or text" v-model="searchText" />
32
32
  </form>
33
- </div>
34
- <div class="buttons">
35
- <div class="mr-2">
33
+ <div>
36
34
  <span v-if="status === 'loading'">Loading ...</span>
37
35
  <span v-if="status === 'loaded'">{{numDocuments === 1 ? numDocuments+ ' document' : numDocuments + ' documents'}}</span>
38
36
  </div>
39
37
  <button
40
38
  @click="shouldShowExportModal = true"
41
39
  type="button"
42
- class="mr-2 rounded bg-puerto-rico-600 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-puerto-rico-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-puerto-rico-600">
40
+ class="rounded bg-teal-600 px-2 py-2 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">
43
41
  Export
44
42
  </button>
43
+ <button
44
+ @click="shouldShowCreateModal = true;"
45
+ type="button"
46
+ class="rounded bg-teal-600 px-2 py-2 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">
47
+ Create
48
+ </button>
45
49
  <button
46
50
  @click="shouldShowFieldModal = true"
47
51
  type="button"
48
- class="rounded bg-puerto-rico-600 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-puerto-rico-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-puerto-rico-600">
52
+ class="rounded bg-teal-600 px-2 py-2 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">
49
53
  Fields
50
54
  </button>
55
+ <span class="isolate inline-flex rounded-md shadow-sm">
56
+ <button
57
+ @click="outputType = 'table'"
58
+ type="button"
59
+ class="relative inline-flex items-center rounded-none rounded-l-md px-2 py-2 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-10"
60
+ :class="outputType === 'table' ? 'bg-gray-200' : 'bg-white'">
61
+ <img class="h-5 w-5" src="images/table.svg">
62
+ </button>
63
+ <button
64
+ @click="outputType = 'json'"
65
+ type="button"
66
+ class="relative -ml-px inline-flex items-center rounded-none rounded-r-md px-2 py-2 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-10"
67
+ :class="outputType === 'json' ? 'bg-gray-200' : 'bg-white'">
68
+ <img class="h-5 w-5" src="images/json.svg">
69
+ </button>
70
+ </span>
51
71
  </div>
52
72
  </div>
53
73
  </div>
54
74
  <div class="documents-container">
55
- <table>
75
+ <table v-if="outputType === 'table'">
56
76
  <thead>
57
77
  <th v-for="path in filteredPaths">
58
78
  {{path.path}}
@@ -75,6 +95,12 @@
75
95
  </tr>
76
96
  </tbody>
77
97
  </table>
98
+ <div v-if="outputType === 'json'">
99
+ <div v-for="document in documents" @click="$router.push('/model/' + currentModel + '/document/' + document._id)" :key="document._id">
100
+ <list-json :value="filterDocument(document)">
101
+ </list-json>
102
+ </div>
103
+ </div>
78
104
  <div v-if="status === 'loading'" class="loader">
79
105
  <img src="images/loader.gif">
80
106
  </div>
@@ -105,5 +131,11 @@
105
131
  </div>
106
132
  </template>
107
133
  </modal>
134
+ <modal v-if="shouldShowCreateModal">
135
+ <template v-slot:body>
136
+ <div class="modal-exit" @click="shouldShowCreateModal = false;">&times;</div>
137
+ <create-document :currentModel="currentModel" :paths="schemaPaths" @close="closeCreationModal"></create-document>
138
+ </template>
139
+ </modal>
108
140
  </div>
109
141
  </div>
@@ -5,6 +5,12 @@ const template = require('./models.html');
5
5
  const mpath = require('mpath');
6
6
  const { BSON, EJSON } = require('bson');
7
7
 
8
+ const { EditorState } = require('@codemirror/state');
9
+ const { lineNumbers } = require('@codemirror/view')
10
+ const { EditorView, basicSetup } = require('codemirror');
11
+ const { javascript } = require('@codemirror/lang-javascript');
12
+
13
+
8
14
  const ObjectId = new Proxy(BSON.ObjectId, {
9
15
  apply (target, thisArg, argumentsList) {
10
16
  return new target(...argumentsList);
@@ -13,6 +19,7 @@ const ObjectId = new Proxy(BSON.ObjectId, {
13
19
 
14
20
  const appendCSS = require('../appendCSS');
15
21
 
22
+
16
23
  appendCSS(require('./models.css'));
17
24
 
18
25
  const limit = 50;
@@ -35,12 +42,14 @@ module.exports = app => app.component('models', {
35
42
  filter: null,
36
43
  searchText: '',
37
44
  shouldShowExportModal: false,
45
+ shouldShowCreateModal: false,
38
46
  shouldShowFieldModal: false,
39
47
  shouldExport: {},
40
48
  sortBy: {},
41
49
  query: {},
42
50
  scrollHeight: 0,
43
- interval: null
51
+ interval: null,
52
+ outputType: 'table' // json, table
44
53
  }),
45
54
  created() {
46
55
  this.currentModel = this.model;
@@ -77,9 +86,25 @@ module.exports = app => app.component('models', {
77
86
  this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path))
78
87
  }
79
88
 
89
+
80
90
  this.status = 'loaded';
81
91
  },
82
92
  methods: {
93
+ async closeCreationModal() {
94
+ this.shouldShowCreateModal = false;
95
+ await this.getDocuments();
96
+ },
97
+ initializeDocumentData() {
98
+ this.shouldShowCreateModal = true;
99
+ },
100
+ filterDocument(doc) {
101
+ const filteredDoc = {};
102
+ console.log(doc, this.filteredPaths)
103
+ for (let i = 0; i < this.filteredPaths.length; i++) {
104
+ filteredDoc[this.filteredPaths[i].path] = doc[this.filteredPaths[i].path];
105
+ }
106
+ return filteredDoc;
107
+ },
83
108
  async onScroll() {
84
109
  if (this.status === 'loading' || this.loadedAllDocs) {
85
110
  return;
@@ -3,6 +3,14 @@
3
3
  background-color: #eee;
4
4
  }
5
5
 
6
+ .active {
7
+ text-decoration: underline;
8
+ }
9
+
10
+ .spacing {
11
+ margin-right: 10px;
12
+ }
13
+
6
14
  .navbar .nav-left {
7
15
  float: left;
8
16
  line-height: 54px;
@@ -30,6 +38,7 @@
30
38
  float: right;
31
39
  display: flex;
32
40
  flex-direction: row;
41
+ justify-content: space-between;
33
42
  font-size: 16px;
34
43
  line-height: 54px;
35
44
  padding-right: 20px;
@@ -4,9 +4,17 @@
4
4
  <img src="images/logo.svg" alt="Mongoose Studio Logo" />
5
5
  </router-link>
6
6
  </div>
7
- <div class="nav-right">
8
- <!--- <router-link to="/">Models</router-link>
9
- <router-link to="/charts">Charts</router-link> -->
7
+ <div class="nav-right h-full">
8
+ <div class="sm:ml-6 sm:flex sm:space-x-8 h-full">
9
+ <a
10
+ href="#/"
11
+ class="inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium"
12
+ :class="routeName === 'root' ? 'text-gray-900 border-teal-500' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'">Documents</a>
13
+ <a
14
+ href="#/dashboards"
15
+ class="inline-flex items-center border-b-2 px-1 pt-1 text-sm font-medium"
16
+ :class="routeName === 'dashboards' ? 'text-gray-900 border-teal-500' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'">Dashboards</a>
17
+ </div>
10
18
  </div>
11
19
  <div style="clear: both"></div>
12
20
  </div>
@@ -7,5 +7,10 @@ const appendCSS = require('../appendCSS');
7
7
  appendCSS(require('./navbar.css'));
8
8
 
9
9
  module.exports = app => app.component('navbar', {
10
- template: template
10
+ template: template,
11
+ computed: {
12
+ routeName() {
13
+ return this.$route.name;
14
+ }
15
+ }
11
16
  });
@@ -20,5 +20,10 @@ module.exports = [
20
20
  path: '/model/:model/document/:documentId',
21
21
  name: 'document',
22
22
  component: 'document'
23
+ },
24
+ {
25
+ path: '/dashboards',
26
+ name: 'dashboards',
27
+ component: 'dashboard'
23
28
  }
24
29
  ];
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "dependencies": {
5
+ "@codemirror/commands": "^6.5.0",
6
+ "@codemirror/lang-javascript": "^6.2.2",
7
+ "@codemirror/state": "^6.4.1",
8
+ "@codemirror/view": "^6.26.3",
5
9
  "archetype": "0.13.0",
10
+ "codemirror": "^6.0.1",
6
11
  "csv-stringify": "6.3.0",
7
12
  "ejson": "^2.2.3",
8
- "extrovert": "0.0.20",
13
+ "extrovert": "0.0.24",
9
14
  "openai": "3.2.1",
10
15
  "vanillatoasts": "^1.6.0"
11
16
  },
@@ -18,7 +23,7 @@
18
23
  "axios": "1.2.2",
19
24
  "express": "4.x",
20
25
  "mocha": "10.2.0",
21
- "mongoose": "7.x",
26
+ "mongoose": "8.x",
22
27
  "tailwindcss": "3.4.0",
23
28
  "vue": "3.x",
24
29
  "webpack": "5.75.0"
@@ -22,7 +22,33 @@ module.exports = {
22
22
  '800': '#08675f',
23
23
  '900': '#0c554e',
24
24
  '950': '#003432',
25
- }
25
+ },
26
+ 'teal': {
27
+ '50': '#eefffc',
28
+ '100': '#c5fffa',
29
+ '200': '#8bfff5',
30
+ '300': '#4afef0',
31
+ '400': '#15ece2',
32
+ '500': '#00d0c9',
33
+ '600': '#00a8a5',
34
+ '700': '#008888',
35
+ '800': '#066769',
36
+ '900': '#0a5757',
37
+ '950': '#003235',
38
+ },
39
+ 'navy-blue': {
40
+ '50': '#f1f4ff',
41
+ '100': '#e5e8ff',
42
+ '200': '#ced5ff',
43
+ '300': '#a7b1ff',
44
+ '400': '#767fff',
45
+ '500': '#3f42ff',
46
+ '600': '#2118ff',
47
+ '700': '#1007fa',
48
+ '800': '#0d05d2',
49
+ '900': '#0c06ac',
50
+ '950': '#000088',
51
+ },
26
52
  }
27
53
  }
28
54
  }