@ossy/storage 1.9.6 → 1.10.0
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/package.json +2 -2
- package/src/Definition.js +1 -7
- package/src/ResourcesPage.jsx +31 -30
- package/src/SalesSection.jsx +3 -3
- package/src/en.translations.json +20 -0
- package/src/storage.page.jsx +14 -4
- package/src/sv.translations.json +20 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/storage",
|
|
3
3
|
"description": "Analytics module — workspace analytics for website traffic",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"module": "./src/index.js",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"ramda": "*",
|
|
31
31
|
"react": "*"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "d9d31182be64a448d575da432af2830d909ad4b9"
|
|
34
34
|
}
|
package/src/Definition.js
CHANGED
|
@@ -2,12 +2,6 @@ export const Definition = {
|
|
|
2
2
|
id: 'storage',
|
|
3
3
|
title: 'Storage',
|
|
4
4
|
description: 'Storage views and resource browsing inside workspaces.',
|
|
5
|
-
|
|
6
|
-
id: 'storage',
|
|
7
|
-
enabled: true
|
|
8
|
-
},
|
|
5
|
+
icon: 'software-upload',
|
|
9
6
|
statuses: ['beta'],
|
|
10
|
-
actions: ['resources.create-directory', 'resources.move', 'resources.rename', 'resources.remove'],
|
|
11
|
-
views: ['home.page', 'resources.list', 'resources.search', 'resources.get'],
|
|
12
|
-
tasks: ['resources.upload-named-version']
|
|
13
7
|
}
|
package/src/ResourcesPage.jsx
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
Overlay,
|
|
12
12
|
Switch,
|
|
13
|
-
Stack,
|
|
14
13
|
DropZone,
|
|
15
14
|
Breadcrumbs,
|
|
16
15
|
Guide,
|
|
@@ -23,6 +22,7 @@ import {
|
|
|
23
22
|
Title,
|
|
24
23
|
Tags,
|
|
25
24
|
EmptyState,
|
|
25
|
+
useLocale,
|
|
26
26
|
} from '@ossy/design-system'
|
|
27
27
|
import { useActivePath, ResourcePanel, ResourceList, ResourceDialogMove } from '@ossy/resources'
|
|
28
28
|
import { useRouter } from '@ossy/router-react'
|
|
@@ -49,6 +49,7 @@ const Overlays = {
|
|
|
49
49
|
|
|
50
50
|
export const ResourcesPage = () => {
|
|
51
51
|
const router = useRouter()
|
|
52
|
+
const { t } = useLocale()
|
|
52
53
|
const { workspace } = useWorkspace()
|
|
53
54
|
const [overlay, setOverlay] = useState(Overlays.None)
|
|
54
55
|
const [selectedResourceId, setSelectedResourceId] = useState()
|
|
@@ -64,7 +65,7 @@ export const ResourcesPage = () => {
|
|
|
64
65
|
} = useResources(activePath)
|
|
65
66
|
|
|
66
67
|
const [isCreatingFolder, setIsCreatingFolder] = useState(false)
|
|
67
|
-
const [newFolderName, setNewFolderName] = useState(
|
|
68
|
+
const [newFolderName, setNewFolderName] = useState(() => t('storage.resources.newFolderDefault'))
|
|
68
69
|
|
|
69
70
|
const onCreateFolderSave = (name) => {
|
|
70
71
|
const folderName = (name || '').trim()
|
|
@@ -75,7 +76,7 @@ export const ResourcesPage = () => {
|
|
|
75
76
|
createDirectory({ name: folderName, location: activePath })
|
|
76
77
|
.finally(() => {
|
|
77
78
|
setIsCreatingFolder(false)
|
|
78
|
-
setNewFolderName('
|
|
79
|
+
setNewFolderName(t('storage.resources.newFolderDefault'))
|
|
79
80
|
})
|
|
80
81
|
}
|
|
81
82
|
|
|
@@ -169,7 +170,7 @@ export const ResourcesPage = () => {
|
|
|
169
170
|
event.stopPropagation()
|
|
170
171
|
onRemoveResource(resource)
|
|
171
172
|
}}
|
|
172
|
-
>
|
|
173
|
+
>{t('storage.resources.contextRemove')}
|
|
173
174
|
</ContextMenu.Item>
|
|
174
175
|
]
|
|
175
176
|
}
|
|
@@ -200,7 +201,7 @@ export const ResourcesPage = () => {
|
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
>
|
|
203
|
-
|
|
204
|
+
{t('storage.resources.move')}
|
|
204
205
|
</ContextMenu.Item>,
|
|
205
206
|
<ContextMenu.Separator key="separator"></ContextMenu.Separator>,
|
|
206
207
|
<ContextMenu.Item
|
|
@@ -241,18 +242,18 @@ export const ResourcesPage = () => {
|
|
|
241
242
|
|
|
242
243
|
<View layout="row" inset="m" justifyContent="space-between" alignItems="center" surface="primary" roundness="s" style={{ flexShrink: 0 }}>
|
|
243
244
|
<View layout='row' gap="s" alignItems="center">
|
|
244
|
-
<Title>
|
|
245
|
+
<Title>{t('storage.resources.title')}</Title>
|
|
245
246
|
|
|
246
|
-
<Tags size="s" tags={['
|
|
247
|
+
<Tags size="s" tags={[t('storage.resources.beta')]} />
|
|
247
248
|
</View>
|
|
248
249
|
</View>
|
|
249
250
|
|
|
250
|
-
<
|
|
251
|
+
<View stack horizontal gap="xs" style={{ flexGrow: 1 }}>
|
|
251
252
|
|
|
252
|
-
<
|
|
253
|
-
<
|
|
253
|
+
<View.Item fill surface="primary" roundness="xs" >
|
|
254
|
+
<View stack bordered style={{ height: '100%' }}>
|
|
254
255
|
|
|
255
|
-
<
|
|
256
|
+
<View.Item
|
|
256
257
|
data-surface="primary"
|
|
257
258
|
layout="row"
|
|
258
259
|
style={{
|
|
@@ -279,39 +280,39 @@ export const ResourcesPage = () => {
|
|
|
279
280
|
{ activePath !== '/' && getActivePath() }
|
|
280
281
|
</Breadcrumbs>
|
|
281
282
|
|
|
282
|
-
<Dropdown trigger={<Button prefix="add" variant="command" style={{ height: '32px' }}>
|
|
283
|
+
<Dropdown trigger={<Button prefix="add" variant="command" style={{ height: '32px' }}>{t('storage.resources.add')}</Button>}>
|
|
283
284
|
<View inset="xs" surface="primary" roundness="s">
|
|
284
285
|
<ContextMenu roundness="s" surface="primary">
|
|
285
286
|
<ContextMenu.Item
|
|
286
287
|
prefix="folder-add"
|
|
287
288
|
onClick={() => {
|
|
288
289
|
setIsCreatingFolder(true)
|
|
289
|
-
setNewFolderName('
|
|
290
|
+
setNewFolderName(t('storage.resources.newFolderDefault'))
|
|
290
291
|
}}
|
|
291
292
|
>
|
|
292
|
-
|
|
293
|
+
{t('storage.resources.createFolder')}
|
|
293
294
|
</ContextMenu.Item>
|
|
294
295
|
<ContextMenu.Item
|
|
295
296
|
prefix="software-upload"
|
|
296
297
|
href={router.getHref(`@upload-media?location=${activePath}`)}
|
|
297
298
|
>
|
|
298
|
-
|
|
299
|
+
{t('storage.resources.uploadFile')}
|
|
299
300
|
</ContextMenu.Item>
|
|
300
301
|
</ContextMenu>
|
|
301
302
|
</View>
|
|
302
303
|
</Dropdown>
|
|
303
304
|
|
|
304
|
-
</
|
|
305
|
+
</View.Item>
|
|
305
306
|
|
|
306
|
-
<
|
|
307
|
+
<View.Item fill data-scrollbar="hide" style={{ overflowY: 'auto' }}>
|
|
307
308
|
<Switch on={resourcesListStatus}>
|
|
308
309
|
|
|
309
310
|
<Switch.Case match={[ResourcesListStatus.Error]}>
|
|
310
311
|
<View layout="off-center" style={{ height: '100%' }}>
|
|
311
312
|
<Guide
|
|
312
313
|
slot="content"
|
|
313
|
-
title=
|
|
314
|
-
text=
|
|
314
|
+
title={t('storage.resources.errorTitle')}
|
|
315
|
+
text={t('storage.resources.errorText')}
|
|
315
316
|
style={{ width: '100vw', maxWidth: '350px' }}
|
|
316
317
|
/>
|
|
317
318
|
</View>
|
|
@@ -320,7 +321,7 @@ export const ResourcesPage = () => {
|
|
|
320
321
|
<Switch.Case match={[ResourcesListStatus.Loading]}>
|
|
321
322
|
<DelayedRender>
|
|
322
323
|
{[1, 2, 3].map(n => (
|
|
323
|
-
<
|
|
324
|
+
<View.Item key={n}>
|
|
324
325
|
<div
|
|
325
326
|
className="inset-m cursor-pointer sans-serif d-flex align-center justify-between"
|
|
326
327
|
style={{ height: '56px', }}
|
|
@@ -345,7 +346,7 @@ export const ResourcesPage = () => {
|
|
|
345
346
|
/>
|
|
346
347
|
</div>
|
|
347
348
|
</div>
|
|
348
|
-
</
|
|
349
|
+
</View.Item>
|
|
349
350
|
))}
|
|
350
351
|
</DelayedRender>
|
|
351
352
|
</Switch.Case>
|
|
@@ -353,7 +354,7 @@ export const ResourcesPage = () => {
|
|
|
353
354
|
<Switch.Case match={[ResourcesListStatus.Empty]}>
|
|
354
355
|
{isCreatingFolder
|
|
355
356
|
? <ResourceList resources={[]} inlineFolder={inlineFolder} />
|
|
356
|
-
: <EmptyState message=
|
|
357
|
+
: <EmptyState message={t('storage.resources.emptyDirectory')} />
|
|
357
358
|
}
|
|
358
359
|
</Switch.Case>
|
|
359
360
|
|
|
@@ -362,14 +363,14 @@ export const ResourcesPage = () => {
|
|
|
362
363
|
</Switch.Case>
|
|
363
364
|
|
|
364
365
|
</Switch>
|
|
365
|
-
</
|
|
366
|
+
</View.Item>
|
|
366
367
|
|
|
367
|
-
</
|
|
368
|
-
</
|
|
368
|
+
</View>
|
|
369
|
+
</View.Item>
|
|
369
370
|
|
|
370
371
|
<ResourcePanel resourceId={selectedResourceId} onClose={() => setSelectedResourceId(undefined)} />
|
|
371
372
|
|
|
372
|
-
</
|
|
373
|
+
</View>
|
|
373
374
|
|
|
374
375
|
|
|
375
376
|
{
|
|
@@ -380,11 +381,11 @@ export const ResourcesPage = () => {
|
|
|
380
381
|
<View surface="primary" roundness="s">
|
|
381
382
|
<View surface="primary" inset="l" roundness="s">
|
|
382
383
|
<Guide
|
|
383
|
-
title=
|
|
384
|
-
text=
|
|
384
|
+
title={t('storage.resources.removeDirectoryTitle')}
|
|
385
|
+
text={t('storage.resources.removeDirectoryText')}
|
|
385
386
|
actions={[
|
|
386
|
-
{ label: '
|
|
387
|
-
{ label: '
|
|
387
|
+
{ label: t('storage.resources.cancel'), variant: "command", onClick: () => setOverlay(Overlays.None) },
|
|
388
|
+
{ label: t('storage.resources.remove'), variant: 'command-danger', onClick: () => {
|
|
388
389
|
removeResource(selectedResourceId)
|
|
389
390
|
setOverlay(Overlays.None)
|
|
390
391
|
}}
|
package/src/SalesSection.jsx
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Title,
|
|
4
4
|
Text,
|
|
5
5
|
View,
|
|
6
|
-
|
|
6
|
+
Icon,
|
|
7
7
|
PageSection,
|
|
8
8
|
MarkdownViewer
|
|
9
9
|
} from '@ossy/design-system'
|
|
@@ -40,7 +40,7 @@ export default ({
|
|
|
40
40
|
}}
|
|
41
41
|
>
|
|
42
42
|
<View justifyContent="center" alignItems="center">
|
|
43
|
-
<
|
|
43
|
+
<Icon name={x.icon} size="m" />
|
|
44
44
|
</View>
|
|
45
45
|
<Text variant="small" style={{ fontWeight: 'bold', textAlign: 'center' }}>{x.title}</Text>
|
|
46
46
|
<Text variant="small" style={{ textAlign: 'center' }}>{x.text}</Text>
|
|
@@ -62,7 +62,7 @@ export default ({
|
|
|
62
62
|
|
|
63
63
|
<View layout="row" gap="s" alignItems="center">
|
|
64
64
|
<View justifyContent="center" alignItems="center">
|
|
65
|
-
<
|
|
65
|
+
<Icon name={x.icon} size="m" />
|
|
66
66
|
</View>
|
|
67
67
|
<Title variant="tertiary">
|
|
68
68
|
{x.title}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"storage.home.documentTitle": "Storage – Ossy",
|
|
3
|
+
"storage.home.cover.title": "Storage",
|
|
4
|
+
"storage.home.cover.text": "Managing content should be easy",
|
|
5
|
+
"storage.resources.title": "Storage",
|
|
6
|
+
"storage.resources.beta": "Beta",
|
|
7
|
+
"storage.resources.add": "Add",
|
|
8
|
+
"storage.resources.createFolder": "Create folder",
|
|
9
|
+
"storage.resources.uploadFile": "Upload file",
|
|
10
|
+
"storage.resources.newFolderDefault": "New folder",
|
|
11
|
+
"storage.resources.errorTitle": "Something went wrong",
|
|
12
|
+
"storage.resources.errorText": "We could not fetch the data to display",
|
|
13
|
+
"storage.resources.emptyDirectory": "Empty directory",
|
|
14
|
+
"storage.resources.removeDirectoryTitle": "Remove directory",
|
|
15
|
+
"storage.resources.removeDirectoryText": "Are you sure you want to remove this directory and everything in it?",
|
|
16
|
+
"storage.resources.cancel": "Cancel",
|
|
17
|
+
"storage.resources.remove": "Remove",
|
|
18
|
+
"storage.resources.move": "Move",
|
|
19
|
+
"storage.resources.contextRemove": "Remove"
|
|
20
|
+
}
|
package/src/storage.page.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { useLocale } from '@ossy/design-system'
|
|
2
3
|
import { ResourcesPage } from './ResourcesPage.jsx'
|
|
3
4
|
import { useApp } from '@ossy/app/shell'
|
|
4
|
-
import { cover } from './cover.js'
|
|
5
5
|
import { features } from './features.js'
|
|
6
6
|
import SalesSection from './SalesSection.jsx'
|
|
7
7
|
|
|
@@ -13,7 +13,17 @@ export const metadata = {
|
|
|
13
13
|
},
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
function StorageSalesSection () {
|
|
17
|
+
const { t } = useLocale()
|
|
18
|
+
const cover = {
|
|
19
|
+
title: t('storage.home.cover.title'),
|
|
20
|
+
titleVariant: 'primary',
|
|
21
|
+
text: t('storage.home.cover.text'),
|
|
22
|
+
}
|
|
23
|
+
return <SalesSection cover={cover} features={features} />
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function StorageHomePage () {
|
|
27
|
+
const app = useApp()
|
|
28
|
+
return app?.isAuthenticated ? <ResourcesPage /> : <StorageSalesSection />
|
|
19
29
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"storage.home.documentTitle": "Storage",
|
|
3
|
+
"storage.home.cover.title": "Storage",
|
|
4
|
+
"storage.home.cover.text": "Det ska vara enkelt att hantera innehåll",
|
|
5
|
+
"storage.resources.title": "Storage",
|
|
6
|
+
"storage.resources.beta": "Beta",
|
|
7
|
+
"storage.resources.add": "Lägg till",
|
|
8
|
+
"storage.resources.createFolder": "Skapa mapp",
|
|
9
|
+
"storage.resources.uploadFile": "Ladda upp fil",
|
|
10
|
+
"storage.resources.newFolderDefault": "Ny mapp",
|
|
11
|
+
"storage.resources.errorTitle": "Något gick fel",
|
|
12
|
+
"storage.resources.errorText": "Vi kunde inte hämta data att visa",
|
|
13
|
+
"storage.resources.emptyDirectory": "Tom katalog",
|
|
14
|
+
"storage.resources.removeDirectoryTitle": "Ta bort mapp",
|
|
15
|
+
"storage.resources.removeDirectoryText": "Är du säker på att du vill ta bort den här mappen och allt innehåll?",
|
|
16
|
+
"storage.resources.cancel": "Avbryt",
|
|
17
|
+
"storage.resources.remove": "Ta bort",
|
|
18
|
+
"storage.resources.move": "Flytta",
|
|
19
|
+
"storage.resources.contextRemove": "Ta bort"
|
|
20
|
+
}
|