@mongoosejs/studio 0.0.94 → 0.0.96

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 (51) hide show
  1. package/.github/workflows/lint.yml +18 -0
  2. package/backend/actions/ChatThread/createChatMessage.js +1 -1
  3. package/backend/actions/ChatThread/createChatThread.js +2 -2
  4. package/backend/actions/Dashboard/getDashboards.js +1 -1
  5. package/backend/actions/Dashboard/updateDashboard.js +1 -1
  6. package/backend/actions/Model/createDocument.js +1 -1
  7. package/backend/actions/Model/deleteDocument.js +3 -3
  8. package/backend/actions/Model/deleteDocuments.js +2 -2
  9. package/backend/actions/Model/exportQueryResults.js +1 -1
  10. package/backend/actions/Model/getDocument.js +1 -1
  11. package/backend/actions/Model/getDocuments.js +2 -2
  12. package/backend/actions/Model/getIndexes.js +1 -1
  13. package/backend/actions/Model/index.js +1 -1
  14. package/backend/actions/Model/updateDocument.js +1 -1
  15. package/backend/actions/Model/updateDocuments.js +1 -1
  16. package/backend/authorize.js +1 -3
  17. package/backend/db/dashboardSchema.js +2 -2
  18. package/backend/helpers/removeSpecifiedPaths.js +1 -1
  19. package/backend/netlify.js +3 -3
  20. package/backend/next.js +1 -1
  21. package/eslint.config.js +46 -0
  22. package/frontend/index.js +1 -1
  23. package/frontend/public/app.js +128 -112
  24. package/frontend/public/tw.css +418 -31
  25. package/frontend/src/api.js +16 -16
  26. package/frontend/src/chat/chat-message/chat-message.html +1 -1
  27. package/frontend/src/chat/chat-message/chat-message.js +1 -1
  28. package/frontend/src/chat/chat-message-script/chat-message-script.html +2 -2
  29. package/frontend/src/chat/chat-message-script/chat-message-script.js +1 -2
  30. package/frontend/src/chat/chat.html +18 -6
  31. package/frontend/src/chat/chat.js +3 -2
  32. package/frontend/src/clone-document/clone-document.js +8 -8
  33. package/frontend/src/create-dashboard/create-dashboard.js +7 -7
  34. package/frontend/src/create-document/create-document.js +10 -10
  35. package/frontend/src/dashboard/dashboard.js +1 -1
  36. package/frontend/src/dashboard/edit-dashboard/edit-dashboard.js +3 -3
  37. package/frontend/src/dashboards/dashboards.js +1 -1
  38. package/frontend/src/document/confirm-changes/confirm-changes.js +2 -2
  39. package/frontend/src/document/confirm-delete/confirm-delete.js +2 -2
  40. package/frontend/src/document/document.js +2 -2
  41. package/frontend/src/document-details/document-details.js +3 -3
  42. package/frontend/src/document-details/document-property/document-property.js +3 -3
  43. package/frontend/src/edit-array/edit-array.js +1 -1
  44. package/frontend/src/edit-subdocument/edit-subdocument.js +1 -1
  45. package/frontend/src/list-default/list-default.js +3 -3
  46. package/frontend/src/models/models.js +11 -11
  47. package/frontend/src/navbar/navbar.css +0 -21
  48. package/frontend/src/navbar/navbar.html +62 -5
  49. package/frontend/src/navbar/navbar.js +19 -3
  50. package/frontend/src/update-document/update-document.js +25 -25
  51. package/package.json +4 -1
@@ -43,9 +43,9 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
43
43
  return client.post('', { action: 'Dashboard.getDashboards', ...params }).then(res => res.data);
44
44
  },
45
45
  updateDashboard(params) {
46
- return client.post('', { action: 'Dashboard.updateDashboard', ...params}).then(res => res.data);
46
+ return client.post('', { action: 'Dashboard.updateDashboard', ...params }).then(res => res.data);
47
47
  }
