@plone/volto 18.0.0-alpha.42 → 18.0.0-alpha.43

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.
Files changed (137) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/finalreleasechangelog.py +48 -0
  3. package/locales/ca/LC_MESSAGES/volto.po +8 -12
  4. package/locales/ca.json +1 -1
  5. package/locales/de/LC_MESSAGES/volto.po +9 -13
  6. package/locales/de.json +1 -1
  7. package/locales/en/LC_MESSAGES/volto.po +8 -12
  8. package/locales/en.json +1 -1
  9. package/locales/es/LC_MESSAGES/volto.po +9 -13
  10. package/locales/es.json +1 -1
  11. package/locales/eu/LC_MESSAGES/volto.po +9 -13
  12. package/locales/eu.json +1 -1
  13. package/locales/fi/LC_MESSAGES/volto.po +9 -13
  14. package/locales/fi.json +1 -1
  15. package/locales/fr/LC_MESSAGES/volto.po +9 -13
  16. package/locales/fr.json +1 -1
  17. package/locales/hi/LC_MESSAGES/volto.po +9 -13
  18. package/locales/hi.json +1 -1
  19. package/locales/it/LC_MESSAGES/volto.po +9 -13
  20. package/locales/it.json +1 -1
  21. package/locales/ja/LC_MESSAGES/volto.po +8 -12
  22. package/locales/ja.json +1 -1
  23. package/locales/nl/LC_MESSAGES/volto.po +8 -12
  24. package/locales/nl.json +1 -1
  25. package/locales/pt/LC_MESSAGES/volto.po +8 -12
  26. package/locales/pt.json +1 -1
  27. package/locales/pt_BR/LC_MESSAGES/volto.po +9 -13
  28. package/locales/pt_BR.json +1 -1
  29. package/locales/ro/LC_MESSAGES/volto.po +8 -12
  30. package/locales/ro.json +1 -1
  31. package/locales/volto.pot +9 -13
  32. package/locales/zh_CN/LC_MESSAGES/volto.po +9 -13
  33. package/locales/zh_CN.json +1 -1
  34. package/package.json +3 -3
  35. package/razzle.config.js +1 -1
  36. package/src/components/manage/Actions/Actions.stories.jsx +138 -0
  37. package/src/components/manage/Add/Add.jsx +7 -4
  38. package/src/components/manage/BlockChooser/BlockChooser.jsx +9 -1
  39. package/src/components/manage/Blocks/Block/Edit.jsx +24 -8
  40. package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +17 -1
  41. package/src/components/manage/Blocks/Block/Order/Item.jsx +3 -1
  42. package/src/components/manage/Blocks/Grid/View.jsx +3 -0
  43. package/src/components/manage/Blocks/LeadImage/Edit.jsx +74 -126
  44. package/src/components/manage/Blocks/Search/components/SortOn.jsx +82 -55
  45. package/src/components/manage/Blocks/Search/widgets/SelectMetadataField.jsx +107 -176
  46. package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +15 -8
  47. package/src/components/manage/Blocks/ToC/Edit.jsx +36 -29
  48. package/src/components/manage/Blocks/Video/Edit.jsx +105 -172
  49. package/src/components/manage/Blocks/Video/Edit.stories.jsx +57 -0
  50. package/src/components/manage/Contents/Contents.jsx +3 -0
  51. package/src/components/manage/Contents/ContentsBreadcrumbs.stories.jsx +46 -0
  52. package/src/components/manage/Contents/ContentsPropertiesModal.jsx +85 -52
  53. package/src/components/manage/Contents/ContentsUploadModal.jsx +230 -323
  54. package/src/components/manage/Contents/ContentsUploadModal.stories.jsx +56 -0
  55. package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +323 -441
  56. package/src/components/manage/Controlpanels/Aliases.jsx +452 -580
  57. package/src/components/manage/Controlpanels/Aliases.stories.jsx +74 -0
  58. package/src/components/manage/Controlpanels/Controlpanel.jsx +41 -2
  59. package/src/components/manage/Controlpanels/Controlpanel.test.jsx +55 -24
  60. package/src/components/manage/Controlpanels/DatabaseInformation.jsx +162 -229
  61. package/src/components/manage/Controlpanels/Groups/RenderGroups.jsx +74 -122
  62. package/src/components/manage/Display/Display.jsx +92 -148
  63. package/src/components/manage/Display/Display.stories.jsx +46 -0
  64. package/src/components/manage/Edit/Edit.jsx +2 -4
  65. package/src/components/manage/Preferences/ChangePassword.jsx +94 -172
  66. package/src/components/manage/Preferences/ChangePassword.stories.jsx +41 -0
  67. package/src/components/manage/Preferences/PersonalInformation.jsx +50 -115
  68. package/src/components/manage/Preferences/PersonalPreferences.jsx +46 -100
  69. package/src/components/manage/Preferences/PersonalPreferences.stories.jsx +48 -0
  70. package/src/components/manage/Toolbar/More.jsx +308 -399
  71. package/src/components/manage/Widgets/DatetimeWidget.jsx +121 -175
  72. package/src/components/manage/Widgets/ReferenceWidget.jsx +134 -210
  73. package/src/components/theme/Register/Register.jsx +70 -142
  74. package/src/components/theme/Register/Register.stories.jsx +49 -0
  75. package/src/components/theme/Tags/Tags.jsx +19 -10
  76. package/src/components/theme/Tags/Tags.test.jsx +9 -11
  77. package/src/components/theme/View/AlbumView.jsx +122 -167
  78. package/src/components/theme/View/LinkView.jsx +4 -0
  79. package/src/components/theme/View/LinkView.test.jsx +2 -0
  80. package/src/components/theme/View/View.jsx +0 -6
  81. package/src/config/ControlPanels.js +49 -43
  82. package/src/config/config.test.js +1 -0
  83. package/src/config/index.js +16 -0
  84. package/src/config/slots.js +12 -0
  85. package/src/helpers/Blocks/Blocks.js +12 -7
  86. package/src/helpers/Blocks/Blocks.test.js +15 -0
  87. package/src/helpers/Blocks/cloneBlocks.ts +1 -1
  88. package/src/helpers/FormValidation/FormValidation.jsx +19 -2
  89. package/src/helpers/FormValidation/validators.ts +1 -1
  90. package/src/helpers/Url/Url.test.js +15 -2
  91. package/src/helpers/Url/urlRegex.js +1 -1
  92. package/src/helpers/index.js +2 -0
  93. package/src/middleware/api.js +4 -2
  94. package/src/middleware/index.js +1 -0
  95. package/src/middleware/userSessionReset.js +46 -0
  96. package/src/store.js +2 -0
  97. package/test-setup-config.jsx +3 -0
  98. package/theme/themes/pastanaga/extras/blocks.less +6 -0
  99. package/types/components/manage/Actions/Actions.stories.d.ts +8 -0
  100. package/types/components/manage/Blocks/LeadImage/Edit.d.ts +14 -5
  101. package/types/components/manage/Blocks/Search/widgets/SelectMetadataField.d.ts +0 -5
  102. package/types/components/manage/Blocks/ToC/Edit.d.ts +1 -6
  103. package/types/components/manage/Blocks/Video/Edit.d.ts +1 -1
  104. package/types/components/manage/Blocks/Video/Edit.stories.d.ts +8 -0
  105. package/types/components/manage/Contents/ContentsBreadcrumbs.stories.d.ts +8 -0
  106. package/types/components/manage/Contents/ContentsUploadModal.d.ts +14 -2
  107. package/types/components/manage/Contents/ContentsUploadModal.stories.d.ts +8 -0
  108. package/types/components/manage/Contents/index.d.ts +1 -1
  109. package/types/components/manage/Controlpanels/AddonsControlpanel.d.ts +2 -2
  110. package/types/components/manage/Controlpanels/Aliases.d.ts +2 -2
  111. package/types/components/manage/Controlpanels/Aliases.stories.d.ts +8 -0
  112. package/types/components/manage/Controlpanels/DatabaseInformation.d.ts +2 -2
  113. package/types/components/manage/Controlpanels/Groups/RenderGroups.d.ts +10 -5
  114. package/types/components/manage/Controlpanels/index.d.ts +4 -4
  115. package/types/components/manage/Display/Display.stories.d.ts +8 -0
  116. package/types/components/manage/Preferences/ChangePassword.d.ts +2 -2
  117. package/types/components/manage/Preferences/ChangePassword.stories.d.ts +8 -0
  118. package/types/components/manage/Preferences/PersonalInformation.d.ts +7 -2
  119. package/types/components/manage/Preferences/PersonalPreferences.d.ts +5 -1
  120. package/types/components/manage/Preferences/PersonalPreferences.stories.d.ts +8 -0
  121. package/types/components/manage/Toolbar/More.d.ts +8 -5
  122. package/types/components/manage/Widgets/DatetimeWidget.d.ts +0 -85
  123. package/types/components/manage/Widgets/DatetimeWidget.stories.d.ts +0 -1
  124. package/types/components/manage/Widgets/ReferenceWidget.d.ts +27 -2
  125. package/types/components/manage/Widgets/index.d.ts +1 -1
  126. package/types/components/theme/Register/Register.d.ts +2 -2
  127. package/types/components/theme/Register/Register.stories.d.ts +9 -0
  128. package/types/components/theme/Tags/Tags.d.ts +15 -7
  129. package/types/components/theme/View/AlbumView.d.ts +3 -17
  130. package/types/config/ControlPanels.d.ts +8 -0
  131. package/types/config/Widgets.d.ts +1 -1
  132. package/types/config/slots.d.ts +21 -0
  133. package/types/helpers/Blocks/Blocks.d.ts +6 -0
  134. package/types/helpers/FormValidation/FormValidation.d.ts +1 -0
  135. package/types/helpers/index.d.ts +2 -2
  136. package/types/middleware/index.d.ts +1 -0
  137. package/types/middleware/userSessionReset.d.ts +5 -0
