@strapi/plugin-documentation 4.10.3 → 4.11.0-alpha.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.
@@ -14,6 +14,7 @@ import {
14
14
  stopPropagation,
15
15
  EmptyStateLayout,
16
16
  useFocusWhenNavigate,
17
+ AnErrorOccurred,
17
18
  } from '@strapi/helper-plugin';
18
19
  import { Helmet } from 'react-helmet';
19
20
  import {
@@ -31,6 +32,7 @@ import {
31
32
  Th,
32
33
  Tbody,
33
34
  Td,
35
+ Box,
34
36
  } from '@strapi/design-system';
35
37
 
36
38
  import { Trash, Eye as Show, Refresh as Reload } from '@strapi/icons';
@@ -43,7 +45,7 @@ import useReactQuery from '../utils/useReactQuery';
43
45
  const PluginPage = () => {
44
46
  useFocusWhenNavigate();
45
47
  const { formatMessage } = useIntl();
46
- const { data, isLoading, deleteMutation, regenerateDocMutation } = useReactQuery();
48
+ const { data, isLoading, isError, deleteMutation, regenerateDocMutation } = useReactQuery();
47
49
  const [showConfirmDelete, setShowConfirmDelete] = useState(false);
48
50
  const [isConfirmButtonLoading, setIsConfirmButtonLoading] = useState(false);
49
51
  const [versionToDelete, setVersionToDelete] = useState();
@@ -81,6 +83,18 @@ const PluginPage = () => {
81
83
  defaultMessage: 'Documentation',
82
84
  });
83
85
 
86
+ if (isError) {
87
+ return (
88
+ <Layout>
89
+ <ContentLayout>
90
+ <Box paddingTop={8}>
91
+ <AnErrorOccurred />
92
+ </Box>
93
+ </ContentLayout>
94
+ </Layout>
95
+ );
96
+ }
97
+
84
98
  return (
85
99
  <Layout>
86
100
  <Helmet title={title} />
@@ -94,7 +108,7 @@ const PluginPage = () => {
94
108
  primaryAction={
95
109
  // eslint-disable-next-line
96
110
  <CheckPermissions permissions={permissions.open}>
97
- <Button onClick={openDocVersion} startIcon={<Show />}>
111
+ <Button onClick={() => openDocVersion(data?.currentVersion)} startIcon={<Show />}>
98
112
  {formatMessage({
99
113
  id: getTrad('pages.PluginPage.Button.open'),
100
114
  defaultMessage: 'Open Documentation',
@@ -6,7 +6,7 @@ import getTrad from '../../utils/getTrad';
6
6
  const useReactQuery = () => {
7
7
  const queryClient = useQueryClient();
8
8
  const toggleNotification = useNotification();
9
- const { isLoading, data } = useQuery(['get-documentation', pluginId], async () => {
9
+ const { isLoading, isError, data } = useQuery(['get-documentation', pluginId], async () => {
10
10
  try {
11
11
  const { data } = await get(`/${pluginId}/getInfos`);
12
12
 
@@ -60,7 +60,7 @@ const useReactQuery = () => {
60
60
  }
61
61
  );
62
62
 
63
- return { data, isLoading, deleteMutation, submitMutation, regenerateDocMutation };
63
+ return { data, isLoading, isError, deleteMutation, submitMutation, regenerateDocMutation };
64
64
  };
65
65
 
66
66
  export default useReactQuery;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-documentation",
3
- "version": "4.10.3",
3
+ "version": "4.11.0-alpha.0",
4
4
  "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,10 +30,10 @@
30
30
  "test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll"
31
31
  },
32
32
  "dependencies": {
33
- "@strapi/design-system": "1.7.3",
34
- "@strapi/helper-plugin": "4.10.3",
35
- "@strapi/icons": "1.7.3",
36
- "@strapi/utils": "4.10.3",
33
+ "@strapi/design-system": "1.7.4",
34
+ "@strapi/helper-plugin": "4.11.0-alpha.0",
35
+ "@strapi/icons": "1.7.4",
36
+ "@strapi/utils": "4.11.0-alpha.0",
37
37
  "bcryptjs": "2.4.3",
38
38
  "cheerio": "^1.0.0-rc.12",
39
39
  "formik": "2.2.9",
@@ -81,5 +81,5 @@
81
81
  "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
82
82
  "kind": "plugin"
83
83
  },
84
- "gitHead": "b6ec5aff03daf9db7a3c504a45191957f56dc559"
84
+ "gitHead": "ca5fb0fcfab1b6784208d2ddf6d51617b8893b35"
85
85
  }