@blaze-cms/plugin-data-ui 0.127.0-project-admin-customisations.1 → 0.127.0-project-admin-customisations.3
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 +20 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +4 -4
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +171 -173
- 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/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +26 -28
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +77 -83
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +40 -42
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +31 -33
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +40 -42
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +43 -45
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +65 -69
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +10 -12
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +62 -66
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +121 -129
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +17 -19
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/index.js +56 -60
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +25 -27
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +6 -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/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/package.json +6 -5
- package/src/components/EntityManager/Entity/Entity.js +2 -0
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityHeader.js","names":["EntityHeader","saveButtonText","entityData","entityIdentifier","pageTitle","onSubmit","handlePublishAndUnpublish","isSaveButtonAvailable","isEnablePublishButton","isEnablePreviewButton","toggleCopyModal","toggleModal","formData","pageName","onViewUrl","SaveButtonModifiers","showPreviewButton","id","shouldDisableMoreMenu","SAVE_BUTTON_TEXTS","saving","Object","keys","values","length","propTypes","PropTypes","object","string","isRequired","func","bool","oneOfType","defaultProps","displayName"],"sources":["../../../../../src/components/EntityManager/Entity/EntityHeader/EntityHeader.js"],"sourcesContent":["import React from 'react';\nimport { PageHeader } from '@blaze-cms/admin';\nimport Button from '@blaze-react/button';\nimport More from '@blaze-react/more';\nimport PropTypes from 'prop-types';\nimport HeaderPreviewButton from './HeaderPreviewButton';\nimport { SAVE_BUTTON_TEXTS } from '../../../../constants';\n\nconst EntityHeader = ({\n saveButtonText,\n entityData,\n entityIdentifier,\n pageTitle,\n onSubmit,\n handlePublishAndUnpublish,\n isSaveButtonAvailable,\n isEnablePublishButton,\n isEnablePreviewButton,\n toggleCopyModal,\n toggleModal,\n formData,\n pageName,\n onViewUrl\n}) => {\n const SaveButtonModifiers = isSaveButtonAvailable ? ['small'] : ['small', 'disabled'];\n const showPreviewButton = isEnablePreviewButton && entityIdentifier && entityData.id;\n const shouldDisableMoreMenu = saveButtonText === SAVE_BUTTON_TEXTS.saving;\n\n return (\n <PageHeader title={pageTitle} pageName={pageName} onViewUrl={onViewUrl}>\n <PageHeader.Actions>\n <Button onClick={onSubmit} modifiers={SaveButtonModifiers} data-testid=\"button-save\">\n {saveButtonText}\n </Button>\n <More disabled={shouldDisableMoreMenu}>\n <More.Avatar data-testid={`entity-header-${pageName}`} isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu>\n {isEnablePublishButton && (\n <Button className=\"more-menu__link\" onClick={handlePublishAndUnpublish}>\n Publish\n </Button>\n )}\n {isEnablePublishButton && (\n <Button className=\"more-menu__link\" onClick={handlePublishAndUnpublish}>\n Unpublish\n </Button>\n )}\n {showPreviewButton && (\n <HeaderPreviewButton itemId={entityData.id} itemEntity={entityIdentifier} />\n )}\n <Button className=\"more-menu__link\" onClick={toggleCopyModal}>\n Copy data from\n </Button>\n {onViewUrl && (\n <Button className=\"more-menu__link\" onClick={onViewUrl}>\n View\n </Button>\n )}\n {formData &&\n Object.keys(formData.values).length !== 0 && (\n <Button className=\"more-menu__link\" onClick={toggleModal}>\n Delete\n </Button>\n )}\n </More.Content>\n </More>\n </PageHeader.Actions>\n </PageHeader>\n );\n};\n\nEntityHeader.propTypes = {\n entityData: PropTypes.object,\n entityIdentifier: PropTypes.string,\n pageTitle: PropTypes.string.isRequired,\n pageName: PropTypes.string,\n onSubmit: PropTypes.func.isRequired,\n handlePublishAndUnpublish: PropTypes.func.isRequired,\n isSaveButtonAvailable: PropTypes.bool.isRequired,\n isEnablePublishButton: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired,\n isEnablePreviewButton: PropTypes.bool.isRequired,\n toggleCopyModal: PropTypes.func.isRequired,\n toggleModal: PropTypes.func.isRequired,\n formData: PropTypes.object,\n onViewUrl: PropTypes.func.isRequired,\n saveButtonText: PropTypes.string\n};\n\nEntityHeader.defaultProps = {\n entityData: {},\n entityIdentifier: '',\n formData: null,\n pageName: '',\n saveButtonText: 'save'\n};\n\nEntityHeader.displayName = 'EntityHeader';\n\nexport default EntityHeader;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAY,OAeZ;EAAA,IAdJC,cAAc,QAAdA,cAAc;IACdC,UAAU,QAAVA,UAAU;IACVC,gBAAgB,QAAhBA,gBAAgB;IAChBC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IACRC,yBAAyB,QAAzBA,yBAAyB;IACzBC,qBAAqB,QAArBA,qBAAqB;IACrBC,qBAAqB,QAArBA,qBAAqB;IACrBC,qBAAqB,QAArBA,qBAAqB;IACrBC,eAAe,QAAfA,eAAe;IACfC,WAAW,QAAXA,WAAW;IACXC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,SAAS,QAATA,SAAS;EAET,IAAMC,mBAAmB,GAAGR,qBAAqB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC;EACrF,IAAMS,iBAAiB,GAAGP,qBAAqB,IAAIN,gBAAgB,IAAID,UAAU,CAACe,EAAE;EACpF,IAAMC,qBAAqB,GAAGjB,cAAc,KAAKkB,4BAAiB,CAACC,MAAM;EAEzE,oBACE,gCAAC,iBAAU;IAAC,KAAK,EAAEhB,SAAU;IAAC,QAAQ,EAAES,QAAS;IAAC,SAAS,EAAEC;EAAU,gBACrE,gCAAC,iBAAU,CAAC,OAAO,qBACjB,gCAAC,kBAAM;IAAC,OAAO,EAAET,QAAS;IAAC,SAAS,EAAEU,mBAAoB;IAAC,eAAY;EAAa,GACjFd,cAAc,CACR,eACT,gCAAC,gBAAI;IAAC,QAAQ,EAAEiB;EAAsB,gBACpC,gCAAC,gBAAI,CAAC,MAAM;IAAC,uCAA8BL,QAAQ,CAAG;IAAC,UAAU;EAAA,gBAC/D;IAAM,SAAS,EAAC;EAAgB,
|
|
1
|
+
{"version":3,"file":"EntityHeader.js","names":["EntityHeader","saveButtonText","entityData","entityIdentifier","pageTitle","onSubmit","handlePublishAndUnpublish","isSaveButtonAvailable","isEnablePublishButton","isEnablePreviewButton","toggleCopyModal","toggleModal","formData","pageName","onViewUrl","SaveButtonModifiers","showPreviewButton","id","shouldDisableMoreMenu","SAVE_BUTTON_TEXTS","saving","Object","keys","values","length","propTypes","PropTypes","object","string","isRequired","func","bool","oneOfType","defaultProps","displayName"],"sources":["../../../../../src/components/EntityManager/Entity/EntityHeader/EntityHeader.js"],"sourcesContent":["import React from 'react';\nimport { PageHeader } from '@blaze-cms/admin';\nimport Button from '@blaze-react/button';\nimport More from '@blaze-react/more';\nimport PropTypes from 'prop-types';\nimport HeaderPreviewButton from './HeaderPreviewButton';\nimport { SAVE_BUTTON_TEXTS } from '../../../../constants';\n\nconst EntityHeader = ({\n saveButtonText,\n entityData,\n entityIdentifier,\n pageTitle,\n onSubmit,\n handlePublishAndUnpublish,\n isSaveButtonAvailable,\n isEnablePublishButton,\n isEnablePreviewButton,\n toggleCopyModal,\n toggleModal,\n formData,\n pageName,\n onViewUrl\n}) => {\n const SaveButtonModifiers = isSaveButtonAvailable ? ['small'] : ['small', 'disabled'];\n const showPreviewButton = isEnablePreviewButton && entityIdentifier && entityData.id;\n const shouldDisableMoreMenu = saveButtonText === SAVE_BUTTON_TEXTS.saving;\n\n return (\n <PageHeader title={pageTitle} pageName={pageName} onViewUrl={onViewUrl}>\n <PageHeader.Actions>\n <Button onClick={onSubmit} modifiers={SaveButtonModifiers} data-testid=\"button-save\">\n {saveButtonText}\n </Button>\n <More disabled={shouldDisableMoreMenu}>\n <More.Avatar data-testid={`entity-header-${pageName}`} isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu>\n {isEnablePublishButton && (\n <Button className=\"more-menu__link\" onClick={handlePublishAndUnpublish}>\n Publish\n </Button>\n )}\n {isEnablePublishButton && (\n <Button className=\"more-menu__link\" onClick={handlePublishAndUnpublish}>\n Unpublish\n </Button>\n )}\n {showPreviewButton && (\n <HeaderPreviewButton itemId={entityData.id} itemEntity={entityIdentifier} />\n )}\n <Button className=\"more-menu__link\" onClick={toggleCopyModal}>\n Copy data from\n </Button>\n {onViewUrl && (\n <Button className=\"more-menu__link\" onClick={onViewUrl}>\n View\n </Button>\n )}\n {formData &&\n Object.keys(formData.values).length !== 0 && (\n <Button className=\"more-menu__link\" onClick={toggleModal}>\n Delete\n </Button>\n )}\n </More.Content>\n </More>\n </PageHeader.Actions>\n </PageHeader>\n );\n};\n\nEntityHeader.propTypes = {\n entityData: PropTypes.object,\n entityIdentifier: PropTypes.string,\n pageTitle: PropTypes.string.isRequired,\n pageName: PropTypes.string,\n onSubmit: PropTypes.func.isRequired,\n handlePublishAndUnpublish: PropTypes.func.isRequired,\n isSaveButtonAvailable: PropTypes.bool.isRequired,\n isEnablePublishButton: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired,\n isEnablePreviewButton: PropTypes.bool.isRequired,\n toggleCopyModal: PropTypes.func.isRequired,\n toggleModal: PropTypes.func.isRequired,\n formData: PropTypes.object,\n onViewUrl: PropTypes.func.isRequired,\n saveButtonText: PropTypes.string\n};\n\nEntityHeader.defaultProps = {\n entityData: {},\n entityIdentifier: '',\n formData: null,\n pageName: '',\n saveButtonText: 'save'\n};\n\nEntityHeader.displayName = 'EntityHeader';\n\nexport default EntityHeader;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAY,OAeZ;EAAA,IAdJC,cAAc,QAAdA,cAAc;IACdC,UAAU,QAAVA,UAAU;IACVC,gBAAgB,QAAhBA,gBAAgB;IAChBC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IACRC,yBAAyB,QAAzBA,yBAAyB;IACzBC,qBAAqB,QAArBA,qBAAqB;IACrBC,qBAAqB,QAArBA,qBAAqB;IACrBC,qBAAqB,QAArBA,qBAAqB;IACrBC,eAAe,QAAfA,eAAe;IACfC,WAAW,QAAXA,WAAW;IACXC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,SAAS,QAATA,SAAS;EAET,IAAMC,mBAAmB,GAAGR,qBAAqB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC;EACrF,IAAMS,iBAAiB,GAAGP,qBAAqB,IAAIN,gBAAgB,IAAID,UAAU,CAACe,EAAE;EACpF,IAAMC,qBAAqB,GAAGjB,cAAc,KAAKkB,4BAAiB,CAACC,MAAM;EAEzE,oBACE,gCAAC,iBAAU;IAAC,KAAK,EAAEhB,SAAU;IAAC,QAAQ,EAAES,QAAS;IAAC,SAAS,EAAEC;EAAU,gBACrE,gCAAC,iBAAU,CAAC,OAAO,qBACjB,gCAAC,kBAAM;IAAC,OAAO,EAAET,QAAS;IAAC,SAAS,EAAEU,mBAAoB;IAAC,eAAY;EAAa,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,CAACI,IAAI,CAACD,UAAU;EACnCvB,yBAAyB,EAAEoB,qBAAS,CAACI,IAAI,CAACD,UAAU;EACpDtB,qBAAqB,EAAEmB,qBAAS,CAACK,IAAI,CAACF,UAAU;EAChDrB,qBAAqB,EAAEkB,qBAAS,CAACM,SAAS,CAAC,CAACN,qBAAS,CAACE,MAAM,EAAEF,qBAAS,CAACK,IAAI,CAAC,CAAC,CAACF,UAAU;EACzFpB,qBAAqB,EAAEiB,qBAAS,CAACK,IAAI,CAACF,UAAU;EAChDnB,eAAe,EAAEgB,qBAAS,CAACI,IAAI,CAACD,UAAU;EAC1ClB,WAAW,EAAEe,qBAAS,CAACI,IAAI,CAACD,UAAU;EACtCjB,QAAQ,EAAEc,qBAAS,CAACC,MAAM;EAC1Bb,SAAS,EAAEY,qBAAS,CAACI,IAAI,CAACD,UAAU;EACpC5B,cAAc,EAAEyB,qBAAS,CAACE;AAC5B,CAAC;AAED5B,YAAY,CAACiC,YAAY,GAAG;EAC1B/B,UAAU,EAAE,CAAC,CAAC;EACdC,gBAAgB,EAAE,EAAE;EACpBS,QAAQ,EAAE,IAAI;EACdC,QAAQ,EAAE,EAAE;EACZZ,cAAc,EAAE;AAClB,CAAC;AAEDD,YAAY,CAACkC,WAAW,GAAG,cAAc;AAAC,eAE3BlC,YAAY;AAAA"}
|
package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js
CHANGED
|
@@ -23,35 +23,33 @@ var HeaderPreviewButton = function HeaderPreviewButton(_ref) {
|
|
|
23
23
|
if (process.env.BLAZE_DISABLE_PREVIEW) return null;
|
|
24
24
|
var onViewPreview = /*#__PURE__*/function () {
|
|
25
25
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
26
|
-
var _yield$createPreviewT, _yield$createPreviewT2, url;
|
|
26
|
+
var _yield$createPreviewT, _yield$createPreviewT2, _yield$createPreviewT3, url;
|
|
27
27
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
28
|
-
while (1) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return _context.stop();
|
|
54
|
-
}
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
_context.prev = 0;
|
|
31
|
+
_context.next = 3;
|
|
32
|
+
return createPreviewToken({
|
|
33
|
+
variables: {
|
|
34
|
+
itemId: itemId,
|
|
35
|
+
itemEntity: itemEntity
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
case 3:
|
|
39
|
+
_yield$createPreviewT = _context.sent;
|
|
40
|
+
_yield$createPreviewT2 = _yield$createPreviewT.data;
|
|
41
|
+
_yield$createPreviewT3 = _yield$createPreviewT2 === void 0 ? {} : _yield$createPreviewT2;
|
|
42
|
+
url = _yield$createPreviewT3.createPreviewToken.result.url;
|
|
43
|
+
if (url) window.open(url, '_blank');
|
|
44
|
+
// eslint-disable-next-line no-empty
|
|
45
|
+
_context.next = 12;
|
|
46
|
+
break;
|
|
47
|
+
case 10:
|
|
48
|
+
_context.prev = 10;
|
|
49
|
+
_context.t0 = _context["catch"](0);
|
|
50
|
+
case 12:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
55
53
|
}
|
|
56
54
|
}, _callee, null, [[0, 10]]);
|
|
57
55
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderPreviewButton.js","names":["HeaderPreviewButton","itemId","itemEntity","useMutation","getMutation","createPreviewToken","process","env","BLAZE_DISABLE_PREVIEW","onViewPreview","variables","data","url","result","window","open","propTypes","PropTypes","string","isRequired"],"sources":["../../../../../../src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '@blaze-react/button';\nimport { useMutation } from '@apollo/client';\nimport { getMutation } from '@blaze-cms/admin-ui-utils';\n\nconst HeaderPreviewButton = ({ itemId, itemEntity }) => {\n const [createPreviewToken] = useMutation(getMutation('PREVIEW_TOKEN_MUTATION'));\n if (process.env.BLAZE_DISABLE_PREVIEW) return null;\n\n const onViewPreview = async () => {\n try {\n const {\n data: {\n createPreviewToken: {\n result: { url }\n }\n } = {}\n } = await createPreviewToken({\n variables: {\n itemId,\n itemEntity\n }\n });\n\n if (url) window.open(url, '_blank');\n // eslint-disable-next-line no-empty\n } catch (err) {}\n };\n\n return (\n <Button className=\"more-menu__link\" onClick={onViewPreview}>\n Preview\n </Button>\n );\n};\n\nHeaderPreviewButton.propTypes = {\n itemId: PropTypes.string.isRequired,\n itemEntity: PropTypes.string.isRequired\n};\n\nexport default HeaderPreviewButton;\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmB,OAA+B;EAAA,IAAzBC,MAAM,QAANA,MAAM;IAAEC,UAAU,QAAVA,UAAU;EAC/C,mBAA6B,IAAAC,mBAAW,EAAC,IAAAC,yBAAW,EAAC,wBAAwB,CAAC,CAAC;IAAA;IAAxEC,kBAAkB;EACzB,IAAIC,OAAO,CAACC,GAAG,CAACC,qBAAqB,EAAE,OAAO,IAAI;EAElD,IAAMC,aAAa;IAAA,0FAAG;MAAA;MAAA;QAAA;UAAA;YAAA;
|
|
1
|
+
{"version":3,"file":"HeaderPreviewButton.js","names":["HeaderPreviewButton","itemId","itemEntity","useMutation","getMutation","createPreviewToken","process","env","BLAZE_DISABLE_PREVIEW","onViewPreview","variables","data","url","result","window","open","propTypes","PropTypes","string","isRequired"],"sources":["../../../../../../src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '@blaze-react/button';\nimport { useMutation } from '@apollo/client';\nimport { getMutation } from '@blaze-cms/admin-ui-utils';\n\nconst HeaderPreviewButton = ({ itemId, itemEntity }) => {\n const [createPreviewToken] = useMutation(getMutation('PREVIEW_TOKEN_MUTATION'));\n if (process.env.BLAZE_DISABLE_PREVIEW) return null;\n\n const onViewPreview = async () => {\n try {\n const {\n data: {\n createPreviewToken: {\n result: { url }\n }\n } = {}\n } = await createPreviewToken({\n variables: {\n itemId,\n itemEntity\n }\n });\n\n if (url) window.open(url, '_blank');\n // eslint-disable-next-line no-empty\n } catch (err) {}\n };\n\n return (\n <Button className=\"more-menu__link\" onClick={onViewPreview}>\n Preview\n </Button>\n );\n};\n\nHeaderPreviewButton.propTypes = {\n itemId: PropTypes.string.isRequired,\n itemEntity: PropTypes.string.isRequired\n};\n\nexport default HeaderPreviewButton;\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmB,OAA+B;EAAA,IAAzBC,MAAM,QAANA,MAAM;IAAEC,UAAU,QAAVA,UAAU;EAC/C,mBAA6B,IAAAC,mBAAW,EAAC,IAAAC,yBAAW,EAAC,wBAAwB,CAAC,CAAC;IAAA;IAAxEC,kBAAkB;EACzB,IAAIC,OAAO,CAACC,GAAG,CAACC,qBAAqB,EAAE,OAAO,IAAI;EAElD,IAAMC,aAAa;IAAA,0FAAG;MAAA;MAAA;QAAA;UAAA;YAAA;YAAA;YAAA,OAQRJ,kBAAkB,CAAC;cAC3BK,SAAS,EAAE;gBACTT,MAAM,EAANA,MAAM;gBACNC,UAAU,EAAVA;cACF;YACF,CAAC,CAAC;UAAA;YAAA;YAAA,+CAVAS,IAAI;YAAA,6DAIA,CAAC,CAAC;YAFQC,GAAG,0BADfP,kBAAkB,CAChBQ,MAAM,CAAID,GAAG;YAUnB,IAAIA,GAAG,EAAEE,MAAM,CAACC,IAAI,CAACH,GAAG,EAAE,QAAQ,CAAC;YACnC;YAAA;YAAA;UAAA;YAAA;YAAA;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA,CAEH;IAAA,gBAlBKH,aAAa;MAAA;IAAA;EAAA,GAkBlB;EAED,oBACE,gCAAC,kBAAM;IAAC,SAAS,EAAC,iBAAiB;IAAC,OAAO,EAAEA;EAAc,GAAC,SAE5D,CAAS;AAEb,CAAC;AAEDT,mBAAmB,CAACgB,SAAS,GAAG;EAC9Bf,MAAM,EAAEgB,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCjB,UAAU,EAAEe,qBAAS,CAACC,MAAM,CAACC;AAC/B,CAAC;AAAC,eAEanB,mBAAmB;AAAA"}
|
|
@@ -50,90 +50,84 @@ var SideBarRelations = function SideBarRelations(_ref) {
|
|
|
50
50
|
(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
51
51
|
var fetchRelationSchema, allRelationComponents;
|
|
52
52
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
53
|
-
while (1) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
_context.next = 3;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
return _context.abrupt("return", null);
|
|
69
|
-
case 3:
|
|
70
|
-
_context.next = 5;
|
|
71
|
-
return client.query({
|
|
72
|
-
query: (0, _adminUiUtils.getQuery)('GET_ENTITY_SCHEMA'),
|
|
73
|
-
variables: {
|
|
74
|
-
identifier: entityIdentifier
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
case 5:
|
|
78
|
-
_yield$client$query = _context.sent;
|
|
79
|
-
_yield$client$query$d = (0, _slicedToArray2["default"])(_yield$client$query.data.getEntitySchemas, 1);
|
|
80
|
-
relationSchema = _yield$client$query$d[0];
|
|
81
|
-
return _context.abrupt("return", relationSchema);
|
|
82
|
-
case 9:
|
|
83
|
-
case "end":
|
|
84
|
-
return _context.stop();
|
|
53
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
fetchRelationSchema = /*#__PURE__*/function () {
|
|
56
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref3) {
|
|
57
|
+
var entityIdentifier, _yield$client$query, _yield$client$query$d, relationSchema;
|
|
58
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
59
|
+
while (1) switch (_context.prev = _context.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
entityIdentifier = _ref3.entityIdentifier;
|
|
62
|
+
if (entityIdentifier) {
|
|
63
|
+
_context.next = 3;
|
|
64
|
+
break;
|
|
85
65
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
66
|
+
return _context.abrupt("return", null);
|
|
67
|
+
case 3:
|
|
68
|
+
_context.next = 5;
|
|
69
|
+
return client.query({
|
|
70
|
+
query: (0, _adminUiUtils.getQuery)('GET_ENTITY_SCHEMA'),
|
|
71
|
+
variables: {
|
|
72
|
+
identifier: entityIdentifier
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
case 5:
|
|
76
|
+
_yield$client$query = _context.sent;
|
|
77
|
+
_yield$client$query$d = (0, _slicedToArray2["default"])(_yield$client$query.data.getEntitySchemas, 1);
|
|
78
|
+
relationSchema = _yield$client$query$d[0];
|
|
79
|
+
return _context.abrupt("return", relationSchema);
|
|
80
|
+
case 9:
|
|
81
|
+
case "end":
|
|
82
|
+
return _context.stop();
|
|
83
|
+
}
|
|
84
|
+
}, _callee);
|
|
85
|
+
}));
|
|
86
|
+
return function fetchRelationSchema(_x) {
|
|
87
|
+
return _ref4.apply(this, arguments);
|
|
88
|
+
};
|
|
89
|
+
}();
|
|
90
|
+
if (!(!relationsComponents && schema)) {
|
|
91
|
+
_context3.next = 6;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
_context3.next = 4;
|
|
95
|
+
return Promise.all(schema.relations.filter(function (_ref5) {
|
|
96
|
+
var showInForm = _ref5.showInForm,
|
|
97
|
+
foreignKey = _ref5.foreignKey;
|
|
98
|
+
return showInForm && schema.properties[foreignKey];
|
|
99
|
+
}).map( /*#__PURE__*/function () {
|
|
100
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(relation) {
|
|
101
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
102
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
_context2.t0 = (0, _v["default"])();
|
|
105
|
+
_context2.t1 = relation;
|
|
106
|
+
_context2.next = 4;
|
|
107
|
+
return fetchRelationSchema(relation);
|
|
108
|
+
case 4:
|
|
109
|
+
_context2.t2 = _context2.sent;
|
|
110
|
+
return _context2.abrupt("return", {
|
|
111
|
+
id: _context2.t0,
|
|
112
|
+
staticData: _context2.t1,
|
|
113
|
+
schema: _context2.t2
|
|
114
|
+
});
|
|
115
|
+
case 6:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context2.stop();
|
|
118
|
+
}
|
|
119
|
+
}, _callee2);
|
|
120
|
+
}));
|
|
121
|
+
return function (_x2) {
|
|
122
|
+
return _ref6.apply(this, arguments);
|
|
123
|
+
};
|
|
124
|
+
}()));
|
|
125
|
+
case 4:
|
|
126
|
+
allRelationComponents = _context3.sent;
|
|
127
|
+
setRelationsComponents(allRelationComponents);
|
|
128
|
+
case 6:
|
|
129
|
+
case "end":
|
|
130
|
+
return _context3.stop();
|
|
137
131
|
}
|
|
138
132
|
}, _callee3);
|
|
139
133
|
}))();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SideBarRelations","schema","onChange","formData","entity","RelationComponent","formFieldTypes","relation","formattedStatus","formattedUpdated","formattedCreated","formattedPublished","status","client","useApolloClient","useState","relationsComponents","setRelationsComponents","useEffect","fetchRelationSchema","entityIdentifier","query","getQuery","variables","identifier","data","getEntitySchemas","relationSchema","Promise","all","relations","filter","showInForm","foreignKey","properties","map","uuidv1","id","staticData","allRelationComponents","itemId","itemEntity","interfaces","statusClassName","classnames","PUBLISHED","UNPUBLISHED","entitySchema","propTypes","PropTypes","object","isRequired","func","defaultProps"],"sources":["../../../../../src/components/EntityManager/Entity/SideBarRelations/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport uuidv1 from 'uuid/v1';\nimport { useApolloClient } from '@apollo/client';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { formFieldTypes } from '@blaze-cms/react-form-builder';\nimport classnames from 'classnames';\nimport { VersionsList } from '@blaze-cms/versioning-ui';\nimport { PUBLISHED, UNPUBLISHED } from '../../../../constants';\n\nconst SideBarRelations = ({ schema, onChange, formData, entity }) => {\n const { relation: RelationComponent } = formFieldTypes;\n const {\n formattedStatus,\n formattedUpdated,\n formattedCreated,\n formattedPublished,\n status\n } = formData;\n const client = useApolloClient();\n const [relationsComponents, setRelationsComponents] = useState(null);\n useEffect(\n () => {\n (async () => {\n const fetchRelationSchema = async ({ entityIdentifier }) => {\n if (!entityIdentifier) return null;\n\n const {\n data: {\n getEntitySchemas: [relationSchema]\n }\n } = await client.query({\n query: getQuery('GET_ENTITY_SCHEMA'),\n variables: { identifier: entityIdentifier }\n });\n return relationSchema;\n };\n\n if (!relationsComponents && schema) {\n const allRelationComponents = await Promise.all(\n schema.relations\n .filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])\n .map(async relation => ({\n id: uuidv1(),\n staticData: relation,\n schema: await fetchRelationSchema(relation)\n }))\n );\n\n setRelationsComponents(allRelationComponents);\n }\n })();\n },\n [client, relationsComponents, schema, schema.relations]\n );\n const { id: itemId } = entity;\n const { identifier: itemEntity, interfaces } = schema;\n\n const statusClassName = classnames('sidebar__status__badge', {\n 'sidebar__status__badge--published': status === PUBLISHED,\n 'sidebar__status__badge--unpublished': status === UNPUBLISHED\n });\n\n return (\n <div className=\"sidebar\" data-testid=\"sideBarRelations-main-div\">\n <div className=\"sidebar__content\">\n {formattedCreated && (\n <div className=\"sidebar__status\">\n <div className=\"sidebar__status__wrapper\">\n <b>Status</b>\n <span className={statusClassName}>{formattedStatus}</span>\n </div>\n {formattedStatus === PUBLISHED && (\n <p>\n {formattedStatus} on: <span> {formattedPublished}</span>\n </p>\n )}\n\n <p>\n Created: <span>{formattedCreated}</span>\n </p>\n <p>\n Updated: <span>{formattedUpdated}</span>\n </p>\n </div>\n )}\n\n <VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />\n {relationsComponents &&\n relationsComponents.map(({ id, staticData, schema: entitySchema }) => (\n <RelationComponent\n formData={formData}\n schema={entitySchema}\n key={id}\n staticData={staticData}\n onSelect={onChange}\n />\n ))}\n </div>\n </div>\n );\n};\n\nSideBarRelations.propTypes = {\n schema: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n formData: PropTypes.object.isRequired,\n entity: PropTypes.object\n};\n\nSideBarRelations.defaultProps = {\n entity: {}\n};\n\nexport default SideBarRelations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAA+D;AAAA;AAE/D,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB,OAA+C;EAAA,IAAzCC,MAAM,QAANA,MAAM;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,MAAM,QAANA,MAAM;EAC5D,IAAkBC,iBAAiB,GAAKC,gCAAc,CAA9CC,QAAQ;EAChB,IACEC,eAAe,GAKbL,QAAQ,CALVK,eAAe;IACfC,gBAAgB,GAIdN,QAAQ,CAJVM,gBAAgB;IAChBC,gBAAgB,GAGdP,QAAQ,CAHVO,gBAAgB;IAChBC,kBAAkB,GAEhBR,QAAQ,CAFVQ,kBAAkB;IAClBC,MAAM,GACJT,QAAQ,CADVS,MAAM;EAER,IAAMC,MAAM,GAAG,IAAAC,uBAAe,GAAE;EAChC,gBAAsD,IAAAC,eAAQ,EAAC,IAAI,CAAC;IAAA;IAA7DC,mBAAmB;IAAEC,sBAAsB;EAClD,IAAAC,gBAAS,EACP,YAAM;IACJ,8EAAC;MAAA;MAAA;QAAA;UAAA;
|
|
1
|
+
{"version":3,"file":"index.js","names":["SideBarRelations","schema","onChange","formData","entity","RelationComponent","formFieldTypes","relation","formattedStatus","formattedUpdated","formattedCreated","formattedPublished","status","client","useApolloClient","useState","relationsComponents","setRelationsComponents","useEffect","fetchRelationSchema","entityIdentifier","query","getQuery","variables","identifier","data","getEntitySchemas","relationSchema","Promise","all","relations","filter","showInForm","foreignKey","properties","map","uuidv1","id","staticData","allRelationComponents","itemId","itemEntity","interfaces","statusClassName","classnames","PUBLISHED","UNPUBLISHED","entitySchema","propTypes","PropTypes","object","isRequired","func","defaultProps"],"sources":["../../../../../src/components/EntityManager/Entity/SideBarRelations/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport uuidv1 from 'uuid/v1';\nimport { useApolloClient } from '@apollo/client';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { formFieldTypes } from '@blaze-cms/react-form-builder';\nimport classnames from 'classnames';\nimport { VersionsList } from '@blaze-cms/versioning-ui';\nimport { PUBLISHED, UNPUBLISHED } from '../../../../constants';\n\nconst SideBarRelations = ({ schema, onChange, formData, entity }) => {\n const { relation: RelationComponent } = formFieldTypes;\n const {\n formattedStatus,\n formattedUpdated,\n formattedCreated,\n formattedPublished,\n status\n } = formData;\n const client = useApolloClient();\n const [relationsComponents, setRelationsComponents] = useState(null);\n useEffect(\n () => {\n (async () => {\n const fetchRelationSchema = async ({ entityIdentifier }) => {\n if (!entityIdentifier) return null;\n\n const {\n data: {\n getEntitySchemas: [relationSchema]\n }\n } = await client.query({\n query: getQuery('GET_ENTITY_SCHEMA'),\n variables: { identifier: entityIdentifier }\n });\n return relationSchema;\n };\n\n if (!relationsComponents && schema) {\n const allRelationComponents = await Promise.all(\n schema.relations\n .filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])\n .map(async relation => ({\n id: uuidv1(),\n staticData: relation,\n schema: await fetchRelationSchema(relation)\n }))\n );\n\n setRelationsComponents(allRelationComponents);\n }\n })();\n },\n [client, relationsComponents, schema, schema.relations]\n );\n const { id: itemId } = entity;\n const { identifier: itemEntity, interfaces } = schema;\n\n const statusClassName = classnames('sidebar__status__badge', {\n 'sidebar__status__badge--published': status === PUBLISHED,\n 'sidebar__status__badge--unpublished': status === UNPUBLISHED\n });\n\n return (\n <div className=\"sidebar\" data-testid=\"sideBarRelations-main-div\">\n <div className=\"sidebar__content\">\n {formattedCreated && (\n <div className=\"sidebar__status\">\n <div className=\"sidebar__status__wrapper\">\n <b>Status</b>\n <span className={statusClassName}>{formattedStatus}</span>\n </div>\n {formattedStatus === PUBLISHED && (\n <p>\n {formattedStatus} on: <span> {formattedPublished}</span>\n </p>\n )}\n\n <p>\n Created: <span>{formattedCreated}</span>\n </p>\n <p>\n Updated: <span>{formattedUpdated}</span>\n </p>\n </div>\n )}\n\n <VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />\n {relationsComponents &&\n relationsComponents.map(({ id, staticData, schema: entitySchema }) => (\n <RelationComponent\n formData={formData}\n schema={entitySchema}\n key={id}\n staticData={staticData}\n onSelect={onChange}\n />\n ))}\n </div>\n </div>\n );\n};\n\nSideBarRelations.propTypes = {\n schema: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n formData: PropTypes.object.isRequired,\n entity: PropTypes.object\n};\n\nSideBarRelations.defaultProps = {\n entity: {}\n};\n\nexport default SideBarRelations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAA+D;AAAA;AAE/D,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB,OAA+C;EAAA,IAAzCC,MAAM,QAANA,MAAM;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,MAAM,QAANA,MAAM;EAC5D,IAAkBC,iBAAiB,GAAKC,gCAAc,CAA9CC,QAAQ;EAChB,IACEC,eAAe,GAKbL,QAAQ,CALVK,eAAe;IACfC,gBAAgB,GAIdN,QAAQ,CAJVM,gBAAgB;IAChBC,gBAAgB,GAGdP,QAAQ,CAHVO,gBAAgB;IAChBC,kBAAkB,GAEhBR,QAAQ,CAFVQ,kBAAkB;IAClBC,MAAM,GACJT,QAAQ,CADVS,MAAM;EAER,IAAMC,MAAM,GAAG,IAAAC,uBAAe,GAAE;EAChC,gBAAsD,IAAAC,eAAQ,EAAC,IAAI,CAAC;IAAA;IAA7DC,mBAAmB;IAAEC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AEE,QAAS;MACnB,MAAM,EAAE4C,YAAa;MACrB,GAAG,EAAEV,EAAG;MACR,UAAU,EAAEC,UAAW;MACvB,QAAQ,EAAEpC;IAAS,EACnB;EAAA,CACH,CAAC,CACA,CACF;AAEV,CAAC;AAEDF,gBAAgB,CAACgD,SAAS,GAAG;EAC3B/C,MAAM,EAAEgD,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCjD,QAAQ,EAAE+C,qBAAS,CAACG,IAAI,CAACD,UAAU;EACnChD,QAAQ,EAAE8C,qBAAS,CAACC,MAAM,CAACC,UAAU;EACrC/C,MAAM,EAAE6C,qBAAS,CAACC;AACpB,CAAC;AAEDlD,gBAAgB,CAACqD,YAAY,GAAG;EAC9BjD,MAAM,EAAE,CAAC;AACX,CAAC;AAAC,eAEaJ,gBAAgB;AAAA"}
|
|
@@ -17,48 +17,46 @@ var submit = /*#__PURE__*/function () {
|
|
|
17
17
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref, addToast) {
|
|
18
18
|
var entitySchema, parsedFormValues, client, setEntityData, setIsSaveButtonAvailable, setSaveButtonText, history, setIsNewEntity, mutation, _yield$client$mutate, createdEntityResult, updatePathname;
|
|
19
19
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
20
|
-
while (1) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return _context.stop();
|
|
61
|
-
}
|
|
20
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
entitySchema = _ref.entitySchema, parsedFormValues = _ref.parsedFormValues, client = _ref.client, setEntityData = _ref.setEntityData, setIsSaveButtonAvailable = _ref.setIsSaveButtonAvailable, setSaveButtonText = _ref.setSaveButtonText, history = _ref.history, setIsNewEntity = _ref.setIsNewEntity;
|
|
23
|
+
mutation = (0, _buildCreateEntityMutation["default"])(entitySchema);
|
|
24
|
+
_context.prev = 2;
|
|
25
|
+
setIsSaveButtonAvailable(false);
|
|
26
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.saving);
|
|
27
|
+
_context.next = 7;
|
|
28
|
+
return client.mutate({
|
|
29
|
+
mutation: mutation,
|
|
30
|
+
variables: {
|
|
31
|
+
input: parsedFormValues
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
case 7:
|
|
35
|
+
_yield$client$mutate = _context.sent;
|
|
36
|
+
createdEntityResult = _yield$client$mutate.data.createdEntity;
|
|
37
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.saved);
|
|
38
|
+
setEntityData(createdEntityResult.result);
|
|
39
|
+
setIsNewEntity(false);
|
|
40
|
+
updatePathname = history.location.pathname.replace('create', 'update');
|
|
41
|
+
history.push("".concat(updatePathname, "/").concat(createdEntityResult.result.id));
|
|
42
|
+
addToast("Created", {
|
|
43
|
+
appearance: 'success',
|
|
44
|
+
autoDismiss: true
|
|
45
|
+
});
|
|
46
|
+
_context.next = 22;
|
|
47
|
+
break;
|
|
48
|
+
case 17:
|
|
49
|
+
_context.prev = 17;
|
|
50
|
+
_context.t0 = _context["catch"](2);
|
|
51
|
+
setIsSaveButtonAvailable(true);
|
|
52
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
|
|
53
|
+
addToast(_context.t0.message, {
|
|
54
|
+
appearance: 'error',
|
|
55
|
+
autoDismiss: true
|
|
56
|
+
});
|
|
57
|
+
case 22:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
62
60
|
}
|
|
63
61
|
}, _callee, null, [[2, 17]]);
|
|
64
62
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.js","names":["submit","addToast","entitySchema","parsedFormValues","client","setEntityData","setIsSaveButtonAvailable","setSaveButtonText","history","setIsNewEntity","mutation","buildCreateEntityMutation","SAVE_BUTTON_TEXTS","saving","mutate","variables","input","createdEntityResult","data","createdEntity","saved","result","updatePathname","location","pathname","replace","push","id","appearance","autoDismiss","save","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/create/submit.js"],"sourcesContent":["import buildCreateEntityMutation from '../../../../../utils/build-create-entity-mutation';\nimport { SAVE_BUTTON_TEXTS } from '../../../../../constants';\n\nconst submit = async (\n {\n entitySchema,\n parsedFormValues,\n client,\n setEntityData,\n setIsSaveButtonAvailable,\n setSaveButtonText,\n history,\n setIsNewEntity\n },\n addToast\n) => {\n const mutation = buildCreateEntityMutation(entitySchema);\n\n try {\n setIsSaveButtonAvailable(false);\n setSaveButtonText(SAVE_BUTTON_TEXTS.saving);\n const {\n data: { createdEntity: createdEntityResult }\n } = await client.mutate({\n mutation,\n variables: { input: parsedFormValues }\n });\n\n setSaveButtonText(SAVE_BUTTON_TEXTS.saved);\n setEntityData(createdEntityResult.result);\n setIsNewEntity(false);\n\n const updatePathname = history.location.pathname.replace('create', 'update');\n history.push(`${updatePathname}/${createdEntityResult.result.id}`);\n addToast(`Created`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n setIsSaveButtonAvailable(true);\n setSaveButtonText(SAVE_BUTTON_TEXTS.save);\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n};\n\nexport { submit };\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAEA,IAAMA,MAAM;EAAA,0FAAG,uBAWbC,QAAQ;IAAA;IAAA;MAAA;QAAA;
|
|
1
|
+
{"version":3,"file":"submit.js","names":["submit","addToast","entitySchema","parsedFormValues","client","setEntityData","setIsSaveButtonAvailable","setSaveButtonText","history","setIsNewEntity","mutation","buildCreateEntityMutation","SAVE_BUTTON_TEXTS","saving","mutate","variables","input","createdEntityResult","data","createdEntity","saved","result","updatePathname","location","pathname","replace","push","id","appearance","autoDismiss","save","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/create/submit.js"],"sourcesContent":["import buildCreateEntityMutation from '../../../../../utils/build-create-entity-mutation';\nimport { SAVE_BUTTON_TEXTS } from '../../../../../constants';\n\nconst submit = async (\n {\n entitySchema,\n parsedFormValues,\n client,\n setEntityData,\n setIsSaveButtonAvailable,\n setSaveButtonText,\n history,\n setIsNewEntity\n },\n addToast\n) => {\n const mutation = buildCreateEntityMutation(entitySchema);\n\n try {\n setIsSaveButtonAvailable(false);\n setSaveButtonText(SAVE_BUTTON_TEXTS.saving);\n const {\n data: { createdEntity: createdEntityResult }\n } = await client.mutate({\n mutation,\n variables: { input: parsedFormValues }\n });\n\n setSaveButtonText(SAVE_BUTTON_TEXTS.saved);\n setEntityData(createdEntityResult.result);\n setIsNewEntity(false);\n\n const updatePathname = history.location.pathname.replace('create', 'update');\n history.push(`${updatePathname}/${createdEntityResult.result.id}`);\n addToast(`Created`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n setIsSaveButtonAvailable(true);\n setSaveButtonText(SAVE_BUTTON_TEXTS.save);\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n};\n\nexport { submit };\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAEA,IAAMA,MAAM;EAAA,0FAAG,uBAWbC,QAAQ;IAAA;IAAA;MAAA;QAAA;UATNC,YAAY,QAAZA,YAAY,EACZC,gBAAgB,QAAhBA,gBAAgB,EAChBC,MAAM,QAANA,MAAM,EACNC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E__*/function () {
|
|
|
13
13
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref, addToast) {
|
|
14
14
|
var entitySchema, parsedFormValues, client, mutation, id;
|
|
15
15
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
16
|
-
while (1) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
id: id
|
|
29
|
-
}
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
entitySchema = _ref.entitySchema, parsedFormValues = _ref.parsedFormValues, client = _ref.client;
|
|
19
|
+
mutation = (0, _buildDeleteEntityMutation["default"])(entitySchema);
|
|
20
|
+
id = parsedFormValues.id;
|
|
21
|
+
_context.prev = 3;
|
|
22
|
+
_context.next = 6;
|
|
23
|
+
return client.mutate({
|
|
24
|
+
mutation: mutation,
|
|
25
|
+
variables: {
|
|
26
|
+
input: {
|
|
27
|
+
id: id
|
|
30
28
|
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
case 6:
|
|
32
|
+
addToast('Deleted', {
|
|
33
|
+
appearance: 'success',
|
|
34
|
+
autoDismiss: true
|
|
35
|
+
});
|
|
36
|
+
_context.next = 12;
|
|
37
|
+
break;
|
|
38
|
+
case 9:
|
|
39
|
+
_context.prev = 9;
|
|
40
|
+
_context.t0 = _context["catch"](3);
|
|
41
|
+
addToast(_context.t0.message, {
|
|
42
|
+
appearance: 'error',
|
|
43
|
+
autoDismiss: true
|
|
44
|
+
});
|
|
45
|
+
case 12:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context.stop();
|
|
50
48
|
}
|
|
51
49
|
}, _callee, null, [[3, 9]]);
|
|
52
50
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","names":["submit","addToast","entitySchema","parsedFormValues","client","mutation","buildDeleteEntityMutation","id","mutate","variables","input","appearance","autoDismiss","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/delete/delete.js"],"sourcesContent":["import buildDeleteEntityMutation from '../../../../../utils/build-delete-entity-mutation';\n\nconst submit = async ({ entitySchema, parsedFormValues, client }, addToast) => {\n const mutation = buildDeleteEntityMutation(entitySchema);\n const { id } = parsedFormValues;\n\n try {\n await client.mutate({\n mutation,\n variables: { input: { id } }\n });\n addToast('Deleted', {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n};\n\nexport { submit };\n"],"mappings":";;;;;;;;;;AAAA;AAEA,IAAMA,MAAM;EAAA,0FAAG,uBAAmDC,QAAQ;IAAA;IAAA;MAAA;QAAA;
|
|
1
|
+
{"version":3,"file":"delete.js","names":["submit","addToast","entitySchema","parsedFormValues","client","mutation","buildDeleteEntityMutation","id","mutate","variables","input","appearance","autoDismiss","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/delete/delete.js"],"sourcesContent":["import buildDeleteEntityMutation from '../../../../../utils/build-delete-entity-mutation';\n\nconst submit = async ({ entitySchema, parsedFormValues, client }, addToast) => {\n const mutation = buildDeleteEntityMutation(entitySchema);\n const { id } = parsedFormValues;\n\n try {\n await client.mutate({\n mutation,\n variables: { input: { id } }\n });\n addToast('Deleted', {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n};\n\nexport { submit };\n"],"mappings":";;;;;;;;;;AAAA;AAEA,IAAMA,MAAM;EAAA,0FAAG,uBAAmDC,QAAQ;IAAA;IAAA;MAAA;QAAA;UAAlDC,YAAY,QAAZA,YAAY,EAAEC,gBAAgB,QAAhBA,gBAAgB,EAAEC,MAAM,QAANA,MAAM;UACtDC,QAAQ,GAAG,IAAAC,qCAAyB,EAACJ,YAAY,CAAC;UAChDK,EAAE,GAAKJ,gBAAgB,CAAvBI,EAAE;UAAA;UAAA;UAAA,OAGFH,MAAM,CAACI,MAAM,CAAC;YAClBH,QAAQ,EAARA,QAAQ;YACRI,SAAS,EAAE;cAAEC,KAAK,EAAE;gBAAEH,EAAE,EAAFA;cAAG;YAAE;UAC7B,CAAC,CAAC;QAAA;UACFN,QAAQ,CAAC,SAAS,EAAE;YAClBU,UAAU,EAAE,SAAS;YACrBC,WAAW,EAAE;UACf,CAAC,CAAC;UAAC;UAAA;QAAA;UAAA;UAAA;UAEHX,QAAQ,CAAC,YAAMY,OAAO,EAAE;YACtBF,UAAU,EAAE,OAAO;YACnBC,WAAW,EAAE;UACf,CAAC,CAAC;QAAC;QAAA;UAAA;MAAA;IAAA;EAAA,CAEN;EAAA,gBAnBKZ,MAAM;IAAA;EAAA;AAAA,GAmBX;AAAC"}
|