@webiny/app-file-manager 5.23.1-beta.0 → 5.24.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/admin/graphql.js +3 -3
- package/admin/plugins/installation.js +2 -9
- package/admin/plugins/permissionRenderer/FileManagerPermissions.d.ts +14 -5
- package/admin/views/FileManagerSettings.d.ts +2 -2
- package/admin/views/FileManagerSettings.js +29 -11
- package/index.d.ts +2 -2
- package/package.json +12 -10
- package/types.d.ts +13 -0
- package/admin/plugins/upgrades/v5.0.0.d.ts +0 -5
- package/admin/plugins/upgrades/v5.0.0.js +0 -85
package/admin/graphql.js
CHANGED
|
@@ -5,9 +5,9 @@ var _templateObject, _templateObject2;
|
|
|
5
5
|
import gql from "graphql-tag";
|
|
6
6
|
var fields =
|
|
7
7
|
/* GraphQL */
|
|
8
|
-
"\n {\n data {\n uploadMinFileSize\n uploadMaxFileSize\n }\n }\n";
|
|
8
|
+
"\n {\n data {\n uploadMinFileSize\n uploadMaxFileSize\n srcPrefix\n }\n }\n";
|
|
9
9
|
var graphql = {
|
|
10
|
-
GET_SETTINGS: gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query
|
|
11
|
-
UPDATE_SETTINGS: gql(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n mutation
|
|
10
|
+
GET_SETTINGS: gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query GetFileManagerSettings {\n fileManager {\n getSettings", "\n }\n }\n "])), fields),
|
|
11
|
+
UPDATE_SETTINGS: gql(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n mutation UpdateFileManagerSettings($data: FileManagerSettingsInput) {\n fileManager {\n updateSettings(data: $data) ", "\n }\n }\n "])), fields)
|
|
12
12
|
};
|
|
13
13
|
export default graphql;
|
|
@@ -5,7 +5,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
6
6
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
import React, { useState, useEffect
|
|
8
|
+
import React, { useState, useEffect } from "react";
|
|
9
9
|
import gql from "graphql-tag";
|
|
10
10
|
import { useApolloClient } from "@apollo/react-hooks";
|
|
11
11
|
import { i18n } from "@webiny/app/i18n";
|
|
@@ -102,13 +102,6 @@ var plugin = {
|
|
|
102
102
|
onInstalled: onInstalled
|
|
103
103
|
});
|
|
104
104
|
},
|
|
105
|
-
upgrades: [
|
|
106
|
-
version: "5.0.0",
|
|
107
|
-
getComponent: function getComponent() {
|
|
108
|
-
return /*#__PURE__*/lazy(function () {
|
|
109
|
-
return import("./upgrades/v5.0.0");
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}]
|
|
105
|
+
upgrades: []
|
|
113
106
|
};
|
|
114
107
|
export default plugin;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface FileManagerPermissionItem {
|
|
3
|
+
settingsAccessScope?: string;
|
|
4
|
+
filesAccessScope?: string;
|
|
5
|
+
accessLevel?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
filesRWD?: string;
|
|
8
|
+
}
|
|
9
|
+
interface FileManagerPermissionsProps {
|
|
10
|
+
value: FileManagerPermissionItem;
|
|
11
|
+
onChange: (value: FileManagerPermissionItem[]) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const FileManagerPermissions: React.FC<FileManagerPermissionsProps>;
|
|
14
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const FileManagerSettings:
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const FileManagerSettings: React.FC;
|
|
3
3
|
export default FileManagerSettings;
|
|
@@ -10,9 +10,16 @@ import { Input } from "@webiny/ui/Input";
|
|
|
10
10
|
import graphql from "../graphql";
|
|
11
11
|
import { CircularProgress } from "@webiny/ui/Progress";
|
|
12
12
|
import get from "lodash.get";
|
|
13
|
+
import { validation } from "@webiny/validation";
|
|
13
14
|
import { SimpleForm, SimpleFormFooter, SimpleFormContent, SimpleFormHeader } from "@webiny/app-admin/components/SimpleForm";
|
|
14
15
|
import { CenteredView } from "@webiny/app-admin";
|
|
15
16
|
|
|
17
|
+
function prefixValidator(value) {
|
|
18
|
+
if (!value.endsWith("/files/")) {
|
|
19
|
+
throw Error("File URL prefix must end with \"/files/\"");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
var FileManagerSettings = function FileManagerSettings() {
|
|
17
24
|
var _useSnackbar = useSnackbar(),
|
|
18
25
|
showSnackbar = _useSnackbar.showSnackbar;
|
|
@@ -24,13 +31,13 @@ var FileManagerSettings = function FileManagerSettings() {
|
|
|
24
31
|
queryInProgress = _ref.loading;
|
|
25
32
|
return /*#__PURE__*/React.createElement(Mutation, {
|
|
26
33
|
mutation: graphql.UPDATE_SETTINGS
|
|
27
|
-
}, function (update,
|
|
28
|
-
var mutationInProgress = _ref2.loading;
|
|
34
|
+
}, function (update, result) {
|
|
29
35
|
var settings = get(data, "fileManager.getSettings.data") || {};
|
|
36
|
+
var mutationInProgress = result.loading;
|
|
30
37
|
return /*#__PURE__*/React.createElement(CenteredView, null, /*#__PURE__*/React.createElement(Form, {
|
|
31
38
|
data: settings,
|
|
32
39
|
onSubmit: /*#__PURE__*/function () {
|
|
33
|
-
var
|
|
40
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
|
34
41
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
42
|
while (1) {
|
|
36
43
|
switch (_context.prev = _context.next) {
|
|
@@ -40,7 +47,8 @@ var FileManagerSettings = function FileManagerSettings() {
|
|
|
40
47
|
variables: {
|
|
41
48
|
data: {
|
|
42
49
|
uploadMinFileSize: parseFloat(data.uploadMinFileSize),
|
|
43
|
-
uploadMaxFileSize: parseFloat(data.uploadMaxFileSize)
|
|
50
|
+
uploadMaxFileSize: parseFloat(data.uploadMaxFileSize),
|
|
51
|
+
srcPrefix: data.srcPrefix
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
54
|
});
|
|
@@ -57,12 +65,12 @@ var FileManagerSettings = function FileManagerSettings() {
|
|
|
57
65
|
}));
|
|
58
66
|
|
|
59
67
|
return function (_x) {
|
|
60
|
-
return
|
|
68
|
+
return _ref2.apply(this, arguments);
|
|
61
69
|
};
|
|
62
70
|
}()
|
|
63
|
-
}, function (
|
|
64
|
-
var Bind =
|
|
65
|
-
form =
|
|
71
|
+
}, function (_ref3) {
|
|
72
|
+
var Bind = _ref3.Bind,
|
|
73
|
+
form = _ref3.form;
|
|
66
74
|
return /*#__PURE__*/React.createElement(SimpleForm, null, (queryInProgress || mutationInProgress) && /*#__PURE__*/React.createElement(CircularProgress, null), /*#__PURE__*/React.createElement(SimpleFormHeader, {
|
|
67
75
|
title: "General Settings"
|
|
68
76
|
}), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
@@ -74,7 +82,7 @@ var FileManagerSettings = function FileManagerSettings() {
|
|
|
74
82
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
75
83
|
type: "number",
|
|
76
84
|
label: "Minimum file upload size",
|
|
77
|
-
description: "
|
|
85
|
+
description: "The smallest file size in bytes."
|
|
78
86
|
}))))), /*#__PURE__*/React.createElement(Cell, {
|
|
79
87
|
span: 12
|
|
80
88
|
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
@@ -84,10 +92,20 @@ var FileManagerSettings = function FileManagerSettings() {
|
|
|
84
92
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
85
93
|
type: "number",
|
|
86
94
|
label: "Maximum file upload size",
|
|
87
|
-
description: "
|
|
95
|
+
description: "The largest file size in bytes."
|
|
96
|
+
}))))), /*#__PURE__*/React.createElement(Cell, {
|
|
97
|
+
span: 12
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
99
|
+
span: 12
|
|
100
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
101
|
+
name: "srcPrefix",
|
|
102
|
+
validators: [validation.create("url"), prefixValidator]
|
|
103
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
104
|
+
label: "File URL prefix",
|
|
105
|
+
description: "This prefix will be prepended to the file key to form the full file URL."
|
|
88
106
|
}))))))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, /*#__PURE__*/React.createElement(ButtonPrimary, {
|
|
89
107
|
onClick: form.submit
|
|
90
|
-
}, "Save")));
|
|
108
|
+
}, "Save Settings")));
|
|
91
109
|
}));
|
|
92
110
|
});
|
|
93
111
|
});
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const FileManager:
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const FileManager: React.FC;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-file-manager",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.24.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,18 +9,20 @@
|
|
|
9
9
|
"author": "Jon Rapp ",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"@apollo/react-common": "3.1.4",
|
|
12
13
|
"@apollo/react-components": "3.1.5",
|
|
13
14
|
"@apollo/react-hooks": "3.1.5",
|
|
14
15
|
"@babel/runtime": "7.16.7",
|
|
15
16
|
"@emotion/core": "10.3.1",
|
|
16
17
|
"@emotion/styled": "10.3.0",
|
|
17
18
|
"@types/react": "16.14.2",
|
|
18
|
-
"@webiny/app": "5.
|
|
19
|
-
"@webiny/app-admin": "5.
|
|
20
|
-
"@webiny/app-security": "5.
|
|
21
|
-
"@webiny/form": "5.
|
|
22
|
-
"@webiny/plugins": "5.
|
|
23
|
-
"@webiny/ui": "5.
|
|
19
|
+
"@webiny/app": "5.24.0",
|
|
20
|
+
"@webiny/app-admin": "5.24.0",
|
|
21
|
+
"@webiny/app-security": "5.24.0",
|
|
22
|
+
"@webiny/form": "5.24.0",
|
|
23
|
+
"@webiny/plugins": "5.24.0",
|
|
24
|
+
"@webiny/ui": "5.24.0",
|
|
25
|
+
"@webiny/validation": "5.24.0",
|
|
24
26
|
"apollo-cache": "1.3.5",
|
|
25
27
|
"apollo-client": "2.6.10",
|
|
26
28
|
"apollo-link": "1.2.14",
|
|
@@ -39,8 +41,8 @@
|
|
|
39
41
|
"@babel/preset-react": "^7.16.0",
|
|
40
42
|
"@babel/preset-typescript": "^7.16.0",
|
|
41
43
|
"@svgr/webpack": "^6.1.1",
|
|
42
|
-
"@webiny/cli": "^5.
|
|
43
|
-
"@webiny/project-utils": "^5.
|
|
44
|
+
"@webiny/cli": "^5.24.0",
|
|
45
|
+
"@webiny/project-utils": "^5.24.0",
|
|
44
46
|
"rimraf": "^3.0.2",
|
|
45
47
|
"typescript": "^4.1.3"
|
|
46
48
|
},
|
|
@@ -52,5 +54,5 @@
|
|
|
52
54
|
"build": "yarn webiny run build",
|
|
53
55
|
"watch": "yarn webiny run watch"
|
|
54
56
|
},
|
|
55
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "be0cbfcaa9247c658c44179af7943cc5d6d71bc7"
|
|
56
58
|
}
|
package/types.d.ts
CHANGED
|
@@ -11,3 +11,16 @@ export declare type PermissionRendererFileManager = Plugin & {
|
|
|
11
11
|
label: string;
|
|
12
12
|
render: PermissionRendererPluginRenderFunctionType;
|
|
13
13
|
};
|
|
14
|
+
export interface Settings {
|
|
15
|
+
uploadMinFileSize: string;
|
|
16
|
+
uploadMaxFileSize: string;
|
|
17
|
+
srcPrefix: string;
|
|
18
|
+
}
|
|
19
|
+
export interface QueryGetSettingsResult {
|
|
20
|
+
fileManager: {
|
|
21
|
+
getSettings: {
|
|
22
|
+
data: Settings;
|
|
23
|
+
error: Error | null;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
-
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
6
|
-
|
|
7
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
import React, { useCallback, useState } from "react";
|
|
9
|
-
import gql from "graphql-tag";
|
|
10
|
-
import { i18n } from "@webiny/app/i18n";
|
|
11
|
-
import { SimpleForm, SimpleFormContent, SimpleFormFooter, SimpleFormHeader } from "@webiny/app-admin/components/SimpleForm";
|
|
12
|
-
import { useApolloClient } from "@apollo/react-hooks";
|
|
13
|
-
import { Alert } from "@webiny/ui/Alert";
|
|
14
|
-
import { CircularProgress } from "@webiny/ui/Progress";
|
|
15
|
-
import { Cell, Grid } from "@webiny/ui/Grid";
|
|
16
|
-
import { ButtonPrimary } from "@webiny/ui/Button";
|
|
17
|
-
import { Typography } from "@webiny/ui/Typography";
|
|
18
|
-
var t = i18n.ns("app-headless-cms/admin/installation");
|
|
19
|
-
var UPGRADE = gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n mutation UpgradeFileManager($version: String!) {\n fileManager {\n upgrade(version: $version) {\n data\n error {\n code\n message\n data\n }\n }\n }\n }\n"])));
|
|
20
|
-
|
|
21
|
-
var Upgrade = function Upgrade(_ref) {
|
|
22
|
-
var onInstalled = _ref.onInstalled;
|
|
23
|
-
var client = useApolloClient();
|
|
24
|
-
|
|
25
|
-
var _useState = useState(null),
|
|
26
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
-
error = _useState2[0],
|
|
28
|
-
setError = _useState2[1];
|
|
29
|
-
|
|
30
|
-
var _useState3 = useState(false),
|
|
31
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
-
loading = _useState4[0],
|
|
33
|
-
setLoading = _useState4[1];
|
|
34
|
-
|
|
35
|
-
var startUpgrade = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
36
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
37
|
-
while (1) {
|
|
38
|
-
switch (_context.prev = _context.next) {
|
|
39
|
-
case 0:
|
|
40
|
-
setLoading(true);
|
|
41
|
-
_context.next = 3;
|
|
42
|
-
return client.mutate({
|
|
43
|
-
mutation: UPGRADE,
|
|
44
|
-
variables: {
|
|
45
|
-
version: "5.0.0"
|
|
46
|
-
}
|
|
47
|
-
}).then(function (_ref3) {
|
|
48
|
-
var data = _ref3.data;
|
|
49
|
-
setLoading(false);
|
|
50
|
-
var error = data.fileManager.upgrade.error;
|
|
51
|
-
|
|
52
|
-
if (error) {
|
|
53
|
-
setError(error.message);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
onInstalled();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
case 3:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context.stop();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, _callee);
|
|
66
|
-
})), []);
|
|
67
|
-
var label = error ? /*#__PURE__*/React.createElement(Alert, {
|
|
68
|
-
title: t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Something went wrong"]))),
|
|
69
|
-
type: "danger"
|
|
70
|
-
}, error) : t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["Upgrading File Manager..."])));
|
|
71
|
-
return /*#__PURE__*/React.createElement(SimpleForm, null, loading && /*#__PURE__*/React.createElement(CircularProgress, {
|
|
72
|
-
label: label
|
|
73
|
-
}), /*#__PURE__*/React.createElement(SimpleFormHeader, {
|
|
74
|
-
title: "Upgrade File Manager"
|
|
75
|
-
}), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
76
|
-
span: 12
|
|
77
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
78
|
-
use: "body1",
|
|
79
|
-
tag: "div"
|
|
80
|
-
}, "This upgrade will do the following:", /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, "insert Elasticsearch records into a dedicated DynamoDB table")))))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, /*#__PURE__*/React.createElement(ButtonPrimary, {
|
|
81
|
-
onClick: startUpgrade
|
|
82
|
-
}, "Upgrade")));
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default Upgrade;
|