@blaze-cms/plugin-media-ui 0.146.0-node18.1 → 0.146.0-rc-eagle-3.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/CHANGELOG.md +13 -12
- package/lib/components/CardMedia/CardMedia.js +235 -244
- package/lib/components/CardMedia/CardMedia.js.map +1 -1
- package/lib/components/CardMedia/index.js +2 -3
- package/lib/components/CardMedia/index.js.map +1 -1
- package/lib/components/EditMediaFile/EditMediaFile.js +149 -115
- package/lib/components/EditMediaFile/EditMediaFile.js.map +1 -1
- package/lib/components/EditMediaFile/EditMediaFilePage.js +89 -97
- package/lib/components/EditMediaFile/EditMediaFilePage.js.map +1 -1
- package/lib/components/EditMediaFile/index.js +2 -3
- package/lib/components/EditMediaFile/index.js.map +1 -1
- package/lib/components/EditorAdapter/EditorAdapter.js +43 -22
- package/lib/components/EditorAdapter/EditorAdapter.js.map +1 -1
- package/lib/components/EditorAdapter/index.js +2 -3
- package/lib/components/EditorAdapter/index.js.map +1 -1
- package/lib/components/FileList/FilesListContext/index.js +3 -4
- package/lib/components/FileList/FilesListContext/index.js.map +1 -1
- package/lib/components/FileList/FilesListProvider/index.js +27 -29
- package/lib/components/FileList/FilesListProvider/index.js.map +1 -1
- package/lib/components/FileList/useFileList/index.js +3 -6
- package/lib/components/FileList/useFileList/index.js.map +1 -1
- package/lib/components/FileList/useGetFiles/getFiles.js +167 -185
- package/lib/components/FileList/useGetFiles/getFiles.js.map +1 -1
- package/lib/components/FileList/useGetFiles/index.js +2 -3
- package/lib/components/FileList/useGetFiles/index.js.map +1 -1
- package/lib/components/FileList/useGetFiles/useGetFiles.js +93 -133
- package/lib/components/FileList/useGetFiles/useGetFiles.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/getCounters.js +10 -30
- package/lib/components/FileList/useGetFilesList/getCounters.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/index.js +2 -3
- package/lib/components/FileList/useGetFilesList/index.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/useGetFilesList.js +92 -110
- package/lib/components/FileList/useGetFilesList/useGetFilesList.js.map +1 -1
- package/lib/components/FilePreview/Actions/index.js +25 -38
- package/lib/components/FilePreview/Actions/index.js.map +1 -1
- package/lib/components/FilePreview/Image/Image.js +35 -24
- package/lib/components/FilePreview/Image/Image.js.map +1 -1
- package/lib/components/FilePreview/Image/RawImage.js +25 -27
- package/lib/components/FilePreview/Image/RawImage.js.map +1 -1
- package/lib/components/FilePreview/Image/imageSchema.js +10 -7
- package/lib/components/FilePreview/Image/imageSchema.js.map +1 -1
- package/lib/components/FilePreview/Image/index.js +1 -2
- package/lib/components/FilePreview/Image/index.js.map +1 -1
- package/lib/components/FilePreview/ModalContext.js +9 -0
- package/lib/components/FilePreview/ModalContext.js.map +1 -0
- package/lib/components/FilePreview/PDF/PDF.js +44 -31
- package/lib/components/FilePreview/PDF/PDF.js.map +1 -1
- package/lib/components/FilePreview/PDF/RawPDF.js +27 -29
- package/lib/components/FilePreview/PDF/RawPDF.js.map +1 -1
- package/lib/components/FilePreview/PDF/index.js +1 -2
- package/lib/components/FilePreview/PDF/index.js.map +1 -1
- package/lib/components/FilePreview/PDF/schema.js +3 -3
- package/lib/components/FilePreview/PDF/schema.js.map +1 -1
- package/lib/components/FilePreview/get-preview.js +12 -10
- package/lib/components/FilePreview/get-preview.js.map +1 -1
- package/lib/components/FilePreview/index.js +111 -58
- package/lib/components/FilePreview/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/PreviewDefault.js +35 -23
- package/lib/components/FilePreview/previewDefault/PreviewDefault.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/RawPreviewDefault.js +33 -27
- package/lib/components/FilePreview/previewDefault/RawPreviewDefault.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/icons/DefaultIcon.js +120 -123
- package/lib/components/FilePreview/previewDefault/icons/DefaultIcon.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/icons/index.js +2 -3
- package/lib/components/FilePreview/previewDefault/icons/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/index.js +1 -2
- package/lib/components/FilePreview/previewDefault/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js +3 -3
- package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FileList.js +10 -12
- package/lib/components/FilePreviewReadOnly/FileList.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FilePreviewList.js +14 -20
- package/lib/components/FilePreviewReadOnly/FilePreviewList.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js +53 -98
- package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/index.js +2 -3
- package/lib/components/FilePreviewReadOnly/index.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/mappers/format-initial-value.js +7 -8
- package/lib/components/FilePreviewReadOnly/mappers/format-initial-value.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/mappers/index.js +1 -2
- package/lib/components/FilePreviewReadOnly/mappers/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileList.js +27 -39
- package/lib/components/FileUploadAdapter/FileList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FilePreviewList.js +14 -20
- package/lib/components/FileUploadAdapter/FilePreviewList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileReorderList.js +18 -21
- package/lib/components/FileUploadAdapter/FileReorderList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileReorderListItem.js +20 -23
- package/lib/components/FileUploadAdapter/FileReorderListItem.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileUploadAdapter.js +253 -341
- package/lib/components/FileUploadAdapter/FileUploadAdapter.js.map +1 -1
- package/lib/components/FileUploadAdapter/index.js +2 -3
- package/lib/components/FileUploadAdapter/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/format-initial-value.js +7 -8
- package/lib/components/FileUploadAdapter/mappers/format-initial-value.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-button-text.js +9 -6
- package/lib/components/FileUploadAdapter/mappers/get-button-text.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-format.js +7 -13
- package/lib/components/FileUploadAdapter/mappers/get-format.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +6 -5
- package/lib/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/index.js +6 -7
- package/lib/components/FileUploadAdapter/mappers/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/is-unselecting.js +2 -10
- package/lib/components/FileUploadAdapter/mappers/is-unselecting.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/transform-to-array.js +2 -5
- package/lib/components/FileUploadAdapter/mappers/transform-to-array.js.map +1 -1
- package/lib/components/FileUploadAdapter/useLimit.js +4 -10
- package/lib/components/FileUploadAdapter/useLimit.js.map +1 -1
- package/lib/components/FileUploadModal/FileUploadModal.js +215 -146
- package/lib/components/FileUploadModal/FileUploadModal.js.map +1 -1
- package/lib/components/FileUploadModal/index.js +2 -3
- package/lib/components/FileUploadModal/index.js.map +1 -1
- package/lib/components/FilterPanel/FilterPanel.js +49 -151
- package/lib/components/FilterPanel/FilterPanel.js.map +1 -1
- package/lib/components/FilterPanel/MediaSearchFilter.js +41 -0
- package/lib/components/FilterPanel/MediaSearchFilter.js.map +1 -0
- package/lib/components/FilterPanel/index.js +2 -3
- package/lib/components/FilterPanel/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/Listing.js +58 -48
- package/lib/components/ListingContainer/Listing/Listing.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +83 -96
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js +2 -3
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js +23 -26
- package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/index.js +2 -3
- package/lib/components/ListingContainer/Listing/MediaListing/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/index.js +2 -3
- package/lib/components/ListingContainer/Listing/index.js.map +1 -1
- package/lib/components/ListingContainer/ListingContainer.js +74 -93
- package/lib/components/ListingContainer/ListingContainer.js.map +1 -1
- package/lib/components/ListingContainer/index.js +2 -3
- package/lib/components/ListingContainer/index.js.map +1 -1
- package/lib/components/ListingContainer/mappers/exist-previous.js +3 -10
- package/lib/components/ListingContainer/mappers/exist-previous.js.map +1 -1
- package/lib/components/ListingContainer/mappers/index.js +2 -3
- package/lib/components/ListingContainer/mappers/index.js.map +1 -1
- package/lib/components/MediaListing.js +15 -26
- package/lib/components/MediaListing.js.map +1 -1
- package/lib/constants.js +17 -17
- package/lib/constants.js.map +1 -1
- package/lib/icons/MediaLibraryIcon.js +17 -20
- package/lib/icons/MediaLibraryIcon.js.map +1 -1
- package/lib/icons/index.js +2 -3
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +67 -92
- package/lib/index.js.map +1 -1
- package/lib/utils/available-filters/available-filters.js +1 -2
- package/lib/utils/available-filters/available-filters.js.map +1 -1
- package/lib/utils/bustUrl.js +13 -0
- package/lib/utils/bustUrl.js.map +1 -0
- package/lib/utils/media-context/index.js +4 -5
- package/lib/utils/media-context/index.js.map +1 -1
- package/lib/utils/media-context/media-context.js +3 -4
- package/lib/utils/media-context/media-context.js.map +1 -1
- package/lib/utils/media-context/useMediaContext.js +2 -4
- package/lib/utils/media-context/useMediaContext.js.map +1 -1
- package/lib-es/components/CardMedia/CardMedia.js +109 -52
- package/lib-es/components/CardMedia/CardMedia.js.map +1 -1
- package/lib-es/components/EditMediaFile/EditMediaFile.js +109 -53
- package/lib-es/components/EditMediaFile/EditMediaFile.js.map +1 -1
- package/lib-es/components/EditMediaFile/EditMediaFilePage.js +45 -15
- package/lib-es/components/EditMediaFile/EditMediaFilePage.js.map +1 -1
- package/lib-es/components/EditorAdapter/EditorAdapter.js +26 -6
- package/lib-es/components/EditorAdapter/EditorAdapter.js.map +1 -1
- package/lib-es/components/FileList/useGetFiles/getFiles.js +6 -3
- package/lib-es/components/FileList/useGetFiles/getFiles.js.map +1 -1
- package/lib-es/components/FileList/useGetFiles/useGetFiles.js +7 -2
- package/lib-es/components/FileList/useGetFiles/useGetFiles.js.map +1 -1
- package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js +4 -1
- package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js.map +1 -1
- package/lib-es/components/FilePreview/Actions/index.js +2 -2
- package/lib-es/components/FilePreview/Actions/index.js.map +1 -1
- package/lib-es/components/FilePreview/Image/Image.js +16 -3
- package/lib-es/components/FilePreview/Image/Image.js.map +1 -1
- package/lib-es/components/FilePreview/Image/imageSchema.js +9 -5
- package/lib-es/components/FilePreview/Image/imageSchema.js.map +1 -1
- package/lib-es/components/FilePreview/ModalContext.js +3 -0
- package/lib-es/components/FilePreview/ModalContext.js.map +1 -0
- package/lib-es/components/FilePreview/PDF/PDF.js +19 -4
- package/lib-es/components/FilePreview/PDF/PDF.js.map +1 -1
- package/lib-es/components/FilePreview/PDF/schema.js +2 -1
- package/lib-es/components/FilePreview/PDF/schema.js.map +1 -1
- package/lib-es/components/FilePreview/index.js +72 -9
- package/lib-es/components/FilePreview/index.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js +18 -4
- package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js +12 -4
- package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js +2 -1
- package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js.map +1 -1
- package/lib-es/components/FilePreviewReadOnly/FileList.js +2 -2
- package/lib-es/components/FilePreviewReadOnly/FileList.js.map +1 -1
- package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js +14 -12
- package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js +78 -43
- package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js +5 -3
- package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +5 -4
- package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +1 -1
- package/lib-es/components/FileUploadModal/FileUploadModal.js +157 -29
- package/lib-es/components/FileUploadModal/FileUploadModal.js.map +1 -1
- package/lib-es/components/FilterPanel/FilterPanel.js +43 -123
- package/lib-es/components/FilterPanel/FilterPanel.js.map +1 -1
- package/lib-es/components/FilterPanel/MediaSearchFilter.js +34 -0
- package/lib-es/components/FilterPanel/MediaSearchFilter.js.map +1 -0
- package/lib-es/components/ListingContainer/Listing/Listing.js +17 -5
- package/lib-es/components/ListingContainer/Listing/Listing.js.map +1 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +21 -10
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +1 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js +12 -3
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +1 -1
- package/lib-es/components/ListingContainer/ListingContainer.js +18 -6
- package/lib-es/components/ListingContainer/ListingContainer.js.map +1 -1
- package/lib-es/constants.js +3 -2
- package/lib-es/constants.js.map +1 -1
- package/lib-es/index.js +20 -4
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/bustUrl.js +7 -0
- package/lib-es/utils/bustUrl.js.map +1 -0
- package/package.json +20 -13
- package/src/components/CardMedia/CardMedia.js +131 -82
- package/src/components/EditMediaFile/EditMediaFile.js +123 -46
- package/src/components/EditMediaFile/EditMediaFilePage.js +41 -10
- package/src/components/EditorAdapter/EditorAdapter.js +31 -4
- package/src/components/FileList/useGetFiles/getFiles.js +12 -4
- package/src/components/FileList/useGetFiles/useGetFiles.js +3 -4
- package/src/components/FileList/useGetFilesList/useGetFilesList.js +2 -1
- package/src/components/FilePreview/Actions/index.js +25 -27
- package/src/components/FilePreview/Image/Image.js +15 -2
- package/src/components/FilePreview/Image/imageSchema.js +9 -5
- package/src/components/FilePreview/ModalContext.js +3 -0
- package/src/components/FilePreview/PDF/PDF.js +17 -4
- package/src/components/FilePreview/PDF/schema.js +2 -1
- package/src/components/FilePreview/index.js +69 -6
- package/src/components/FilePreview/previewDefault/PreviewDefault.js +16 -3
- package/src/components/FilePreview/previewDefault/RawPreviewDefault.js +17 -7
- package/src/components/FilePreview/previewDefault/previewDefaultSchema.js +2 -1
- package/src/components/FilePreviewReadOnly/FileList.js +1 -3
- package/src/components/FilePreviewReadOnly/FilePreviewReadOnly.js +17 -29
- package/src/components/FileUploadAdapter/FileUploadAdapter.js +66 -32
- package/src/components/FileUploadAdapter/mappers/get-button-text.js +4 -3
- package/src/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +6 -4
- package/src/components/FileUploadModal/FileUploadModal.js +156 -45
- package/src/components/FilterPanel/FilterPanel.js +44 -129
- package/src/components/FilterPanel/MediaSearchFilter.js +32 -0
- package/src/components/ListingContainer/Listing/Listing.js +15 -5
- package/src/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +18 -7
- package/src/components/ListingContainer/Listing/MediaListing/MediaListing.js +10 -2
- package/src/components/ListingContainer/ListingContainer.js +17 -5
- package/src/constants.js +16 -2
- package/src/index.js +17 -14
- package/src/utils/bustUrl.js +6 -0
- package/babel.config.js +0 -3
- package/jest.config.js +0 -5
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import More from '@blaze-react/more';
|
|
3
|
-
import Button from '@blaze-react/button';
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
4
2
|
import { DeleteAction } from '@blaze-cms/admin';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
4
|
import { getQuery, getMutation } from '@blaze-cms/admin-ui-utils';
|
|
7
|
-
import { useMutation, useApolloClient } from '@apollo/client';
|
|
5
|
+
import { useMutation, useApolloClient, useQuery } from '@apollo/client';
|
|
8
6
|
import classnames from 'classnames';
|
|
9
7
|
import { useToasts } from '@blaze-react/toaster';
|
|
10
8
|
import Modal from '@blaze-react/modal';
|
|
11
9
|
import { createPortal } from 'react-dom';
|
|
12
10
|
import { Link } from 'react-router-dom';
|
|
11
|
+
import { DeleteIcon, EditIcon } from '@blaze-cms/plugin-page-builder-ui';
|
|
13
12
|
import EditMediaFile from '../EditMediaFile';
|
|
13
|
+
import bustUrl from '../../utils/bustUrl';
|
|
14
14
|
|
|
15
15
|
const CardMedia = ({
|
|
16
16
|
onSelected,
|
|
@@ -21,10 +21,12 @@ const CardMedia = ({
|
|
|
21
21
|
selected,
|
|
22
22
|
displayLayout,
|
|
23
23
|
data,
|
|
24
|
+
updated,
|
|
24
25
|
modalTargetRef,
|
|
25
26
|
updateFile,
|
|
26
27
|
removeFile,
|
|
27
|
-
index
|
|
28
|
+
index,
|
|
29
|
+
openEditInModal
|
|
28
30
|
}) => {
|
|
29
31
|
const [displayDeleteModal, setDisplayDeleteModal] = useState(false);
|
|
30
32
|
const [displayEditModal, setDisplayEditModal] = useState(false);
|
|
@@ -35,62 +37,63 @@ const CardMedia = ({
|
|
|
35
37
|
const [type, extension] = mimetype.split('/');
|
|
36
38
|
const client = useApolloClient();
|
|
37
39
|
|
|
40
|
+
const { data: { getEntitySchemas: [schemaData] = [] } = {}, loading: schemaLoading } = useQuery(
|
|
41
|
+
getQuery('GET_ENTITY_SCHEMA'),
|
|
42
|
+
{
|
|
43
|
+
variables: { identifier: 'file' }
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
38
47
|
const deleteFileById = async () => {
|
|
39
48
|
setDisplayDeleteModal(false);
|
|
40
49
|
try {
|
|
41
|
-
await deleteFile({
|
|
42
|
-
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
removeFile({
|
|
46
|
-
index
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
addToast(`File: ${name} has been deleted`, {
|
|
50
|
-
appearance: 'success',
|
|
51
|
-
autoDismiss: true
|
|
52
|
-
});
|
|
50
|
+
await deleteFile({ variables: { input: { id } } });
|
|
51
|
+
removeFile({ index });
|
|
52
|
+
addToast(`File: ${name} has been deleted`, { appearance: 'success', autoDismiss: true });
|
|
53
53
|
} catch (error) {
|
|
54
|
-
addToast(error.message, {
|
|
55
|
-
appearance: 'error',
|
|
56
|
-
autoDismiss: true
|
|
57
|
-
});
|
|
54
|
+
addToast(error.message, { appearance: 'error', autoDismiss: true });
|
|
58
55
|
}
|
|
59
56
|
};
|
|
60
57
|
|
|
61
|
-
const
|
|
62
|
-
onSelected({ id, url, name, data });
|
|
63
|
-
};
|
|
58
|
+
const handleRowClick = () => onSelected({ id, url, name, data });
|
|
64
59
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
const handleCheckboxToggle = useCallback(
|
|
61
|
+
e => {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
onSelected({ id, url, name, data });
|
|
65
|
+
},
|
|
66
|
+
[id, url, name, data, onSelected]
|
|
67
|
+
);
|
|
69
68
|
|
|
70
|
-
const
|
|
71
|
-
|
|
69
|
+
const handleKeyDown = e => {
|
|
70
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
handleRowClick();
|
|
73
|
+
}
|
|
72
74
|
};
|
|
73
75
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
const cardMediaClassNames = classnames(
|
|
77
|
+
'card card--media-list card--media-list-row',
|
|
78
|
+
`card--media-${displayLayout}`,
|
|
79
|
+
{ 'card--media-list--selected': selected }
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const handleCloseModal = () => setDisplayEditModal(false);
|
|
83
|
+
const handleSaveButtonStatus = state => setEnableSaveButton(state);
|
|
77
84
|
|
|
78
85
|
const modalActions = [
|
|
86
|
+
{ textButton: 'Cancel', callback: handleCloseModal, modifiers: ['cancel'] },
|
|
79
87
|
{
|
|
80
|
-
textButton: '
|
|
81
|
-
callback: handleCloseModal,
|
|
82
|
-
modifiers: ['cancel']
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
textButton: 'Save',
|
|
88
|
+
textButton: 'Apply',
|
|
86
89
|
callback: () => handleFormSave(),
|
|
87
90
|
modifiers: enableSaveButton ? [] : ['disabled']
|
|
88
91
|
}
|
|
89
92
|
];
|
|
90
93
|
|
|
91
|
-
const handleFileChange = file =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
const handleFileChange = file => setFileData(file);
|
|
95
|
+
|
|
96
|
+
const handleStopPropagation = e => e.stopPropagation();
|
|
94
97
|
|
|
95
98
|
const handleFormSave = async () => {
|
|
96
99
|
try {
|
|
@@ -98,7 +101,7 @@ const CardMedia = ({
|
|
|
98
101
|
data: { updateFile: updatedFile }
|
|
99
102
|
} = await client.mutate({
|
|
100
103
|
mutation: getMutation('UPDATE_FILE'),
|
|
101
|
-
variables: { input: fileData },
|
|
104
|
+
variables: { input: fileData.formData },
|
|
102
105
|
update(cache, { data: { updateFile: fileUpdated } }) {
|
|
103
106
|
cache.writeQuery({
|
|
104
107
|
query: getQuery('GET_FILE_BY_ID'),
|
|
@@ -124,6 +127,8 @@ const CardMedia = ({
|
|
|
124
127
|
setEnableSaveButton(false);
|
|
125
128
|
};
|
|
126
129
|
|
|
130
|
+
if (schemaLoading) return null;
|
|
131
|
+
|
|
127
132
|
return (
|
|
128
133
|
<>
|
|
129
134
|
{displayEditModal &&
|
|
@@ -135,28 +140,52 @@ const CardMedia = ({
|
|
|
135
140
|
handleSaveButtonStatus={handleSaveButtonStatus}
|
|
136
141
|
handleFormSave={handleFormSave}
|
|
137
142
|
enableSaveButton={enableSaveButton}
|
|
143
|
+
schemaData={schemaData}
|
|
138
144
|
/>
|
|
139
145
|
</Modal>,
|
|
140
146
|
modalTargetRef.current
|
|
141
147
|
)}
|
|
142
|
-
<div className={cardMediaClassNames} role="button" onClick={handleClick}>
|
|
143
|
-
{displayDeleteModal &&
|
|
144
|
-
createPortal(
|
|
145
|
-
<DeleteAction
|
|
146
|
-
onClose={() => setDisplayDeleteModal(false)}
|
|
147
|
-
deleteAction={() => deleteFileById()}
|
|
148
|
-
itemName={name}
|
|
149
|
-
/>,
|
|
150
|
-
modalTargetRef.current
|
|
151
|
-
)}
|
|
152
148
|
|
|
149
|
+
{displayDeleteModal &&
|
|
150
|
+
createPortal(
|
|
151
|
+
<DeleteAction
|
|
152
|
+
onClose={() => setDisplayDeleteModal(false)}
|
|
153
|
+
deleteAction={() => deleteFileById()}
|
|
154
|
+
itemName={name}
|
|
155
|
+
/>,
|
|
156
|
+
modalTargetRef.current
|
|
157
|
+
)}
|
|
158
|
+
|
|
159
|
+
<div
|
|
160
|
+
className={cardMediaClassNames}
|
|
161
|
+
role="option"
|
|
162
|
+
aria-selected={selected}
|
|
163
|
+
tabIndex={0}
|
|
164
|
+
onClick={handleRowClick}
|
|
165
|
+
onKeyDown={handleKeyDown}>
|
|
166
|
+
{openEditInModal && (
|
|
167
|
+
<div className="card__select">
|
|
168
|
+
<input
|
|
169
|
+
type="checkbox"
|
|
170
|
+
aria-label={`Select ${name}`}
|
|
171
|
+
checked={!!selected}
|
|
172
|
+
onChange={handleCheckboxToggle}
|
|
173
|
+
onClick={handleStopPropagation}
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
)}
|
|
153
177
|
{type === 'image' ? (
|
|
154
178
|
<div className={`card__image card__image--media-${displayLayout}`}>
|
|
155
|
-
<img src={url} alt={name} />
|
|
179
|
+
<img src={bustUrl(url, updated)} alt={name} />
|
|
156
180
|
</div>
|
|
157
181
|
) : (
|
|
158
182
|
<div className="card__image card__image--media-list-document">
|
|
159
|
-
<svg
|
|
183
|
+
<svg
|
|
184
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
185
|
+
width="100"
|
|
186
|
+
height="100"
|
|
187
|
+
viewBox="0 0 8 8"
|
|
188
|
+
aria-hidden="true">
|
|
160
189
|
<path d="M0 0v8h7v-4h-4v-4h-3zm4 0v3h3l-3-3zm-3 2h1v1h-1v-1zm0 2h1v1h-1v-1zm0 2h4v1h-4v-1z" />
|
|
161
190
|
</svg>
|
|
162
191
|
</div>
|
|
@@ -165,34 +194,50 @@ const CardMedia = ({
|
|
|
165
194
|
<footer className={`card__footer card__footer--media-${displayLayout}`}>
|
|
166
195
|
<div className={`card__details card__details--media-${displayLayout}`}>
|
|
167
196
|
<div className={`card__title card__title--media-${displayLayout}`}>
|
|
168
|
-
<h2>{name}</h2>
|
|
197
|
+
<h2 className="card__file-name">{name}</h2>
|
|
169
198
|
</div>
|
|
170
|
-
<p>
|
|
171
|
-
<span>
|
|
199
|
+
<p className="card__meta">
|
|
200
|
+
<span>Format: {extension}</span>
|
|
172
201
|
</p>
|
|
173
202
|
</div>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
203
|
+
|
|
204
|
+
<div className={`card__menu card__menu--icons card__menu--${displayLayout}`}>
|
|
205
|
+
{openEditInModal ? (
|
|
206
|
+
<button
|
|
207
|
+
type="button"
|
|
208
|
+
className="card__icon-btn"
|
|
209
|
+
title="Edit"
|
|
210
|
+
aria-label="Edit"
|
|
211
|
+
onClick={e => {
|
|
212
|
+
e.preventDefault();
|
|
213
|
+
e.stopPropagation();
|
|
214
|
+
setDisplayEditModal(true);
|
|
215
|
+
}}>
|
|
216
|
+
<EditIcon width="20px" height="20px" />
|
|
217
|
+
</button>
|
|
218
|
+
) : (
|
|
219
|
+
<Link
|
|
220
|
+
to={`/media/edit/${id}`}
|
|
221
|
+
className="card__icon-btn"
|
|
222
|
+
title="Edit"
|
|
223
|
+
aria-label="Edit"
|
|
224
|
+
onClick={e => e.stopPropagation()}>
|
|
225
|
+
<EditIcon width="20px" height="20px" />
|
|
226
|
+
</Link>
|
|
227
|
+
)}
|
|
228
|
+
|
|
229
|
+
<button
|
|
230
|
+
type="button"
|
|
231
|
+
className="card__icon-btn"
|
|
232
|
+
title="Delete"
|
|
233
|
+
aria-label="Delete"
|
|
234
|
+
onClick={e => {
|
|
235
|
+
e.preventDefault();
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
setDisplayDeleteModal(true);
|
|
238
|
+
}}>
|
|
239
|
+
<DeleteIcon width="18px" height="18px" />
|
|
240
|
+
</button>
|
|
196
241
|
</div>
|
|
197
242
|
</footer>
|
|
198
243
|
</div>
|
|
@@ -207,18 +252,22 @@ CardMedia.propTypes = {
|
|
|
207
252
|
mimetype: PropTypes.string.isRequired,
|
|
208
253
|
displayLayout: PropTypes.string.isRequired,
|
|
209
254
|
data: PropTypes.object,
|
|
255
|
+
updated: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
210
256
|
onSelected: PropTypes.func,
|
|
211
257
|
updateFile: PropTypes.func.isRequired,
|
|
212
258
|
removeFile: PropTypes.func.isRequired,
|
|
213
259
|
selected: PropTypes.bool,
|
|
214
260
|
modalTargetRef: PropTypes.object.isRequired,
|
|
215
|
-
index: PropTypes.number.isRequired
|
|
261
|
+
index: PropTypes.number.isRequired,
|
|
262
|
+
openEditInModal: PropTypes.bool
|
|
216
263
|
};
|
|
217
264
|
|
|
218
265
|
CardMedia.defaultProps = {
|
|
219
266
|
onSelected: () => {},
|
|
220
267
|
selected: false,
|
|
221
|
-
data: {}
|
|
268
|
+
data: {},
|
|
269
|
+
updated: null,
|
|
270
|
+
openEditInModal: false
|
|
222
271
|
};
|
|
223
272
|
|
|
224
273
|
export default CardMedia;
|
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
3
|
+
import { getQuery, getDynamicQuery } from '@blaze-cms/admin-ui-utils';
|
|
4
4
|
import { useQuery } from '@apollo/client';
|
|
5
|
+
import { useToasts } from '@blaze-react/toaster';
|
|
5
6
|
import FilePreview from '../FilePreview';
|
|
6
|
-
import
|
|
7
|
+
import FileUploadModal from '../FileUploadModal';
|
|
8
|
+
import { FILE_DEFAULT_PROPS } from '../../constants';
|
|
7
9
|
|
|
8
|
-
const EditMediaFile = ({
|
|
10
|
+
const EditMediaFile = ({
|
|
11
|
+
onChange,
|
|
12
|
+
handleSaveButtonStatus,
|
|
13
|
+
fileId,
|
|
14
|
+
showChangeButton,
|
|
15
|
+
fileUpdated,
|
|
16
|
+
schemaData
|
|
17
|
+
}) => {
|
|
9
18
|
const [formValues, setFormValues] = useState(null);
|
|
10
|
-
const
|
|
11
|
-
const {
|
|
12
|
-
|
|
19
|
+
const [displayFileUploadModal, setDisplayFileUploadModal] = useState(false);
|
|
20
|
+
const { addToast } = useToasts();
|
|
21
|
+
|
|
22
|
+
const fileQuery = getDynamicQuery('DATA_QUERY')(schemaData, fileId, null, FILE_DEFAULT_PROPS);
|
|
23
|
+
const {
|
|
24
|
+
loading,
|
|
25
|
+
data: { entityData: file } = {},
|
|
26
|
+
refetch: refetchFile
|
|
27
|
+
} = useQuery(fileQuery, {
|
|
28
|
+
variables: { id: fileId },
|
|
29
|
+
fetchPolicy: 'cache-and-network'
|
|
13
30
|
});
|
|
14
31
|
|
|
15
32
|
const fileStoresType = getQuery('GET_FILE_STORES');
|
|
@@ -18,65 +35,123 @@ const EditMediaFile = ({ onChange, handleSaveButtonStatus, enableSaveButton, fil
|
|
|
18
35
|
});
|
|
19
36
|
|
|
20
37
|
useEffect(() => {
|
|
21
|
-
if (
|
|
22
|
-
setFormValues(
|
|
38
|
+
if (file) {
|
|
39
|
+
setFormValues(prevFormValues => {
|
|
40
|
+
if (!prevFormValues || prevFormValues.updated !== file.updated) {
|
|
41
|
+
return file;
|
|
42
|
+
}
|
|
43
|
+
return prevFormValues;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, [file]);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (fileUpdated && fileUpdated.updated) {
|
|
50
|
+
setFormValues(fileUpdated);
|
|
23
51
|
}
|
|
24
|
-
}, [
|
|
52
|
+
}, [fileUpdated]);
|
|
25
53
|
|
|
26
54
|
const handleFormChange = ({ isValid, isNewValueSet, valuesChecked }) => {
|
|
27
|
-
const
|
|
28
|
-
if (id === NAME || id === STORE_KEY) return false;
|
|
29
|
-
return true;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const dataValues = valuesCheckedWithoutName.reduce((acc, { id, value }) => {
|
|
33
|
-
acc[id] = value;
|
|
34
|
-
return acc;
|
|
35
|
-
}, {});
|
|
36
|
-
const { value: newFileName } = valuesChecked.find(({ id }) => id === NAME) || {};
|
|
37
|
-
const { value: storeKey } = valuesChecked.find(({ id }) => id === STORE_KEY) || {};
|
|
55
|
+
const baseFile = formValues || file;
|
|
38
56
|
|
|
39
|
-
const
|
|
40
|
-
|
|
57
|
+
const dataValues = valuesChecked.reduce(
|
|
58
|
+
(acc, { id, value, isDataPropery }) => {
|
|
59
|
+
if (isDataPropery) {
|
|
60
|
+
acc.data[id] = value;
|
|
61
|
+
} else {
|
|
62
|
+
acc[id] = value;
|
|
63
|
+
}
|
|
64
|
+
return acc;
|
|
65
|
+
},
|
|
66
|
+
{ id: baseFile.id, data: { ...baseFile.data } }
|
|
67
|
+
);
|
|
68
|
+
delete dataValues.data.__typename; // Remove __typename if it exists in data to avoid issues with Apollo cache.
|
|
41
69
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
70
|
+
const shouldEnableSaveButton = isNewValueSet && isValid;
|
|
71
|
+
handleSaveButtonStatus(shouldEnableSaveButton);
|
|
45
72
|
|
|
46
73
|
const updatedFile = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
storeKey,
|
|
50
|
-
data: dataValues
|
|
74
|
+
...baseFile,
|
|
75
|
+
...dataValues
|
|
51
76
|
};
|
|
77
|
+
|
|
52
78
|
setFormValues(updatedFile);
|
|
53
|
-
onChange(updatedFile);
|
|
79
|
+
onChange({ ...updatedFile, formData: dataValues });
|
|
54
80
|
};
|
|
55
81
|
|
|
56
|
-
const getFileWithStoreType =
|
|
57
|
-
|
|
82
|
+
const getFileWithStoreType = sourceFile => {
|
|
83
|
+
const base = sourceFile || file;
|
|
84
|
+
if (storeType && base) {
|
|
58
85
|
const storeOptions = storeType.map(type => [type.key, type.name]);
|
|
59
86
|
const defaultStore = storeType.find(type => type.isDefault) || null;
|
|
60
|
-
return { ...
|
|
87
|
+
return { ...base, store: { defaultStore, storeOptions } };
|
|
88
|
+
}
|
|
89
|
+
return base;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const closeModalAndSetValue = async (isSaving, values, toastMessage) => {
|
|
93
|
+
if (toastMessage) {
|
|
94
|
+
addToast(toastMessage, { appearance: 'success', autoDismiss: true });
|
|
61
95
|
}
|
|
62
96
|
|
|
63
|
-
|
|
97
|
+
if (values) {
|
|
98
|
+
const updated =
|
|
99
|
+
values.id === fileId
|
|
100
|
+
? values
|
|
101
|
+
: {
|
|
102
|
+
...(formValues || file),
|
|
103
|
+
...values,
|
|
104
|
+
url: values.url || (formValues || file).url
|
|
105
|
+
};
|
|
106
|
+
setFormValues(updated);
|
|
107
|
+
onChange(updated);
|
|
108
|
+
handleSaveButtonStatus(true);
|
|
109
|
+
} else {
|
|
110
|
+
const { data: { file: refreshedFile } = {} } = await refetchFile({
|
|
111
|
+
id: fileId,
|
|
112
|
+
timestamp: Date.now()
|
|
113
|
+
});
|
|
114
|
+
if (refreshedFile) {
|
|
115
|
+
setFormValues(refreshedFile);
|
|
116
|
+
onChange(refreshedFile);
|
|
117
|
+
handleSaveButtonStatus(true);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
setDisplayFileUploadModal(false);
|
|
64
122
|
};
|
|
65
123
|
|
|
66
|
-
|
|
124
|
+
if (loading) return <div>loading...</div>;
|
|
125
|
+
|
|
126
|
+
const fileToRender = formValues || file;
|
|
127
|
+
const fileWithStoreType = getFileWithStoreType(fileToRender);
|
|
67
128
|
|
|
68
|
-
return (
|
|
129
|
+
return !loading ? (
|
|
69
130
|
<>
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
131
|
+
{!!file && (
|
|
132
|
+
<FilePreview
|
|
133
|
+
file={fileWithStoreType}
|
|
134
|
+
handleFormChange={handleFormChange}
|
|
135
|
+
handleChangeFile={() => setDisplayFileUploadModal(true)}
|
|
136
|
+
displayForm
|
|
137
|
+
showChangeButton={showChangeButton}
|
|
138
|
+
/>
|
|
139
|
+
)}
|
|
140
|
+
{displayFileUploadModal && (
|
|
141
|
+
<div className="file-upload-modal-wrapper">
|
|
142
|
+
<FileUploadModal
|
|
143
|
+
onClose={() => setDisplayFileUploadModal(false)}
|
|
144
|
+
closeModalAndSetValue={closeModalAndSetValue}
|
|
145
|
+
simpleLayout
|
|
146
|
+
fileId={fileId}
|
|
147
|
+
storeKey={file && file.storeKey}
|
|
148
|
+
getSelectedFiles={() => {}}
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
78
151
|
)}
|
|
79
152
|
</>
|
|
153
|
+
) : (
|
|
154
|
+
<div>loading...</div>
|
|
80
155
|
);
|
|
81
156
|
};
|
|
82
157
|
|
|
@@ -84,11 +159,13 @@ EditMediaFile.propTypes = {
|
|
|
84
159
|
fileId: PropTypes.string.isRequired,
|
|
85
160
|
onChange: PropTypes.func.isRequired,
|
|
86
161
|
handleSaveButtonStatus: PropTypes.func.isRequired,
|
|
87
|
-
|
|
162
|
+
showChangeButton: PropTypes.bool,
|
|
163
|
+
fileUpdated: PropTypes.object
|
|
88
164
|
};
|
|
89
165
|
|
|
90
166
|
EditMediaFile.defaultProps = {
|
|
91
|
-
|
|
167
|
+
showChangeButton: false,
|
|
168
|
+
fileUpdated: null
|
|
92
169
|
};
|
|
93
170
|
|
|
94
171
|
export default EditMediaFile;
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { withRouter } from 'react-router-dom';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Button from '@blaze-react/button';
|
|
5
|
-
import { useApolloClient } from '@apollo/client';
|
|
5
|
+
import { useApolloClient, useQuery } from '@apollo/client';
|
|
6
6
|
import { getQuery, getMutation } from '@blaze-cms/admin-ui-utils';
|
|
7
7
|
import { useToasts } from '@blaze-react/toaster';
|
|
8
8
|
import EditMediaFile from './EditMediaFile';
|
|
@@ -13,6 +13,13 @@ const EditMediaFilePage = ({ match, history }) => {
|
|
|
13
13
|
const client = useApolloClient();
|
|
14
14
|
const { addToast } = useToasts();
|
|
15
15
|
|
|
16
|
+
const { data: { getEntitySchemas: [schemaData] = [] } = {}, loading: schemaLoading } = useQuery(
|
|
17
|
+
getQuery('GET_ENTITY_SCHEMA'),
|
|
18
|
+
{
|
|
19
|
+
variables: { identifier: 'file' }
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
|
|
16
23
|
const handleFileChange = values => setFile(values);
|
|
17
24
|
|
|
18
25
|
const handleSaveButtonStatus = value => {
|
|
@@ -20,19 +27,39 @@ const EditMediaFilePage = ({ match, history }) => {
|
|
|
20
27
|
};
|
|
21
28
|
|
|
22
29
|
const handleFormSave = async () => {
|
|
30
|
+
if (!file) {
|
|
31
|
+
addToast('No file data to update', {
|
|
32
|
+
appearance: 'error',
|
|
33
|
+
autoDismiss: true
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
23
38
|
try {
|
|
24
|
-
|
|
39
|
+
const inputData = file.formData;
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
data: { updateFile: updatedFile }
|
|
43
|
+
} = await client.mutate({
|
|
25
44
|
mutation: getMutation('UPDATE_FILE'),
|
|
26
|
-
variables: {
|
|
45
|
+
variables: {
|
|
46
|
+
input: inputData
|
|
47
|
+
},
|
|
27
48
|
update(cache, { data: { updateFile: fileUpdated } }) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
try {
|
|
50
|
+
cache.writeQuery({
|
|
51
|
+
query: getQuery('GET_FILE_BY_ID'),
|
|
52
|
+
variables: { id: match.params.fileId },
|
|
53
|
+
data: { file: fileUpdated.result }
|
|
54
|
+
});
|
|
55
|
+
} catch (e) {
|
|
56
|
+
console.error(e); //eslint-disable-line
|
|
57
|
+
}
|
|
33
58
|
}
|
|
34
59
|
});
|
|
35
60
|
|
|
61
|
+
setFile(updatedFile.result);
|
|
62
|
+
|
|
36
63
|
addToast(`File: ${file.name} has been updated`, {
|
|
37
64
|
appearance: 'success',
|
|
38
65
|
autoDismiss: true
|
|
@@ -42,7 +69,6 @@ const EditMediaFilePage = ({ match, history }) => {
|
|
|
42
69
|
appearance: 'error',
|
|
43
70
|
autoDismiss: true
|
|
44
71
|
});
|
|
45
|
-
console.error(e); //eslint-disable-line
|
|
46
72
|
}
|
|
47
73
|
setShouldEnableSaveButton(false);
|
|
48
74
|
};
|
|
@@ -51,6 +77,8 @@ const EditMediaFilePage = ({ match, history }) => {
|
|
|
51
77
|
|
|
52
78
|
const buttonModifiers = shouldEnableSaveButton ? [] : ['disabled'];
|
|
53
79
|
|
|
80
|
+
if (schemaLoading) return null;
|
|
81
|
+
|
|
54
82
|
return (
|
|
55
83
|
<div className="page">
|
|
56
84
|
<div className="page__content">
|
|
@@ -60,11 +88,14 @@ const EditMediaFilePage = ({ match, history }) => {
|
|
|
60
88
|
fileId={match.params.fileId}
|
|
61
89
|
handleSaveButtonStatus={handleSaveButtonStatus}
|
|
62
90
|
handleFormSave={handleFormSave}
|
|
91
|
+
showChangeButton
|
|
92
|
+
fileUpdated={file}
|
|
93
|
+
schemaData={schemaData}
|
|
63
94
|
/>
|
|
64
95
|
<div className="page__content__mediaWrapperActions">
|
|
65
96
|
<Button onClick={pushBack}>Cancel</Button>
|
|
66
97
|
<Button onClick={handleFormSave} modifiers={buttonModifiers}>
|
|
67
|
-
|
|
98
|
+
Apply
|
|
68
99
|
</Button>
|
|
69
100
|
</div>
|
|
70
101
|
</div>
|