@blaze-cms/plugin-data-ui 0.139.0-alpha.1 → 0.139.0-project-admin-customisations.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.
- package/CHANGELOG.md +35 -4
- package/README.md +42 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +3 -24
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +39 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +12 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
- package/lib/components/EntityManager/Entity/Entity.js +16 -3
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +44 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +32 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +45 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +12 -2
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +38 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib/components/InfoBoxes/InfoBoxes.js +36 -0
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -0
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +44 -0
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
- package/lib/components/InfoBoxes/hooks/useData.js +42 -0
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +26 -0
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
- package/lib/components/InfoBoxes/index.js +12 -0
- package/lib/components/InfoBoxes/index.js.map +1 -0
- package/lib/components/InfoBoxes/presentational/InfoBox.js +46 -0
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib/components/ListingTable/ListingTable.js +125 -80
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +8 -20
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +92 -26
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +73 -11
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/constants.js +11 -1
- package/lib/constants.js.map +1 -1
- package/lib/icons/ContentIcon.js +90 -0
- package/lib/icons/ContentIcon.js.map +1 -0
- package/lib/icons/SettingsIcon.js +66 -0
- package/lib/icons/SettingsIcon.js.map +1 -0
- package/lib/icons/TaxonomyIcon.js +90 -0
- package/lib/icons/TaxonomyIcon.js.map +1 -0
- package/lib/icons/UsersIcon.js +64 -0
- package/lib/icons/UsersIcon.js.map +1 -0
- package/lib/icons/index.js +36 -0
- package/lib/icons/index.js.map +1 -0
- package/lib/index.js +38 -11
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +61 -13
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-listing-query.js +11 -2
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/get-default-query-params.js +3 -4
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib-es/components/EntityDataListing/EntityDataListing.js +3 -14
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +30 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/Entity.js +16 -3
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +30 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +26 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +39 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +12 -2
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +24 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.js +28 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.js.map +1 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +30 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js +37 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +19 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
- package/lib-es/components/InfoBoxes/index.js +3 -0
- package/lib-es/components/InfoBoxes/index.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +31 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTable.js +56 -50
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +11 -19
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js +76 -24
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js +65 -7
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/constants.js +9 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/icons/ContentIcon.js +80 -0
- package/lib-es/icons/ContentIcon.js.map +1 -0
- package/lib-es/icons/SettingsIcon.js +56 -0
- package/lib-es/icons/SettingsIcon.js.map +1 -0
- package/lib-es/icons/TaxonomyIcon.js +80 -0
- package/lib-es/icons/TaxonomyIcon.js.map +1 -0
- package/lib-es/icons/UsersIcon.js +54 -0
- package/lib-es/icons/UsersIcon.js.map +1 -0
- package/lib-es/icons/index.js +6 -0
- package/lib-es/icons/index.js.map +1 -0
- package/lib-es/index.js +37 -9
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js +46 -5
- package/lib-es/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/utils/build-listing-query.js +10 -1
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/get-default-query-params.js +1 -3
- package/lib-es/utils/get-default-query-params.js.map +1 -1
- package/package.json +10 -9
- package/src/components/EntityDataListing/EntityDataListing.js +3 -12
- package/src/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +26 -0
- package/src/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
- package/src/components/EntityManager/Entity/Entity.js +10 -1
- package/src/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +22 -0
- package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +33 -0
- package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +28 -0
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +34 -16
- package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +33 -0
- package/src/components/InfoBoxes/InfoBoxes.js +24 -0
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +22 -0
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
- package/src/components/InfoBoxes/hooks/useData.js +20 -0
- package/src/components/InfoBoxes/hooks/useInfoBox.js +13 -0
- package/src/components/InfoBoxes/index.js +3 -0
- package/src/components/InfoBoxes/presentational/InfoBox.js +34 -0
- package/src/components/ListingTable/ListingTable.js +73 -39
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +8 -22
- package/src/components/ListingTable/mappers/populate-rows.js +83 -18
- package/src/components/ListingTable/service/index.js +42 -5
- package/src/constants.js +13 -1
- package/src/icons/ContentIcon.js +72 -0
- package/src/icons/SettingsIcon.js +53 -0
- package/src/icons/TaxonomyIcon.js +74 -0
- package/src/icons/UsersIcon.js +50 -0
- package/src/icons/index.js +6 -0
- package/src/index.js +36 -8
- package/src/utils/add-content-menu-items.js +42 -3
- package/src/utils/build-listing-query.js +11 -1
- package/src/utils/get-default-query-params.js +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ICON_SIZE } from '../constants';
|
|
3
|
+
|
|
4
|
+
function TaxonomyIcon({ width = ICON_SIZE.WIDTH, height = ICON_SIZE.HEIGHT }) {
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
width={width}
|
|
8
|
+
height={height}
|
|
9
|
+
viewBox="0 0 21 21"
|
|
10
|
+
version="1.1"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
xmlnsXlink="http://www.w3.org/1999/xlink">
|
|
13
|
+
<title>icons/taxonomy</title>
|
|
14
|
+
<g id="Symbols" stroke="none" strokeWidth={1} fill="none" fillRule="evenodd">
|
|
15
|
+
<g id="main-menu/collapsed" transform="translate(-15, -412)">
|
|
16
|
+
<g id="Group-4" transform="translate(9, 19)">
|
|
17
|
+
<g id="scheme" transform="translate(0, 386)">
|
|
18
|
+
<g id="icons/taxonomy" transform="translate(7, 8)">
|
|
19
|
+
<g
|
|
20
|
+
id="Group"
|
|
21
|
+
stroke="#63779C"
|
|
22
|
+
strokeLinecap="round"
|
|
23
|
+
strokeLinejoin="round"
|
|
24
|
+
strokeWidth="1.5">
|
|
25
|
+
<rect
|
|
26
|
+
id="Rectangle"
|
|
27
|
+
x={0}
|
|
28
|
+
y="12.6666667"
|
|
29
|
+
width="6.33333333"
|
|
30
|
+
height="6.33333333"
|
|
31
|
+
rx={2}
|
|
32
|
+
/>
|
|
33
|
+
<rect
|
|
34
|
+
id="Rectangle"
|
|
35
|
+
x="12.6666667"
|
|
36
|
+
y="12.6666667"
|
|
37
|
+
width="6.33333333"
|
|
38
|
+
height="6.33333333"
|
|
39
|
+
rx={2}
|
|
40
|
+
/>
|
|
41
|
+
<rect
|
|
42
|
+
id="Rectangle"
|
|
43
|
+
x="6.33333333"
|
|
44
|
+
y={0}
|
|
45
|
+
width="6.33333333"
|
|
46
|
+
height="6.33333333"
|
|
47
|
+
rx={2}
|
|
48
|
+
/>
|
|
49
|
+
<path
|
|
50
|
+
d="M3.16666667,12.6666667 L3.16666667,11.6111111 C3.16666667,10.4451766 4.11184331,9.5 5.27777778,9.5 L13.7222222,9.5 C14.8881567,9.5 15.8333333,10.4451766 15.8333333,11.6111111 L15.8333333,12.6666667"
|
|
51
|
+
id="Path"
|
|
52
|
+
/>
|
|
53
|
+
<line x1="9.5" y1="6.33333333" x2="9.5" y2="9.5" id="Path" />
|
|
54
|
+
</g>
|
|
55
|
+
<rect
|
|
56
|
+
id="Rectangle"
|
|
57
|
+
fillOpacity={0}
|
|
58
|
+
fill="#000000"
|
|
59
|
+
fillRule="nonzero"
|
|
60
|
+
x={0}
|
|
61
|
+
y={0}
|
|
62
|
+
width={19}
|
|
63
|
+
height={19}
|
|
64
|
+
/>
|
|
65
|
+
</g>
|
|
66
|
+
</g>
|
|
67
|
+
</g>
|
|
68
|
+
</g>
|
|
69
|
+
</g>
|
|
70
|
+
</svg>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default TaxonomyIcon;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ICON_SIZE } from '../constants';
|
|
3
|
+
|
|
4
|
+
function UserIcon({ width = ICON_SIZE.WIDTH, height = ICON_SIZE.HEIGHT }) {
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
width={width}
|
|
8
|
+
height={height}
|
|
9
|
+
viewBox="0 0 21 20"
|
|
10
|
+
version="1.1"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
xmlnsXlink="http://www.w3.org/1999/xlink">
|
|
13
|
+
<title>icons/user</title>
|
|
14
|
+
<g id="Symbols" stroke="none" strokeWidth={1} fill="none" fillRule="evenodd">
|
|
15
|
+
<g id="main-menu/collapsed" transform="translate(-14, -453)">
|
|
16
|
+
<g id="Group-4" transform="translate(9, 19)">
|
|
17
|
+
<g id="Group-15" transform="translate(0, 428)">
|
|
18
|
+
<g id="icons/user" transform="translate(6, 6)">
|
|
19
|
+
<g
|
|
20
|
+
id="Group"
|
|
21
|
+
transform="translate(0, 0.76)"
|
|
22
|
+
stroke="#63779C"
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
strokeLinejoin="round"
|
|
25
|
+
strokeWidth="1.5">
|
|
26
|
+
<path
|
|
27
|
+
d="M2.23883333,15.0013865 C4.45382875,13.7994901 6.95566666,13.1696336 9.5,13.1733169 C12.1388889,13.1733169 14.6162778,13.8370665 16.7611667,15.0013865 M12.6666667,7.09333314 C12.6666667,8.77227878 11.2489017,10.1333331 9.5,10.1333331 C7.75109829,10.1333331 6.33333333,8.77227878 6.33333333,7.09333314 C6.33333333,5.4143875 7.75109829,4.05333314 9.5,4.05333314 C11.2489017,4.05333314 12.6666667,5.4143875 12.6666667,7.09333314 L12.6666667,7.09333314 Z M19,9.11999981 C19,12.378262 17.1893103,15.3890205 14.25,17.0181516 C11.3106898,18.6472827 7.68931021,18.6472827 4.74999996,17.0181516 C1.81068971,15.3890205 4.68760833e-16,12.378262 4.68760833e-16,9.11999981 C4.68760833e-16,4.08316296 4.25329495,0 9.5,0 C14.746705,0 19,4.08316296 19,9.11999981 L19,9.11999981 Z"
|
|
28
|
+
id="Shape"
|
|
29
|
+
/>
|
|
30
|
+
</g>
|
|
31
|
+
<rect
|
|
32
|
+
id="Rectangle"
|
|
33
|
+
fillOpacity={0}
|
|
34
|
+
fill="#000000"
|
|
35
|
+
fillRule="nonzero"
|
|
36
|
+
x={0}
|
|
37
|
+
y={0}
|
|
38
|
+
width={19}
|
|
39
|
+
height="18.24"
|
|
40
|
+
/>
|
|
41
|
+
</g>
|
|
42
|
+
</g>
|
|
43
|
+
</g>
|
|
44
|
+
</g>
|
|
45
|
+
</g>
|
|
46
|
+
</svg>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default UserIcon;
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import pkg from '../package.json';
|
|
4
4
|
import { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';
|
|
5
5
|
import getAddContentMenuItems from './utils/add-content-menu-items';
|
|
6
|
+
import { UserIcon, TaxonomyIcon, ContentIcon, SettingsIcon } from './icons';
|
|
6
7
|
|
|
7
8
|
const EntityDataListing = React.lazy(() =>
|
|
8
9
|
import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')
|
|
@@ -12,14 +13,7 @@ const EntityManager = React.lazy(() =>
|
|
|
12
13
|
);
|
|
13
14
|
|
|
14
15
|
export default async function load(app) {
|
|
15
|
-
|
|
16
|
-
const sectionKey = 'content';
|
|
17
|
-
|
|
18
|
-
app.events.once('load:menu-section', addSection => {
|
|
19
|
-
addSection(sectionKey, { header: 'content', order: 100 });
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
app.events.once('load:menu-items', getAddContentMenuItems(app, sectionKey));
|
|
16
|
+
app.events.once('admin:menu:config:load', getAddContentMenuItems(app));
|
|
23
17
|
|
|
24
18
|
app.events.once('load:custom:field:type', addFieldType => {
|
|
25
19
|
Object.keys(formFieldTypes).forEach(type => {
|
|
@@ -31,6 +25,40 @@ export default async function load(app) {
|
|
|
31
25
|
await app.events.emitAsync('load:custom:field:type', getFormBuilderLookup.addFieldType);
|
|
32
26
|
});
|
|
33
27
|
|
|
28
|
+
app.events.once('admin:menu:config:load', ({ addConfig }) => {
|
|
29
|
+
addConfig({
|
|
30
|
+
main: {
|
|
31
|
+
items: {
|
|
32
|
+
content: {
|
|
33
|
+
label: 'content',
|
|
34
|
+
loadOpen: true,
|
|
35
|
+
items: {},
|
|
36
|
+
icon: ContentIcon,
|
|
37
|
+
order: 10
|
|
38
|
+
},
|
|
39
|
+
taxonomy: {
|
|
40
|
+
label: 'Taxonomy',
|
|
41
|
+
items: {},
|
|
42
|
+
icon: TaxonomyIcon,
|
|
43
|
+
order: 40
|
|
44
|
+
},
|
|
45
|
+
user: {
|
|
46
|
+
label: 'User',
|
|
47
|
+
items: {},
|
|
48
|
+
icon: UserIcon,
|
|
49
|
+
order: 90
|
|
50
|
+
},
|
|
51
|
+
settings: {
|
|
52
|
+
label: 'Settings',
|
|
53
|
+
items: {},
|
|
54
|
+
icon: SettingsIcon,
|
|
55
|
+
order: 100
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
34
62
|
const entityDataListingRoute = {
|
|
35
63
|
path: `${DATA_LISTING_PREFIX}/:entityIdentifier`,
|
|
36
64
|
key: 'entityDataListing',
|
|
@@ -2,8 +2,8 @@ import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
|
2
2
|
|
|
3
3
|
const { MENU_PERMISSIONS } = require('../constants');
|
|
4
4
|
|
|
5
|
-
function getAddContentMenuItems(app
|
|
6
|
-
return async
|
|
5
|
+
function getAddContentMenuItems(app) {
|
|
6
|
+
return async ({ addConfig }) => {
|
|
7
7
|
const client = app.getClient();
|
|
8
8
|
const {
|
|
9
9
|
data: { getEntitySchemas }
|
|
@@ -14,9 +14,48 @@ function getAddContentMenuItems(app, sectionKey) {
|
|
|
14
14
|
canDoActions: MENU_PERMISSIONS
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
+
|
|
18
|
+
if (!getEntitySchemas || !getEntitySchemas.length) return; // no items so don't add section
|
|
19
|
+
|
|
20
|
+
const menuItems = {};
|
|
21
|
+
const sectionMenuItems = { settings: {} };
|
|
22
|
+
|
|
23
|
+
getEntitySchemas.forEach(({ id, displayName, displayProperties }) => {
|
|
24
|
+
if (!displayProperties) return null;
|
|
25
|
+
|
|
26
|
+
const { adminMenu: { sectionKey = 'settings' } = {} } = displayProperties;
|
|
27
|
+
const sectionItems = sectionMenuItems[sectionKey] || {};
|
|
28
|
+
sectionItems[id] = {
|
|
29
|
+
label: displayName,
|
|
30
|
+
uri: `/data-listing/${id}`
|
|
31
|
+
};
|
|
32
|
+
sectionMenuItems[sectionKey] = sectionItems;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const menuConfig = {
|
|
36
|
+
main: {
|
|
37
|
+
items: {
|
|
38
|
+
settings: {
|
|
39
|
+
items: menuItems
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
Object.entries(sectionMenuItems).forEach(([sectionKey, sectionItems]) => {
|
|
46
|
+
const sectionConfig = menuConfig.main.items[sectionKey] || {};
|
|
47
|
+
sectionConfig.items = sectionItems;
|
|
48
|
+
menuConfig.main.items[sectionKey] = sectionConfig;
|
|
49
|
+
});
|
|
50
|
+
|
|
17
51
|
getEntitySchemas.forEach(({ id, displayName }) => {
|
|
18
|
-
|
|
52
|
+
menuItems[id] = {
|
|
53
|
+
label: displayName,
|
|
54
|
+
uri: `/data-listing/${id}`
|
|
55
|
+
};
|
|
19
56
|
});
|
|
57
|
+
|
|
58
|
+
addConfig(menuConfig);
|
|
20
59
|
};
|
|
21
60
|
}
|
|
22
61
|
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { BlazeError } from '@blaze-cms/core-errors';
|
|
3
|
+
import { getDynamicQuery } from '@blaze-cms/admin-ui-utils';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
const buildAdminSearchQuery = entitySchema => {
|
|
6
|
+
const { listingProperties = [] } = entitySchema || {};
|
|
7
|
+
const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;
|
|
8
|
+
|
|
9
|
+
return getDynamicQuery('ADMIN_SEARCH')([entitySchema], parsedProperties, true);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function buildListingQuery(entitySchema, isSearchQuery) {
|
|
5
13
|
if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {
|
|
6
14
|
throw new BlazeError(
|
|
7
15
|
'Listing query requires getAll action and listingProperties from entity schema'
|
|
8
16
|
);
|
|
9
17
|
}
|
|
10
18
|
|
|
19
|
+
if (isSearchQuery) return buildAdminSearchQuery(entitySchema);
|
|
20
|
+
|
|
11
21
|
const sortType =
|
|
12
22
|
entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
|
|
13
23
|
|