@blaze-cms/plugin-data-ui 0.146.0-core-styles.42 → 0.146.0-node18.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 +13 -155
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +1 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +1 -1
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxes.js +1 -0
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +1 -1
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +2 -2
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +1 -1
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +2 -2
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/index.js.map +1 -1
- package/package.json +17 -16
- package/src/components/EntityManager/Entity/Entity.js +41 -44
- package/src/components/EntityManager/Entity/EntityHeader/EntityHeader.js +1 -2
- package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +9 -7
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +40 -51
- package/src/components/EntityManager/EntityManager.js +52 -45
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +3 -6
- package/src/components/InfoBoxes/hooks/useData.js +6 -1
- package/src/components/ListingTable/ListingTable.js +26 -29
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +15 -17
- package/src/components/ListingTable/service/index.js +2 -3
- package/src/index.js +4 -4
package/lib-es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getFormBuilderLookup","formFieldTypes","React","pkg","DATA_LISTING_PREFIX","PLUGIN_NAME","getAddContentMenuItems","UserIcon","TaxonomyIcon","ContentIcon","SettingsIcon","EntityDataListing","lazy","EntityManager","load","app","events","once","addFieldType","Object","keys","forEach","type","component","emitAsync","addConfig","main","items","content","label","loadOpen","icon","order","taxonomy","user","settings","entityDataListingRoute","path","key","exact","editEntityRoute","addEntityRoute","addRoute","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import { getFormBuilderLookup, formFieldTypes } from '@blaze-cms/react-form-builder';\nimport React from 'react';\nimport pkg from '../package.json';\nimport { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';\nimport getAddContentMenuItems from './utils/add-content-menu-items';\nimport { UserIcon, TaxonomyIcon, ContentIcon, SettingsIcon } from './icons';\n\nconst EntityDataListing = React.lazy(()
|
|
1
|
+
{"version":3,"file":"index.js","names":["getFormBuilderLookup","formFieldTypes","React","pkg","DATA_LISTING_PREFIX","PLUGIN_NAME","getAddContentMenuItems","UserIcon","TaxonomyIcon","ContentIcon","SettingsIcon","EntityDataListing","lazy","EntityManager","load","app","events","once","addFieldType","Object","keys","forEach","type","component","emitAsync","addConfig","main","items","content","label","loadOpen","icon","order","taxonomy","user","settings","entityDataListingRoute","path","key","exact","editEntityRoute","addEntityRoute","addRoute","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import { getFormBuilderLookup, formFieldTypes } from '@blaze-cms/react-form-builder';\nimport React from 'react';\nimport pkg from '../package.json';\nimport { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';\nimport getAddContentMenuItems from './utils/add-content-menu-items';\nimport { UserIcon, TaxonomyIcon, ContentIcon, SettingsIcon } from './icons';\n\nconst EntityDataListing = React.lazy(\n () => import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')\n);\nconst EntityManager = React.lazy(\n () => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')\n);\n\nexport default async function load(app) {\n app.events.once('admin:menu:config:load', getAddContentMenuItems(app));\n\n app.events.once('load:custom:field:type', addFieldType => {\n Object.keys(formFieldTypes).forEach(type => {\n addFieldType({ type, component: formFieldTypes[type] });\n });\n });\n\n app.events.once('plugin:data-ui:load:loaded', async () => {\n await app.events.emitAsync('load:custom:field:type', getFormBuilderLookup.addFieldType);\n });\n\n app.events.once('admin:menu:config:load', ({ addConfig }) => {\n addConfig({\n main: {\n items: {\n content: {\n label: 'content',\n loadOpen: true,\n items: {},\n icon: ContentIcon,\n order: 10\n },\n taxonomy: {\n label: 'Taxonomy',\n items: {},\n icon: TaxonomyIcon,\n order: 40\n },\n user: {\n label: 'User',\n items: {},\n icon: UserIcon,\n order: 90\n },\n settings: {\n label: 'Settings',\n items: {},\n icon: SettingsIcon,\n order: 100\n }\n }\n }\n });\n });\n\n const entityDataListingRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier`,\n key: 'entityDataListing',\n component: EntityDataListing,\n exact: true\n };\n\n const editEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action/:id`,\n key: 'editEntity',\n component: EntityManager,\n exact: true\n };\n\n const addEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action`,\n key: 'createEntity',\n component: EntityManager,\n exact: true\n };\n\n app.addRoute(entityDataListingRoute);\n app.addRoute(editEntityRoute);\n app.addRoute(addEntityRoute);\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-data-ui",
|
|
3
|
-
"version": "0.146.0-
|
|
3
|
+
"version": "0.146.0-node18.0",
|
|
4
4
|
"description": "Blaze plugin data ui",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"test": "jest",
|
|
13
|
-
"lint": "
|
|
13
|
+
"lint": "npm run lint:js",
|
|
14
14
|
"lint:js": "eslint .",
|
|
15
15
|
"clean": "rm -Rf ./lib/ && rm -Rf ./lib-es/",
|
|
16
16
|
"build:cjs": "BABEL_ENV=cjs ../../node_modules/.bin/babel ./src --out-dir ./lib --source-maps --root-mode upward",
|
|
17
17
|
"build:esm": "BABEL_ENV=esm ../../node_modules/.bin/babel ./src --out-dir ./lib-es --source-maps --root-mode upward",
|
|
18
|
-
"build": "
|
|
19
|
-
"build:clean": "
|
|
20
|
-
"prepublishOnly": "
|
|
21
|
-
"postpublish": "
|
|
18
|
+
"build": "npm run build:cjs && npm run build:esm",
|
|
19
|
+
"build:clean": "npm run clean && npm run build",
|
|
20
|
+
"prepublishOnly": "npm run build:clean",
|
|
21
|
+
"postpublish": "npm run clean"
|
|
22
22
|
},
|
|
23
23
|
"author": {
|
|
24
24
|
"email": "hello@thebyte9.com",
|
|
@@ -27,18 +27,19 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/admin-ui-utils": "0.146.0-
|
|
31
|
-
"@blaze-cms/core-errors": "0.146.0-
|
|
32
|
-
"@blaze-cms/plugin-render-hooks-ui": "0.
|
|
33
|
-
"@blaze-cms/react-form-builder": "0.146.0-
|
|
34
|
-
"@blaze-cms/react-page-builder": "0.146.0-
|
|
35
|
-
"@blaze-cms/setup-ui": "0.
|
|
36
|
-
"@blaze-cms/versioning-ui": "0.146.0-
|
|
30
|
+
"@blaze-cms/admin-ui-utils": "0.146.0-node18.0",
|
|
31
|
+
"@blaze-cms/core-errors": "0.146.0-node18.0",
|
|
32
|
+
"@blaze-cms/plugin-render-hooks-ui": "0.146.0-node18.0",
|
|
33
|
+
"@blaze-cms/react-form-builder": "0.146.0-node18.0",
|
|
34
|
+
"@blaze-cms/react-page-builder": "0.146.0-node18.0",
|
|
35
|
+
"@blaze-cms/setup-ui": "0.146.0-node18.0",
|
|
36
|
+
"@blaze-cms/versioning-ui": "0.146.0-node18.0",
|
|
37
37
|
"@blaze-react/button": "0.8.0-alpha.82",
|
|
38
38
|
"@blaze-react/more": "0.5.19",
|
|
39
39
|
"@blaze-react/multiselect": "0.8.0-alpha.78",
|
|
40
40
|
"@blaze-react/pagination": "0.8.0-alpha.76",
|
|
41
41
|
"@blaze-react/select": "0.8.0-alpha.80",
|
|
42
|
+
"@blaze-react/tab": "^0.7.0",
|
|
42
43
|
"@blaze-react/table": "0.8.0-alpha.74",
|
|
43
44
|
"@blaze-react/toaster": "0.5.17",
|
|
44
45
|
"@blaze-react/utils": "0.5.15",
|
|
@@ -55,17 +56,17 @@
|
|
|
55
56
|
"uuid": "^3.3.3"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@blaze-cms/core-ui": "0.146.0-
|
|
59
|
+
"@blaze-cms/core-ui": "0.146.0-node18.0"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
62
|
"@apollo/client": "3.x",
|
|
62
63
|
"prop-types": "^15.7.2",
|
|
63
|
-
"react": "^
|
|
64
|
+
"react": "^18.2.0",
|
|
64
65
|
"react-router-dom": "^5.0.1"
|
|
65
66
|
},
|
|
66
67
|
"eslintIgnore": [
|
|
67
68
|
"lib/*",
|
|
68
69
|
"lib-es/*"
|
|
69
70
|
],
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "c60370714e89e0c96f2169d61e4c56bc542f7686"
|
|
71
72
|
}
|
|
@@ -51,6 +51,7 @@ const Entity = ({
|
|
|
51
51
|
onViewUrl,
|
|
52
52
|
refetchRecord
|
|
53
53
|
}) => {
|
|
54
|
+
const client = useApolloClient();
|
|
54
55
|
const [, setCurrentTabId] = useState(null);
|
|
55
56
|
const [formValues, setFormValues] = useState(null);
|
|
56
57
|
const [entitySchema, setEntitySchema] = useState(null);
|
|
@@ -76,7 +77,6 @@ const Entity = ({
|
|
|
76
77
|
const isCreatePage = history.location.pathname.includes('create');
|
|
77
78
|
const [isNewEntity, setIsNewEntity] = useState(isCreatePage);
|
|
78
79
|
|
|
79
|
-
const client = useApolloClient();
|
|
80
80
|
const shouldUpdateState =
|
|
81
81
|
!entityIdentifier ||
|
|
82
82
|
checkFulfilConditions(entity, schema, previousQuery, !entityData) ||
|
|
@@ -107,50 +107,47 @@ const Entity = ({
|
|
|
107
107
|
[]
|
|
108
108
|
); // Using an empty dependency array ensures this only runs on unmount
|
|
109
109
|
|
|
110
|
-
useEffect(
|
|
111
|
-
()
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (shouldUpdateState) {
|
|
112
|
+
setSaveButtonText(SAVE_BUTTON_TEXTS.save);
|
|
113
|
+
setEntityData(entity);
|
|
114
|
+
setPageTitle(getPageName(schema.displayProperties, entity));
|
|
115
|
+
setEntityIsPublish(entity.status);
|
|
116
|
+
setEntitySchema(schema);
|
|
117
|
+
setEnablePublishButton(schema.actions.publish);
|
|
118
|
+
setEntityIdentifier(schema.identifier);
|
|
119
|
+
setEnablePreviewButton(!!schema.interfaces.includes(PREVIEW_INTERFACE));
|
|
120
|
+
}
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
]
|
|
153
|
-
);
|
|
122
|
+
if (formData && pageBuilderTemplateStatus) {
|
|
123
|
+
const isPageBuilderTemplateSet = !!formData.values.pageBuilderTemplateId;
|
|
124
|
+
client.writeQuery({
|
|
125
|
+
query: getQuery('GET_PB_TEMPLATE_STATUS'),
|
|
126
|
+
data: {
|
|
127
|
+
pageBuilderTemplateSet: isPageBuilderTemplateSet,
|
|
128
|
+
pageBuilderTemplateId: formData.values.pageBuilderTemplateId || ''
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
if (schema) {
|
|
133
|
+
client.writeQuery({
|
|
134
|
+
query: getQuery('GET_CURRENT_ENTITY'),
|
|
135
|
+
data: {
|
|
136
|
+
currentEntity: schema.id
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}, [
|
|
141
|
+
client,
|
|
142
|
+
entity,
|
|
143
|
+
entityData,
|
|
144
|
+
formData,
|
|
145
|
+
formValues,
|
|
146
|
+
pageBuilderTemplateStatus,
|
|
147
|
+
previousQuery,
|
|
148
|
+
schema,
|
|
149
|
+
shouldUpdateState
|
|
150
|
+
]);
|
|
154
151
|
|
|
155
152
|
const getFullUrl = async () => {
|
|
156
153
|
const query = getQuery('GET_ENTITY_URL');
|
|
@@ -30,8 +30,7 @@ const EntityHeader = ({
|
|
|
30
30
|
|
|
31
31
|
const {
|
|
32
32
|
displayProperties: { adminCrudActions: { delete: deleteAction = { active: true } } = {} } = {}
|
|
33
|
-
} =
|
|
34
|
-
entitySchema || {};
|
|
33
|
+
} = entitySchema || {};
|
|
35
34
|
|
|
36
35
|
const showDeleteButton =
|
|
37
36
|
deleteAction.active && formData && Object.keys(formData.values).length !== 0;
|
|
@@ -21,17 +21,19 @@ const useCustomSidebarData = ({ id, schema, displayProperties }) => {
|
|
|
21
21
|
}
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
data = {},
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
refetch
|
|
29
|
+
} = useQuery(customSidebarInfoQuery, {
|
|
25
30
|
variables: { id },
|
|
26
31
|
skip: !query
|
|
27
32
|
});
|
|
28
33
|
|
|
29
|
-
useEffect(
|
|
30
|
-
()
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
[externalUpdateTime, updated, refetch]
|
|
34
|
-
);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
refetch();
|
|
36
|
+
}, [externalUpdateTime, updated, refetch]);
|
|
35
37
|
|
|
36
38
|
return { data: data.__typename !== 'Query' ? data : null, loading, error };
|
|
37
39
|
};
|
|
@@ -12,51 +12,43 @@ import EntityNavLinks from '../EntitiyNavLinks';
|
|
|
12
12
|
|
|
13
13
|
const SideBarRelations = ({ schema, onChange, formData, entity }) => {
|
|
14
14
|
const { relation: RelationComponent } = formFieldTypes;
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
formattedUpdated,
|
|
18
|
-
formattedCreated,
|
|
19
|
-
formattedPublished,
|
|
20
|
-
status
|
|
21
|
-
} = formData;
|
|
15
|
+
const { formattedStatus, formattedUpdated, formattedCreated, formattedPublished, status } =
|
|
16
|
+
formData;
|
|
22
17
|
const client = useApolloClient();
|
|
23
18
|
|
|
24
19
|
const [relationsComponents, setRelationsComponents] = useState(null);
|
|
25
20
|
|
|
26
|
-
useEffect(
|
|
27
|
-
() => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!entityIdentifier) return null;
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
(async () => {
|
|
23
|
+
const fetchRelationSchema = async ({ entityIdentifier }) => {
|
|
24
|
+
if (!entityIdentifier) return null;
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
const {
|
|
27
|
+
data: {
|
|
28
|
+
getEntitySchemas: [relationSchema]
|
|
29
|
+
}
|
|
30
|
+
} = await client.query({
|
|
31
|
+
query: getQuery('GET_ENTITY_SCHEMA'),
|
|
32
|
+
variables: { identifier: entityIdentifier }
|
|
33
|
+
});
|
|
34
|
+
return relationSchema;
|
|
35
|
+
};
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
if (!relationsComponents && schema) {
|
|
38
|
+
const allRelationComponents = await Promise.all(
|
|
39
|
+
schema.relations
|
|
40
|
+
.filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])
|
|
41
|
+
.map(async relation => ({
|
|
42
|
+
id: uuidv1(),
|
|
43
|
+
staticData: relation,
|
|
44
|
+
schema: await fetchRelationSchema(relation)
|
|
45
|
+
}))
|
|
46
|
+
);
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
[client, relationsComponents, schema, schema.relations]
|
|
59
|
-
);
|
|
48
|
+
setRelationsComponents(allRelationComponents);
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
}, [client, relationsComponents, schema, schema.relations]);
|
|
60
52
|
const { id: itemId } = entity;
|
|
61
53
|
const { identifier: itemEntity, interfaces } = schema;
|
|
62
54
|
|
|
@@ -82,19 +74,16 @@ const SideBarRelations = ({ schema, onChange, formData, entity }) => {
|
|
|
82
74
|
)}
|
|
83
75
|
</div>
|
|
84
76
|
)}
|
|
85
|
-
{!schema.displayProperties.disableDefaultAdminInfo &&
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</>
|
|
96
|
-
</>
|
|
97
|
-
)}
|
|
77
|
+
{!schema.displayProperties.disableDefaultAdminInfo && formattedCreated && (
|
|
78
|
+
<>
|
|
79
|
+
<p>
|
|
80
|
+
Created: <span>{formattedCreated}</span>
|
|
81
|
+
</p>
|
|
82
|
+
<p>
|
|
83
|
+
Updated: <span>{formattedUpdated}</span>
|
|
84
|
+
</p>
|
|
85
|
+
</>
|
|
86
|
+
)}
|
|
98
87
|
|
|
99
88
|
<CustomSidebarInfoContainer
|
|
100
89
|
id={itemId}
|
|
@@ -19,56 +19,63 @@ const EntityManager = ({ match, history }) => {
|
|
|
19
19
|
|
|
20
20
|
const { action, entityIdentifier, id = null, onViewUrl } = match.params;
|
|
21
21
|
|
|
22
|
-
useEffect(
|
|
23
|
-
() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
addToast(PAGE_NOT_FOUND, {
|
|
34
|
-
appearance: ERROR,
|
|
35
|
-
autoDismiss: true
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
history.push(`/data-listing/${entityIdentifier}`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let localData = data;
|
|
42
|
-
|
|
43
|
-
if (isPageBuilderTemplateSet(data)) {
|
|
44
|
-
const pageBuilderComponents = await getPageBuilderComponents({
|
|
45
|
-
entitySchema,
|
|
46
|
-
client,
|
|
47
|
-
id
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
localData = {
|
|
51
|
-
...localData,
|
|
52
|
-
pageBuilder: pageBuilderComponents || localData.pageBuilder
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
setFormData({ values: localData });
|
|
57
|
-
setEntity(data);
|
|
58
|
-
setSchema(entitySchema);
|
|
59
|
-
setPreviousQuery(requestedQuery);
|
|
60
|
-
setShouldRefetch(false);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
addToast(error.message, {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
(async () => {
|
|
24
|
+
try {
|
|
25
|
+
const [entitySchema, data = {}, requestedQuery] = await entityAvailableActions[action]({
|
|
26
|
+
client,
|
|
27
|
+
identifier: entityIdentifier,
|
|
28
|
+
id
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (!data) {
|
|
32
|
+
addToast(PAGE_NOT_FOUND, {
|
|
63
33
|
appearance: ERROR,
|
|
64
34
|
autoDismiss: true
|
|
65
35
|
});
|
|
36
|
+
|
|
66
37
|
history.push(`/data-listing/${entityIdentifier}`);
|
|
67
38
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
39
|
+
|
|
40
|
+
let localData = data;
|
|
41
|
+
|
|
42
|
+
if (isPageBuilderTemplateSet(data)) {
|
|
43
|
+
const pageBuilderComponents = await getPageBuilderComponents({
|
|
44
|
+
entitySchema,
|
|
45
|
+
client,
|
|
46
|
+
id
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
localData = {
|
|
50
|
+
...localData,
|
|
51
|
+
pageBuilder: pageBuilderComponents || localData.pageBuilder
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setFormData({ values: localData });
|
|
56
|
+
setEntity(data);
|
|
57
|
+
setSchema(entitySchema);
|
|
58
|
+
setPreviousQuery(requestedQuery);
|
|
59
|
+
setShouldRefetch(false);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
addToast(error.message, {
|
|
62
|
+
appearance: ERROR,
|
|
63
|
+
autoDismiss: true
|
|
64
|
+
});
|
|
65
|
+
history.push(`/data-listing/${entityIdentifier}`);
|
|
66
|
+
}
|
|
67
|
+
})();
|
|
68
|
+
}, [
|
|
69
|
+
action,
|
|
70
|
+
addToast,
|
|
71
|
+
client,
|
|
72
|
+
entityIdentifier,
|
|
73
|
+
history,
|
|
74
|
+
history.push,
|
|
75
|
+
id,
|
|
76
|
+
schema,
|
|
77
|
+
shouldRefetch
|
|
78
|
+
]);
|
|
72
79
|
|
|
73
80
|
const updateFormData = (updatedFormData, shouldRefresh) => {
|
|
74
81
|
if (shouldRefresh) setShouldRefetch(true);
|
|
@@ -9,12 +9,9 @@ const InfoBoxContainer = ({ id, schema, infoBox }) => {
|
|
|
9
9
|
|
|
10
10
|
const { data, refetch } = useData({ id, schema, infoBox });
|
|
11
11
|
|
|
12
|
-
useEffect(
|
|
13
|
-
()
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
[externalUpdateTime, refetch]
|
|
17
|
-
);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
refetch();
|
|
14
|
+
}, [externalUpdateTime, refetch]);
|
|
18
15
|
|
|
19
16
|
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
20
17
|
|
|
@@ -12,7 +12,12 @@ function useData({ id, schema, infoBox }) {
|
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
|
-
const {
|
|
15
|
+
const {
|
|
16
|
+
data = {},
|
|
17
|
+
loading,
|
|
18
|
+
error,
|
|
19
|
+
refetch
|
|
20
|
+
} = useQuery(infoBoxQuery, {
|
|
16
21
|
variables: { id },
|
|
17
22
|
skip: !query
|
|
18
23
|
});
|
|
@@ -144,7 +144,6 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
144
144
|
});
|
|
145
145
|
history.push('?page=1');
|
|
146
146
|
};
|
|
147
|
-
|
|
148
147
|
if (!tableData || !tableData.rows) return 'loading';
|
|
149
148
|
|
|
150
149
|
const {
|
|
@@ -160,35 +159,33 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
160
159
|
|
|
161
160
|
return (
|
|
162
161
|
<div className="page">
|
|
163
|
-
{modalStatus &&
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
)}
|
|
162
|
+
{modalStatus && _deleteAction.active && (
|
|
163
|
+
<DeleteAction
|
|
164
|
+
data-testid="deleteEntity"
|
|
165
|
+
onClose={toggleModal}
|
|
166
|
+
deleteAction={deleteAction}
|
|
167
|
+
itemName={itemToDelete.name}
|
|
168
|
+
/>
|
|
169
|
+
)}
|
|
172
170
|
<PageHeader title={entitySchema.displayName} subtitle="">
|
|
173
|
-
{createAction.active &&
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
<
|
|
183
|
-
<More>
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
)}
|
|
171
|
+
{createAction.active && !showAddButton && (
|
|
172
|
+
<>
|
|
173
|
+
<Link
|
|
174
|
+
data-testid="addEntity"
|
|
175
|
+
className="button button--small"
|
|
176
|
+
to={`${match.url}/create`}>
|
|
177
|
+
Add
|
|
178
|
+
</Link>
|
|
179
|
+
<PageHeader.Actions>
|
|
180
|
+
<More>
|
|
181
|
+
<More.Avatar isMoreMenu>
|
|
182
|
+
<span className="material-icons">more_vert</span>
|
|
183
|
+
</More.Avatar>
|
|
184
|
+
<More.Content isMoreMenu />
|
|
185
|
+
</More>
|
|
186
|
+
</PageHeader.Actions>
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
192
189
|
</PageHeader>
|
|
193
190
|
{showAddButton ? (
|
|
194
191
|
<CardPrompt>
|
|
@@ -20,23 +20,21 @@ const ListingTableContent = ({
|
|
|
20
20
|
return (
|
|
21
21
|
<>
|
|
22
22
|
{displayTable ? (
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</div>
|
|
39
|
-
</>
|
|
23
|
+
<div className={className}>
|
|
24
|
+
<Table
|
|
25
|
+
onSort={onSort}
|
|
26
|
+
data={tableData}
|
|
27
|
+
checkboxes={!isEnquiry}
|
|
28
|
+
onSelect={handleSelect}
|
|
29
|
+
data-testid="listing-table-content"
|
|
30
|
+
/>
|
|
31
|
+
<Pagination
|
|
32
|
+
visiblePages={10}
|
|
33
|
+
totalItems={totalItems}
|
|
34
|
+
currentPage={currentPage}
|
|
35
|
+
onPageChange={handleOnPageChange}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
40
38
|
) : (
|
|
41
39
|
<span className="table-no-results" data-testid="no-results">
|
|
42
40
|
No results
|
|
@@ -34,9 +34,8 @@ function buildVariables({ entitySchema, isSearchQuery, listFilters = [], queryPa
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const fetchData = async ({ client, querySettings: { entitySchema, queryParams }, listFilters }) => {
|
|
37
|
-
const {
|
|
38
|
-
|
|
39
|
-
} = entitySchema;
|
|
37
|
+
const { displayProperties: { adminListings: { dataSource: { source } = {} } = {} } = {} } =
|
|
38
|
+
entitySchema;
|
|
40
39
|
|
|
41
40
|
const isSearchQuery = source === 'search';
|
|
42
41
|
const query = buildListingQuery(entitySchema, isSearchQuery);
|
package/src/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';
|
|
|
5
5
|
import getAddContentMenuItems from './utils/add-content-menu-items';
|
|
6
6
|
import { UserIcon, TaxonomyIcon, ContentIcon, SettingsIcon } from './icons';
|
|
7
7
|
|
|
8
|
-
const EntityDataListing = React.lazy(
|
|
9
|
-
import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')
|
|
8
|
+
const EntityDataListing = React.lazy(
|
|
9
|
+
() => import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')
|
|
10
10
|
);
|
|
11
|
-
const EntityManager = React.lazy(
|
|
12
|
-
import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
|
|
11
|
+
const EntityManager = React.lazy(
|
|
12
|
+
() => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
export default async function load(app) {
|