@mongoosejs/studio 0.0.5 → 0.0.6
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.
|
Binary file
|
package/frontend/src/api.js
CHANGED
|
@@ -108,7 +108,16 @@
|
|
|
108
108
|
width: calc(100% - 1em);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
.sort-arrow {
|
|
111
|
+
.models .sort-arrow {
|
|
112
112
|
padding-left: 10px;
|
|
113
113
|
padding-right: 10px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.models .loader {
|
|
117
|
+
width: 100%;
|
|
118
|
+
text-align: center;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.models .loader img {
|
|
122
|
+
height: 4em;
|
|
114
123
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</router-link>
|
|
8
8
|
</div>
|
|
9
9
|
</div>
|
|
10
|
-
<div class="documents">
|
|
10
|
+
<div class="documents" ref="documentsList">
|
|
11
11
|
<div>
|
|
12
12
|
<div class="documents-menu">
|
|
13
13
|
<div class="search-input">
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
</tr>
|
|
47
47
|
</tbody>
|
|
48
48
|
</table>
|
|
49
|
+
<div v-if="true" class="loader">
|
|
50
|
+
<img src="images/loader.gif">
|
|
51
|
+
</div>
|
|
49
52
|
</div>
|
|
50
53
|
<modal v-if="shouldShowExportModal">
|
|
51
54
|
<template v-slot:body>
|
|
@@ -26,12 +26,19 @@ module.exports = app => app.component('models', {
|
|
|
26
26
|
shouldShowExportModal: false,
|
|
27
27
|
shouldExport: {},
|
|
28
28
|
sortBy: {},
|
|
29
|
-
query: {}
|
|
29
|
+
query: {},
|
|
30
|
+
scrollHeight: 0,
|
|
31
|
+
limit: 50,
|
|
32
|
+
interval: null
|
|
30
33
|
}),
|
|
31
34
|
created() {
|
|
32
35
|
this.currentModel = this.model;
|
|
33
36
|
},
|
|
37
|
+
beforeDestroy() {
|
|
38
|
+
document.removeEventListener('scroll', () => this.onScroll(), true);
|
|
39
|
+
},
|
|
34
40
|
async mounted() {
|
|
41
|
+
document.addEventListener('scroll', () => this.onScroll(), true);
|
|
35
42
|
this.models = await api.Model.listModels().then(res => res.models);
|
|
36
43
|
if (this.currentModel == null && this.models.length > 0) {
|
|
37
44
|
this.currentModel = this.models[0];
|
|
@@ -56,6 +63,18 @@ module.exports = app => app.component('models', {
|
|
|
56
63
|
this.status = 'loaded';
|
|
57
64
|
},
|
|
58
65
|
methods: {
|
|
66
|
+
async onScroll() {
|
|
67
|
+
if (this.status === 'loading') {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const container = this.$refs.documentsList;
|
|
71
|
+
if (container.scrollHeight - container.clientHeight - 100 < container.scrollTop) {
|
|
72
|
+
this.status = 'loading';
|
|
73
|
+
this.limit += 50;
|
|
74
|
+
await this.getDocuments();
|
|
75
|
+
this.status = 'loaded';
|
|
76
|
+
}
|
|
77
|
+
},
|
|
59
78
|
async sortDocs(num, path) {
|
|
60
79
|
let sorted = false;
|
|
61
80
|
if (this.sortBy[path] == num) {
|
|
@@ -90,7 +109,8 @@ module.exports = app => app.component('models', {
|
|
|
90
109
|
const { docs, schemaPaths, numDocs } = await api.Model.getDocuments({
|
|
91
110
|
model: this.currentModel,
|
|
92
111
|
filter: this.filter,
|
|
93
|
-
sort: this.sortBy
|
|
112
|
+
sort: this.sortBy,
|
|
113
|
+
limit: this.limit
|
|
94
114
|
});
|
|
95
115
|
this.documents = docs;
|
|
96
116
|
this.schemaPaths = Object.keys(schemaPaths).sort((k1, k2) => {
|