@@ -0,0 +1,74 @@
1
+ import { injectIntl } from 'react-intl';
2
+ import React from 'react';
3
+ import AliasesComponent from './Aliases';
4
+ import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
5
+
6
+ const IntlAliasesComponent = injectIntl(AliasesComponent);
7
+
8
+ function StoryComponent(args) {
9
+ return (
10
+ <Wrapper
11
+ customStore={{
12
+ aliases: {
13
+ add: {
14
+ loaded: false,
15
+ loading: false,
16
+ error: null,
17
+ },
18
+ remove: {
19
+ loaded: false,
20
+ loading: false,
21
+ error: null,
22
+ },
23
+ get: {
24
+ loading: false,
25
+ loaded: true,
26
+ error: null,
27
+ },
28
+ items: [
29
+ {
30
+ datetime: '2022-05-16T11:52:35+00:00',
31
+ manual: true,
32
+ path: '/eventsalias',
33
+ 'redirect-to': '/events',
34
+ },
35
+ {
36
+ datetime: '2022-05-17T09:38:19+00:00',
37
+ manual: true,
38
+ path: '/eventsgreatalias',
39
+ 'redirect-to': '/events',
40
+ },
41
+ {
42
+ datetime: '2022-05-17T09:38:35+00:00',
43
+ manual: true,
44
+ path: '/eventsincredible',
45
+ 'redirect-to': '/events',
46
+ },
47
+ ],
48
+ },
49
+ intl: {
50
+ locale: 'en',
51
+ messages: {},
52
+ },
53
+ }}
54
+ >
55
+ <div id="toolbar" style={{ display: 'none' }} />
56
+ <IntlAliasesComponent {...args} location={{ pathname: '/blog' }} />
57
+ </Wrapper>
58
+ );
59
+ }
60
+
61
+ export const Aliases = StoryComponent.bind({});
62
+
63
+ export default {
64
+ title: 'Internal Components/ControlPanels/Aliases',
65
+ component: Aliases,
66
+ decorators: [
67
+ (Story) => (
68
+ <div className="ui segment form attached" style={{ width: '900px' }}>
69
+ <Story />
70
+ </div>
71
+ ),
72
+ ],
73
+ argTypes: {},
74
+ };
@@ -8,7 +8,11 @@ import PropTypes from 'prop-types';
8
8
  import { connect } from 'react-redux';
