@cloudron/pankow 4.2.1 → 4.2.2

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.
@@ -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
@@ -40,6 +40,7 @@ import SplitLayout from './components/SplitLayout.vue';
40
40
  import Spinner from './components/Spinner.vue';
41
41
  import Switch from './components/Switch.vue';
42
42
  import TableView from './components/TableView.vue';
43
+ import TableViewActionBar from './components/TableViewActionBar.vue';
43
44
  import TabView from './components/TabView.vue';
44
45
  import TagInput from './components/TagInput.vue';
45
46
  import TextInput from './components/TextInput.vue';
@@ -90,6 +91,7 @@ export {
90
91
  Spinner,
91
92
  Switch,
92
93
  TableView,
94
+ TableViewActionBar,
93
95
  TabView,
94
96
  TagInput,
95
97
  TextInput,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudron/pankow",
3
3
  "private": false,
4
- "version": "4.2.1",
4
+ "version": "4.2.2",
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.2.0",
27
- "filesize": "^11.0.17",
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.0.16",
37
- "vue": "^3.5.38",
36
+ "vite": "^8.1.0",
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, 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, SideBar, SplitLayout, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, TreeView, fetcher, gestures, tooltip, fallbackImage, utils };
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, SideBar, SplitLayout, Spinner, Switch, TableView, TableViewActionBar, TabView, TagInput, TextInput, TextInputRaw, TopBar, TreeView, fetcher, gestures, tooltip, fallbackImage, utils };
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
- });