48
- }
48
+ };
49
49
  exports.ChatThread = {
50
50
  createChatMessage(params) {
51
51
  return client.post('', { action: 'ChatThread.createChatMessage', ...params }).then(res => res.data);
@@ -59,24 +59,24 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
59
59
  listChatThreads(params) {
60
60
  return client.post('', { action: 'ChatThread.listChatThreads', ...params }).then(res => res.data);
61
61
  }
62
- }
62
+ };
63
63
  exports.ChatMessage = {
64
64
  executeScript(params) {
65
65
  return client.post('', { action: 'ChatMessage.executeScript', ...params }).then(res => res.data);
66
66
  }
67
- }
67
+ };
68
68
  exports.Model = {
69
69
  createChart(params) {
70
- return client.post('', { action: 'Model.createChart', ...params}).then(res => res.data);
70
+ return client.post('', { action: 'Model.createChart', ...params }).then(res => res.data);
71
71
  },
72
72
  createDocument(params) {
73
- return client.post('', { action: 'Model.createDocument', ...params}).then(res => res.data);
73
+ return client.post('', { action: 'Model.createDocument', ...params }).then(res => res.data);
74
74
  },
75
75
  deleteDocument(params) {
76
- return client.post('', { action: 'Model.deleteDocument', ...params}).then(res => res.data);
76
+ return client.post('', { action: 'Model.deleteDocument', ...params }).then(res => res.data);
77
77
  },
78
78
  deleteDocuments(params) {
79
- return client.post('', { action: 'Model.deleteDocuments', ...params}).then(res => res.data);
79
+ return client.post('', { action: 'Model.deleteDocuments', ...params }).then(res => res.data);
80
80
  },
81
81
  exportQueryResults(params) {
82
82
  const accessToken = window.localStorage.getItem('_mongooseStudioAccessToken') || null;
@@ -84,8 +84,8 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
84
84
  return fetch(window.MONGOOSE_STUDIO_CONFIG.baseURL + new URLSearchParams({ ...params, action: 'Model.exportQueryResults' }).toString(), {
85
85
  method: 'GET',
86
86
  headers: {
87
- 'Authorization': `${accessToken}`, // Set your authorization token here
88
- 'Accept': 'text/csv'
87
+ Authorization: `${accessToken}`, // Set your authorization token here
88
+ Accept: 'text/csv'
89
89
  }
90
90
  })
91
91
  .then(response => {
@@ -136,7 +136,7 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
136
136
  return client.post('/Dashboard/createDashboard', params).then(res => res.data);
137
137
  },
138
138
  deleteDashboard: function deleteDashboard(params) {
139
- return client.post('/Dashboard/deleteDashboard', params).then(res => res.data)
139
+ return client.post('/Dashboard/deleteDashboard', params).then(res => res.data);
140
140
  },
141
141
  getDashboard: function getDashboard(params) {
142
142
  return client.put('/Dashboard/getDashboard', params).then(res => res.data);
@@ -147,7 +147,7 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
147
147
  updateDashboard: function updateDashboard(params) {
148
148
  return client.post('/Dashboard/updateDashboard', params).then(res => res.data);
149
149
  }
150
- }
150
+ };
151
151
  exports.ChatThread = {
152
152
  createChatMessage: function createChatMessage(params) {
153
153
  return client.post('/ChatThread/createChatMessage', params).then(res => res.data);
@@ -168,13 +168,13 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
168
168
  }
169
169
  };
170
170
  exports.Model = {
171
- createChart: function (params) {
171
+ createChart: function(params) {
172
172
  return client.post('/Model/createChart', params).then(res => res.data);
173
173
  },
174
174
  createDocument: function(params) {
175
175
  return client.post('/Model/createDocument', params).then(res => res.data);
176
176
  },
177
- deleteDocument: function (params) {
177
+ deleteDocument: function(params) {
178
178
  return client.post('/Model/deleteDocument', params).then(res => res.data);
179
179
  },
180
180
  deleteDocuments: function(params) {
@@ -186,8 +186,8 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
186
186
  return fetch(window.MONGOOSE_STUDIO_CONFIG.baseURL + '/Model/exportQueryResults?' + new URLSearchParams(params).toString(), {
187
187
  method: 'GET',
188
188
  headers: {
189
- 'Authorization': `${accessToken}`, // Set your authorization token here
190
- 'Accept': 'text/csv'
189
+ Authorization: `${accessToken}`, // Set your authorization token here
190
+ Accept: 'text/csv'
191
191
  }
192
192
  })
193
193
  .then(response => {
@@ -1,6 +1,6 @@
1
1
  <div class="relative flex items-start space-x-3" :class="{'justify-end': message.role === 'user'}">
2
2
  <div
3
- class="min-w-0 max-w-[calc(100%-6.5rem)]"
3
+ class="min-w-0 max-w-[calc(100vw-4rem)]"
4
4
  :class="{'text-right': message.role === 'user'}">
5
5
 
6
6
  <div class="text-sm text-gray-900 p-3 rounded-md inline-block" :class="styleForMessage">
@@ -61,6 +61,6 @@ module.exports = app => app.component('chat-message', {
61
61
  });
62
62
  message.executionResult = chatMessage.executionResult;
63
63
  console.log(message);
64
- },
64
+ }
65
65
  }
66
66
  });
@@ -37,9 +37,9 @@
37
37
  </div>
38
38
  </div>
39
39
 
40
- <pre class="p-3 whitespace-pre-wrap max-h-[30vh] max-w-[calc(100vw-25rem)] overflow-y-auto" v-show="activeTab === 'code'"><code v-text="script" ref="code" :class="'language-' + language"></code></pre>
40
+ <pre class="p-3 whitespace-pre-wrap max-h-[30vh] max-w-[calc(100vw-4rem)] overflow-y-auto" v-show="activeTab === 'code'"><code v-text="script" ref="code" :class="'language-' + language"></code></pre>
41
41
 
42
- <div class="p-3 whitespace-pre-wrap max-h-[30vh] overflow-y-auto bg-white border-t max-w-[calc(100vw-25rem)] relative" v-show="activeTab === 'output'">
42
+ <div class="p-3 whitespace-pre-wrap max-h-[30vh] overflow-y-auto bg-white border-t max-w-[calc(100vw-4rem)] relative" v-show="activeTab === 'output'">
43
43
  <dashboard-chart v-if="message.executionResult?.output?.$chart" :value="message.executionResult?.output" />
44
44
  <pre v-else>{{ message.executionResult?.output || 'No output' }}</pre>
45
45
  </div>
@@ -1,12 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  const api = require('../../api');
4
- const marked = require('marked').marked;
5
4
  const template = require('./chat-message-script.html');
6
5
  const vanillatoasts = require('vanillatoasts');
7
6
 
8
7
  module.exports = app => app.component('chat-message-script', {
9
- template: template,
8
+ template,
10
9
  props: ['message', 'script', 'language'],
11
10
  data: () => ({ activeTab: 'code', showDetailModal: false }),
12
11
  computed: {
@@ -1,8 +1,20 @@
1
1
  <div class="flex" style="height: calc(100vh - 55px)">
2
- <!-- Sidebar: Chat Threads -->
3
- <aside class="w-64 bg-gray-100 border-r overflow-y-auto h-full">
4
- <div class="p-4 font-bold text-lg border-b">Chat Threads</div>
5
- <div class="p-4">
2
+ <div class="fixed top-[65px] cursor-pointer bg-gray-100 rounded-r-md z-10" @click="hideSidebar = false">
3
+ <svg xmlns="http://www.w3.org/2000/svg" style="h-5 w-5" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M360-120v-720h80v720h-80Zm160-160v-400l200 200-200 200Z"/></svg>
4
+ </div>
5
+ <!-- Sidebar: Chat Threads -->
6
+ <aside class="bg-gray-50 border-r overflow-y-auto overflow-x-hidden h-full transition-all duration-300 ease-in-out z-20 w-0 md:w-64 fixed md:relative" :class="hideSidebar === true ? '!w-0' : hideSidebar === false ? '!w-64' : ''">
7
+ <div class="flex items-center border-b border-gray-100 w-64 overflow-x-hidden">
8
+ <div class="p-4 font-bold text-lg">Chat Threads</div>
9
+ <button
10
+ @click="hideSidebar = true"
11
+ class="ml-auto mr-2 p-2 rounded hover:bg-gray-200 focus:outline-none"
12
+ aria-label="Close sidebar"
13
+ >
14
+ <svg xmlns="http://www.w3.org/2000/svg" style="h-5 w-5" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M660-320v-320L500-480l160 160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Zm-80 0H200h120Z"/></svg>
15
+ </button>
16
+ </div>
17
+ <div class="p-4 w-64">
6
18
  <async-button
7
19
  @click="createNewThread"
8
20
  class="w-full bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700"
@@ -13,12 +25,12 @@
13
25
  <div v-if="status === 'loaded' && chatThreads.length === 0" class="p-4 text-sm text-gray-700">
14
26
  No threads yet
15
27
  </div>
16
- <ul vif="status === 'loaded'">
28
+ <ul v-if="status === 'loaded'" class="w-64">
17
29
  <li
18
30
  v-for="thread in chatThreads"
19
31
  :key="thread._id"
20
32
  @click="selectThread(thread._id)"
21
- class="p-4 hover:bg-gray-200 cursor-pointer"
33
+ class="p-4 hover:bg-gray-200 cursor-pointer w-64"
22
34
  :class="{ 'bg-gray-300': thread._id === chatThreadId }"
23
35
  >
24
36
  {{ thread.title || 'Untitled Thread' }}
@@ -12,7 +12,8 @@ module.exports = app => app.component('chat', {
12
12
  newMessage: '',
13
13
  chatThreadId: null,
14
14
  chatThreads: [],
15
- chatMessages: []
15
+ chatMessages: [],
16
+ hideSidebar: null
16
17
  }),
17
18
  methods: {
18
19
  async sendMessage() {
@@ -86,5 +87,5 @@ module.exports = app => app.component('chat', {
86
87
  });
87
88
  });
88
89
  }
89
- },
90
+ }
90
91
  });
@@ -5,7 +5,7 @@ const api = require('../api');
5
5
  const { BSON, EJSON } = require('bson');
6
6
 
7
7
  const ObjectId = new Proxy(BSON.ObjectId, {
8
- apply (target, thisArg, argumentsList) {
8
+ apply(target, thisArg, argumentsList) {
9
9
  return new target(...argumentsList);
10
10
  }
11
11
  });
@@ -14,7 +14,7 @@ const appendCSS = require('../appendCSS');
14
14
 
15
15
  appendCSS(require('./clone-document.css'));
16
16
 
17
- const template = require('./clone-document.html')
17
+ const template = require('./clone-document.html');
18
18
 
19
19
  module.exports = app => app.component('clone-document', {
20
20
  props: ['currentModel', 'doc', 'schemaPaths'],
@@ -24,7 +24,7 @@ module.exports = app => app.component('clone-document', {
24
24
  documentData: '',
25
25
  editor: null,
26
26
  errors: []
27
- }
27
+ };
28
28
  },
29
29
  methods: {
30
30
  async cloneDocument() {
@@ -32,17 +32,17 @@ module.exports = app => app.component('clone-document', {
32
32
  const { doc } = await api.Model.createDocument({ model: this.currentModel, data }).catch(err => {
33
33
  if (err.response?.data?.message) {
34
34
  console.log(err.response.data);
35
- const message = err.response.data.message.split(": ").slice(1).join(": ");
35
+ const message = err.response.data.message.split(': ').slice(1).join(': ');
36
36
  this.errors = message.split(',').map(error => {
37
37
  return error.split(': ').slice(1).join(': ').trim();
38
- })
38
+ });
39
39
  throw new Error(err.response?.data?.message);
40
40
  }
41
41
  throw err;
42
42
  });
43
43
  this.errors.length = 0;
44
44
  this.$emit('close', doc);
45
- },
45
+ }
46
46
  },
47
47
  mounted: function() {
48
48
  const pathsToClone = this.schemaPaths.map(x => x.path);
@@ -68,5 +68,5 @@ module.exports = app => app.component('clone-document', {
68
68
  lineNumbers: true,
69
69
  smartIndent: false
70
70
  });
71
- },
72
- })
71
+ }
72
+ });
@@ -2,7 +2,7 @@
2
2
 
