@blaze-cms/plugin-data-ui 0.139.0 → 0.139.1-core-styles.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 +12 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +2 -1
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +2 -1
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +2 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +2 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +24 -12
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +2 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +2 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +2 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +2 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +2 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +11 -2
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +4 -3
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +2 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +2 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +2 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +2 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +2 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +2 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +2 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +2 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +2 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +4 -3
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +2 -1
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +6 -5
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +2 -1
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/RecordEditContext/index.js +16 -0
- package/lib/components/EntityManager/utils/RecordEditContext/index.js.map +1 -0
- package/lib/components/EntityManager/utils/data-mappers.js +10 -6
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +2 -2
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +2 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +2 -1
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +2 -1
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxes.js +2 -1
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +19 -3
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useData.js +6 -3
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +2 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/index.js +2 -1
- package/lib/components/InfoBoxes/index.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +2 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +9 -15
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +2 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +2 -1
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js +2 -1
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +2 -1
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +2 -1
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +8 -5
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +4 -3
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +4 -3
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/constants.js +52 -26
- package/lib/constants.js.map +1 -1
- package/lib/icons/ContentIcon.js +2 -1
- package/lib/icons/ContentIcon.js.map +1 -1
- package/lib/icons/SettingsIcon.js +2 -1
- package/lib/icons/SettingsIcon.js.map +1 -1
- package/lib/icons/TaxonomyIcon.js +2 -1
- package/lib/icons/TaxonomyIcon.js.map +1 -1
- package/lib/icons/UsersIcon.js +2 -1
- package/lib/icons/UsersIcon.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +2 -1
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +2 -1
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +2 -1
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +2 -1
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +2 -1
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +2 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +2 -1
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +2 -1
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +2 -1
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +13 -5
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +10 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js +2 -2
- package/lib-es/components/EntityManager/EntityManager.js +2 -2
- package/lib-es/components/EntityManager/utils/RecordEditContext/index.js +6 -0
- package/lib-es/components/EntityManager/utils/RecordEditContext/index.js.map +1 -0
- package/lib-es/components/EntityManager/utils/data-mappers.js +2 -2
- package/lib-es/components/EntityManager/utils/entity.js +2 -2
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +10 -2
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib-es/components/InfoBoxes/hooks/useData.js +4 -2
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +5 -9
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js +2 -2
- package/lib-es/components/ListingTable/service/index.js +2 -2
- package/package.json +11 -11
- package/src/components/EntityManager/Entity/Entity.js +86 -75
- package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +12 -1
- package/src/components/EntityManager/utils/RecordEditContext/index.js +7 -0
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +12 -2
- package/src/components/InfoBoxes/hooks/useData.js +5 -2
- package/src/components/ListingTable/ListingTable.js +11 -16
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
} from '../utils/entity';
|
|
37
37
|
import useToggle from '../../../utils/hooks/useToggle';
|
|
38
38
|
import InfoBoxes from '../../InfoBoxes/InfoBoxes';
|
|
39
|
+
import { RecordEditContextProvider } from '../utils/RecordEditContext';
|
|
39
40
|
|
|
40
41
|
const Entity = ({
|
|
41
42
|
formData,
|
|
@@ -68,6 +69,7 @@ const Entity = ({
|
|
|
68
69
|
const [formDataFromCopy, setFormDataFromCopy] = useState(null);
|
|
69
70
|
const [newUpdatedDate, setNewUpdatedDate] = useState(null);
|
|
70
71
|
const [saveButtonText, setSaveButtonText] = useState(SAVE_BUTTON_TEXTS.save);
|
|
72
|
+
const [externalUpdateTime, setExternalUpdateTime] = useState(null);
|
|
71
73
|
|
|
72
74
|
const isCreatePage = history.location.pathname.includes('create');
|
|
73
75
|
const [isNewEntity, setIsNewEntity] = useState(isCreatePage);
|
|
@@ -238,6 +240,7 @@ const Entity = ({
|
|
|
238
240
|
if (componentIsMounted.current) {
|
|
239
241
|
setIsFormValid(isValid);
|
|
240
242
|
}
|
|
243
|
+
|
|
241
244
|
if (isValidAndNewValueSet && componentIsMounted.current) {
|
|
242
245
|
setIsSaveButtonAvailable(true);
|
|
243
246
|
setSaveButtonText(SAVE_BUTTON_TEXTS.save);
|
|
@@ -404,89 +407,97 @@ const Entity = ({
|
|
|
404
407
|
schema?.interfaces?.includes('page-builder/page-builder');
|
|
405
408
|
|
|
406
409
|
return (
|
|
407
|
-
<
|
|
408
|
-
<
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
<div className="
|
|
426
|
-
<
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
<div className="page__content">
|
|
444
|
-
<div className="
|
|
445
|
-
<
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
410
|
+
<RecordEditContextProvider value={{ externalUpdateTime }}>
|
|
411
|
+
<div className="page">
|
|
412
|
+
<EntityHeader
|
|
413
|
+
entityData={entityData}
|
|
414
|
+
entityIdentifier={entityIdentifier}
|
|
415
|
+
pageTitle={pageTitle}
|
|
416
|
+
pageName={pageName}
|
|
417
|
+
onSubmit={onSubmit}
|
|
418
|
+
handlePublishAndUnpublish={handlePublishAndUnpublish}
|
|
419
|
+
isSaveButtonAvailable={isSaveButtonAvailable}
|
|
420
|
+
isEnablePublishButton={isEnablePublishButton}
|
|
421
|
+
isEnablePreviewButton={isEnablePreviewButton}
|
|
422
|
+
toggleCopyModal={setCopyModalStatus}
|
|
423
|
+
toggleModal={setModalStatus}
|
|
424
|
+
formData={formData}
|
|
425
|
+
onViewUrl={onViewUrlHandler}
|
|
426
|
+
saveButtonText={saveButtonText}
|
|
427
|
+
/>
|
|
428
|
+
<div className="page-wrapper__content">
|
|
429
|
+
<div className="tabs-wrapper tabs-wrapper__tab">
|
|
430
|
+
<Prompt when={hasToDisplayPrompt} message={LEAVE_PAGE_MESSAGE} />
|
|
431
|
+
{showModal && (
|
|
432
|
+
<DeleteAction
|
|
433
|
+
onClose={setModalStatus}
|
|
434
|
+
deleteAction={onDelete}
|
|
435
|
+
itemName={formData.values.name}
|
|
436
|
+
/>
|
|
437
|
+
)}
|
|
438
|
+
{copyModalStatus && (
|
|
439
|
+
<CopyDataFromAction
|
|
440
|
+
onClose={handleCopyDataFromClose}
|
|
441
|
+
copyAction={onCopy}
|
|
442
|
+
getFormData={getFormData}
|
|
443
|
+
/>
|
|
444
|
+
)}
|
|
445
|
+
|
|
446
|
+
<div className="page__content--fixed">
|
|
447
|
+
<div className="page__content">
|
|
448
|
+
<div className="content">
|
|
449
|
+
<RenderHook
|
|
450
|
+
hookKey={`entity:${action}:main:top`}
|
|
451
|
+
entity={entity}
|
|
452
|
+
schema={schema}
|
|
453
|
+
/>
|
|
454
|
+
<InfoBoxes id={entity.id} schema={schema} />
|
|
455
|
+
<Tabs
|
|
456
|
+
enabled={showPageBuilderTabs}
|
|
457
|
+
onTabChange={tabId => {
|
|
458
|
+
client.writeQuery({
|
|
459
|
+
query: GET_CURRENT_TAB_ID,
|
|
460
|
+
data: { currentTabId: tabId }
|
|
461
|
+
});
|
|
462
|
+
setCurrentTabId(tabId);
|
|
463
|
+
}}>
|
|
464
|
+
<FormBuilder
|
|
465
|
+
getIsFormValid={setIsFormValid}
|
|
466
|
+
getFormValues={getFormValues}
|
|
467
|
+
schema={schema}
|
|
468
|
+
data={clonedFormData}
|
|
469
|
+
onChange={onChangeFormValues}
|
|
470
|
+
shouldCopyData={shouldCopyData}
|
|
471
|
+
updateCopyData={updateCopyData}
|
|
472
|
+
formValues={formValues}
|
|
473
|
+
isNewEntity={isNewEntity}
|
|
474
|
+
onExternalUpdate={setExternalUpdateTime}
|
|
475
|
+
dataUpdatedDateTime={newUpdatedDate}
|
|
476
|
+
/>
|
|
477
|
+
</Tabs>
|
|
478
|
+
<RenderHook
|
|
479
|
+
hookKey={`entity:${action}:main:bottom`}
|
|
480
|
+
entity={entity}
|
|
459
481
|
schema={schema}
|
|
460
|
-
data={clonedFormData}
|
|
461
|
-
onChange={onChangeFormValues}
|
|
462
|
-
shouldCopyData={shouldCopyData}
|
|
463
|
-
updateCopyData={updateCopyData}
|
|
464
|
-
formValues={formValues}
|
|
465
|
-
isNewEntity={isNewEntity}
|
|
466
482
|
/>
|
|
467
|
-
</
|
|
468
|
-
<RenderHook
|
|
469
|
-
hookKey={`entity:${action}:main:bottom`}
|
|
470
|
-
entity={entity}
|
|
471
|
-
schema={schema}
|
|
472
|
-
/>
|
|
483
|
+
</div>
|
|
473
484
|
</div>
|
|
474
485
|
</div>
|
|
475
486
|
</div>
|
|
476
|
-
</div>
|
|
477
487
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
488
|
+
<div className="column column--one-third page-sidebar page-sidebar--relations">
|
|
489
|
+
{showSideBarRelations && (
|
|
490
|
+
<SideBarRelations
|
|
491
|
+
entity={entity}
|
|
492
|
+
formData={formData.values}
|
|
493
|
+
schema={schema}
|
|
494
|
+
onChange={onChangeSideBarRelations}
|
|
495
|
+
/>
|
|
496
|
+
)}
|
|
497
|
+
</div>
|
|
487
498
|
</div>
|
|
488
499
|
</div>
|
|
489
|
-
</
|
|
500
|
+
</RecordEditContextProvider>
|
|
490
501
|
);
|
|
491
502
|
};
|
|
492
503
|
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
1
2
|
import ProptTypes from 'prop-types';
|
|
2
3
|
import { useQuery, gql } from '@apollo/client';
|
|
3
4
|
import buildDynamicQuery from '../helpers/build-dynamic-query';
|
|
5
|
+
import { RecordEditContext } from '../../../utils/RecordEditContext';
|
|
4
6
|
|
|
5
7
|
const useCustomSidebarData = ({ id, schema, displayProperties }) => {
|
|
8
|
+
const { externalUpdateTime } = useContext(RecordEditContext);
|
|
9
|
+
|
|
6
10
|
const query = buildDynamicQuery({ id, schema, displayProperties });
|
|
7
11
|
|
|
8
12
|
const customSidebarInfoQuery =
|
|
@@ -13,11 +17,18 @@ const useCustomSidebarData = ({ id, schema, displayProperties }) => {
|
|
|
13
17
|
}
|
|
14
18
|
`;
|
|
15
19
|
|
|
16
|
-
const { data = {}, loading, error } = useQuery(customSidebarInfoQuery, {
|
|
20
|
+
const { data = {}, loading, error, refetch } = useQuery(customSidebarInfoQuery, {
|
|
17
21
|
variables: { id },
|
|
18
22
|
skip: !query
|
|
19
23
|
});
|
|
20
24
|
|
|
25
|
+
useEffect(
|
|
26
|
+
() => {
|
|
27
|
+
refetch();
|
|
28
|
+
},
|
|
29
|
+
[externalUpdateTime, refetch]
|
|
30
|
+
);
|
|
31
|
+
|
|
21
32
|
return { data: data.__typename !== 'Query' ? data : null, loading, error };
|
|
22
33
|
};
|
|
23
34
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const RecordEditContext = React.createContext();
|
|
4
|
+
const RecordEditContextProvider = RecordEditContext.Provider;
|
|
5
|
+
const RecordEditContextConsumer = RecordEditContext.Consumer;
|
|
6
|
+
|
|
7
|
+
export { RecordEditContext, RecordEditContextProvider, RecordEditContextConsumer };
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useContext, useEffect } from 'react';
|
|
3
3
|
import useData from '../hooks/useData';
|
|
4
4
|
import InfoBox from '../presentational/InfoBox';
|
|
5
|
+
import { RecordEditContext } from '../../EntityManager/utils/RecordEditContext';
|
|
5
6
|
|
|
6
7
|
const InfoBoxContainer = ({ id, schema, infoBox }) => {
|
|
7
|
-
const {
|
|
8
|
+
const { externalUpdateTime } = useContext(RecordEditContext);
|
|
9
|
+
|
|
10
|
+
const { data, refetch } = useData({ id, schema, infoBox });
|
|
11
|
+
|
|
12
|
+
useEffect(
|
|
13
|
+
() => {
|
|
14
|
+
refetch();
|
|
15
|
+
},
|
|
16
|
+
[externalUpdateTime, refetch]
|
|
17
|
+
);
|
|
8
18
|
|
|
9
19
|
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
10
20
|
|
|
@@ -12,9 +12,12 @@ function useData({ id, schema, infoBox }) {
|
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
|
-
const { data = {}, loading, error } = useQuery(infoBoxQuery, {
|
|
15
|
+
const { data = {}, loading, error, refetch } = useQuery(infoBoxQuery, {
|
|
16
|
+
variables: { id },
|
|
17
|
+
skip: !query
|
|
18
|
+
});
|
|
16
19
|
|
|
17
|
-
return { data: data.__typename !== 'Query' ? data : null, loading, error };
|
|
20
|
+
return { data: data.__typename !== 'Query' ? data : null, loading, error, refetch };
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export default useData;
|
|
@@ -24,7 +24,6 @@ const ListingTable = ({ match, entitySchema }) => {
|
|
|
24
24
|
const queryParamsDefault = getDefaultQueryParams(entitySchema);
|
|
25
25
|
const [queryParams, setQueryParams] = useState(queryParamsDefault);
|
|
26
26
|
const [listFilters, setListFilters] = useState([]);
|
|
27
|
-
const [displayCardPrompt, setDisplayCardPrompt] = useState(true);
|
|
28
27
|
const client = useApolloClient();
|
|
29
28
|
const { addToast } = useToasts();
|
|
30
29
|
|
|
@@ -167,7 +166,7 @@ const ListingTable = ({ match, entitySchema }) => {
|
|
|
167
166
|
};
|
|
168
167
|
|
|
169
168
|
if (!tableData || !tableData.rows) return 'loading';
|
|
170
|
-
const showAddButton = !!tableData.rows.length
|
|
169
|
+
const showAddButton = !!tableData.rows.length;
|
|
171
170
|
|
|
172
171
|
return (
|
|
173
172
|
<div className="page">
|
|
@@ -198,20 +197,16 @@ const ListingTable = ({ match, entitySchema }) => {
|
|
|
198
197
|
</Fragment>
|
|
199
198
|
)}
|
|
200
199
|
</PageHeader>
|
|
201
|
-
{
|
|
202
|
-
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Add
|
|
212
|
-
</Link>
|
|
213
|
-
</CardPrompt>
|
|
214
|
-
)}
|
|
200
|
+
{!showAddButton && (
|
|
201
|
+
<CardPrompt>
|
|
202
|
+
<Link
|
|
203
|
+
className="button button--rounded button--cta"
|
|
204
|
+
to={`${match.url}/create`}
|
|
205
|
+
data-testid="add-button">
|
|
206
|
+
Add
|
|
207
|
+
</Link>
|
|
208
|
+
</CardPrompt>
|
|
209
|
+
)}
|
|
215
210
|
<RenderHook
|
|
216
211
|
hookKey="entity:listing:main:top"
|
|
217
212
|
schema={entitySchema}
|