@strapi/plugin-documentation 4.10.4 → 4.10.6

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',
@@ -137,6 +137,7 @@ describe('Plugin | Documentation | PluginPage', () => {
137
137
  font-size: 0.75rem;
138
138
  line-height: 1.33;
139
139
  font-weight: 600;
140
+ line-height: 0;
140
141
  color: #ffffff;
141
142
  }
142
143
 
@@ -124,6 +124,7 @@ describe('Plugin | Documentation | SettingsPage', () => {
124
124
  font-size: 0.75rem;
125
125
  line-height: 1.33;
126
126
  font-weight: 600;
127
+ line-height: 0;
127
128
  color: #ffffff;
128
129
  }
129
130
 
@@ -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;
@@ -1,14 +1,14 @@
1
1
  const openWithNewTab = (path) => {
2
2
  const url = (() => {
3
3
  if (path.startsWith('/')) {
4
- return `${strapi.backendURL}${path}`;
4
+ return `${window.strapi.backendURL}${path}`;
5
5
  }
6
6
 
7
7
  if (path.startsWith('http')) {
8
8
  return path;
9
9
  }
10
10
 
11
- return `${strapi.backendURL}/${path}`;
11
+ return `${window.strapi.backendURL}/${path}`;
12
12
  })();
13
13
 
14
14
  window.open(url, '_blank');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-documentation",
3
- "version": "4.10.4",
3
+ "version": "4.10.6",
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.4",
35
- "@strapi/icons": "1.7.3",
36
- "@strapi/utils": "4.10.4",
33
+ "@strapi/design-system": "1.7.7",
34
+ "@strapi/helper-plugin": "4.10.6",
35
+ "@strapi/icons": "1.7.7",
36
+ "@strapi/utils": "4.10.6",
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": "3f55bac2e7fc3b15c85ac6910be1e95bb7eed9e5"
84
+ "gitHead": "7dbae9d05d765b85927e1ccff282ac9d82d0a9eb"
85
85
  }