3
3
  const api = require('../api');
4
4
 
5
- const template = require('./create-dashboard.html')
5
+ const template = require('./create-dashboard.html');
6
6
 
7
7
  module.exports = app => app.component('create-dashboard', {
8
8
  template,
@@ -11,7 +11,7 @@ module.exports = app => app.component('create-dashboard', {
11
11
  title: '',
12
12
  code: '',
13
13
  errors: []
14
- }
14
+ };
15
15
  },
16
16
  methods: {
17
17
  async createDashboard() {
@@ -19,22 +19,22 @@ module.exports = app => app.component('create-dashboard', {
19
19
  const { dashboard } = await api.Dashboard.createDashboard({ code: this.code, title: this.title }).catch(err => {
20
20
  if (err.response?.data?.message) {
21
21
  console.log(err.response.data);
22
- const message = err.response.data.message.split(": ").slice(1).join(": ");
22
+ const message = err.response.data.message.split(': ').slice(1).join(': ');
23
23
  this.errors = message.split(',').map(error => {
24
24
  return error.split(': ').slice(1).join(': ').trim();
25
- })
25
+ });
26
26
  throw new Error(err.response?.data?.message);
27
27
  }
28
28
  throw err;
29
29
  });
30
30
  this.errors.length = 0;
31
31
  this.$emit('close', dashboard);
32
- },
32
+ }
33
33
  },
