@ossy/storage 1.10.0 → 1.10.1
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/ResourcesPage.jsx +11 -11
- package/src/en.translations.json +1 -1
- package/src/features.js +7 -6
- package/src/sv.translations.json +1 -1
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.10.
|
|
4
|
+
"version": "1.10.1",
|
|
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": "c0ba5d90749690634e4dc2705178ff8d89dd3070"
|
|
34
34
|
}
|
package/src/ResourcesPage.jsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { ListResources, createDirectory, moveResource, removeResource } from '@ossy/resources'
|
|
3
|
+
import { GetWorkspace } from '@ossy/workspaces'
|
|
4
|
+
import { AsyncStatus, useSdk } from '@ossy/sdk-react'
|
|
3
5
|
import {
|
|
4
6
|
pipe,
|
|
5
7
|
split,
|
|
@@ -50,7 +52,8 @@ const Overlays = {
|
|
|
50
52
|
export const ResourcesPage = () => {
|
|
51
53
|
const router = useRouter()
|
|
52
54
|
const { t } = useLocale()
|
|
53
|
-
const
|
|
55
|
+
const sdk = useSdk()
|
|
56
|
+
const { data: workspace = {} } = sdk.read(GetWorkspace)
|
|
54
57
|
const [overlay, setOverlay] = useState(Overlays.None)
|
|
55
58
|
const [selectedResourceId, setSelectedResourceId] = useState()
|
|
56
59
|
const [resourcesListStatus, setResourcesListStatus] = useState(ResourcesListStatus.Loading)
|
|
@@ -58,11 +61,8 @@ export const ResourcesPage = () => {
|
|
|
58
61
|
|
|
59
62
|
const {
|
|
60
63
|
status: resourcesStatus,
|
|
61
|
-
resources,
|
|
62
|
-
|
|
63
|
-
moveResource,
|
|
64
|
-
createDirectory,
|
|
65
|
-
} = useResources(activePath)
|
|
64
|
+
data: resources = [],
|
|
65
|
+
} = sdk.read(ListResources, { location: activePath })
|
|
66
66
|
|
|
67
67
|
const [isCreatingFolder, setIsCreatingFolder] = useState(false)
|
|
68
68
|
const [newFolderName, setNewFolderName] = useState(() => t('storage.resources.newFolderDefault'))
|
|
@@ -73,7 +73,7 @@ export const ResourcesPage = () => {
|
|
|
73
73
|
onCreateFolderCancel()
|
|
74
74
|
return
|
|
75
75
|
}
|
|
76
|
-
createDirectory({ name: folderName, location: activePath })
|
|
76
|
+
createDirectory(sdk, { name: folderName, location: activePath })
|
|
77
77
|
.finally(() => {
|
|
78
78
|
setIsCreatingFolder(false)
|
|
79
79
|
setNewFolderName(t('storage.resources.newFolderDefault'))
|
|
@@ -96,7 +96,7 @@ export const ResourcesPage = () => {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
const onMoveResource = newLocation => resourceId => {
|
|
99
|
-
moveResource(resourceId, newLocation)
|
|
99
|
+
moveResource(sdk, resourceId, newLocation, activePath)
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const onRemoveResource = resource => {
|
|
@@ -105,7 +105,7 @@ export const ResourcesPage = () => {
|
|
|
105
105
|
if (resource.type === 'directory') {
|
|
106
106
|
setOverlay(Overlays.RemoveDirectory)
|
|
107
107
|
} else {
|
|
108
|
-
removeResource(resource.id)
|
|
108
|
+
removeResource(sdk, resource.id, resource.location)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
}
|
|
@@ -386,7 +386,7 @@ export const ResourcesPage = () => {
|
|
|
386
386
|
actions={[
|
|
387
387
|
{ label: t('storage.resources.cancel'), variant: "command", onClick: () => setOverlay(Overlays.None) },
|
|
388
388
|
{ label: t('storage.resources.remove'), variant: 'command-danger', onClick: () => {
|
|
389
|
-
removeResource(selectedResourceId)
|
|
389
|
+
removeResource(sdk, selectedResourceId, activePath)
|
|
390
390
|
setOverlay(Overlays.None)
|
|
391
391
|
}}
|
|
392
392
|
]}
|
package/src/en.translations.json
CHANGED
package/src/features.js
CHANGED
|
@@ -11,22 +11,23 @@ export const features = [
|
|
|
11
11
|
"icon": "user-list"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
|
-
"title": "React
|
|
15
|
-
"text": "Load content with
|
|
14
|
+
"title": "React SDK",
|
|
15
|
+
"text": "Load content with useSdk().read() by passing a folder path.",
|
|
16
16
|
"icon": "code-slash",
|
|
17
17
|
"content": `
|
|
18
18
|
\`\`\`
|
|
19
|
-
|
|
20
|
-
import {
|
|
19
|
+
import { WorkspaceProvider, useSdk } from '@ossy/sdk-react'
|
|
20
|
+
import { ListResources } from '@ossy/resources'
|
|
21
21
|
|
|
22
22
|
export const App = () => (
|
|
23
|
-
<WorkspaceProvider
|
|
23
|
+
<WorkspaceProvider sdk={sdk}>
|
|
24
24
|
<MyComponent />
|
|
25
25
|
</WorkspaceProvider>
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
const MyComponent = () => {
|
|
29
|
-
const
|
|
29
|
+
const sdk = useSdk()
|
|
30
|
+
const { status, data: resources } = sdk.read(ListResources, { location: '/folder/path/in/cms' })
|
|
30
31
|
|
|
31
32
|
return status !== 'Success'
|
|
32
33
|
? <>Loading...</>
|
package/src/sv.translations.json
CHANGED