9
9
  import { compose } from 'redux';
10
10
  import { withRouter } from 'react-router-dom';
11
- import { Helmet } from '@plone/volto/helpers';
11
+ import {
12
+ Helmet,
13
+ tryParseJSON,
14
+ extractInvariantErrors,
15
+ } from '@plone/volto/helpers';
12
16
  import { createPortal } from 'react-dom';
13
17
  import { Button, Container } from 'semantic-ui-react';
14
18
  import { defineMessages, injectIntl } from 'react-intl';
@@ -44,6 +48,10 @@ const messages = defineMessages({
44
48
  id: 'Info',
45
49
  defaultMessage: 'Info',
46
50
  },
51
+ error: {
52
+ id: 'Error',
53
+ defaultMessage: 'Error',
54
+ },
47
55
  });
48
56
 
49
57
  /**
@@ -93,7 +101,7 @@ class Controlpanel extends Component {
93
101
  super(props);
94
102
  this.onCancel = this.onCancel.bind(this);
95
103
  this.onSubmit = this.onSubmit.bind(this);
96
- this.state = { isClient: false };
104
+ this.state = { isClient: false, error: null };
97
105
  }
98
106
 
99
107
  /**
@@ -113,6 +121,36 @@ class Controlpanel extends Component {
113
121
  * @returns {undefined}
114
122
  */