34
34
  mounted: function() {
35
35
  this._editor = CodeMirror.fromTextArea(this.$refs.codeEditor, {
36
36
  mode: 'javascript',
37
37
  lineNumbers: true
38
38
  });
39
- },
40
- })
39
+ }
40
+ });
@@ -5,7 +5,7 @@ const api = require('../api');
5
5
  const { BSON, EJSON } = require('bson');
6
6
 
7
7
  const ObjectId = new Proxy(BSON.ObjectId, {
8
- apply (target, thisArg, argumentsList) {
8
+ apply(target, thisArg, argumentsList) {
9
9
  return new target(...argumentsList);
10
10
  }
11
11
  });
@@ -14,7 +14,7 @@ const appendCSS = require('../appendCSS');
14
14
 
15
15
  appendCSS(require('./create-document.css'));
16
16
 
17
- const template = require('./create-document.html')
17
+ const template = require('./create-document.html');
18
18
 
19
19
  module.exports = app => app.component('create-document', {
20
20
  props: ['currentModel', 'paths'],
@@ -24,7 +24,7 @@ module.exports = app => app.component('create-document', {
24
24
  documentData: '',
25
25
  editor: null,
26
26
  errors: []
27
- }
27
+ };
28
28
  },
29
29
  methods: {
30
30
  async createDocument() {
@@ -32,24 +32,24 @@ module.exports = app => app.component('create-document', {
32
32
  const { doc } = await api.Model.createDocument({ model: this.currentModel, data }).catch(err => {
33
33
  if (err.response?.data?.message) {
34
34
  console.log(err.response.data);
35
- const message = err.response.data.message.split(": ").slice(1).join(": ");
35
+ const message = err.response.data.message.split(': ').slice(1).join(': ');
36
36
  this.errors = message.split(',').map(error => {
37
37
  return error.split(': ').slice(1).join(': ').trim();
38
- })
38
+ });
39
39
  throw new Error(err.response?.data?.message);
40
40
  }
41
41
  throw err;
42
42
  });
43
43
  this.errors.length = 0;
44
44
  this.$emit('close', doc);
45
- },
45
+ }
46
46
  },
47
47
  mounted: function() {
48
48
  const requiredPaths = this.paths.filter(x => x.required);
49
- this.documentData = `{\n`;
49
+ this.documentData = '{\n';
50
50
  for (let i = 0; i < requiredPaths.length; i++) {
51
51
  const isLast = i + 1 >= requiredPaths.length;
52
- this.documentData += ` ${requiredPaths[i].path}: ${isLast ? '': ','}\n`
52
+ this.documentData += ` ${requiredPaths[i].path}: ${isLast ? '' : ','}\n`;
53
53
  }
54
54
  this.documentData += '}';
55
55
  this.$refs.codeEditor.value = this.documentData;
@@ -58,5 +58,5 @@ module.exports = app => app.component('create-document', {
58
58
  lineNumbers: true,
59
59
  smartIndent: false
60
60
  });
61
- },
62
- })
61
+ }
62
+ });
@@ -16,7 +16,7 @@ module.exports = app => app.component('dashboard', {
16
16
  dashboard: null,
17
17
  result: null,
18
18
  errorMessage: null
19
- }
19
+ };
20
20
  },
