@coworkee/airworks 0.0.1037 → 0.0.1039
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/dist/apps/admin/system.js +14 -1
- package/package.json +2 -2
|
@@ -117,6 +117,13 @@ export const themesApp = crudApp({
|
|
|
117
117
|
},
|
|
118
118
|
],
|
|
119
119
|
});
|
|
120
|
+
/** The file the user picks, or null when the picker closes without one. */
|
|
121
|
+
const pickFile = (accept) => new Promise((resolve) => {
|
|
122
|
+
const input = Object.assign(document.createElement('input'), { type: 'file', accept });
|
|
123
|
+
input.addEventListener('change', () => resolve(input.files?.[0] ?? null));
|
|
124
|
+
input.addEventListener('cancel', () => resolve(null));
|
|
125
|
+
input.click();
|
|
126
|
+
});
|
|
120
127
|
export const backupsApp = crudApp({
|
|
121
128
|
id: 'coworkee.admin.backups', group: 'System', title: 'Backups', icon: icons.backup, accent: '#455a64',
|
|
122
129
|
permissions: ['Backups.Manage'], hostOnly: true,
|
|
@@ -125,7 +132,13 @@ export const backupsApp = crudApp({
|
|
|
125
132
|
{ field: 'name', title: 'Name' }, { field: 'createdAt', title: 'Created' }, { field: 'tables', title: 'Tables' },
|
|
126
133
|
{ field: 'size', title: 'Size', format: (backup) => `${(Number(backup.size) / 1048576).toFixed(1)} MB` }, { field: 'migration', title: 'Migration' },
|
|
127
134
|
],
|
|
128
|
-
toolbar: [
|
|
135
|
+
toolbar: [
|
|
136
|
+
{ title: 'Upload backup', run: async ({ request }) => {
|
|
137
|
+
const file = await pickFile('.zip');
|
|
138
|
+
return file && request(`/api/v1/backups/upload?${new URLSearchParams({ name: file.name })}`, { method: 'POST', body: file, headers: { 'Content-Type': 'application/zip' } });
|
|
139
|
+
} },
|
|
140
|
+
{ title: 'Create backup', primary: true, run: ({ request }) => request('/api/v1/backups', json('POST')) },
|
|
141
|
+
],
|
|
129
142
|
remove: { run: (backup, { request }) => request(`/api/v1/backups/${backup.id}`, json('DELETE')) },
|
|
130
143
|
actions: [
|
|
131
144
|
{ title: 'Download', icon: '⬇', run: async (backup) => { window.open(`/api/v1/backups/${backup.id}/download`, '_blank'); return false; } },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coworkee/airworks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1039",
|
|
4
4
|
"description": "AirWorks web desktop for Coworkee apps: sign-in through the app's BFF, theme, texts, realtime and apps for settings, files, data, chat, reports, the assistant and the administration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://fgilde.github.io/CoworkeeLib/web/airworks/",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"test": "node --test \"test/**/*.test.ts\""
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@coworkee/client": "0.0.
|
|
43
|
+
"@coworkee/client": "0.0.1039"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@fgilde/airworks": ">=0.4.0"
|