@mongoosejs/studio 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/actions/Model/getDocument.js +2 -1
- package/backend/actions/Model/getDocuments.js +3 -2
- package/backend/actions/Model/getDocumentsStream.js +3 -2
- package/backend/helpers/getRefFromSchemaType.js +5 -0
- package/frontend/public/app.js +15045 -605
- package/frontend/src/chat/chat-message/chat-message.js +2 -15
- package/frontend/src/chat/chat-message-script/chat-message-script.js +4 -29
- package/frontend/src/chat/chat.js +4 -29
- package/frontend/src/clone-document/clone-document.js +1 -8
- package/frontend/src/create-dashboard/create-dashboard.js +1 -8
- package/frontend/src/create-document/create-document.js +1 -8
- package/frontend/src/dashboard/dashboard.js +1 -8
- package/frontend/src/dashboard/edit-dashboard/edit-dashboard.js +1 -8
- package/frontend/src/dashboards/dashboards.js +1 -8
- package/frontend/src/document/document.js +3 -23
- package/frontend/src/export-query-results/export-query-results.js +1 -8
- package/frontend/src/index.js +13 -7
- package/frontend/src/list-default/list-default.js +1 -8
- package/frontend/src/list-json/json-node.html +1 -1
- package/frontend/src/list-json/list-json.js +28 -3
- package/frontend/src/list-mixed/list-mixed.js +1 -8
- package/frontend/src/list-string/list-string.js +1 -8
- package/frontend/src/list-subdocument/list-subdocument.js +1 -8
- package/frontend/src/models/models.html +7 -0
- package/frontend/src/models/models.js +16 -22
- package/frontend/src/update-document/update-document.js +1 -8
- package/package.json +4 -4
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../../api');
|
|
4
4
|
const marked = require('marked').marked;
|
|
5
|
-
const vanillatoasts = require('vanillatoasts');
|
|
6
5
|
const template = require('./chat-message.html');
|
|
7
6
|
|
|
8
7
|
module.exports = app => app.component('chat-message', {
|
|
@@ -62,13 +61,7 @@ module.exports = app => app.component('chat-message', {
|
|
|
62
61
|
});
|
|
63
62
|
message.executionResult = chatMessage.executionResult;
|
|
64
63
|
console.log(message);
|
|
65
|
-
|
|
66
|
-
title: 'Script executed successfully!',
|
|
67
|
-
type: 'success',
|
|
68
|
-
timeout: 3000,
|
|
69
|
-
icon: 'images/success.png',
|
|
70
|
-
positionClass: 'bottomRight'
|
|
71
|
-
});
|
|
64
|
+
this.$toast.success('Script executed successfully!');
|
|
72
65
|
},
|
|
73
66
|
async copyMessage() {
|
|
74
67
|
const parts = this.contentSplitByScripts;
|
|
@@ -93,13 +86,7 @@ module.exports = app => app.component('chat-message', {
|
|
|
93
86
|
}
|
|
94
87
|
}
|
|
95
88
|
await navigator.clipboard.writeText(output.trim());
|
|
96
|
-
|
|
97
|
-
title: 'Message output copied!',
|
|
98
|
-
type: 'success',
|
|
99
|
-
timeout: 3000,
|
|
100
|
-
icon: 'images/success.png',
|
|
101
|
-
positionClass: 'bottomRight'
|
|
102
|
-
});
|
|
89
|
+
this.$toast.success('Message output copied!');
|
|
103
90
|
}
|
|
104
91
|
}
|
|
105
92
|
});
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
const api = require('../../api');
|
|
5
5
|
const template = require('./chat-message-script.html');
|
|
6
|
-
const vanillatoasts = require('vanillatoasts');
|
|
7
6
|
|
|
8
7
|
module.exports = app => app.component('chat-message-script', {
|
|
9
8
|
template,
|
|
@@ -56,13 +55,7 @@ module.exports = app => app.component('chat-message-script', {
|
|
|
56
55
|
this.highlightCode();
|
|
57
56
|
}
|
|
58
57
|
this.activeTab = 'output';
|
|
59
|
-
|
|
60
|
-
title: 'Script executed successfully!',
|
|
61
|
-
type: 'success',
|
|
62
|
-
timeout: 3000,
|
|
63
|
-
icon: 'images/success.png',
|
|
64
|
-
positionClass: 'bottomRight'
|
|
65
|
-
});
|
|
58
|
+
this.$toast.success('Script executed successfully!');
|
|
66
59
|
return chatMessage;
|
|
67
60
|
},
|
|
68
61
|
openDetailModal() {
|
|
@@ -164,13 +157,7 @@ module.exports = app => app.component('chat-message-script', {
|
|
|
164
157
|
throw err;
|
|
165
158
|
});
|
|
166
159
|
this.createError = null;
|
|
167
|
-
|
|
168
|
-
title: 'Dashboard created!',
|
|
169
|
-
type: 'success',
|
|
170
|
-
timeout: 3000,
|
|
171
|
-
icon: 'images/success.png',
|
|
172
|
-
positionClass: 'bottomRight'
|
|
173
|
-
});
|
|
160
|
+
this.$toast.success('Dashboard created!');
|
|
174
161
|
this.showCreateDashboardModal = false;
|
|
175
162
|
this.$router.push('/dashboard/' + dashboard._id);
|
|
176
163
|
},
|
|
@@ -197,13 +184,7 @@ module.exports = app => app.component('chat-message-script', {
|
|
|
197
184
|
});
|
|
198
185
|
|
|
199
186
|
this.overwriteError = null;
|
|
200
|
-
|
|
201
|
-
title: 'Dashboard updated!',
|
|
202
|
-
type: 'success',
|
|
203
|
-
timeout: 3000,
|
|
204
|
-
icon: 'images/success.png',
|
|
205
|
-
positionClass: 'bottomRight'
|
|
206
|
-
});
|
|
187
|
+
this.$toast.success('Dashboard updated!');
|
|
207
188
|
this.showOverwriteDashboardConfirmationModal = false;
|
|
208
189
|
this.$router.push('/dashboard/' + doc._id);
|
|
209
190
|
},
|
|
@@ -224,13 +205,7 @@ module.exports = app => app.component('chat-message-script', {
|
|
|
224
205
|
}
|
|
225
206
|
|
|
226
207
|
await navigator.clipboard.writeText(parts.join('\n\n'));
|
|
227
|
-
|
|
228
|
-
title: 'Code output copied!',
|
|
229
|
-
type: 'success',
|
|
230
|
-
timeout: 3000,
|
|
231
|
-
icon: 'images/success.png',
|
|
232
|
-
positionClass: 'bottomRight'
|
|
233
|
-
});
|
|
208
|
+
this.$toast.success('Code output copied!');
|
|
234
209
|
}
|
|
235
210
|
},
|
|
236
211
|
watch: {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const template = require('./chat.html');
|
|
5
|
-
const vanillatoasts = require('vanillatoasts');
|
|
6
5
|
|
|
7
6
|
module.exports = app => app.component('chat', {
|
|
8
7
|
template: template,
|
|
@@ -28,13 +27,7 @@ module.exports = app => app.component('chat', {
|
|
|
28
27
|
this.chatThreads.unshift(chatThread);
|
|
29
28
|
this.chatThreadId = chatThread._id;
|
|
30
29
|
this.chatMessages = [];
|
|
31
|
-
|
|
32
|
-
title: 'Chat thread created!',
|
|
33
|
-
type: 'success',
|
|
34
|
-
timeout: 3000,
|
|
35
|
-
icon: 'images/success.png',
|
|
36
|
-
positionClass: 'bottomRight'
|
|
37
|
-
});
|
|
30
|
+
this.$toast.success('Chat thread created!');
|
|
38
31
|
}
|
|
39
32
|
|
|
40
33
|
this.chatMessages.push({
|
|
@@ -128,13 +121,7 @@ module.exports = app => app.component('chat', {
|
|
|
128
121
|
},
|
|
129
122
|
async createNewThread() {
|
|
130
123
|
const { chatThread } = await api.ChatThread.createChatThread();
|
|
131
|
-
|
|
132
|
-
title: 'Chat thread created!',
|
|
133
|
-
type: 'success',
|
|
134
|
-
timeout: 3000,
|
|
135
|
-
icon: 'images/success.png',
|
|
136
|
-
positionClass: 'bottomRight'
|
|
137
|
-
});
|
|
124
|
+
this.$toast.success('Chat thread created!');
|
|
138
125
|
this.$router.push('/chat/' + chatThread._id);
|
|
139
126
|
},
|
|
140
127
|
async toggleShareThread() {
|
|
@@ -150,24 +137,12 @@ module.exports = app => app.component('chat', {
|
|
|
150
137
|
this.chatThreads.splice(idx, 1, chatThread);
|
|
151
138
|
}
|
|
152
139
|
|
|
153
|
-
|
|
154
|
-
title: 'Chat thread shared!',
|
|
155
|
-
type: 'success',
|
|
156
|
-
timeout: 3000,
|
|
157
|
-
icon: 'images/success.png',
|
|
158
|
-
positionClass: 'bottomRight'
|
|
159
|
-
});
|
|
140
|
+
this.$toast.success('Chat thread shared!');
|
|
160
141
|
|
|
161
142
|
// Copy current URL to clipboard and show a toast
|
|
162
143
|
const url = window.location.href;
|
|
163
144
|
await navigator.clipboard.writeText(url);
|
|
164
|
-
|
|
165
|
-
title: 'Share link copied!',
|
|
166
|
-
type: 'success',
|
|
167
|
-
timeout: 3000,
|
|
168
|
-
icon: 'images/success.png',
|
|
169
|
-
positionClass: 'bottomRight'
|
|
170
|
-
});
|
|
145
|
+
this.$toast.success('Share link copied!');
|
|
171
146
|
} finally {
|
|
172
147
|
this.sharingThread = false;
|
|
173
148
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
|
-
const vanillatoasts = require('vanillatoasts');
|
|
5
4
|
|
|
6
5
|
const { BSON, EJSON } = require('mongodb/lib/bson');
|
|
7
6
|
|
|
@@ -33,13 +32,7 @@ module.exports = app => app.component('clone-document', {
|
|
|
33
32
|
try {
|
|
34
33
|
const { doc } = await api.Model.createDocument({ model: this.currentModel, data });
|
|
35
34
|
this.errors.length = 0;
|
|
36
|
-
|
|
37
|
-
title: 'Document cloned!',
|
|
38
|
-
type: 'success',
|
|
39
|
-
timeout: 3000,
|
|
40
|
-
icon: 'images/success.png',
|
|
41
|
-
positionClass: 'bottomRight'
|
|
42
|
-
});
|
|
35
|
+
this.$toast.success('Document cloned!');
|
|
43
36
|
this.$emit('close', doc);
|
|
44
37
|
} catch (err) {
|
|
45
38
|
if (err.response?.data?.message) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
|
-
const vanillatoasts = require('vanillatoasts');
|
|
5
4
|
|
|
6
5
|
const template = require('./create-dashboard.html');
|
|
7
6
|
|
|
@@ -29,13 +28,7 @@ module.exports = app => app.component('create-dashboard', {
|
|
|
29
28
|
throw err;
|
|
30
29
|
});
|
|
31
30
|
this.errors.length = 0;
|
|
32
|
-
|
|
33
|
-
title: 'Dashboard created!',
|
|
34
|
-
type: 'success',
|
|
35
|
-
timeout: 3000,
|
|
36
|
-
icon: 'images/success.png',
|
|
37
|
-
positionClass: 'bottomRight'
|
|
38
|
-
});
|
|
31
|
+
this.$toast.success('Dashboard created!');
|
|
39
32
|
this.$emit('close', dashboard);
|
|
40
33
|
}
|
|
41
34
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
|
-
const vanillatoasts = require('vanillatoasts');
|
|
5
4
|
|
|
6
5
|
const { BSON, EJSON } = require('mongodb/lib/bson');
|
|
7
6
|
|
|
@@ -33,13 +32,7 @@ module.exports = app => app.component('create-document', {
|
|
|
33
32
|
try {
|
|
34
33
|
const { doc } = await api.Model.createDocument({ model: this.currentModel, data });
|
|
35
34
|
this.errors.length = 0;
|
|
36
|
-
|
|
37
|
-
title: 'Document created!',
|
|
38
|
-
type: 'success',
|
|
39
|
-
timeout: 3000,
|
|
40
|
-
icon: 'images/success.png',
|
|
41
|
-
positionClass: 'bottomRight'
|
|
42
|
-
});
|
|
35
|
+
this.$toast.success('Document created!');
|
|
43
36
|
this.$emit('close', doc);
|
|
44
37
|
} catch (err) {
|
|
45
38
|
if (err.response?.data?.message) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const template = require('./dashboard.html');
|
|
5
|
-
const vanillatoasts = require('vanillatoasts');
|
|
6
5
|
|
|
7
6
|
module.exports = app => app.component('dashboard', {
|
|
8
7
|
template: template,
|
|
@@ -110,13 +109,7 @@ module.exports = app => app.component('dashboard', {
|
|
|
110
109
|
initialMessage,
|
|
111
110
|
dashboardId: this.dashboard?._id
|
|
112
111
|
});
|
|
113
|
-
|
|
114
|
-
title: 'Chat thread created!',
|
|
115
|
-
type: 'success',
|
|
116
|
-
timeout: 3000,
|
|
117
|
-
icon: 'images/success.png',
|
|
118
|
-
positionClass: 'bottomRight'
|
|
119
|
-
});
|
|
112
|
+
this.$toast.success('Chat thread created!');
|
|
120
113
|
this.$router.push('/chat/' + chatThread._id);
|
|
121
114
|
} finally {
|
|
122
115
|
this.startingChat = false;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../../api');
|
|
4
4
|
const template = require('./edit-dashboard.html');
|
|
5
|
-
const vanillatoasts = require('vanillatoasts');
|
|
6
5
|
|
|
7
6
|
module.exports = app => app.component('edit-dashboard', {
|
|
8
7
|
template: template,
|
|
@@ -32,13 +31,7 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
32
31
|
});
|
|
33
32
|
this.$emit('update', { doc });
|
|
34
33
|
this.editor.setValue(doc.code);
|
|
35
|
-
|
|
36
|
-
title: 'Dashboard updated!',
|
|
37
|
-
type: 'success',
|
|
38
|
-
timeout: 3000,
|
|
39
|
-
icon: 'images/success.png',
|
|
40
|
-
positionClass: 'bottomRight'
|
|
41
|
-
});
|
|
34
|
+
this.$toast.success('Dashboard updated!');
|
|
42
35
|
this.closeEditor();
|
|
43
36
|
} catch (err) {
|
|
44
37
|
this.$emit('update', { error: { message: err.message } });
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const template = require('./dashboards.html');
|
|
5
|
-
const vanillatoasts = require('vanillatoasts');
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
module.exports = app => app.component('dashboards', {
|
|
@@ -22,13 +21,7 @@ module.exports = app => app.component('dashboards', {
|
|
|
22
21
|
const removedDashboard = this.dashboards.findIndex(x => x._id.toString() === dashboard._id.toString());
|
|
23
22
|
this.dashboards.splice(removedDashboard, 1);
|
|
24
23
|
this.showDeleteDashboardModal = null;
|
|
25
|
-
|
|
26
|
-
title: 'Dashboard deleted!',
|
|
27
|
-
type: 'success',
|
|
28
|
-
timeout: 3000,
|
|
29
|
-
icon: 'images/success.png',
|
|
30
|
-
positionClass: 'bottomRight'
|
|
31
|
-
});
|
|
24
|
+
this.$toast.success('Dashboard deleted!');
|
|
32
25
|
},
|
|
33
26
|
insertNewDashboard(dashboard) {
|
|
34
27
|
this.dashboards.push(dashboard);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const mpath = require('mpath');
|
|
5
5
|
const template = require('./document.html');
|
|
6
|
-
const vanillatoasts = require('vanillatoasts');
|
|
7
6
|
|
|
8
7
|
const appendCSS = require('../appendCSS');
|
|
9
8
|
|
|
@@ -83,13 +82,7 @@ module.exports = app => app.component('document', {
|
|
|
83
82
|
this.changes = {};
|
|
84
83
|
this.editting = false;
|
|
85
84
|
this.shouldShowConfirmModal = false;
|
|
86
|
-
|
|
87
|
-
title: 'Document saved!',
|
|
88
|
-
type: 'success',
|
|
89
|
-
timeout: 3000,
|
|
90
|
-
icon: 'images/success.png',
|
|
91
|
-
positionClass: 'bottomRight'
|
|
92
|
-
});
|
|
85
|
+
this.$toast.success('Document saved!');
|
|
93
86
|
},
|
|
94
87
|
async remove() {
|
|
95
88
|
const { doc } = await api.Model.deleteDocument({
|
|
@@ -99,13 +92,7 @@ module.exports = app => app.component('document', {
|
|
|
99
92
|
if (doc.acknowledged) {
|
|
100
93
|
this.editting = false;
|
|
101
94
|
this.document = {};
|
|
102
|
-
|
|
103
|
-
title: 'Document deleted!',
|
|
104
|
-
type: 'success',
|
|
105
|
-
timeout: 3000,
|
|
106
|
-
icon: 'images/success.png',
|
|
107
|
-
positionClass: 'bottomRight'
|
|
108
|
-
});
|
|
95
|
+
this.$toast.success('Document deleted!');
|
|
109
96
|
this.$router.push({
|
|
110
97
|
path: `/model/${this.model}`,
|
|
111
98
|
query: this.previousQuery || {}
|
|
@@ -124,14 +111,7 @@ module.exports = app => app.component('document', {
|
|
|
124
111
|
});
|
|
125
112
|
this.document = doc;
|
|
126
113
|
|
|
127
|
-
|
|
128
|
-
title: 'Field added!',
|
|
129
|
-
text: `Field "${fieldData.name}" has been added to the document`,
|
|
130
|
-
type: 'success',
|
|
131
|
-
timeout: 3000,
|
|
132
|
-
icon: 'images/success.png',
|
|
133
|
-
positionClass: 'bottomRight'
|
|
134
|
-
});
|
|
114
|
+
this.$toast.success(`Field added! Field "${fieldData.name}" has been added to the document`);
|
|
135
115
|
},
|
|
136
116
|
updateViewMode(mode) {
|
|
137
117
|
this.viewMode = mode;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const template = require('./export-query-results.html');
|
|
5
|
-
const vanillatoasts = require('vanillatoasts');
|
|
6
5
|
|
|
7
6
|
const appendCSS = require('../appendCSS');
|
|
8
7
|
|
|
@@ -31,13 +30,7 @@ module.exports = app => app.component('export-query-results', {
|
|
|
31
30
|
params.searchText = this.searchText;
|
|
32
31
|
}
|
|
33
32
|
await api.Model.exportQueryResults(params);
|
|
34
|
-
|
|
35
|
-
title: 'Export completed!',
|
|
36
|
-
type: 'success',
|
|
37
|
-
timeout: 3000,
|
|
38
|
-
icon: 'images/success.png',
|
|
39
|
-
positionClass: 'bottomRight'
|
|
40
|
-
});
|
|
33
|
+
this.$toast.success('Export completed!');
|
|
41
34
|
this.$emit('done');
|
|
42
35
|
}
|
|
43
36
|
}
|
package/frontend/src/index.js
CHANGED
|
@@ -12,12 +12,21 @@ const format = require('./format');
|
|
|
12
12
|
const arrayUtils = require('./array-utils');
|
|
13
13
|
const mothership = require('./mothership');
|
|
14
14
|
const { routes } = require('./routes');
|
|
15
|
-
const
|
|
15
|
+
const Toast = require('vue-toastification').default;
|
|
16
|
+
const { useToast } = require('vue-toastification');
|
|
17
|
+
const appendCSS = require('./appendCSS');
|
|
18
|
+
appendCSS(require('vue-toastification/dist/index.css'));
|
|
16
19
|
|
|
17
20
|
const app = Vue.createApp({
|
|
18
21
|
template: '<app-component />'
|
|
19
22
|
});
|
|
20
23
|
|
|
24
|
+
// https://github.com/Maronato/vue-toastification/tree/main?tab=readme-ov-file#toast-types
|
|
25
|
+
app.use(Toast, { position: 'bottom-right', timeout: 3000 });
|
|
26
|
+
|
|
27
|
+
// Create a global toast instance for convenience (must be after app.use)
|
|
28
|
+
const toast = useToast();
|
|
29
|
+
|
|
21
30
|
// Import all components
|
|
22
31
|
const requireComponents = require.context(
|
|
23
32
|
'.', // Relative path (current directory)
|
|
@@ -56,11 +65,8 @@ app.component('app-component', {
|
|
|
56
65
|
</div>
|
|
57
66
|
`,
|
|
58
67
|
errorCaptured(err) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
icon: 'images/failure.jpg',
|
|
62
|
-
timeout: 10000,
|
|
63
|
-
positionClass: 'bottomRight'
|
|
68
|
+
this.$toast.error(`Error: ${err?.response?.data?.message || err.message}`, {
|
|
69
|
+
timeout: 10000
|
|
64
70
|
});
|
|
65
71
|
},
|
|
66
72
|
computed: {
|
|
@@ -150,7 +156,7 @@ router.beforeEach((to, from, next) => {
|
|
|
150
156
|
}
|
|
151
157
|
});
|
|
152
158
|
|
|
153
|
-
app.config.globalProperties = { format, arrayUtils };
|
|
159
|
+
app.config.globalProperties = { format, arrayUtils, $toast: toast };
|
|
154
160
|
app.use(router);
|
|
155
161
|
|
|
156
162
|
app.mount('#content');
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const template = require('./list-default.html');
|
|
4
4
|
const appendCSS = require('../appendCSS');
|
|
5
|
-
const vanillatoast = require('vanillatoasts');
|
|
6
5
|
|
|
7
6
|
appendCSS(require('./list-default.css'));
|
|
8
7
|
|
|
@@ -19,13 +18,7 @@ module.exports = app => app.component('list-default', {
|
|
|
19
18
|
storage.setSelectionRange(0, 99999);
|
|
20
19
|
document.execCommand('copy');
|
|
21
20
|
elem.removeChild(storage);
|
|
22
|
-
|
|
23
|
-
title: 'Text copied!',
|
|
24
|
-
type: 'success',
|
|
25
|
-
timeout: 3000,
|
|
26
|
-
icon: 'images/success.png',
|
|
27
|
-
positionClass: 'bottomRight'
|
|
28
|
-
});
|
|
21
|
+
this.$toast.success('Text copied!');
|
|
29
22
|
},
|
|
30
23
|
goToDoc(id) {
|
|
31
24
|
this.$router.push({ path: `/model/${this.allude}/document/${id}` });
|
|
@@ -277,7 +277,31 @@ module.exports = app => app.component('list-json', {
|
|
|
277
277
|
return this.references[this.normalizedPath] || null;
|
|
278
278
|
},
|
|
279
279
|
shouldShowReferenceLink() {
|
|
280
|
-
return
|
|
280
|
+
return this.referenceId != null;
|
|
281
|
+
},
|
|
282
|
+
referenceId() {
|
|
283
|
+
if (!this.referenceModel) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
if (this.value == null) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
const type = typeof this.value;
|
|
290
|
+
if (type === 'string' || type === 'number' || type === 'bigint') {
|
|
291
|
+
return String(this.value);
|
|
292
|
+
}
|
|
293
|
+
if (type === 'object') {
|
|
294
|
+
if (this.value._id != null) {
|
|
295
|
+
return String(this.value._id);
|
|
296
|
+
}
|
|
297
|
+
if (typeof this.value.toString === 'function') {
|
|
298
|
+
const stringified = this.value.toString();
|
|
299
|
+
if (typeof stringified === 'string' && stringified !== '[object Object]') {
|
|
300
|
+
return stringified;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return null;
|
|
281
305
|
}
|
|
282
306
|
},
|
|
283
307
|
methods: {
|
|
@@ -303,8 +327,9 @@ module.exports = app => app.component('list-json', {
|
|
|
303
327
|
this.expandTopLevel();
|
|
304
328
|
}
|
|
305
329
|
},
|
|
306
|
-
goToReference(
|
|
307
|
-
|
|
330
|
+
goToReference() {
|
|
331
|
+
const id = this.referenceId;
|
|
332
|
+
if (!this.referenceModel || id == null) {
|
|
308
333
|
return;
|
|
309
334
|
}
|
|
310
335
|
this.$router.push({ path: `/model/${this.referenceModel}/document/${id}` });
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const template = require('./list-mixed.html');
|
|
5
5
|
|
|
6
|
-
const vanillatoast = require('vanillatoasts');
|
|
7
6
|
|
|
8
7
|
require('../appendCSS')(require('./list-mixed.css'));
|
|
9
8
|
|
|
@@ -25,13 +24,7 @@ module.exports = app => app.component('list-mixed', {
|
|
|
25
24
|
storage.setSelectionRange(0, 99999);
|
|
26
25
|
document.execCommand('copy');
|
|
27
26
|
elem.removeChild(storage);
|
|
28
|
-
|
|
29
|
-
title: 'Text copied!',
|
|
30
|
-
type: 'success',
|
|
31
|
-
timeout: 3000,
|
|
32
|
-
icon: 'images/success.png',
|
|
33
|
-
positionClass: 'bottomRight'
|
|
34
|
-
});
|
|
27
|
+
this.$toast.success('Text copied!');
|
|
35
28
|
}
|
|
36
29
|
},
|
|
37
30
|
mounted: function() {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const template = require('./list-string.html');
|
|
4
4
|
const appendCSS = require('../appendCSS');
|
|
5
|
-
const vanillatoast = require('vanillatoasts');
|
|
6
5
|
appendCSS(require('./list-string.css'));
|
|
7
6
|
|
|
8
7
|
module.exports = app => app.component('list-string', {
|
|
@@ -18,13 +17,7 @@ module.exports = app => app.component('list-string', {
|
|
|
18
17
|
storage.setSelectionRange(0, 99999);
|
|
19
18
|
document.execCommand('copy');
|
|
20
19
|
elem.removeChild(storage);
|
|
21
|
-
|
|
22
|
-
title: 'Text copied!',
|
|
23
|
-
type: 'success',
|
|
24
|
-
timeout: 3000,
|
|
25
|
-
icon: 'images/success.png',
|
|
26
|
-
positionClass: 'bottomRight'
|
|
27
|
-
});
|
|
20
|
+
this.$toast.success('Text copied!');
|
|
28
21
|
}
|
|
29
22
|
},
|
|
30
23
|
computed: {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const template = require('./list-subdocument.html');
|
|
5
|
-
const vanillatoast = require('vanillatoasts');
|
|
6
5
|
|
|
7
6
|
require('../appendCSS')(require('./list-subdocument.css'));
|
|
8
7
|
|
|
@@ -24,13 +23,7 @@ module.exports = app => app.component('list-subdocument', {
|
|
|
24
23
|
storage.setSelectionRange(0, 99999);
|
|
25
24
|
document.execCommand('copy');
|
|
26
25
|
elem.removeChild(storage);
|
|
27
|
-
|
|
28
|
-
title: 'Text copied!',
|
|
29
|
-
type: 'success',
|
|
30
|
-
timeout: 3000,
|
|
31
|
-
icon: 'images/success.png',
|
|
32
|
-
positionClass: 'bottomRight'
|
|
33
|
-
});
|
|
26
|
+
this.$toast.success('Text copied!');
|
|
34
27
|
}
|
|
35
28
|
},
|
|
36
29
|
mounted: function() {
|
|
@@ -122,6 +122,13 @@
|
|
|
122
122
|
>
|
|
123
123
|
Collection Info
|
|
124
124
|
</button>
|
|
125
|
+
<button
|
|
126
|
+
@click="findOldestDocument"
|
|
127
|
+
type="button"
|
|
128
|
+
class="block w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100"
|
|
129
|
+
>
|
|
130
|
+
Find oldest document
|
|
131
|
+
</button>
|
|
125
132
|
</div>
|
|
126
133
|
</div>
|
|
127
134
|
</div>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
const template = require('./models.html');
|
|
5
5
|
const mpath = require('mpath');
|
|
6
|
-
const vanillatoasts = require('vanillatoasts');
|
|
7
6
|
|
|
8
7
|
const appendCSS = require('../appendCSS');
|
|
9
8
|
appendCSS(require('./models.css'));
|
|
@@ -175,13 +174,7 @@ module.exports = app => app.component('models', {
|
|
|
175
174
|
async dropIndex(name) {
|
|
176
175
|
const { mongoDBIndexes } = await api.Model.dropIndex({ model: this.currentModel, name });
|
|
177
176
|
this.mongoDBIndexes = mongoDBIndexes;
|
|
178
|
-
|
|
179
|
-
title: 'Index dropped!',
|
|
180
|
-
type: 'success',
|
|
181
|
-
timeout: 3000,
|
|
182
|
-
icon: 'images/success.png',
|
|
183
|
-
positionClass: 'bottomRight'
|
|
184
|
-
});
|
|
177
|
+
this.$toast.success('Index dropped!');
|
|
185
178
|
},
|
|
186
179
|
async closeCreationModal() {
|
|
187
180
|
this.shouldShowCreateModal = false;
|
|
@@ -273,6 +266,19 @@ module.exports = app => app.component('models', {
|
|
|
273
266
|
const { info } = await api.Model.getCollectionInfo({ model: this.currentModel });
|
|
274
267
|
this.collectionInfo = info;
|
|
275
268
|
},
|
|
269
|
+
async findOldestDocument() {
|
|
270
|
+
this.closeActionsMenu();
|
|
271
|
+
const { docs } = await api.Model.getDocuments({
|
|
272
|
+
model: this.currentModel,
|
|
273
|
+
limit: 1,
|
|
274
|
+
sortKey: '_id',
|
|
275
|
+
sortDirection: 1
|
|
276
|
+
});
|
|
277
|
+
if (!Array.isArray(docs) || docs.length === 0) {
|
|
278
|
+
throw new Error('No documents found');
|
|
279
|
+
}
|
|
280
|
+
this.openDocument(docs[0]);
|
|
281
|
+
},
|
|
276
282
|
isTTLIndex(index) {
|
|
277
283
|
return index != null && index.expireAfterSeconds != null;
|
|
278
284
|
},
|
|
@@ -507,13 +513,7 @@ module.exports = app => app.component('models', {
|
|
|
507
513
|
this.documents[index] = res.doc;
|
|
508
514
|
}
|
|
509
515
|
this.edittingDoc = null;
|
|
510
|
-
|
|
511
|
-
title: 'Document updated!',
|
|
512
|
-
type: 'success',
|
|
513
|
-
timeout: 3000,
|
|
514
|
-
icon: 'images/success.png',
|
|
515
|
-
positionClass: 'bottomRight'
|
|
516
|
-
});
|
|
516
|
+
this.$toast.success('Document updated!');
|
|
517
517
|
},
|
|
518
518
|
handleDocumentClick(document, event) {
|
|
519
519
|
if (this.selectMultiple) {
|
|
@@ -577,13 +577,7 @@ module.exports = app => app.component('models', {
|
|
|
577
577
|
this.lastSelectedIndex = null;
|
|
578
578
|
this.shouldShowDeleteMultipleModal = false;
|
|
579
579
|
this.selectMultiple = false;
|
|
580
|
-
|
|
581
|
-
title: 'Documents deleted!',
|
|
582
|
-
type: 'success',
|
|
583
|
-
timeout: 3000,
|
|
584
|
-
icon: 'images/success.png',
|
|
585
|
-
positionClass: 'bottomRight'
|
|
586
|
-
});
|
|
580
|
+
this.$toast.success('Documents deleted!');
|
|
587
581
|
},
|
|
588
582
|
async updateDocuments() {
|
|
589
583
|
await this.getDocuments();
|