21
21
  methods: {
22
22
  toggleEditor() {
@@ -12,11 +12,11 @@ module.exports = app => app.component('edit-dashboard', {
12
12
  editor: null,
13
13
  title: '',
14
14
  description: ''
15
- }
15
+ };
16
16
  },
17
17
  methods: {
18
18
  closeEditor() {
19
- this.$emit('close')
19
+ this.$emit('close');
20
20
  },
21
21
  async updateCode() {
22
22
  this.status = 'loading';
@@ -47,7 +47,7 @@ module.exports = app => app.component('edit-dashboard', {
47
47
  indentWithTabs: true,
48
48
  cursorBlinkRate: 300,
49
49
  lineWrapping: true,
50
- showCursorWhenSelecting: true,
50
+ showCursorWhenSelecting: true
51
51
  });
52
52
  // this.editor.focus();
53
53
  // this.editor.refresh(); // if anything weird happens on load, this usually fixes it. However, this breaks it in this case.
@@ -31,5 +31,5 @@ module.exports = app => app.component('dashboards', {
31
31
  const { dashboards } = await api.Dashboard.getDashboards();
32
32
  this.dashboards = dashboards;
33
33
  this.status = 'loaded';
34
- },
34
+ }
35
35
  });
@@ -12,10 +12,10 @@ module.exports = app => app.component('confirm-changes', {
12
12
  },
13
13
  methods: {
14
14
  closeConfirm() {
15
- this.$emit('close')
15
+ this.$emit('close');
16
16
  },
17
17
  startSave() {
18
- this.$emit('save');
18
+ this.$emit('save');
19
19
  }
20
20
  },
21
21
  mounted() {
@@ -12,10 +12,10 @@ module.exports = app => app.component('confirm-delete', {
12
12
  },
13
13
  methods: {
14
14
  closeDelete() {
15
- this.$emit('close')
15
+ this.$emit('close');
16
16
  },
17
17
  startDelete() {
18
- this.$emit('remove');
18
+ this.$emit('remove');
19
19
  }
20
20
  },
21
21
  mounted() {
@@ -84,11 +84,11 @@ module.exports = app => app.component('document', {
84
84
  timeout: 3000,
85
85
  positionClass: 'bottomRight'
86
86
  });
87
- this.$router.push({ path: `/model/${this.model}`});
87
+ this.$router.push({ path: `/model/${this.model}` });
88
88
  }
89
89
  },
90
90
  showClonedDocument(doc) {
91
- this.$router.push({ path: `/model/${this.model}/document/${doc._id}`});
91
+ this.$router.push({ path: `/model/${this.model}/document/${doc._id}` });
92
92
  }
93
93
  }
94
94
  });
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const mpath = require('mpath');
4
- const template = require('./document-details.html')
4
+ const template = require('./document-details.html');
5
5
 
