@blaze-cms/plugin-data-ui 0.139.0-alpha.3 → 0.139.0-alpha.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.
- package/CHANGELOG.md +56 -0
- package/README.md +42 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +4 -26
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +1 -2
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +38 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +11 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
- package/lib/components/EntityManager/Entity/Entity.js +19 -7
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +1 -2
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +1 -2
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +1 -2
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +1 -2
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +43 -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 +44 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +15 -6
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +37 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +1 -2
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +3 -4
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +1 -2
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js +4 -8
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +1 -2
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +1 -2
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +1 -2
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxes.js +35 -0
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -0
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +43 -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 +41 -0
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +25 -0
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
- package/lib/components/InfoBoxes/index.js +11 -0
- package/lib/components/InfoBoxes/index.js.map +1 -0
- package/lib/components/InfoBoxes/presentational/InfoBox.js +45 -0
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib/components/ListingTable/ListingTable.js +127 -84
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +9 -22
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +1 -2
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js +1 -2
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +1 -2
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +1 -2
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +92 -29
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +74 -13
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +3 -4
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/constants.js +33 -49
- 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 +46 -0
- package/lib/icons/SettingsIcon.js.map +1 -0
- package/lib/icons/TaxonomyIcon.js +70 -0
- package/lib/icons/TaxonomyIcon.js.map +1 -0
- package/lib/icons/UsersIcon.js +43 -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 +40 -13
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +62 -15
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +1 -2
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +1 -2
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +12 -4
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +1 -2
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +1 -2
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +3 -5
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +1 -2
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +1 -2
- package/lib/utils/hooks/useToggle.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 -51
- 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 +36 -0
- package/lib-es/icons/SettingsIcon.js.map +1 -0
- package/lib-es/icons/TaxonomyIcon.js +60 -0
- package/lib-es/icons/TaxonomyIcon.js.map +1 -0
- package/lib-es/icons/UsersIcon.js +33 -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 +6 -5
- 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 +83 -0
- package/src/icons/SettingsIcon.js +41 -0
- package/src/icons/TaxonomyIcon.js +62 -0
- package/src/icons/UsersIcon.js +37 -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
|
@@ -1,12 +1,49 @@
|
|
|
1
1
|
import buildListingQuery from '../../../utils/build-listing-query';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
function buildVariables({ entitySchema, isSearchQuery, listFilters = [], queryParams = {} }) {
|
|
4
|
+
const { identifier } = entitySchema;
|
|
5
|
+
const { sort, offset, limit, where } = queryParams;
|
|
6
|
+
const [{ property, direction }] = sort;
|
|
7
|
+
const parsedOffset = `${property}:${direction}`;
|
|
8
|
+
|
|
9
|
+
if (!isSearchQuery)
|
|
10
|
+
return {
|
|
11
|
+
...queryParams,
|
|
12
|
+
where: !Array.isArray(listFilters) ? listFilters : where
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const rawQuery = {
|
|
16
|
+
bool: {
|
|
17
|
+
must: listFilters || [],
|
|
18
|
+
filter: [
|
|
19
|
+
{
|
|
20
|
+
term: {
|
|
21
|
+
entityIdentifier: identifier
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
limit,
|
|
30
|
+
offset,
|
|
31
|
+
sort: parsedOffset,
|
|
32
|
+
where: JSON.stringify(rawQuery)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const fetchData = async ({ client, querySettings: { entitySchema, queryParams }, listFilters }) => {
|
|
5
37
|
const {
|
|
6
|
-
|
|
7
|
-
} =
|
|
38
|
+
displayProperties: { adminListings: { dataSource: { source } = {} } = {} } = {}
|
|
39
|
+
} = entitySchema;
|
|
40
|
+
|
|
41
|
+
const isSearchQuery = source === 'search';
|
|
42
|
+
const query = buildListingQuery(entitySchema, isSearchQuery);
|
|
43
|
+
const variables = buildVariables({ entitySchema, listFilters, queryParams, isSearchQuery });
|
|
44
|
+
const { data = {} } = await client.query({ query, variables, fetchPolicy: 'network-only' });
|
|
8
45
|
|
|
9
|
-
return listingData;
|
|
46
|
+
return data.searchResults ? data.searchResults.results : data.listingData;
|
|
10
47
|
};
|
|
11
48
|
|
|
12
49
|
export { fetchData };
|
package/src/constants.js
CHANGED
|
@@ -25,6 +25,16 @@ const PAGE_BUILDER_TAB_INDEX = 1;
|
|
|
25
25
|
const EDITOR_VIEW_TAB = 'Editor view';
|
|
26
26
|
const EDITOR_VIEW_TAB_INDEX = 0;
|
|
27
27
|
|
|
28
|
+
const ICON_SIZE = {
|
|
29
|
+
WIDTH: '25px',
|
|
30
|
+
HEIGHT: '25px'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const ICON_COLOR = {
|
|
34
|
+
STROKE: '#63779C',
|
|
35
|
+
FILL: '#63779C'
|
|
36
|
+
};
|
|
37
|
+
|
|
28
38
|
export {
|
|
29
39
|
DATA_LISTING_PREFIX,
|
|
30
40
|
ENTITY_PUBLISHED,
|
|
@@ -49,5 +59,7 @@ export {
|
|
|
49
59
|
EDITOR_VIEW_TAB,
|
|
50
60
|
PAGE_BUILDER_TAB,
|
|
51
61
|
UNPUBLISHED_WARNING,
|
|
52
|
-
SAVE_BEFORE_PUBLISH_MESSAGE
|
|
62
|
+
SAVE_BEFORE_PUBLISH_MESSAGE,
|
|
63
|
+
ICON_SIZE,
|
|
64
|
+
ICON_COLOR
|
|
53
65
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ICON_COLOR } from '../constants';
|
|
3
|
+
|
|
4
|
+
function ContentIcon({ fill = ICON_COLOR.FILL, stroke = ICON_COLOR.STROKE }) {
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
width="19px"
|
|
8
|
+
height="19px"
|
|
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>content</title>
|
|
14
|
+
<g id="Page-1" stroke="none" strokeWidth={1} fill="none" fillRule="evenodd">
|
|
15
|
+
<g id="content" transform="translate(1, 1)">
|
|
16
|
+
<g id="Group">
|
|
17
|
+
<path
|
|
18
|
+
d="M0,8.70833334 L5.445875,3.26245834 C6.37331215,2.33530123 7.87668785,2.33530123 8.804125,3.26245834 L14.25,8.70833334"
|
|
19
|
+
id="Shape-path"
|
|
20
|
+
stroke={stroke}
|
|
21
|
+
strokeLinecap="round"
|
|
22
|
+
strokeLinejoin="round"
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
d="M11.875,6.33333334 L13.758375,4.44995834 C14.6858122,3.52280123 16.1891878,3.52280123 17.116625,4.44995834 L19,6.33333334"
|
|
26
|
+
id="Shape-path"
|
|
27
|
+
stroke={stroke}
|
|
28
|
+
strokeLinecap="round"
|
|
29
|
+
strokeLinejoin="round"
|
|
30
|
+
/>
|
|
31
|
+
<path
|
|
32
|
+
d="M2.375,19 L16.625,19 C17.9366763,19 19,17.9366763 19,16.625 L19,2.375 C19,1.06332371 17.9366763,0 16.625,0 L2.375,0 C1.06332371,0 0,1.06332371 0,2.375 L0,16.625 C0,17.9366763 1.06332371,19 2.375,19 Z"
|
|
33
|
+
id="Shape-path"
|
|
34
|
+
stroke={stroke}
|
|
35
|
+
strokeLinecap="round"
|
|
36
|
+
strokeLinejoin="round"
|
|
37
|
+
/>
|
|
38
|
+
<circle
|
|
39
|
+
id="Oval"
|
|
40
|
+
fill={fill}
|
|
41
|
+
fillRule="nonzero"
|
|
42
|
+
cx="11.4791666"
|
|
43
|
+
cy="2.77083334"
|
|
44
|
+
r="1.1875"
|
|
45
|
+
/>
|
|
46
|
+
</g>
|
|
47
|
+
<line
|
|
48
|
+
x1={0}
|
|
49
|
+
y1="9.23611111"
|
|
50
|
+
x2={19}
|
|
51
|
+
y2="9.23611111"
|
|
52
|
+
id="Path"
|
|
53
|
+
stroke={stroke}
|
|
54
|
+
strokeLinecap="round"
|
|
55
|
+
strokeLinejoin="round"
|
|
56
|
+
/>
|
|
57
|
+
<line
|
|
58
|
+
x1="3.95833334"
|
|
59
|
+
y1="12.4027778"
|
|
60
|
+
x2="15.3055553"
|
|
61
|
+
y2="12.4027778"
|
|
62
|
+
id="Path"
|
|
63
|
+
stroke={stroke}
|
|
64
|
+
strokeLinecap="round"
|
|
65
|
+
strokeLinejoin="round"
|
|
66
|
+
/>
|
|
67
|
+
<line
|
|
68
|
+
x1="3.95833334"
|
|
69
|
+
y1="15.5694445"
|
|
70
|
+
x2="12.1388885"
|
|
71
|
+
y2="15.5694445"
|
|
72
|
+
id="Path"
|
|
73
|
+
stroke={stroke}
|
|
74
|
+
strokeLinecap="round"
|
|
75
|
+
strokeLinejoin="round"
|
|
76
|
+
/>
|
|
77
|
+
</g>
|
|
78
|
+
</g>
|
|
79
|
+
</svg>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default ContentIcon;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ICON_SIZE, ICON_COLOR } from '../constants';
|
|
3
|
+
|
|
4
|
+
function SettingsIcon({
|
|
5
|
+
width = ICON_SIZE.WIDTH,
|
|
6
|
+
height = ICON_SIZE.HEIGHT,
|
|
7
|
+
stroke = ICON_COLOR.STROKE
|
|
8
|
+
}) {
|
|
9
|
+
return (
|
|
10
|
+
<svg
|
|
11
|
+
width={width}
|
|
12
|
+
height={height}
|
|
13
|
+
viewBox="0 0 22 22"
|
|
14
|
+
version="1.1"
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
xmlnsXlink="http://www.w3.org/1999/xlink">
|
|
17
|
+
<title>setting</title>
|
|
18
|
+
<g
|
|
19
|
+
id="Page-1"
|
|
20
|
+
stroke="none"
|
|
21
|
+
strokeWidth={1}
|
|
22
|
+
fill="none"
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
strokeLinecap="round"
|
|
25
|
+
strokeLinejoin="round">
|
|
26
|
+
<g id="Group" transform="translate(1, 1)" stroke={stroke}>
|
|
27
|
+
<path
|
|
28
|
+
d="M8.13888889,1.46333333 C8.61222222,-0.487777777 11.3877778,-0.487777777 11.8611111,1.46333333 C12.0051589,2.05784356 12.4244819,2.54780471 12.9896128,2.78193979 C13.5547438,3.01607487 14.1977123,2.96622362 14.72,2.64777778 C16.4344444,1.60333333 18.3977778,3.56555556 17.3533333,5.28111111 C17.0353472,5.803171 16.9856162,6.44564563 17.2194755,7.0104213 C17.4533348,7.57519696 17.9426987,7.99444609 18.5366667,8.13888889 C20.4877778,8.61222222 20.4877778,11.3877778 18.5366667,11.8611111 C17.9421564,12.0051589 17.4521953,12.4244819 17.2180602,12.9896128 C16.9839251,13.5547438 17.0337764,14.1977123 17.3522222,14.72 C18.3966667,16.4344444 16.4344444,18.3977778 14.7188889,17.3533333 C14.196829,17.0353472 13.5543544,16.9856162 12.9895787,17.2194755 C12.424803,17.4533348 12.0055539,17.9426987 11.8611111,18.5366667 C11.3877778,20.4877778 8.61222222,20.4877778 8.13888889,18.5366667 C7.99484107,17.9421564 7.57551807,17.4521953 7.01038716,17.2180602 C6.44525624,16.9839251 5.80228769,17.0337764 5.28,17.3522222 C3.56555556,18.3966667 1.60222222,16.4344444 2.64666667,14.7188889 C2.96465281,14.196829 3.01438377,13.5543544 2.78052448,12.9895787 C2.5466652,12.424803 2.05730134,12.0055539 1.46333333,11.8611111 C-0.487777777,11.3877778 -0.487777777,8.61222222 1.46333333,8.13888889 C2.05784356,7.99484107 2.54780471,7.57551807 2.78193979,7.01038716 C3.01607487,6.44525624 2.96622362,5.80228769 2.64777778,5.28 C1.60333333,3.56555556 3.56555556,1.60222222 5.28111111,2.64666667 C6.38777778,3.32222222 7.83222222,2.72444444 8.13888889,1.46333333 Z"
|
|
29
|
+
id="Path"
|
|
30
|
+
/>
|
|
31
|
+
<path
|
|
32
|
+
d="M13.6666666,10.3333333 C13.6666666,12.1742825 12.1742825,13.6666666 10.3333333,13.6666666 C8.49238416,13.6666666 7,12.1742825 7,10.3333333 C7,8.49238416 8.49238416,7 10.3333333,7 C12.1742825,7 13.6666666,8.49238416 13.6666666,10.3333333 L13.6666666,10.3333333 Z"
|
|
33
|
+
id="Path"
|
|
34
|
+
/>
|
|
35
|
+
</g>
|
|
36
|
+
</g>
|
|
37
|
+
</svg>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default SettingsIcon;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ICON_SIZE, ICON_COLOR } from '../constants';
|
|
3
|
+
|
|
4
|
+
function TaxonomyIcon({
|
|
5
|
+
width = ICON_SIZE.WIDTH,
|
|
6
|
+
height = ICON_SIZE.HEIGHT,
|
|
7
|
+
stroke = ICON_COLOR.STROKE
|
|
8
|
+
}) {
|
|
9
|
+
return (
|
|
10
|
+
<svg
|
|
11
|
+
width={width}
|
|
12
|
+
height={height}
|
|
13
|
+
viewBox="0 0 22 22"
|
|
14
|
+
version="1.1"
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
xmlnsXlink="http://www.w3.org/1999/xlink">
|
|
17
|
+
<title>taxonomy</title>
|
|
18
|
+
<g
|
|
19
|
+
id="Page-1"
|
|
20
|
+
stroke="none"
|
|
21
|
+
strokeWidth="1"
|
|
22
|
+
fill="none"
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
strokeLinecap="round"
|
|
25
|
+
strokeLinejoin="round">
|
|
26
|
+
<g id="Group" transform="translate(1, 1)" stroke={stroke}>
|
|
27
|
+
<rect
|
|
28
|
+
id="Rectangle"
|
|
29
|
+
x="0"
|
|
30
|
+
y="13.2173913"
|
|
31
|
+
width="6.78260868"
|
|
32
|
+
height="6.60869564"
|
|
33
|
+
rx="1.5"
|
|
34
|
+
/>
|
|
35
|
+
<rect
|
|
36
|
+
id="Rectangle"
|
|
37
|
+
x="13.2173913"
|
|
38
|
+
y="13.2173913"
|
|
39
|
+
width="6.78260868"
|
|
40
|
+
height="6.60869564"
|
|
41
|
+
rx="1.5"
|
|
42
|
+
/>
|
|
43
|
+
<rect
|
|
44
|
+
id="Rectangle"
|
|
45
|
+
x="6.60869564"
|
|
46
|
+
y="0"
|
|
47
|
+
width="6.78260868"
|
|
48
|
+
height="6.60869564"
|
|
49
|
+
rx="1.5"
|
|
50
|
+
/>
|
|
51
|
+
<path
|
|
52
|
+
d="M3.30434782,13.2173913 L3.30434782,12.115942 C3.30434782,10.8993147 4.2906191,9.91304346 5.50724637,9.91304346 L14.3188405,9.91304346 C15.5354678,9.91304346 16.5217391,10.8993147 16.5217391,12.115942 L16.5217391,13.2173913"
|
|
53
|
+
id="Path"
|
|
54
|
+
/>
|
|
55
|
+
<line x1="9.91304346" y1="6.60869564" x2="9.91304346" y2="9.91304346" id="Path" />
|
|
56
|
+
</g>
|
|
57
|
+
</g>
|
|
58
|
+
</svg>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default TaxonomyIcon;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ICON_SIZE, ICON_COLOR } from '../constants';
|
|
3
|
+
|
|
4
|
+
function UserIcon({
|
|
5
|
+
width = ICON_SIZE.WIDTH,
|
|
6
|
+
height = ICON_SIZE.HEIGHT,
|
|
7
|
+
stroke = ICON_COLOR.STROKE
|
|
8
|
+
}) {
|
|
9
|
+
return (
|
|
10
|
+
<svg
|
|
11
|
+
width={width}
|
|
12
|
+
height={height}
|
|
13
|
+
viewBox="0 0 22 22"
|
|
14
|
+
version="1.1"
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
xmlnsXlink="http://www.w3.org/1999/xlink">
|
|
17
|
+
<title>user</title>
|
|
18
|
+
<g
|
|
19
|
+
id="Page-1"
|
|
20
|
+
stroke="none"
|
|
21
|
+
strokeWidth={1}
|
|
22
|
+
fill="none"
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
strokeLinecap="round"
|
|
25
|
+
strokeLinejoin="round">
|
|
26
|
+
<g id="Group" transform="translate(1, 0.76)" stroke={stroke}>
|
|
27
|
+
<path
|
|
28
|
+
d="M2.35666666,16.4488888 C4.68824079,15.1310199 7.32175438,14.4403878 10,14.4444089 C12.7777778,14.4444089 15.3855556,15.1722221 17.6433334,16.4488888 M13.3333334,7.7777776 C13.3333334,9.61872677 11.8409492,11.1111109 10,11.1111109 C8.15905083,11.1111109 6.66666666,9.61872677 6.66666666,7.7777776 C6.66666666,5.93682842 8.15905083,4.44444425 10,4.44444425 C11.8409492,4.44444425 13.3333334,5.93682842 13.3333334,7.7777776 L13.3333334,7.7777776 Z M20,10 C20,13.5726558 18.0940108,16.8739261 15,18.660254 C11.9059893,20.446582 8.09401075,20.446582 5,18.660254 C1.90598917,16.8739261 0,13.5726558 0,10 C0,4.47715239 4.47715258,0 10,0 C15.5228474,0 20,4.47715239 20,10 L20,10 Z"
|
|
29
|
+
id="Shape"
|
|
30
|
+
/>
|
|
31
|
+
</g>
|
|
32
|
+
</g>
|
|
33
|
+
</svg>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
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
|
|