@strapi/admin 4.2.1-alpha.0 → 4.2.2
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/src/components/OverlayBlocker/index.js +4 -0
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +1 -1
- package/admin/src/hooks/{useFetchInstalledPlugins → useFetchEnabledPlugins}/index.js +4 -4
- package/admin/src/hooks/{useFetchInstalledPlugins → useFetchEnabledPlugins}/utils/api.js +2 -2
- package/admin/src/pages/InstalledPluginsPage/Plugins.js +2 -2
- package/admin/src/pages/MarketplacePage/components/NpmPackageCard/index.js +7 -8
- package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +9 -3
- package/admin/src/pages/MarketplacePage/index.js +9 -39
- package/admin/src/translations/hi.json +699 -0
- package/admin/src/translations/languageNativeNames.js +1 -0
- package/admin/src/translations/pl.json +238 -233
- package/admin/src/translations/zh-Hans.json +28 -1
- package/build/{4715.4588fdf5.chunk.js → 4715.a6e62860.chunk.js} +8 -8
- package/build/{7197.47565569.chunk.js → 7197.74d81c4c.chunk.js} +10 -10
- package/build/{8681.aec05472.chunk.js → 8681.2fd4020a.chunk.js} +1 -1
- package/build/{9158.e48d88af.chunk.js → 9158.c5f772d6.chunk.js} +1 -1
- package/build/Admin-authenticatedApp.2a22d6f4.chunk.js +80 -0
- package/build/Admin_marketplace.0724f650.chunk.js +11 -0
- package/build/Admin_pluginsPage.6f1187fe.chunk.js +1 -0
- package/build/{content-manager.002bfd99.chunk.js → content-manager.18834aa8.chunk.js} +1 -1
- package/build/content-type-builder-translation-pl-json.4a42349b.chunk.js +1 -0
- package/build/{content-type-builder.a0450dfe.chunk.js → content-type-builder.55dd9554.chunk.js} +1 -0
- package/build/email-translation-pl-json.a03bcf98.chunk.js +1 -0
- package/build/hi-json.b4ae16d1.chunk.js +1 -0
- package/build/i18n-translation-pl-json.cea5bf23.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/{main.e3a13431.js → main.fcb539e3.js} +73 -71
- package/build/pl-json.4d11f53d.chunk.js +1 -0
- package/build/runtime~main.ade14a85.js +2 -0
- package/build/upload-translation-pl-json.bb2aa937.chunk.js +1 -0
- package/build/{users-advanced-settings-page.747b2ec1.chunk.js → users-advanced-settings-page.583c5dda.chunk.js} +1 -1
- package/build/users-permissions-translation-en-json.765abf48.chunk.js +1 -0
- package/build/users-permissions-translation-pl-json.1dbdd4a1.chunk.js +1 -0
- package/build/zh-Hans-json.562f3b6f.chunk.js +1 -0
- package/package.json +9 -7
- package/server/controllers/admin.js +2 -0
- package/webpack.config.js +4 -1
- package/admin/src/pages/MarketplacePage/utils/api.js +0 -9
- package/build/Admin-authenticatedApp.63a5061a.chunk.js +0 -80
- package/build/Admin_marketplace.8a503eec.chunk.js +0 -11
- package/build/Admin_pluginsPage.91a96fa5.chunk.js +0 -1
- package/build/content-type-builder-translation-pl-json.a866acda.chunk.js +0 -1
- package/build/email-translation-pl-json.6da50d0f.chunk.js +0 -1
- package/build/pl-json.f65302c2.chunk.js +0 -1
- package/build/runtime~main.dacf1aff.js +0 -2
- package/build/upload-translation-pl-json.6071e38c.chunk.js +0 -1
- package/build/users-permissions-translation-en-json.3fe86528.chunk.js +0 -1
- package/build/users-permissions-translation-pl-json.3c4fe81c.chunk.js +0 -1
- package/build/zh-Hans-json.c84ce330.chunk.js +0 -1
|
@@ -16,7 +16,7 @@ export const EditorStylesContainer = styled.div`
|
|
|
16
16
|
height: ${({ isExpandMode }) => (isExpandMode ? '100%' : '290px')};
|
|
17
17
|
color: ${({ theme }) => theme.colors.neutral800};
|
|
18
18
|
direction: ltr;
|
|
19
|
-
font-family:
|
|
19
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
20
20
|
'Open Sans', 'Helvetica Neue', sans-serif;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useQuery } from 'react-query';
|
|
2
2
|
import { useNotification } from '@strapi/helper-plugin';
|
|
3
|
-
import {
|
|
3
|
+
import { fetchEnabledPlugins } from './utils/api';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const useFetchEnabledPlugins = notifyLoad => {
|
|
6
6
|
const toggleNotification = useNotification();
|
|
7
7
|
|
|
8
|
-
return useQuery('list-
|
|
8
|
+
return useQuery('list-enabled-plugins', () => fetchEnabledPlugins(), {
|
|
9
9
|
onSuccess: () => {
|
|
10
10
|
if (notifyLoad) {
|
|
11
11
|
notifyLoad();
|
|
@@ -20,4 +20,4 @@ const useFetchInstalledPlugins = notifyLoad => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export default
|
|
23
|
+
export default useFetchEnabledPlugins;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { axiosInstance } from '../../../core/utils';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const fetchEnabledPlugins = async () => {
|
|
4
4
|
const { data } = await axiosInstance.get('/admin/plugins');
|
|
5
5
|
|
|
6
6
|
return data;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { fetchEnabledPlugins };
|
|
@@ -6,7 +6,7 @@ import { Layout, HeaderLayout, ContentLayout } from '@strapi/design-system/Layou
|
|
|
6
6
|
import { Main } from '@strapi/design-system/Main';
|
|
7
7
|
import { Typography } from '@strapi/design-system/Typography';
|
|
8
8
|
import { Table, Thead, Tbody, Tr, Td, Th } from '@strapi/design-system/Table';
|
|
9
|
-
import
|
|
9
|
+
import useFetchEnabledPlugins from '../../hooks/useFetchEnabledPlugins';
|
|
10
10
|
|
|
11
11
|
const Plugins = () => {
|
|
12
12
|
const { formatMessage } = useIntl();
|
|
@@ -30,7 +30,7 @@ const Plugins = () => {
|
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const { status, data } =
|
|
33
|
+
const { status, data } = useFetchEnabledPlugins(notifyPluginPageLoad);
|
|
34
34
|
|
|
35
35
|
const isLoading = status !== 'success' && status !== 'error';
|
|
36
36
|
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
|
+
import pluralize from 'pluralize';
|
|
5
6
|
import { Box } from '@strapi/design-system/Box';
|
|
6
7
|
import { Stack } from '@strapi/design-system/Stack';
|
|
7
8
|
import { Typography } from '@strapi/design-system/Typography';
|
|
@@ -27,7 +28,7 @@ const EllipsisText = styled(Typography)`
|
|
|
27
28
|
|
|
28
29
|
const NpmPackageCard = ({
|
|
29
30
|
npmPackage,
|
|
30
|
-
|
|
31
|
+
isInstalled,
|
|
31
32
|
useYarn,
|
|
32
33
|
isInDevelopmentMode,
|
|
33
34
|
npmPackageType,
|
|
@@ -36,8 +37,6 @@ const NpmPackageCard = ({
|
|
|
36
37
|
const { formatMessage } = useIntl();
|
|
37
38
|
const { trackUsage } = useTracking();
|
|
38
39
|
|
|
39
|
-
const isInstalled = installedPackageNames.includes(attributes.npmPackageName);
|
|
40
|
-
|
|
41
40
|
const commandToCopy = useYarn
|
|
42
41
|
? `yarn add ${attributes.npmPackageName}`
|
|
43
42
|
: `npm install ${attributes.npmPackageName}`;
|
|
@@ -47,10 +46,9 @@ const NpmPackageCard = ({
|
|
|
47
46
|
defaultMessage: 'Made by Strapi',
|
|
48
47
|
});
|
|
49
48
|
|
|
50
|
-
const npmPackageHref =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
: `https://market.strapi.io/plugins/${attributes.slug}`;
|
|
49
|
+
const npmPackageHref = `https://market.strapi.io/${pluralize.plural(npmPackageType)}/${
|
|
50
|
+
attributes.slug
|
|
51
|
+
}`;
|
|
54
52
|
|
|
55
53
|
return (
|
|
56
54
|
<Flex
|
|
@@ -65,6 +63,7 @@ const NpmPackageCard = ({
|
|
|
65
63
|
shadow="tableShadow"
|
|
66
64
|
height="100%"
|
|
67
65
|
alignItems="normal"
|
|
66
|
+
data-testid="npm-package-card"
|
|
68
67
|
>
|
|
69
68
|
<Box>
|
|
70
69
|
<Box
|
|
@@ -167,7 +166,7 @@ NpmPackageCard.propTypes = {
|
|
|
167
166
|
strapiCompatibility: PropTypes.oneOf(['v3', 'v4']),
|
|
168
167
|
}).isRequired,
|
|
169
168
|
}).isRequired,
|
|
170
|
-
|
|
169
|
+
isInstalled: PropTypes.bool.isRequired,
|
|
171
170
|
useYarn: PropTypes.bool.isRequired,
|
|
172
171
|
isInDevelopmentMode: PropTypes.bool,
|
|
173
172
|
npmPackageType: PropTypes.string.isRequired,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Grid, GridItem } from '@strapi/design-system/Grid';
|
|
4
4
|
import NpmPackageCard from '../NpmPackageCard';
|
|
@@ -10,13 +10,19 @@ const NpmPackagesGrid = ({
|
|
|
10
10
|
isInDevelopmentMode,
|
|
11
11
|
npmPackageType,
|
|
12
12
|
}) => {
|
|
13
|
+
// Check if an individual package is in the dependencies
|
|
14
|
+
const isAlreadyInstalled = useCallback(
|
|
15
|
+
npmPackageName => installedPackageNames.includes(npmPackageName),
|
|
16
|
+
[installedPackageNames]
|
|
17
|
+
);
|
|
18
|
+
|
|
13
19
|
return (
|
|
14
20
|
<Grid gap={4}>
|
|
15
|
-
{npmPackages.map(
|
|
21
|
+
{npmPackages.map(npmPackage => (
|
|
16
22
|
<GridItem col={4} s={6} xs={12} style={{ height: '100%' }} key={npmPackage.id}>
|
|
17
23
|
<NpmPackageCard
|
|
18
24
|
npmPackage={npmPackage}
|
|
19
|
-
|
|
25
|
+
isInstalled={isAlreadyInstalled(npmPackage.attributes.npmPackageName)}
|
|
20
26
|
useYarn={useYarn}
|
|
21
27
|
isInDevelopmentMode={isInDevelopmentMode}
|
|
22
28
|
npmPackageType={npmPackageType}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { Helmet } from 'react-helmet';
|
|
4
|
-
import { useQuery } from 'react-query';
|
|
5
4
|
import matchSorter from 'match-sorter';
|
|
6
5
|
import {
|
|
7
6
|
AnErrorOccurred,
|
|
@@ -23,8 +22,6 @@ import { Tabs, Tab, TabGroup, TabPanels, TabPanel } from '@strapi/design-system/
|
|
|
23
22
|
|
|
24
23
|
import EmptyNpmPackageSearch from './components/EmptyNpmPackageSearch';
|
|
25
24
|
import PageHeader from './components/PageHeader';
|
|
26
|
-
import { fetchAppInformation } from './utils/api';
|
|
27
|
-
import useFetchInstalledPlugins from '../../hooks/useFetchInstalledPlugins';
|
|
28
25
|
import useFetchMarketplaceProviders from '../../hooks/useFetchMarketplaceProviders';
|
|
29
26
|
import useFetchMarketplacePlugins from '../../hooks/useFetchMarketplacePlugins';
|
|
30
27
|
import adminPermissions from '../../permissions';
|
|
@@ -53,7 +50,7 @@ const MarketPlacePage = () => {
|
|
|
53
50
|
const toggleNotification = useNotification();
|
|
54
51
|
const [searchQuery, setSearchQuery] = useState('');
|
|
55
52
|
const [npmPackageType, setNpmPackageType] = useState('plugin');
|
|
56
|
-
const { autoReload: isInDevelopmentMode } = useAppInfos();
|
|
53
|
+
const { autoReload: isInDevelopmentMode, dependencies, useYarn } = useAppInfos();
|
|
57
54
|
const isOnline = useNavigatorOnLine();
|
|
58
55
|
|
|
59
56
|
useFocusWhenNavigate();
|
|
@@ -85,37 +82,9 @@ const MarketPlacePage = () => {
|
|
|
85
82
|
data: marketplaceProvidersResponse,
|
|
86
83
|
} = useFetchMarketplaceProviders(notifyMarketplaceLoad);
|
|
87
84
|
|
|
88
|
-
const
|
|
89
|
-
status: installedPluginsStatus,
|
|
90
|
-
data: installedPluginsResponse,
|
|
91
|
-
} = useFetchInstalledPlugins();
|
|
92
|
-
|
|
93
|
-
const { data: appInfoResponse, status: appInfoStatus } = useQuery(
|
|
94
|
-
'app-information',
|
|
95
|
-
fetchAppInformation,
|
|
96
|
-
{
|
|
97
|
-
onError: () => {
|
|
98
|
-
toggleNotification({
|
|
99
|
-
type: 'warning',
|
|
100
|
-
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
|
101
|
-
});
|
|
102
|
-
},
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const isLoading = [
|
|
107
|
-
marketplacePluginsStatus,
|
|
108
|
-
marketplaceProvidersStatus,
|
|
109
|
-
installedPluginsStatus,
|
|
110
|
-
appInfoStatus,
|
|
111
|
-
].includes('loading');
|
|
85
|
+
const isLoading = [marketplacePluginsStatus, marketplaceProvidersStatus].includes('loading');
|
|
112
86
|
|
|
113
|
-
const hasFailed = [
|
|
114
|
-
marketplacePluginsStatus,
|
|
115
|
-
marketplaceProvidersStatus,
|
|
116
|
-
installedPluginsStatus,
|
|
117
|
-
appInfoStatus,
|
|
118
|
-
].includes('error');
|
|
87
|
+
const hasFailed = [marketplacePluginsStatus, marketplaceProvidersStatus].includes('error');
|
|
119
88
|
|
|
120
89
|
useEffect(() => {
|
|
121
90
|
trackUsageRef.current('didGoToMarketplace');
|
|
@@ -208,8 +177,8 @@ const MarketPlacePage = () => {
|
|
|
208
177
|
setNpmPackageType(packageType);
|
|
209
178
|
};
|
|
210
179
|
|
|
211
|
-
// Check if plugins are installed already
|
|
212
|
-
const
|
|
180
|
+
// Check if plugins and providers are installed already
|
|
181
|
+
const installedPackageNames = Object.keys(dependencies);
|
|
213
182
|
|
|
214
183
|
return (
|
|
215
184
|
<Layout>
|
|
@@ -278,8 +247,8 @@ const MarketPlacePage = () => {
|
|
|
278
247
|
) : (
|
|
279
248
|
<NpmPackagesGrid
|
|
280
249
|
npmPackages={pluginSearchResults}
|
|
281
|
-
installedPackageNames={
|
|
282
|
-
useYarn={
|
|
250
|
+
installedPackageNames={installedPackageNames}
|
|
251
|
+
useYarn={useYarn}
|
|
283
252
|
isInDevelopmentMode={isInDevelopmentMode}
|
|
284
253
|
npmPackageType="plugin"
|
|
285
254
|
/>
|
|
@@ -292,7 +261,8 @@ const MarketPlacePage = () => {
|
|
|
292
261
|
) : (
|
|
293
262
|
<NpmPackagesGrid
|
|
294
263
|
npmPackages={providerSearchResults}
|
|
295
|
-
|
|
264
|
+
installedPackageNames={installedPackageNames}
|
|
265
|
+
useYarn={useYarn}
|
|
296
266
|
isInDevelopmentMode={isInDevelopmentMode}
|
|
297
267
|
npmPackageType="provider"
|
|
298
268
|
/>
|