6
6
  const appendCSS = require('../appendCSS');
7
7
 
@@ -28,6 +28,6 @@ module.exports = app => app.component('document-details', {
28
28
  }
29
29
 
30
30
  return result;
31
- },
31
+ }
32
32
  }
33
- })
33
+ });
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const mpath = require('mpath');
4
- const template = require('./document-property.html')
4
+ const template = require('./document-property.html');
5
5
 
6
6
  const appendCSS = require('../../appendCSS');
7
7
 
@@ -12,7 +12,7 @@ module.exports = app => app.component('document-property', {
12
12
  data: function() {
13
13
  return {
14
14
  dateType: 'picker' // picker, iso
15
- }
15
+ };
16
16
  },
17
17
  props: ['path', 'document', 'schemaPaths', 'editting', 'changes', 'invalid'],
18
18
  methods: {
@@ -53,4 +53,4 @@ module.exports = app => app.component('document-property', {
53
53
  return path in this.changes ? this.changes[path] : mpath.get(path, this.document);
54
54
  }
55
55
  }
56
- })
56
+ });
@@ -5,7 +5,7 @@ const template = require('./edit-array.html');
5
5
  const { BSON } = require('bson');
6
6
 
7
7
  const ObjectId = new Proxy(BSON.ObjectId, {
8
- apply (target, thisArg, argumentsList) {
8
+ apply(target, thisArg, argumentsList) {
9
9
  return new target(...argumentsList);
10
10
  }
11
11
  });
@@ -5,7 +5,7 @@ const template = require('./edit-subdocument.html');
5
5
  const { BSON, EJSON } = require('bson');
6
6
 
7
7
  const ObjectId = new Proxy(BSON.ObjectId, {
8
- apply (target, thisArg, argumentsList) {
8
+ apply(target, thisArg, argumentsList) {
9
9
  return new target(...argumentsList);
10
10
  }
11
11
  });
@@ -13,7 +13,7 @@ module.exports = app => app.component('list-default', {
13
13
  copyText(value) {
14
14
  const storage = document.createElement('textarea');
15
15
  storage.value = value;
16
- const elem = this.$refs.itemData
16
+ const elem = this.$refs.itemData;
17
17
  elem.appendChild(storage);
18
18
  storage.select();
19
19
  storage.setSelectionRange(0, 99999);
@@ -28,7 +28,7 @@ module.exports = app => app.component('list-default', {
28
28
  });
29
29
  },
30
30
  goToDoc(id) {
31
- this.$router.push({ path: `/model/${this.allude}/document/${id}`});
31
+ this.$router.push({ path: `/model/${this.allude}/document/${id}` });
32
32
  }
33
33
  },
34
34
  computed: {
@@ -40,7 +40,7 @@ module.exports = app => app.component('list-default', {
40
40
  return 'undefined';
41
41
  }
42
42
  if (this.value.length > 30) {
43
- return this.value.substring(0,30) + '...';
43
+ return this.value.substring(0, 30) + '...';
44
44
  }
45
45
  return this.value;
46
46
  },
@@ -8,7 +8,7 @@ const { BSON, EJSON } = require('bson');
8
8
 
9
9
 
10
10
  const ObjectId = new Proxy(BSON.ObjectId, {
11
- apply (target, thisArg, argumentsList) {
11
+ apply(target, thisArg, argumentsList) {
12
12
  return new target(...argumentsList);
13
13
  }
14
14
  });
@@ -86,7 +86,7 @@ module.exports = app => app.component('models', {
86
86
  }
87
87
  if (this.$route.query?.fields) {
88
88
  const filter = this.$route.query.fields.split(',');
89
- this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path))
89
+ this.filteredPaths = this.filteredPaths.filter(x => filter.includes(x.path));
90
90
  }
91
91
 
92
92
 
@@ -121,7 +121,7 @@ module.exports = app => app.component('models', {
121
121
 
122
122
  this.$nextTick(() => {
123
123
  const input = this.$refs.searchInput;
124
- const cursorIndex = this.searchText.lastIndexOf(":") + 2; // Move cursor after ": "
124
+ const cursorIndex = this.searchText.lastIndexOf(':') + 2; // Move cursor after ": "
125
125
 
126
126
  input.focus();
127
127
  input.setSelectionRange(cursorIndex, cursorIndex);
@@ -136,7 +136,7 @@ module.exports = app => app.component('models', {
136
136
  },
137
137
  filterDocument(doc) {
138
138
  const filteredDoc = {};
139
- console.log(doc, this.filteredPaths)
139
+ console.log(doc, this.filteredPaths);
140
140
  for (let i = 0; i < this.filteredPaths.length; i++) {
141
141
  filteredDoc[this.filteredPaths[i].path] = doc[this.filteredPaths[i].path];
142
142
  }
@@ -175,7 +175,7 @@ module.exports = app => app.component('models', {
175
175
  }
176
176
  if (!sorted) {
177
177
  this.sortBy[path] = num;
178
- this.query.sort = `{${path}:${num}}`
178
+ this.query.sort = `{${path}:${num}}`;
179
179
  this.$router.push({ query: this.query });
180
180
  }
181
181
  await this.loadMoreDocuments();
@@ -201,11 +201,11 @@ module.exports = app => app.component('models', {
201
201
  },
202
202
  checkIndexLocation(indexName) {
203
203
  if (this.schemaIndexes.find(x => x.name == indexName) && this.mongoDBIndexes.find(x => x.name == indexName)) {
204
- return 'text-gray-500'
204
+ return 'text-gray-500';
205
205
  } else if (this.schemaIndexes.find(x => x.name == indexName)) {
206
- return 'text-forest-green-500'
206
+ return 'text-forest-green-500';
207
207
  } else {
208
- return 'text-valencia-500'
208
+ return 'text-valencia-500';
209
209
  }
210
210
  },
211
211
  async getDocuments() {
@@ -269,7 +269,7 @@ module.exports = app => app.component('models', {
269
269
  openFieldSelection() {
270
270
  if (this.$route.query?.fields) {
271
271
  this.selectedPaths.length = 0;
272
- console.log('there are fields in play', this.$route.query.fields)
272
+ console.log('there are fields in play', this.$route.query.fields);
273
273
  const fields = this.$route.query.fields.split(',');
274
274
  for (let i = 0; i < fields.length; i++) {
275
275
  this.selectedPaths.push({ path: fields[i] });
@@ -342,7 +342,7 @@ module.exports = app => app.component('models', {
342
342
  handleDocumentClick(document) {
343
343
  console.log(this.selectedDocuments);
344
344
  if (this.selectMultiple) {
345
- const exists = this.selectedDocuments.find(x => x._id.toString() == document._id.toString())
345
+ const exists = this.selectedDocuments.find(x => x._id.toString() == document._id.toString());
346
346
  if (exists) {
347
347
  const index = this.selectedDocuments.findIndex(x => x._id.toString() == document._id.toString());
348
348
  if (index !== -1) {
@@ -352,7 +352,7 @@ module.exports = app => app.component('models', {
352
352
  this.selectedDocuments.push(document);
353
353
  }
354
354
  } else {
355
- this.$router.push('/model/' + this.currentModel + '/document/' + document._id)
355
+ this.$router.push('/model/' + this.currentModel + '/document/' + document._id);
356
356
  }
357
357
  },
358
358
  async deleteDocuments() {