@strapi/plugin-documentation 4.11.2 → 4.11.4

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.
@@ -1,4 +1,4 @@
1
- const pluginPermissions = {
1
+ export const PERMISSIONS = {
2
2
  // This permission regards the main component (App) and is used to tell
3
3
  // If the plugin link should be displayed in the menu
4
4
  // And also if the plugin is accessible. This use case is found when a user types the url of the
@@ -15,5 +15,3 @@ const pluginPermissions = {
15
15
  regenerate: [{ action: 'plugin::documentation.settings.regenerate', subject: null }],
16
16
  update: [{ action: 'plugin::documentation.settings.update', subject: null }],
17
17
  };
18
-
19
- export default pluginPermissions;
@@ -9,7 +9,7 @@ import { prefixPluginTranslations } from '@strapi/helper-plugin';
9
9
  import pluginPkg from '../../package.json';
10
10
 
11
11
  import PluginIcon from './components/PluginIcon';
12
- import pluginPermissions from './permissions';
12
+ import { PERMISSIONS } from './constants';
13
13
  import pluginId from './pluginId';
14
14
 
15
15
  const name = pluginPkg.strapi.name;
@@ -23,7 +23,7 @@ export default {
23
23
  id: `${pluginId}.plugin.name`,
24
24
  defaultMessage: 'Documentation',
25
25
  },
26
- permissions: pluginPermissions.main,
26
+ permissions: PERMISSIONS.main,
27
27
  async Component() {
28
28
  const component = await import(
29
29
  /* webpackChunkName: "documentation-page" */ './pages/PluginPage'
@@ -53,7 +53,7 @@ export default {
53
53
 
54
54
  return component;
55
55
  },
56
- permissions: pluginPermissions.main,
56
+ permissions: PERMISSIONS.main,
57
57
  });
58
58
  },
59
59
  async registerTrads({ locales }) {
@@ -37,7 +37,7 @@ import { Eye as Show, Refresh as Reload, Trash } from '@strapi/icons';
37
37
  import { Helmet } from 'react-helmet';
38
38
  import { useIntl } from 'react-intl';
39
39
 
40
- import permissions from '../../permissions';
40
+ import { PERMISSIONS } from '../../constants';
41
41
  import { getTrad } from '../../utils';
42
42
  import openWithNewTab from '../../utils/openWithNewTab';
43
43
  import useReactQuery from '../utils/useReactQuery';
@@ -107,7 +107,7 @@ const PluginPage = () => {
107
107
  })}
108
108
  primaryAction={
109
109
  // eslint-disable-next-line
110
- <CheckPermissions permissions={permissions.open}>
110
+ <CheckPermissions permissions={PERMISSIONS.open}>
111
111
  <Button onClick={() => openDocVersion(data?.currentVersion)} startIcon={<Show />}>
112
112
  {formatMessage({
113
113
  id: getTrad('pages.PluginPage.Button.open'),
@@ -166,7 +166,7 @@ const PluginPage = () => {
166
166
  { target: `${doc.version}` }
167
167
  )}
168
168
  />
169
- <CheckPermissions permissions={permissions.regenerate}>
169
+ <CheckPermissions permissions={PERMISSIONS.regenerate}>
170
170
  <IconButton
171
171
  onClick={() => handleRegenerateDoc(doc.version)}
172
172
  noBorder
@@ -180,7 +180,7 @@ const PluginPage = () => {
180
180
  )}
181
181
  />
182
182
  </CheckPermissions>
183
- <CheckPermissions permissions={permissions.update}>
183
+ <CheckPermissions permissions={PERMISSIONS.update}>
184
184
  {doc.version !== data.currentVersion && (
185
185
  <IconButton
186
186
  onClick={() => handleClickDelete(doc.version)}
@@ -89,7 +89,6 @@ describe('Plugin | Documentation | PluginPage', () => {
89
89
  font-size: 0.75rem;
90
90
  line-height: 1.33;
91
91
  font-weight: 600;
92
- line-height: 0;
93
92
  color: #ffffff;
94
93
  }
95
94
 
@@ -26,7 +26,7 @@ import { Formik } from 'formik';
26
26
  import { useIntl } from 'react-intl';
27
27
 
28
28
  import FieldActionWrapper from '../../components/FieldActionWrapper';
29
- import permissions from '../../permissions';
29
+ import { PERMISSIONS } from '../../constants';
30
30
  import { getTrad } from '../../utils';
31
31
  import schema from '../utils/schema';
32
32
  import useReactQuery from '../utils/useReactQuery';
@@ -57,7 +57,15 @@ const SettingsPage = () => {
57
57
  onSubmit={handleUpdateSettingsSubmit}
58
58
  validationSchema={schema}
59
59
  >
60
- {({ handleSubmit, values, handleChange, errors, setFieldTouched, setFieldValue }) => {
60
+ {({
61
+ handleSubmit,
62
+ values,
63
+ handleChange,
64
+ errors,
65
+ setFieldTouched,
66
+ setFieldValue,
67
+ dirty,
68
+ }) => {
61
69
  return (
62
70
  <Form noValidate onSubmit={handleSubmit}>
63
71
  <HeaderLayout
@@ -70,8 +78,8 @@ const SettingsPage = () => {
70
78
  defaultMessage: 'Configure the documentation plugin',
71
79
  })}
72
80
  primaryAction={
73
- <CheckPermissions permissions={permissions.update}>
74
- <Button type="submit" startIcon={<Check />}>
81
+ <CheckPermissions permissions={PERMISSIONS.update}>
82
+ <Button type="submit" startIcon={<Check />} disabled={!dirty}>
75
83
  {formatMessage({
76
84
  id: getTrad('pages.SettingsPage.Button.save'),
77
85
  defaultMessage: 'Save',
@@ -81,7 +81,6 @@ describe('Plugin | Documentation | SettingsPage', () => {
81
81
  font-size: 0.75rem;
82
82
  line-height: 1.33;
83
83
  font-weight: 600;
84
- line-height: 0;
85
84
  color: #ffffff;
86
85
  }
87
86
 
@@ -517,8 +516,9 @@ describe('Plugin | Documentation | SettingsPage', () => {
517
516
  </h1>
518
517
  </div>
519
518
  <button
520
- aria-disabled="false"
519
+ aria-disabled="true"
521
520
  class="c7 c8 c9 c10"
521
+ disabled=""
522
522
  type="submit"
523
523
  >
524
524
  <div
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-documentation",
3
- "version": "4.11.2",
3
+ "version": "4.11.4",
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.8.0",
34
- "@strapi/helper-plugin": "4.11.2",
35
- "@strapi/icons": "1.8.0",
36
- "@strapi/utils": "4.11.2",
33
+ "@strapi/design-system": "1.8.1",
34
+ "@strapi/helper-plugin": "4.11.4",
35
+ "@strapi/icons": "1.8.1",
36
+ "@strapi/utils": "4.11.4",
37
37
  "bcryptjs": "2.4.3",
38
38
  "cheerio": "^1.0.0-rc.12",
39
39
  "formik": "2.4.0",
@@ -80,5 +80,5 @@
80
80
  "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
81
81
  "kind": "plugin"
82
82
  },
83
- "gitHead": "6f7c815c2bbe41dda7d77136eb8df736c028ff67"
83
+ "gitHead": "8d325a695386ab9b578b360bf768cfa25173050f"
84
84
  }