115
123
  UNSAFE_componentWillReceiveProps(nextProps) {
124
+ if (this.props.updateRequest.loading && nextProps.updateRequest.error) {
125
+ const message =
126
+ nextProps.updateRequest.error?.response?.body?.error?.message ||
127
+ nextProps.updateRequest.error?.response?.body?.message ||
128
+ nextProps.updateRequest.error?.response?.text ||
129
+ '';
130
+
131
+ const error =
132
+ new DOMParser().parseFromString(message, 'text/html')?.all?.[0]
133
+ ?.textContent || message;
134
+
135
+ const errorsList = tryParseJSON(error);
136
+ let invariantErrors = [];
137
+ if (Array.isArray(errorsList)) {
138
+ invariantErrors = extractInvariantErrors(errorsList);
139
+ }
140
+
141
+ this.setState({ error: error });
142
+
143
+ if (invariantErrors.length > 0) {
144
+ toast.error(
145
+ <Toast
146
+ error
147
+ title={this.props.intl.formatMessage(messages.error)}
148
+ content={invariantErrors.join(' - ')}
149
+ />,
150
+ );
151
+ }
152
+ }
153
+
116
154
  if (this.props.updateRequest.loading && nextProps.updateRequest.loaded) {
117
155
  toast.info(
118
156
  <Toast
@@ -162,6 +200,7 @@ class Controlpanel extends Component {
162
200
  title={this.props.controlpanel.title}
163
201
  schema={filterControlPanelsSchema(this.props.controlpanel)}
164
202
  formData={this.props.controlpanel.data}
203
+ requestError={this.state.error}
165
204
  onSubmit={this.onSubmit}
166
205
  onCancel={this.onCancel}
167
206
  hideActions
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
1
+ import { render, waitFor, screen } from '@testing-library/react';
3
2
  import configureStore from 'redux-mock-store';
4
3
  import { Provider } from 'react-intl-redux';
5
4
  import { MemoryRouter, Route } from 'react-router-dom';
@@ -8,32 +7,40 @@ import Controlpanel from './Controlpanel';
8
7
 
9
8
  const mockStore = configureStore();
10
9
 
11
- jest.mock('@plone/volto/components/manage/Form');
10
+ jest.mock('../Form/Form', () =>
11
+ jest.fn(({ requestError }) => (
12
+ <div id="form">
13
+ {requestError ? `requestError : ${requestError}` : null}
14
+ </div>
15
+ )),
16
+ );
12
17
  jest.mock('../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
13
18
 
19
+ const store = mockStore({
20
+ controlpanels: {
21
+ controlpanel: {
22
+ '@id': 'http://localhost:8080/Plone/@controlpanels/date-and-time',
23
+ title: 'Date and Time',
24
+ schema: {
25
+ fieldsets: [],
26
+ properties: [],
27
+ },
28
+ data: {},
29
+ },
30
+ update: {
31
+ loading: false,
32
+ loaded: true,
33
+ error: { response: { body: { message: null } } },
34
+ },
35
+ },
36
+ intl: {
37
+ locale: 'en',
38
+ messages: {},
39
+ },
40
+ });
41
+
14
42
  describe('Controlpanel', () => {
15
43
  it('renders a controlpanel component', () => {
16
- const store = mockStore({
17
- controlpanels: {
18
- controlpanel: {
19
- '@id': 'http://localhost:8080/Plone/@controlpanels/date-and-time',
20
- title: 'Date and Time',
21
- schema: {
22
- fieldsets: [],
23
- properties: [],
24
- },
25
- data: {},
26
- },
27
- update: {
28
- loading: false,
29
- loaded: true,
30
- },
31
- },
32
- intl: {
33
- locale: 'en',
34
- messages: {},
35
- },
36
- });
37
44
  const { container } = render(
38
45
  <Provider store={store}>
39
46
  <MemoryRouter initialEntries={['/controlpanel/date-and-time']}>
@@ -45,4 +52,28 @@ describe('Controlpanel', () => {
45
52
 
46
53
  expect(container).toMatchSnapshot();
47
54
  });
55
+ it('renders a controlpanel component with error', async () => {
56
+ const { container, rerender } = render(
57
+ <Provider store={store}>
58
+ <MemoryRouter initialEntries={['/controlpanel/date-and-time']}>
59
+ <Route path={'/controlpanel/:id'} component={Controlpanel} />
60
+ <div id="toolbar"></div>
61
+ </MemoryRouter>
62
+ </Provider>,
63
+ );
64
+ store.getState().controlpanels.update.loading = true;
65
+ store.getState().controlpanels.update.error.response.body.message =
66
+ "[{'message': 'Twitter username should not include the \"@\" prefix character.', 'field': 'twitter_username', 'error': 'ValidationError'}]";
67
+
68
+ rerender(
69
+ <Provider store={store}>
70
+ <MemoryRouter initialEntries={['/controlpanel/date-and-time']}>
71
+ <Route path={'/controlpanel/:id'} component={Controlpanel} />
72
+ <div id="toolbar"></div>
73
+ </MemoryRouter>
74
+ </Provider>,
75
+ );
76
+ await waitFor(() => screen.findByText(/Twitter/i));
77
+ expect(container).toMatchSnapshot();
78
+ });
48
79
  });
@@ -1,18 +1,13 @@
1
- /**
2
- * Users controlpanel container.
3
- * @module components/manage/Controlpanels/DatabaseInformation
4
- */
5
- import React, { Component } from 'react';
6
- import PropTypes from 'prop-types';
7
- import { connect } from 'react-redux';
8
- import { compose } from 'redux';
9
- import { Link } from 'react-router-dom';
1
+ import { useEffect } from 'react';
2
+ import { useDispatch, useSelector } from 'react-redux';
3
+ import { Link, useLocation } from 'react-router-dom';
10
4
  import { createPortal } from 'react-dom';
11
5
  import { Container, Divider, Message, Segment, Table } from 'semantic-ui-react';
12
- import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
6
+ import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
13
7
 
14
8
  import { getDatabaseInformation } from '@plone/volto/actions';
15
9
  import { Helmet } from '@plone/volto/helpers';
10
+ import { useClient } from '@plone/volto/hooks';
16
11
  import { Icon, Toolbar } from '@plone/volto/components';
17
12
  import backSVG from '@plone/volto/icons/back.svg';
18
13
 
@@ -27,228 +22,166 @@ const messages = defineMessages({
27
22
  },
28
23
  });
29
24
 
30
- /**
31
- * DatabaseInformation class.
32
- * @class DatabaseInformation
33
- * @extends Component
34
- */
35
- class DatabaseInformation extends Component {
36
- /**
37
- * Property types.
38
- * @property {Object} propTypes Property types.
39
- * @static
40
- */
41
- static propTypes = {
42
- getDatabaseInformation: PropTypes.func.isRequired,
43
- };
25
+ const DatabaseInformation = () => {
26
+ const intl = useIntl();
27
+ const dispatch = useDispatch();
28
+ const { pathname } = useLocation();
29
+ const isClient = useClient();
30
+ const databaseInformation = useSelector(
31
+ (state) => state.controlpanels.databaseinformation,
32
+ );
44
33
 
45
- /**
46
- * Constructor
47
- * @method constructor
48
- * @param {Object} props Component properties
49
- * @constructs DiffComponent
50
- */
51
- constructor(props) {
52
- super(props);
53
- this.state = { isClient: false };
54
- }
34
+ useEffect(() => {
35
+ dispatch(getDatabaseInformation());
36
+ }, [dispatch]);
55
37
 
56
- /**
57
- * Component did mount
58
- * @method componentDidMount
59
- * @returns {undefined}
60
- */
61
- componentDidMount() {
62
- this.props.getDatabaseInformation();
63
- this.setState({ isClient: true });
64
- }
65
-
66
- /**
67
- * Render method.
68
- * @method render
69
- * @returns {string} Markup for the component.
70
- */
71
- render() {
72
- return this.props.databaseInformation ? (
73
- <Container id="database-page" className="controlpanel-database">
74
- <Helmet
75
- title={this.props.intl.formatMessage(messages.databaseInformation)}
76
- />
77
- <Segment.Group raised>
78
- <Segment className="primary">
79
- <FormattedMessage
80
- id="Database Information"
81
- defaultMessage="Database Information"
82
- />
83
- </Segment>
84
- <Segment>
85
- <Message>
38
+ return databaseInformation ? (
39
+ <Container id="database-page" className="controlpanel-database">
40
+ <Helmet title={intl.formatMessage(messages.databaseInformation)} />
41
+ <Segment.Group raised>
42
+ <Segment className="primary">
43
+ <FormattedMessage
44
+ id="Database Information"
45
+ defaultMessage="Database Information"
46
+ />
47
+ </Segment>
48
+ <Segment>
49
+ <Message>
50
+ <Message.Header>
86
51
  <FormattedMessage
87
- id="The Database Manager allow you to view database status information"
88
- defaultMessage="The Database Manager allow you to view database status information"
52
+ id="Database main"
53
+ defaultMessage="Database main"
89
54
  />
90
- </Message>
91
- </Segment>
92
- <Segment>
93
- <Message>
94
- <Message.Header>
95
- <FormattedMessage
96
- id="Database main"
97
- defaultMessage="Database main"
98
- />
99
- </Message.Header>
100
- </Message>
101
- <Table celled padded columns="2">
102
- <Table.Body>
103
- <Table.Row>
104
- <Table.Cell>
105
- <FormattedMessage
106
- id="Database Location"
107
- defaultMessage="Database Location"
108
- />
109
- </Table.Cell>
110
- <Table.Cell>
111
- {this.props.databaseInformation.db_name}
112
- </Table.Cell>
113
- </Table.Row>
114
- <Table.Row>
115
- <Table.Cell>
116
- <FormattedMessage
117
- id="Database Size"
118
- defaultMessage="Database Size"
119
- />
120
- </Table.Cell>
121
- <Table.Cell>
122
- {this.props.databaseInformation.database_size}
123
- </Table.Cell>
124
- </Table.Row>
125
- <Table.Row>
126
- <Table.Cell>
127
- <FormattedMessage
128
- id="Total number of objects in the database"
129
- defaultMessage="Total number of objects in the database"
130
- />
131
- </Table.Cell>
132
- <Table.Cell>
133
- {this.props.databaseInformation.db_size}
134
- </Table.Cell>
135
- </Table.Row>
136
- <Table.Row>
137
- <Table.Cell>
138
- <FormattedMessage
139
- id="Total number of objects in memory from all caches"
140
- defaultMessage="Total number of objects in memory from all caches"
141
- />
142
- </Table.Cell>
143
- <Table.Cell>
144
- {this.props.databaseInformation.cache_size}
145
- </Table.Cell>
146
- </Table.Row>
147
- <Table.Row>
148
- <Table.Cell>
149
- <FormattedMessage
150
- id="Target number of objects in memory per cache"
151
- defaultMessage="Target number of objects in memory per cache"
152
- />
153
- </Table.Cell>
154
- <Table.Cell>
155
- {this.props.databaseInformation.cache_length}
156
- </Table.Cell>
157
- </Table.Row>
158
- <Table.Row>
159
- <Table.Cell>
160
- <FormattedMessage
161
- id="Target memory size per cache in bytes"
162
- defaultMessage="Target memory size per cache in bytes"
163
- />
164
- </Table.Cell>
165
- <Table.Cell>
166
- {this.props.databaseInformation.cache_length_bytes}
167
- </Table.Cell>
168
- </Table.Row>
169
- </Table.Body>
170
- </Table>
171
- </Segment>
172
- <Segment>
173
- <Divider />
174
-
175
- <Message>
176
- <Message.Header>
177
- <FormattedMessage
178
- id="Total number of objects in each cache"
179
- defaultMessage="Total number of objects in each cache"
180
- />
181
- </Message.Header>
182
- </Message>
183
- <Table celled padded>
184
- <Table.Header>
185
- <Table.Row>
186
- <Table.HeaderCell>
187
- <FormattedMessage
188
- id="Cache Name"
189
- defaultMessage="Cache Name"
190
- />
191
- </Table.HeaderCell>
192
- <Table.HeaderCell>
193
- <FormattedMessage
194
- id="Number of active objects"
195
- defaultMessage="Number of active objects"
196
- />
197
- </Table.HeaderCell>
198
- <Table.HeaderCell>
199
- <FormattedMessage
200
- id="Total active and non-active objects"
201
- defaultMessage="Total active and non-active objects"
202
- />
203
- </Table.HeaderCell>
204
- </Table.Row>
205
- </Table.Header>
206
- {this.props.databaseInformation.cache_detail_length.map(
207
- (item) => (
208
- <Table.Row>
209
- <Table.Cell>{item.connection}</Table.Cell>
210
- <Table.Cell>{item.ngsize}</Table.Cell>
211
- <Table.Cell>{item.size}</Table.Cell>
212
- </Table.Row>
213
- ),
214
- )}
215
- </Table>
216
- </Segment>
217
- </Segment.Group>
55
+ </Message.Header>
56
+ </Message>
57
+ <Table celled padded columns="2">
58
+ <Table.Body>
59
+ <Table.Row>
60
+ <Table.Cell>
61
+ <FormattedMessage
62
+ id="Database Location"
63
+ defaultMessage="Database Location"
64
+ />
65
+ </Table.Cell>
66
+ <Table.Cell>{databaseInformation.db_name}</Table.Cell>
67
+ </Table.Row>
68
+ <Table.Row>
69
+ <Table.Cell>
70
+ <FormattedMessage
71
+ id="Database Size"
72
+ defaultMessage="Database Size"
73
+ />
74
+ </Table.Cell>
75
+ <Table.Cell>{databaseInformation.database_size}</Table.Cell>
76
+ </Table.Row>
77
+ <Table.Row>
78
+ <Table.Cell>
79
+ <FormattedMessage
80
+ id="Total number of objects in the database"
81
+ defaultMessage="Total number of objects in the database"
82
+ />
83
+ </Table.Cell>
84
+ <Table.Cell>{databaseInformation.db_size}</Table.Cell>
85
+ </Table.Row>
86
+ <Table.Row>
87
+ <Table.Cell>
88
+ <FormattedMessage
89
+ id="Total number of objects in memory from all caches"
90
+ defaultMessage="Total number of objects in memory from all caches"
91
+ />
92
+ </Table.Cell>
93
+ <Table.Cell>{databaseInformation.cache_size}</Table.Cell>
94
+ </Table.Row>
95
+ <Table.Row>
96
+ <Table.Cell>
97
+ <FormattedMessage
98
+ id="Target number of objects in memory per cache"
99
+ defaultMessage="Target number of objects in memory per cache"
100
+ />
101
+ </Table.Cell>
102
+ <Table.Cell>{databaseInformation.cache_length}</Table.Cell>
103
+ </Table.Row>
104
+ <Table.Row>
105
+ <Table.Cell>
106
+ <FormattedMessage
107
+ id="Target memory size per cache in bytes"
108
+ defaultMessage="Target memory size per cache in bytes"
109
+ />
110
+ </Table.Cell>
111
+ <Table.Cell>
112
+ {databaseInformation.cache_length_bytes}
113
+ </Table.Cell>
114
+ </Table.Row>
115
+ </Table.Body>
116
+ </Table>
117
+ </Segment>
118
+ <Segment>
119
+ <Divider />
218
120
 
219
- {this.state.isClient &&
220
- createPortal(
221
- <Toolbar
222
- pathname={this.props.pathname}
223
- hideDefaultViewButtons
224
- inner={
225
- <>
226
- <Link to="/controlpanel" className="item">
227
- <Icon
228
- name={backSVG}
229
- aria-label={this.props.intl.formatMessage(messages.back)}
230
- className="contents circled"
231
- size="30px"
232
- title={this.props.intl.formatMessage(messages.back)}
233
- />
234
- </Link>
235
- </>
236
- }
237
- />,
238
- document.getElementById('toolbar'),
239
- )}
240
- </Container>
241
- ) : null;
242
- }
243
- }
121
+ <Message>
122
+ <Message.Header>
123
+ <FormattedMessage
124
+ id="Total number of objects in each cache"
125
+ defaultMessage="Total number of objects in each cache"
126
+ />
127
+ </Message.Header>
128
+ </Message>
129
+ <Table celled padded>
130
+ <Table.Header>
131
+ <Table.Row>
132
+ <Table.HeaderCell>
133
+ <FormattedMessage
134
+ id="Cache Name"
135
+ defaultMessage="Cache Name"
136
+ />
137
+ </Table.HeaderCell>
138
+ <Table.HeaderCell>
139
+ <FormattedMessage
140
+ id="Number of active objects"
141
+ defaultMessage="Number of active objects"
142
+ />
143
+ </Table.HeaderCell>
144
+ <Table.HeaderCell>
145
+ <FormattedMessage
146
+ id="Total active and non-active objects"
147
+ defaultMessage="Total active and non-active objects"
148
+ />
149
+ </Table.HeaderCell>
150
+ </Table.Row>
151
+ </Table.Header>
152
+ {databaseInformation.cache_detail_length.map((item) => (
153
+ <Table.Row>
154
+ <Table.Cell>{item.connection}</Table.Cell>
155
+ <Table.Cell>{item.ngsize}</Table.Cell>
156
+ <Table.Cell>{item.size}</Table.Cell>
157
+ </Table.Row>
158
+ ))}
159
+ </Table>
160
+ </Segment>
161
+ </Segment.Group>
162
+ {isClient &&
163
+ createPortal(
164
+ <Toolbar
165
+ pathname={pathname}
166
+ hideDefaultViewButtons
167
+ inner={
168
+ <>
169
+ <Link to="/controlpanel" className="item">
170
+ <Icon
171
+ name={backSVG}
172
+ aria-label={intl.formatMessage(messages.back)}
173
+ className="contents circled"
174
+ size="30px"
175
+ title={intl.formatMessage(messages.back)}
176
+ />
177
+ </Link>
178
+ </>
179
+ }
180
+ />,
181
+ document.getElementById('toolbar'),
182
+ )}
183
+ </Container>
184
+ ) : null;
185
+ };
244
186
 
245
- export default compose(
246
- injectIntl,
247
- connect(
248
- (state, props) => ({
249
- databaseInformation: state.controlpanels.databaseinformation,
250
- pathname: props.location.pathname,
251
- }),
252
- { getDatabaseInformation },
253
- ),
254
- )(DatabaseInformation);
187
+ export default DatabaseInformation;