@strapi/plugin-documentation 4.0.0-beta.2 → 4.0.0-beta.20
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/FieldActionWrapper/index.js +14 -0
- package/admin/src/components/PluginIcon/index.js +12 -0
- package/admin/src/index.js +23 -11
- package/admin/src/pages/PluginPage/index.js +199 -0
- package/admin/src/pages/PluginPage/tests/index.test.js +873 -0
- package/admin/src/pages/PluginPage/tests/server.js +23 -0
- package/admin/src/pages/SettingsPage/index.js +181 -0
- package/admin/src/pages/SettingsPage/tests/index.test.js +612 -0
- package/admin/src/pages/SettingsPage/tests/server.js +18 -0
- package/admin/src/pages/{HomePage/utils → utils}/api.js +5 -4
- package/admin/src/pages/{HomePage/utils → utils}/schema.js +0 -0
- package/admin/src/pages/utils/useReactQuery.js +46 -0
- package/admin/src/translations/ar.json +0 -3
- package/admin/src/translations/cs.json +0 -3
- package/admin/src/translations/de.json +0 -3
- package/admin/src/translations/en.json +13 -3
- package/admin/src/translations/es.json +0 -3
- package/admin/src/translations/fr.json +0 -3
- package/admin/src/translations/id.json +0 -3
- package/admin/src/translations/it.json +0 -3
- package/admin/src/translations/ko.json +0 -3
- package/admin/src/translations/ms.json +0 -3
- package/admin/src/translations/nl.json +0 -3
- package/admin/src/translations/pl.json +0 -3
- package/admin/src/translations/pt-BR.json +0 -3
- package/admin/src/translations/pt.json +0 -3
- package/admin/src/translations/ru.json +0 -3
- package/admin/src/translations/sk.json +0 -3
- package/admin/src/translations/th.json +0 -3
- package/admin/src/translations/tr.json +0 -3
- package/admin/src/translations/uk.json +0 -3
- package/admin/src/translations/vi.json +0 -3
- package/admin/src/translations/zh-Hans.json +0 -3
- package/admin/src/translations/zh.json +0 -3
- package/package.json +26 -46
- package/server/bootstrap.js +22 -105
- package/server/config/default-config.js +12 -15
- package/server/config/index.js +10 -2
- package/server/controllers/documentation.js +49 -111
- package/server/index.js +17 -0
- package/server/middlewares/documentation.js +24 -55
- package/server/{policies/index-policy.js → middlewares/restrict-access.js} +2 -10
- package/{public → server/public}/index.html +0 -0
- package/{public → server/public}/login.html +0 -0
- package/server/register.js +11 -0
- package/server/routes/index.js +10 -17
- package/server/services/documentation.js +125 -1831
- package/server/utils/builders/build-api-endpoint-path.js +174 -0
- package/server/utils/builders/build-api-requests.js +41 -0
- package/server/utils/builders/build-api-responses.js +108 -0
- package/server/utils/builders/index.js +11 -0
- package/server/utils/clean-schema-attributes.js +205 -0
- package/server/utils/error-response.js +22 -0
- package/server/utils/get-schema-data.js +32 -0
- package/server/utils/query-params.js +84 -0
- package/strapi-server.js +1 -19
- package/admin/src/assets/images/logo.svg +0 -1
- package/admin/src/components/Block/components.js +0 -26
- package/admin/src/components/Block/index.js +0 -39
- package/admin/src/components/Copy/index.js +0 -36
- package/admin/src/components/Header/index.js +0 -72
- package/admin/src/components/Row/ButtonContainer.js +0 -67
- package/admin/src/components/Row/components.js +0 -83
- package/admin/src/components/Row/index.js +0 -51
- package/admin/src/pages/App/index.js +0 -52
- package/admin/src/pages/HomePage/components.js +0 -59
- package/admin/src/pages/HomePage/index.js +0 -175
- package/admin/src/pages/HomePage/useHomePage.js +0 -56
- package/server/policies/index.js +0 -7
- package/server/services/utils/forms.json +0 -29
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { useQuery, useMutation, useQueryClient } from 'react-query';
|
|
2
|
-
import { useNotification } from '@strapi/helper-plugin';
|
|
3
|
-
import { fetchData, deleteDoc, regenerateDoc, submit } from './utils/api';
|
|
4
|
-
import getTrad from '../../utils/getTrad';
|
|
5
|
-
|
|
6
|
-
const useHomePage = () => {
|
|
7
|
-
const queryClient = useQueryClient();
|
|
8
|
-
const toggleNotification = useNotification();
|
|
9
|
-
const { isLoading, data } = useQuery('get-documentation', () => fetchData(toggleNotification));
|
|
10
|
-
|
|
11
|
-
const handleError = err => {
|
|
12
|
-
toggleNotification({
|
|
13
|
-
type: 'warning',
|
|
14
|
-
message: err.response.payload.message,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const deleteMutation = useMutation(deleteDoc, {
|
|
19
|
-
onSuccess: async () => {
|
|
20
|
-
await queryClient.invalidateQueries('get-documentation');
|
|
21
|
-
toggleNotification({
|
|
22
|
-
type: 'info',
|
|
23
|
-
message: { id: getTrad('notification.delete.success') },
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
onError: handleError,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const submitMutation = useMutation(submit, {
|
|
30
|
-
onSuccess: () => {
|
|
31
|
-
queryClient.invalidateQueries('get-documentation');
|
|
32
|
-
|
|
33
|
-
toggleNotification({
|
|
34
|
-
type: 'success',
|
|
35
|
-
message: { id: getTrad('notification.update.success') },
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
onError: handleError,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const regenerateDocMutation = useMutation(regenerateDoc, {
|
|
42
|
-
onSuccess: () => {
|
|
43
|
-
queryClient.invalidateQueries('get-documentation');
|
|
44
|
-
|
|
45
|
-
toggleNotification({
|
|
46
|
-
type: 'info',
|
|
47
|
-
message: { id: getTrad('notification.generate.success') },
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
onError: handleError,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return { data, isLoading, deleteMutation, submitMutation, regenerateDocMutation };
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default useHomePage;
|
package/server/policies/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
{
|
|
4
|
-
"name": "restrictedAccess",
|
|
5
|
-
"label": {
|
|
6
|
-
"id": "documentation.containers.HomePage.form.restrictedAccess"
|
|
7
|
-
},
|
|
8
|
-
"type": "toggle",
|
|
9
|
-
"inputDescription": {
|
|
10
|
-
"id": "documentation.containers.HomePage.form.restrictedAccess.inputDescription"
|
|
11
|
-
},
|
|
12
|
-
"inputDescriptionStyle": { "marginBottom": "2px"},
|
|
13
|
-
"value": false
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"name": "password",
|
|
17
|
-
"label": {
|
|
18
|
-
"id": "documentation.containers.HomePage.form.password"
|
|
19
|
-
},
|
|
20
|
-
"customBootstrapClass": "col-md-4",
|
|
21
|
-
"type": "password",
|
|
22
|
-
"inputDescription": {
|
|
23
|
-
"id": "documentation.containers.HomePage.form.password.inputDescription"
|
|
24
|
-
},
|
|
25
|
-
"validations": { "required": true },
|
|
26
|
-
"value": ""
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
]
|