@cloudron/pankow 4.2.1 → 4.2.3
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/components/MenuItem.vue +2 -2
- package/components/MenuItemLink.vue +1 -1
- package/components/{Radiobutton.vue → RadioButton.vue} +12 -28
- package/components/SectionItem.vue +113 -0
- package/components/TableViewActionBar.vue +110 -0
- package/index.js +14 -6
- package/package.json +5 -5
- package/types/index.d.ts +1 -1
- package/stats.js +0 -89
- /package/components/{Breadcrumb.vue → BreadCrumb.vue} +0 -0
- /package/components/{Checkbox.vue → CheckBox.vue} +0 -0
package/components/MenuItem.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
|
|
3
3
|
import { computed } from 'vue';
|
|
4
|
-
import
|
|
4
|
+
import CheckBox from './CheckBox.vue';
|
|
5
5
|
import Icon from './Icon.vue';
|
|
6
6
|
|
|
7
7
|
const emit = defineEmits(['activated']);
|
|
@@ -43,7 +43,7 @@ function onActivated() {
|
|
|
43
43
|
|
|
44
44
|
<template>
|
|
45
45
|
<div class="pankow-menu-item" :class="{'pankow-menu-item-disabled': isDisabled }" @click.stop="onActivated" :separator="item.separator" v-if="isVisible" tabindex="0" @keydown.enter.stop="onActivated" @keydown.space.stop="onActivated">
|
|
46
|
-
<
|
|
46
|
+
<CheckBox v-model="item.checked" v-if="item.checkbox" style="margin-right: 4px; display: inline-flex;"/>
|
|
47
47
|
<span v-if="!item.separator" :style="{ width: (hasIcons && !item.checkbox) ? '29px' : 0 }"><Icon v-show="hasIcons" :icon="item.icon"/></span>{{ item.label }}
|
|
48
48
|
<div class="pankow-menu-item-separator-line" v-if="item.separator"></div>
|
|
49
49
|
</div>
|
|
@@ -7,37 +7,21 @@
|
|
|
7
7
|
</span>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
|
-
<script>
|
|
10
|
+
<script setup>
|
|
11
11
|
|
|
12
12
|
import { uuidv4 } from '../utils.js';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
computed: {
|
|
26
|
-
internalValue: {
|
|
27
|
-
get() {
|
|
28
|
-
return this.modelValue
|
|
29
|
-
},
|
|
30
|
-
set(internalValue) {
|
|
31
|
-
this.$emit('update:modelValue', internalValue)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
data () {
|
|
36
|
-
return {
|
|
37
|
-
internalId: uuidv4()
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
14
|
+
defineProps({
|
|
15
|
+
value: String,
|
|
16
|
+
label: String,
|
|
17
|
+
id: String,
|
|
18
|
+
name: String,
|
|
19
|
+
disabled: null
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const internalValue = defineModel({ type: String });
|
|
23
|
+
|
|
24
|
+
const internalId = uuidv4();
|
|
41
25
|
|
|
42
26
|
</script>
|
|
43
27
|
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
|
|
3
|
+
import { useTemplateRef, ref, onMounted, onUnmounted } from 'vue';
|
|
4
|
+
|
|
5
|
+
const mobileFilterBar = useTemplateRef('mobileFilterBar');
|
|
6
|
+
|
|
7
|
+
const isMobile = ref(false);
|
|
8
|
+
|
|
9
|
+
defineProps({
|
|
10
|
+
title: String,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
function checkForMobile() {
|
|
14
|
+
isMobile.value = window.innerWidth <= 576;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
checkForMobile();
|
|
19
|
+
window.addEventListener('resize', checkForMobile);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
onUnmounted(() => {
|
|
23
|
+
window.removeEventListener('resize', checkForMobile);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div class="pankow-section-item">
|
|
30
|
+
<h2 class="pankow-section-item-header">
|
|
31
|
+
<div>
|
|
32
|
+
<div class="pankow-section-item-header-title-text">
|
|
33
|
+
<slot name="header-title">{{ title }}</slot>
|
|
34
|
+
<slot name="header-title-extra"></slot>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div>
|
|
38
|
+
<Teleport :disabled="!isMobile" :to="mobileFilterBar">
|
|
39
|
+
<slot name="filter-bar"></slot>
|
|
40
|
+
</Teleport>
|
|
41
|
+
<slot name="header-buttons"></slot>
|
|
42
|
+
</div>
|
|
43
|
+
</h2>
|
|
44
|
+
<div class="pankow-section-item-mobile-filter-bar" v-show="isMobile && $slots['filter-bar']" ref="mobileFilterBar"></div>
|
|
45
|
+
<hr class="pankow-section-item-divider"/>
|
|
46
|
+
<div class="pankow-section-item-body">
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
|
|
54
|
+
.pankow-section-item {
|
|
55
|
+
margin-bottom: 20px;
|
|
56
|
+
position: relative;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.pankow-section-item-header {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-wrap: wrap;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 5px;
|
|
65
|
+
padding-left: 15px;
|
|
66
|
+
padding-right: 15px;
|
|
67
|
+
padding-top: 5px;
|
|
68
|
+
margin-top: 0;
|
|
69
|
+
margin-bottom: 0;
|
|
70
|
+
font-size: 24px;
|
|
71
|
+
font-weight: var(--pankow-font-weight-bold);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pankow-section-item-header > div {
|
|
75
|
+
display: flex;
|
|
76
|
+
gap: 6px;
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
align-items: center;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.pankow-section-item-header-title-text {
|
|
82
|
+
display: flex;
|
|
83
|
+
gap: 6px;
|
|
84
|
+
align-items: baseline;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.pankow-section-item-divider {
|
|
88
|
+
border: 0;
|
|
89
|
+
border-top: 1px solid #d8dee4;
|
|
90
|
+
margin-top: 10px;
|
|
91
|
+
margin-bottom: 5px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media (prefers-color-scheme: dark) {
|
|
95
|
+
.pankow-section-item-divider {
|
|
96
|
+
border-top-color: #495057;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.pankow-section-item-body {
|
|
101
|
+
position: relative;
|
|
102
|
+
margin-bottom: 15px;
|
|
103
|
+
padding: 10px 15px 25px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.pankow-section-item-mobile-filter-bar {
|
|
107
|
+
display: flex;
|
|
108
|
+
gap: 6px;
|
|
109
|
+
flex-wrap: wrap;
|
|
110
|
+
margin: 10px 15px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
|
|
3
|
+
import { computed, useTemplateRef, ref } from 'vue';
|
|
4
|
+
import Menu from './Menu.vue';
|
|
5
|
+
import Button from './Button.vue';
|
|
6
|
+
import ButtonGroup from './ButtonGroup.vue';
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
actions: {
|
|
10
|
+
type: Array,
|
|
11
|
+
default: () => [],
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const quickActions = computed(() => {
|
|
16
|
+
if (window.innerWidth <= 576) return [];
|
|
17
|
+
|
|
18
|
+
const visibleActions = props.actions.filter(a => !(typeof a.visible !== 'undefined' && !a.visible) && !a.separator);
|
|
19
|
+
if (visibleActions.length <= 2) return visibleActions;
|
|
20
|
+
|
|
21
|
+
return visibleActions.filter(a => a.quickAction);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const visibleActionCount = computed(() => {
|
|
25
|
+
return props.actions.filter(a => !(typeof a.visible !== 'undefined' && !a.visible) && !a.separator).length;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const isMenuOpen = ref(false);
|
|
29
|
+
|
|
30
|
+
const menuElement = useTemplateRef('menuElement');
|
|
31
|
+
function onMenu(event) {
|
|
32
|
+
isMenuOpen.value = true;
|
|
33
|
+
menuElement.value.open(event, event.currentTarget);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<div class="pankow-table-view-action-bar" :class="{ 'is-menu-open': isMenuOpen }">
|
|
40
|
+
<Menu ref="menuElement" :model="actions" @close="isMenuOpen = false" />
|
|
41
|
+
<ButtonGroup class="pankow-table-view-action-bar-quick-actions">
|
|
42
|
+
<Button tool v-for="quickAction in quickActions" :key="quickAction" :icon="quickAction.icon" @click="quickAction.action && quickAction.action()" :href="quickAction.href || null" :target="quickAction.target || null" v-tooltip.top="quickAction.label"/>
|
|
43
|
+
<Button tool @click.capture="onMenu($event)" icon="fa-solid fa-ellipsis" v-if="visibleActionCount > 0 && visibleActionCount !== quickActions.length"/>
|
|
44
|
+
</ButtonGroup>
|
|
45
|
+
<Button tool :plain="isMenuOpen ? null : true" secondary @click.capture="onMenu($event)" icon="fa-solid fa-ellipsis" v-if="visibleActionCount > 0" class="pankow-table-view-action-bar-menu-trigger"/>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<style scoped>
|
|
50
|
+
|
|
51
|
+
.pankow-table-view-action-bar {
|
|
52
|
+
display: flex;
|
|
53
|
+
gap: 5px;
|
|
54
|
+
justify-content: end;
|
|
55
|
+
min-height: 31px;
|
|
56
|
+
align-items: center;
|
|
57
|
+
min-width: 55px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.pankow-table-view-action-bar-menu-trigger {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.pankow-table-view-action-bar-quick-actions {
|
|
65
|
+
display: block;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pankow-table-view-action-bar .pankow-table-view-action-bar-quick-actions .pankow-button {
|
|
69
|
+
background-color: var(--pankow-input-background-color);
|
|
70
|
+
color: var(--pankow-color-text);
|
|
71
|
+
border: 1px solid transparent;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pankow-table-view-action-bar .pankow-table-view-action-bar-quick-actions .pankow-button:hover {
|
|
75
|
+
color: var(--pankow-color-primary);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (hover: hover) {
|
|
79
|
+
.pankow-table-view-action-bar-quick-actions {
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.pankow-table-view-action-bar-menu-trigger {
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.pankow-table-row-with-hover:hover .pankow-table-view-action-bar-quick-actions {
|
|
88
|
+
display: block;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.pankow-table-row-with-hover:hover .pankow-table-view-action-bar-menu-trigger {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media (hover: none) {
|
|
97
|
+
.pankow-table-view-action-bar-quick-actions {
|
|
98
|
+
display: block;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.pankow-table-view-action-bar-menu-trigger {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.pankow-table-view-action-bar.is-menu-open .pankow-table-view-action-bar-menu-trigger {
|
|
107
|
+
display: block !important;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
</style>
|
package/index.js
CHANGED
|
@@ -7,12 +7,12 @@ import './style.css';
|
|
|
7
7
|
|
|
8
8
|
// Order of import matters due to css rule matching!
|
|
9
9
|
import BottomBar from './components/BottomBar.vue';
|
|
10
|
-
import
|
|
10
|
+
import BreadCrumb from './components/BreadCrumb.vue';
|
|
11
11
|
import Button from './components/Button.vue';
|
|
12
12
|
import ButtonGroup from './components/ButtonGroup.vue';
|
|
13
13
|
import ClipboardAction from './components/ClipboardAction.vue';
|
|
14
14
|
import ClipboardButton from './components/ClipboardButton.vue';
|
|
15
|
-
import
|
|
15
|
+
import CheckBox from './components/CheckBox.vue';
|
|
16
16
|
import DateTimeInput from './components/DateTimeInput.vue';
|
|
17
17
|
import Dialog from './components/Dialog.vue';
|
|
18
18
|
import DirectoryView from './components/DirectoryView.vue';
|
|
@@ -34,12 +34,14 @@ import OfflineBanner from './components/OfflineBanner.vue';
|
|
|
34
34
|
import PasswordInput from './components/PasswordInput.vue';
|
|
35
35
|
import Popover from './components/Popover.vue';
|
|
36
36
|
import ProgressBar from './components/ProgressBar.vue';
|
|
37
|
-
import
|
|
37
|
+
import RadioButton from './components/RadioButton.vue';
|
|
38
|
+
import SectionItem from './components/SectionItem.vue';
|
|
38
39
|
import SideBar from './components/SideBar.vue';
|
|
39
40
|
import SplitLayout from './components/SplitLayout.vue';
|
|
40
41
|
import Spinner from './components/Spinner.vue';
|
|
41
42
|
import Switch from './components/Switch.vue';
|
|
42
43
|
import TableView from './components/TableView.vue';
|
|
44
|
+
import TableViewActionBar from './components/TableViewActionBar.vue';
|
|
43
45
|
import TabView from './components/TabView.vue';
|
|
44
46
|
import TagInput from './components/TagInput.vue';
|
|
45
47
|
import TextInput from './components/TextInput.vue';
|
|
@@ -56,12 +58,12 @@ import fallbackImage from './fallbackImage.js';
|
|
|
56
58
|
|
|
57
59
|
export {
|
|
58
60
|
BottomBar,
|
|
59
|
-
|
|
61
|
+
BreadCrumb,
|
|
60
62
|
Button,
|
|
61
63
|
ButtonGroup,
|
|
62
64
|
ClipboardAction,
|
|
63
65
|
ClipboardButton,
|
|
64
|
-
|
|
66
|
+
CheckBox,
|
|
65
67
|
DateTimeInput,
|
|
66
68
|
Dialog,
|
|
67
69
|
DirectoryView,
|
|
@@ -84,12 +86,14 @@ export {
|
|
|
84
86
|
PasswordInput,
|
|
85
87
|
Popover,
|
|
86
88
|
ProgressBar,
|
|
87
|
-
|
|
89
|
+
RadioButton,
|
|
90
|
+
SectionItem,
|
|
88
91
|
SideBar,
|
|
89
92
|
SplitLayout,
|
|
90
93
|
Spinner,
|
|
91
94
|
Switch,
|
|
92
95
|
TableView,
|
|
96
|
+
TableViewActionBar,
|
|
93
97
|
TabView,
|
|
94
98
|
TagInput,
|
|
95
99
|
TextInput,
|
|
@@ -103,3 +107,7 @@ export {
|
|
|
103
107
|
fallbackImage,
|
|
104
108
|
utils,
|
|
105
109
|
};
|
|
110
|
+
|
|
111
|
+
export { CheckBox as Checkbox }; /* deprecated */
|
|
112
|
+
export { RadioButton as Radiobutton }; /* deprecated */
|
|
113
|
+
export { BreadCrumb as Breadcrumb }; /* deprecated */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudron/pankow",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.3",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"license": "ISC",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@fontsource/inter": "^5.2.8",
|
|
26
|
-
"@fortawesome/fontawesome-free": "^7.
|
|
27
|
-
"filesize": "^11.0.
|
|
26
|
+
"@fortawesome/fontawesome-free": "^7.3.0",
|
|
27
|
+
"filesize": "^11.0.19",
|
|
28
28
|
"monaco-editor": "^0.55.1",
|
|
29
29
|
"online-3d-viewer": "^0.18.0"
|
|
30
30
|
},
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
34
34
|
"highlight.js": "^11.11.1",
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
|
-
"vite": "^8.
|
|
37
|
-
"vue": "^3.5.
|
|
36
|
+
"vite": "^8.1.3",
|
|
37
|
+
"vue": "^3.5.39",
|
|
38
38
|
"vue-router": "^5.1.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import gestures from './gestures.js';
|
|
|
3
3
|
import tooltip from './tooltip.js';
|
|
4
4
|
import fallbackImage from './fallbackImage.js';
|
|
5
5
|
import utils from './utils.js';
|
|
6
|
-
export { BottomBar,
|
|
6
|
+
export { BottomBar, BreadCrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, CheckBox, DateTimeInput, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, LoginView, MainLayout, MaskedInput, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, RadioButton, SectionItem, SideBar, SplitLayout, Spinner, Switch, TableView, TableViewActionBar, TabView, TagInput, TextInput, TextInputRaw, TopBar, TreeView, fetcher, gestures, tooltip, fallbackImage, utils, CheckBox as Checkbox, RadioButton as Radiobutton, BreadCrumb as Breadcrumb };
|
package/stats.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lists all collections in the Cloudron MongoDB database and displays their sizes.
|
|
3
|
-
* Uses: CLOUDRON_MONGODB_URL, or CLOUDRON_MONGODB_HOST/PORT/DATABASE/USERNAME/PASSWORD
|
|
4
|
-
*
|
|
5
|
-
* Run: node stats.js
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { MongoClient } from 'mongodb';
|
|
9
|
-
|
|
10
|
-
function formatBytes(bytes) {
|
|
11
|
-
if (bytes === 0) return '0 B';
|
|
12
|
-
const k = 1024;
|
|
13
|
-
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
14
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
15
|
-
return `${(bytes / Math.pow(k, i)).toFixed(2)} ${sizes[i]}`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function getConnectionUrl() {
|
|
19
|
-
const url = process.env.CLOUDRON_MONGODB_URL;
|
|
20
|
-
if (url) return url;
|
|
21
|
-
|
|
22
|
-
const host = process.env.CLOUDRON_MONGODB_HOST;
|
|
23
|
-
const port = process.env.CLOUDRON_MONGODB_PORT;
|
|
24
|
-
const database = process.env.CLOUDRON_MONGODB_DATABASE;
|
|
25
|
-
const username = process.env.CLOUDRON_MONGODB_USERNAME;
|
|
26
|
-
const password = process.env.CLOUDRON_MONGODB_PASSWORD;
|
|
27
|
-
|
|
28
|
-
if (!host || !database) {
|
|
29
|
-
throw new Error(
|
|
30
|
-
'Set CLOUDRON_MONGODB_URL or CLOUDRON_MONGODB_HOST and CLOUDRON_MONGODB_DATABASE (and optionally USERNAME, PASSWORD, PORT)'
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const auth = username && password ? `${encodeURIComponent(username)}:${encodeURIComponent(password)}@` : '';
|
|
35
|
-
const portPart = port ? `:${port}` : '';
|
|
36
|
-
return `mongodb://${auth}${host}${portPart}/${database}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function main() {
|
|
40
|
-
const uri = getConnectionUrl();
|
|
41
|
-
const client = new MongoClient(uri);
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
await client.connect();
|
|
45
|
-
const db = client.db(); // uses database from URI
|
|
46
|
-
const dbName = db.databaseName;
|
|
47
|
-
|
|
48
|
-
const collections = await db.listCollections().toArray();
|
|
49
|
-
if (collections.length === 0) {
|
|
50
|
-
console.log(`Database "${dbName}" has no collections.\n`);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
console.log(`Database: ${dbName}\n`);
|
|
55
|
-
console.log('Collection | Size (data) | Storage size | Index size');
|
|
56
|
-
console.log('-'.repeat(75));
|
|
57
|
-
|
|
58
|
-
let totalSize = 0;
|
|
59
|
-
let totalStorageSize = 0;
|
|
60
|
-
let totalIndexSize = 0;
|
|
61
|
-
|
|
62
|
-
for (const { name } of collections) {
|
|
63
|
-
const stats = await db.command({ collStats: name });
|
|
64
|
-
const size = stats.size ?? 0;
|
|
65
|
-
const storageSize = stats.storageSize ?? 0;
|
|
66
|
-
const indexSize = stats.totalIndexSize ?? 0;
|
|
67
|
-
|
|
68
|
-
totalSize += size;
|
|
69
|
-
totalStorageSize += storageSize;
|
|
70
|
-
totalIndexSize += indexSize;
|
|
71
|
-
|
|
72
|
-
console.log(
|
|
73
|
-
`${name.padEnd(28)} | ${formatBytes(size).padStart(13)} | ${formatBytes(storageSize).padStart(13)} | ${formatBytes(indexSize)}`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
console.log('-'.repeat(75));
|
|
78
|
-
console.log(
|
|
79
|
-
`${'TOTAL'.padEnd(28)} | ${formatBytes(totalSize).padStart(13)} | ${formatBytes(totalStorageSize).padStart(13)} | ${formatBytes(totalIndexSize)}`
|
|
80
|
-
);
|
|
81
|
-
} finally {
|
|
82
|
-
await client.close();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
main().catch((err) => {
|
|
87
|
-
console.error(err);
|
|
88
|
-
process.exit(1);
|
|
89
|
-
});
|
|
File without changes
|
|
File without changes
|