@strapi/review-workflows 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d → 0.0.0-experimental.da85533897155e719d784f0271223c866d2f69ab
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/LICENSE +12 -17
- package/dist/_chunks/{Layout-y4m6QHjX.js → Layout-AREWDuuq.js} +8 -9
- package/dist/_chunks/Layout-AREWDuuq.js.map +1 -0
- package/dist/_chunks/{Layout-BDKzgDbH.mjs → Layout-D5aa9iUm.mjs} +8 -9
- package/dist/_chunks/Layout-D5aa9iUm.mjs.map +1 -0
- package/dist/_chunks/{_id-CB3lqKgb.js → _id-C7pCAzXV.js} +34 -70
- package/dist/_chunks/_id-C7pCAzXV.js.map +1 -0
- package/dist/_chunks/{_id-yOfUu1Rs.mjs → _id-DDNHKV_W.mjs} +34 -70
- package/dist/_chunks/_id-DDNHKV_W.mjs.map +1 -0
- package/dist/_chunks/{index-CNKQvAnM.js → index-Bv3cQ3c-.js} +4 -4
- package/dist/_chunks/index-Bv3cQ3c-.js.map +1 -0
- package/dist/_chunks/{index-Bj7gelY1.js → index-CIBLMG85.js} +57 -49
- package/dist/_chunks/index-CIBLMG85.js.map +1 -0
- package/dist/_chunks/{index--7HYUi67.mjs → index-CeaoNBIP.mjs} +4 -4
- package/dist/_chunks/index-CeaoNBIP.mjs.map +1 -0
- package/dist/_chunks/{index-Bx0Y1GZR.mjs → index-Cx5QECZI.mjs} +58 -50
- package/dist/_chunks/index-Cx5QECZI.mjs.map +1 -0
- package/dist/_chunks/{router-t6Nj4F0T.mjs → router-BEoNwQZ1.mjs} +3 -3
- package/dist/_chunks/{router-t6Nj4F0T.mjs.map → router-BEoNwQZ1.mjs.map} +1 -1
- package/dist/_chunks/{router-LZ2xbb95.js → router-gRPIa2_c.js} +3 -3
- package/dist/_chunks/{router-LZ2xbb95.js.map → router-gRPIa2_c.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/services/admin.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/content-manager.d.ts +4 -4
- package/dist/admin/src/services/settings.d.ts +1733 -7
- package/dist/server/index.js +12 -53
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +12 -53
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts +0 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/stages.d.ts.map +1 -1
- package/dist/server/src/controllers/workflows.d.ts +0 -7
- package/dist/server/src/controllers/workflows.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +1 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
- package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +1 -1
- package/dist/server/src/services/stages.d.ts +2 -7
- package/dist/server/src/services/stages.d.ts.map +1 -1
- package/dist/shared/contracts/review-workflows.d.ts +1 -14
- package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/_chunks/Layout-BDKzgDbH.mjs.map +0 -1
- package/dist/_chunks/Layout-y4m6QHjX.js.map +0 -1
- package/dist/_chunks/_id-CB3lqKgb.js.map +0 -1
- package/dist/_chunks/_id-yOfUu1Rs.mjs.map +0 -1
- package/dist/_chunks/index--7HYUi67.mjs.map +0 -1
- package/dist/_chunks/index-Bj7gelY1.js.map +0 -1
- package/dist/_chunks/index-Bx0Y1GZR.mjs.map +0 -1
- package/dist/_chunks/index-CNKQvAnM.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
Copyright (c) 2015-present Strapi Solutions SAS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
* All software that resides within this directory and its subdirectories, is licensed under the license defined below.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Enterprise License
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
|
|
8
|
+
https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
|
|
9
|
+
represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
|
|
10
|
+
agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
|
|
11
|
+
Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions:
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
13
|
+
BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
|
|
14
|
+
IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
|
|
15
|
+
HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
|
|
16
|
+
THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
|
|
17
|
+
IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const React = require("react");
|
|
3
3
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
4
4
|
const reactIntl = require("react-intl");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-CIBLMG85.js");
|
|
6
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
const reactDnd = require("react-dnd");
|
|
@@ -34,10 +34,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
34
34
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
35
35
|
const { formatMessage } = reactIntl.useIntl();
|
|
36
36
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
37
|
-
const {
|
|
37
|
+
const { skip = false, ...queryParams } = params;
|
|
38
38
|
const { data, isLoading, error } = index.useGetWorkflowsQuery(
|
|
39
39
|
{
|
|
40
|
-
id,
|
|
41
40
|
populate: "stages",
|
|
42
41
|
...queryParams
|
|
43
42
|
},
|
|
@@ -82,9 +81,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
82
81
|
);
|
|
83
82
|
const [updateWorkflow] = index.useUpdateWorkflowMutation();
|
|
84
83
|
const update = React__namespace.useCallback(
|
|
85
|
-
async (
|
|
84
|
+
async (id, data2) => {
|
|
86
85
|
try {
|
|
87
|
-
const res = await updateWorkflow({ id
|
|
86
|
+
const res = await updateWorkflow({ id, data: data2 });
|
|
88
87
|
if ("error" in res) {
|
|
89
88
|
toggleNotification({
|
|
90
89
|
type: "danger",
|
|
@@ -109,9 +108,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
109
108
|
);
|
|
110
109
|
const [deleteWorkflow] = index.useDeleteWorkflowMutation();
|
|
111
110
|
const deleteAction = React__namespace.useCallback(
|
|
112
|
-
async (
|
|
111
|
+
async (id) => {
|
|
113
112
|
try {
|
|
114
|
-
const res = await deleteWorkflow({ id
|
|
113
|
+
const res = await deleteWorkflow({ id });
|
|
115
114
|
if ("error" in res) {
|
|
116
115
|
toggleNotification({
|
|
117
116
|
type: "danger",
|
|
@@ -234,7 +233,7 @@ const Header = ({ title, subtitle, navigationAction, primaryAction }) => {
|
|
|
234
233
|
}
|
|
235
234
|
) }),
|
|
236
235
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
-
strapiAdmin.Layouts.
|
|
236
|
+
strapiAdmin.Layouts.BaseHeader,
|
|
238
237
|
{
|
|
239
238
|
navigationAction,
|
|
240
239
|
primaryAction,
|
|
@@ -249,4 +248,4 @@ exports.DragLayerRendered = DragLayerRendered;
|
|
|
249
248
|
exports.Header = Header;
|
|
250
249
|
exports.Root = Root;
|
|
251
250
|
exports.useReviewWorkflows = useReviewWorkflows;
|
|
252
|
-
//# sourceMappingURL=Layout-
|
|
251
|
+
//# sourceMappingURL=Layout-AREWDuuq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout-AREWDuuq.js","sources":["../../admin/src/routes/settings/hooks/useReviewWorkflows.ts","../../admin/src/routes/settings/constants.ts","../../admin/src/routes/settings/components/StageDragPreview.tsx","../../admin/src/routes/settings/components/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useAPIErrorHandler, useNotification } from '@strapi/admin/strapi-admin';\nimport { type MessageDescriptor, useIntl } from 'react-intl';\n\nimport {\n GetWorkflowsParams,\n useCreateWorkflowMutation,\n useDeleteWorkflowMutation,\n useGetWorkflowsQuery,\n useUpdateWorkflowMutation,\n} from '../../../services/settings';\n\nimport type { Create, Update } from '../../../../../shared/contracts/review-workflows';\n\nconst DEFAULT_UNEXPECTED_ERROR_MSG = {\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n} satisfies MessageDescriptor;\n\ntype UseReviewWorkflowsArgs = GetWorkflowsParams & {\n skip?: boolean;\n};\n\nconst useReviewWorkflows = (params: UseReviewWorkflowsArgs = {}) => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n populate: 'stages',\n ...queryParams,\n },\n {\n skip,\n }\n );\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const [createWorkflow] = useCreateWorkflowMutation();\n const create = React.useCallback(\n async (data: Create.Request['body']['data']) => {\n try {\n const res = await createWorkflow({ data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.created', defaultMessage: 'Created workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [createWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const [updateWorkflow] = useUpdateWorkflowMutation();\n const update = React.useCallback(\n async (id: string, data: Update.Request['body']['data']) => {\n try {\n const res = await updateWorkflow({ id, data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.updated', defaultMessage: 'Updated workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [formatAPIError, formatMessage, toggleNotification, updateWorkflow]\n );\n\n const [deleteWorkflow] = useDeleteWorkflowMutation();\n const deleteAction = React.useCallback(\n async (id: string) => {\n try {\n const res = await deleteWorkflow({ id });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.deleted', defaultMessage: 'Deleted workflow' }),\n });\n\n return res.data;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [deleteWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const { workflows = [], meta } = data ?? {};\n\n return {\n // meta contains e.g. the total of all workflows. we can not use\n // the pagination object here, because the list is not paginated.\n meta,\n workflows,\n isLoading,\n error,\n create,\n delete: deleteAction,\n update,\n };\n};\n\nexport { useReviewWorkflows };\n","export type DragDropTypes = 'stage';\n\nexport const DRAG_DROP_TYPES: Record<Uppercase<DragDropTypes>, DragDropTypes> = {\n STAGE: 'stage',\n};\n","import { Flex, Typography } from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\n\ninterface StageDragPreviewType {\n name: string | null;\n}\n\nconst StageDragPreview = ({ name }: StageDragPreviewType) => {\n return (\n <Flex\n background=\"primary100\"\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n gap={3}\n hasRadius\n padding={3}\n shadow=\"tableShadow\"\n width=\"30rem\"\n >\n <Flex\n alignItems=\"center\"\n background=\"neutral200\"\n borderRadius=\"50%\"\n height={6}\n justifyContent=\"center\"\n width={6}\n >\n <CaretDown width=\"0.8rem\" fill=\"neutral600\" />\n </Flex>\n\n <Typography fontWeight=\"bold\">{name}</Typography>\n </Flex>\n );\n};\n\nexport { StageDragPreview };\nexport type { StageDragPreviewType };\n","import * as React from 'react';\n\nimport { Page, Layouts } from '@strapi/admin/strapi-admin';\nimport { Box } from '@strapi/design-system';\nimport { XYCoord, useDragLayer } from 'react-dnd';\nimport { useIntl } from 'react-intl';\n\nimport { DRAG_DROP_TYPES } from '../constants';\n\nimport { StageDragPreview } from './StageDragPreview';\n\nfunction getStyle(\n initialOffset: XYCoord | null,\n currentOffset: XYCoord | null,\n mouseOffset: XYCoord | null\n) {\n if (!initialOffset || !currentOffset || !mouseOffset) {\n return { display: 'none' };\n }\n\n const { x, y } = mouseOffset;\n\n return {\n transform: `translate(${x}px, ${y}px)`,\n };\n}\n\nconst DragLayerRendered = () => {\n const { itemType, isDragging, item, initialOffset, currentOffset, mouseOffset } = useDragLayer(\n (monitor) => ({\n item: monitor.getItem(),\n itemType: monitor.getItemType(),\n initialOffset: monitor.getInitialSourceClientOffset(),\n currentOffset: monitor.getSourceClientOffset(),\n isDragging: monitor.isDragging(),\n mouseOffset: monitor.getClientOffset(),\n })\n );\n\n if (!isDragging || itemType !== DRAG_DROP_TYPES.STAGE) {\n return null;\n }\n\n return (\n <Box\n height=\"100%\"\n left={0}\n position=\"fixed\"\n pointerEvents=\"none\"\n top={0}\n zIndex={100}\n width=\"100%\"\n >\n <Box style={getStyle(initialOffset, currentOffset, mouseOffset)}>\n <StageDragPreview name={typeof item.item === 'string' ? item.item : null} />;\n </Box>\n </Box>\n );\n};\n\nconst Root: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <Page.Main>\n <Layouts.Content>{children}</Layouts.Content>\n </Page.Main>\n );\n};\n\ninterface HeaderProps {\n title: string;\n navigationAction?: React.ReactNode;\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n subtitle?: React.ReactNode;\n}\n\nconst Header: React.FC<HeaderProps> = ({ title, subtitle, navigationAction, primaryAction }) => {\n const { formatMessage } = useIntl();\n return (\n <>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: title,\n }\n )}\n </Page.Title>\n <Layouts.BaseHeader\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n subtitle={subtitle}\n />\n </>\n );\n};\n\nexport { DragLayerRendered, Header, Root };\n"],"names":["useNotification","useIntl","useAPIErrorHandler","useGetWorkflowsQuery","React","useCreateWorkflowMutation","data","useUpdateWorkflowMutation","useDeleteWorkflowMutation","jsxs","Flex","jsx","CaretDown","Typography","useDragLayer","Box","Page","Layouts","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,+BAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,gBAAgB;AAClB;AAMA,MAAM,qBAAqB,CAAC,SAAiC,OAAO;AAC5D,QAAA,EAAE,uBAAuBA,YAAAA;AACzB,QAAA,EAAE,kBAAkBC,UAAAA;AAC1B,QAAM,EAAE,yBAAyB,eAAe,IAAIC,YAAmB,mBAAA;AAEvE,QAAM,EAAE,OAAO,OAAO,GAAG,gBAAgB;AAEzC,QAAM,EAAE,MAAM,WAAW,MAAU,IAAAC,MAAA;AAAA,IACjC;AAAA,MACE,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,IACF;AAAA,EAAA;AAGFC,mBAAM,UAAU,MAAM;AACpB,QAAI,OAAO;AACU,yBAAA;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,eAAe,KAAK;AAAA,MAAA,CAC9B;AAAA,IACH;AAAA,EACC,GAAA,CAAC,OAAO,gBAAgB,kBAAkB,CAAC;AAExC,QAAA,CAAC,cAAc,IAAIC,MAAAA;AACzB,QAAM,SAASD,iBAAM;AAAA,IACnB,OAAOE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C,YAAQ,QAAA,SAAR,EAAiB,SAAS,CAAA,EAC7B,CAAA;AAEJ;AAUA,MAAM,SAAgC,CAAC,EAAE,OAAO,UAAU,kBAAkB,oBAAoB;AACxF,QAAA,EAAE,kBAAkBhB,UAAAA;AAC1B,SAEIQ,2BAAA,KAAAS,qBAAA,EAAA,UAAA;AAAA,IAACP,2BAAAA,IAAAK,YAAA,KAAK,OAAL,EACE,UAAA;AAAA,MACC,EAAE,IAAI,sBAAsB,gBAAgB,oBAAoB;AAAA,MAChE;AAAA,QACE,MAAM;AAAA,MACR;AAAA,IAAA,GAEJ;AAAA,IACAL,2BAAA;AAAA,MAACM,YAAAA,QAAQ;AAAA,MAAR;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useNotification, useAPIErrorHandler, Page, Layouts } from "@strapi/admin/strapi-admin";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
-
import { c as useGetWorkflowsQuery, d as useCreateWorkflowMutation, e as useUpdateWorkflowMutation, f as useDeleteWorkflowMutation } from "./index-
|
|
4
|
+
import { c as useGetWorkflowsQuery, d as useCreateWorkflowMutation, e as useUpdateWorkflowMutation, f as useDeleteWorkflowMutation } from "./index-Cx5QECZI.mjs";
|
|
5
5
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
6
6
|
import { Flex, Typography, Box } from "@strapi/design-system";
|
|
7
7
|
import { useDragLayer } from "react-dnd";
|
|
@@ -14,10 +14,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
14
14
|
const { toggleNotification } = useNotification();
|
|
15
15
|
const { formatMessage } = useIntl();
|
|
16
16
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
|
17
|
-
const {
|
|
17
|
+
const { skip = false, ...queryParams } = params;
|
|
18
18
|
const { data, isLoading, error } = useGetWorkflowsQuery(
|
|
19
19
|
{
|
|
20
|
-
id,
|
|
21
20
|
populate: "stages",
|
|
22
21
|
...queryParams
|
|
23
22
|
},
|
|
@@ -62,9 +61,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
62
61
|
);
|
|
63
62
|
const [updateWorkflow] = useUpdateWorkflowMutation();
|
|
64
63
|
const update = React.useCallback(
|
|
65
|
-
async (
|
|
64
|
+
async (id, data2) => {
|
|
66
65
|
try {
|
|
67
|
-
const res = await updateWorkflow({ id
|
|
66
|
+
const res = await updateWorkflow({ id, data: data2 });
|
|
68
67
|
if ("error" in res) {
|
|
69
68
|
toggleNotification({
|
|
70
69
|
type: "danger",
|
|
@@ -89,9 +88,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
89
88
|
);
|
|
90
89
|
const [deleteWorkflow] = useDeleteWorkflowMutation();
|
|
91
90
|
const deleteAction = React.useCallback(
|
|
92
|
-
async (
|
|
91
|
+
async (id) => {
|
|
93
92
|
try {
|
|
94
|
-
const res = await deleteWorkflow({ id
|
|
93
|
+
const res = await deleteWorkflow({ id });
|
|
95
94
|
if ("error" in res) {
|
|
96
95
|
toggleNotification({
|
|
97
96
|
type: "danger",
|
|
@@ -214,7 +213,7 @@ const Header = ({ title, subtitle, navigationAction, primaryAction }) => {
|
|
|
214
213
|
}
|
|
215
214
|
) }),
|
|
216
215
|
/* @__PURE__ */ jsx(
|
|
217
|
-
Layouts.
|
|
216
|
+
Layouts.BaseHeader,
|
|
218
217
|
{
|
|
219
218
|
navigationAction,
|
|
220
219
|
primaryAction,
|
|
@@ -231,4 +230,4 @@ export {
|
|
|
231
230
|
DragLayerRendered as a,
|
|
232
231
|
useReviewWorkflows as u
|
|
233
232
|
};
|
|
234
|
-
//# sourceMappingURL=Layout-
|
|
233
|
+
//# sourceMappingURL=Layout-D5aa9iUm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout-D5aa9iUm.mjs","sources":["../../admin/src/routes/settings/hooks/useReviewWorkflows.ts","../../admin/src/routes/settings/constants.ts","../../admin/src/routes/settings/components/StageDragPreview.tsx","../../admin/src/routes/settings/components/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useAPIErrorHandler, useNotification } from '@strapi/admin/strapi-admin';\nimport { type MessageDescriptor, useIntl } from 'react-intl';\n\nimport {\n GetWorkflowsParams,\n useCreateWorkflowMutation,\n useDeleteWorkflowMutation,\n useGetWorkflowsQuery,\n useUpdateWorkflowMutation,\n} from '../../../services/settings';\n\nimport type { Create, Update } from '../../../../../shared/contracts/review-workflows';\n\nconst DEFAULT_UNEXPECTED_ERROR_MSG = {\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n} satisfies MessageDescriptor;\n\ntype UseReviewWorkflowsArgs = GetWorkflowsParams & {\n skip?: boolean;\n};\n\nconst useReviewWorkflows = (params: UseReviewWorkflowsArgs = {}) => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n populate: 'stages',\n ...queryParams,\n },\n {\n skip,\n }\n );\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const [createWorkflow] = useCreateWorkflowMutation();\n const create = React.useCallback(\n async (data: Create.Request['body']['data']) => {\n try {\n const res = await createWorkflow({ data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.created', defaultMessage: 'Created workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [createWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const [updateWorkflow] = useUpdateWorkflowMutation();\n const update = React.useCallback(\n async (id: string, data: Update.Request['body']['data']) => {\n try {\n const res = await updateWorkflow({ id, data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.updated', defaultMessage: 'Updated workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [formatAPIError, formatMessage, toggleNotification, updateWorkflow]\n );\n\n const [deleteWorkflow] = useDeleteWorkflowMutation();\n const deleteAction = React.useCallback(\n async (id: string) => {\n try {\n const res = await deleteWorkflow({ id });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.deleted', defaultMessage: 'Deleted workflow' }),\n });\n\n return res.data;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [deleteWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const { workflows = [], meta } = data ?? {};\n\n return {\n // meta contains e.g. the total of all workflows. we can not use\n // the pagination object here, because the list is not paginated.\n meta,\n workflows,\n isLoading,\n error,\n create,\n delete: deleteAction,\n update,\n };\n};\n\nexport { useReviewWorkflows };\n","export type DragDropTypes = 'stage';\n\nexport const DRAG_DROP_TYPES: Record<Uppercase<DragDropTypes>, DragDropTypes> = {\n STAGE: 'stage',\n};\n","import { Flex, Typography } from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\n\ninterface StageDragPreviewType {\n name: string | null;\n}\n\nconst StageDragPreview = ({ name }: StageDragPreviewType) => {\n return (\n <Flex\n background=\"primary100\"\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n gap={3}\n hasRadius\n padding={3}\n shadow=\"tableShadow\"\n width=\"30rem\"\n >\n <Flex\n alignItems=\"center\"\n background=\"neutral200\"\n borderRadius=\"50%\"\n height={6}\n justifyContent=\"center\"\n width={6}\n >\n <CaretDown width=\"0.8rem\" fill=\"neutral600\" />\n </Flex>\n\n <Typography fontWeight=\"bold\">{name}</Typography>\n </Flex>\n );\n};\n\nexport { StageDragPreview };\nexport type { StageDragPreviewType };\n","import * as React from 'react';\n\nimport { Page, Layouts } from '@strapi/admin/strapi-admin';\nimport { Box } from '@strapi/design-system';\nimport { XYCoord, useDragLayer } from 'react-dnd';\nimport { useIntl } from 'react-intl';\n\nimport { DRAG_DROP_TYPES } from '../constants';\n\nimport { StageDragPreview } from './StageDragPreview';\n\nfunction getStyle(\n initialOffset: XYCoord | null,\n currentOffset: XYCoord | null,\n mouseOffset: XYCoord | null\n) {\n if (!initialOffset || !currentOffset || !mouseOffset) {\n return { display: 'none' };\n }\n\n const { x, y } = mouseOffset;\n\n return {\n transform: `translate(${x}px, ${y}px)`,\n };\n}\n\nconst DragLayerRendered = () => {\n const { itemType, isDragging, item, initialOffset, currentOffset, mouseOffset } = useDragLayer(\n (monitor) => ({\n item: monitor.getItem(),\n itemType: monitor.getItemType(),\n initialOffset: monitor.getInitialSourceClientOffset(),\n currentOffset: monitor.getSourceClientOffset(),\n isDragging: monitor.isDragging(),\n mouseOffset: monitor.getClientOffset(),\n })\n );\n\n if (!isDragging || itemType !== DRAG_DROP_TYPES.STAGE) {\n return null;\n }\n\n return (\n <Box\n height=\"100%\"\n left={0}\n position=\"fixed\"\n pointerEvents=\"none\"\n top={0}\n zIndex={100}\n width=\"100%\"\n >\n <Box style={getStyle(initialOffset, currentOffset, mouseOffset)}>\n <StageDragPreview name={typeof item.item === 'string' ? item.item : null} />;\n </Box>\n </Box>\n );\n};\n\nconst Root: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <Page.Main>\n <Layouts.Content>{children}</Layouts.Content>\n </Page.Main>\n );\n};\n\ninterface HeaderProps {\n title: string;\n navigationAction?: React.ReactNode;\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n subtitle?: React.ReactNode;\n}\n\nconst Header: React.FC<HeaderProps> = ({ title, subtitle, navigationAction, primaryAction }) => {\n const { formatMessage } = useIntl();\n return (\n <>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: title,\n }\n )}\n </Page.Title>\n <Layouts.BaseHeader\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n subtitle={subtitle}\n />\n </>\n );\n};\n\nexport { DragLayerRendered, Header, Root };\n"],"names":["data"],"mappings":";;;;;;;;AAeA,MAAM,+BAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,gBAAgB;AAClB;AAMA,MAAM,qBAAqB,CAAC,SAAiC,OAAO;AAC5D,QAAA,EAAE,uBAAuB;AACzB,QAAA,EAAE,kBAAkB;AAC1B,QAAM,EAAE,yBAAyB,eAAe,IAAI,mBAAmB;AAEvE,QAAM,EAAE,OAAO,OAAO,GAAG,gBAAgB;AAEzC,QAAM,EAAE,MAAM,WAAW,MAAU,IAAA;AAAA,IACjC;AAAA,MACE,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,IACF;AAAA,EAAA;AAGF,QAAM,UAAU,MAAM;AACpB,QAAI,OAAO;AACU,yBAAA;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,eAAe,KAAK;AAAA,MAAA,CAC9B;AAAA,IACH;AAAA,EACC,GAAA,CAAC,OAAO,gBAAgB,kBAAkB,CAAC;AAExC,QAAA,CAAC,cAAc,IAAI;AACzB,QAAM,SAAS,MAAM;AAAA,IACnB,OAAOA,UAAyC;AAC1C,UAAA;AACF,cAAM,MAAM,MAAM,eAAe,EAAE,MAAAA,MAAM,CAAA;AAEzC,YAAI,WAAW,KAAK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UAAA;AAAA,MACC,EAAE,IAAI,sBAAsB,gBAAgB,oBAAoB;AAAA,MAChE;AAAA,QACE,MAAM;AAAA,MACR;AAAA,IAAA,GAEJ;AAAA,IACA;AAAA,MAAC,QAAQ;AAAA,MAAR;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ;"}
|
|
@@ -8,11 +8,10 @@ const designSystem = require("@strapi/design-system");
|
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const fractionalIndexing = require("fractional-indexing");
|
|
10
10
|
const reactIntl = require("react-intl");
|
|
11
|
-
const reactRedux = require("react-redux");
|
|
12
11
|
const reactRouterDom = require("react-router-dom");
|
|
13
12
|
const yup = require("yup");
|
|
14
|
-
const index = require("./index-
|
|
15
|
-
const Layout = require("./Layout-
|
|
13
|
+
const index = require("./index-CIBLMG85.js");
|
|
14
|
+
const Layout = require("./Layout-AREWDuuq.js");
|
|
16
15
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
17
16
|
const styledComponents = require("styled-components");
|
|
18
17
|
const reactDnd = require("react-dnd");
|
|
@@ -313,35 +312,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
|
313
312
|
left: "50%",
|
|
314
313
|
position: "absolute",
|
|
315
314
|
top: "0",
|
|
316
|
-
width: 2
|
|
317
|
-
zIndex: 1
|
|
315
|
+
width: 2
|
|
318
316
|
}
|
|
319
317
|
),
|
|
320
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
321
|
-
designSystem.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
canDelete: stages.length > 1 && canDelete,
|
|
335
|
-
canReorder: stages.length > 1,
|
|
336
|
-
canUpdate,
|
|
337
|
-
stagesCount: stages.length,
|
|
338
|
-
defaultOpen: isCreating,
|
|
339
|
-
...stage
|
|
340
|
-
}
|
|
341
|
-
) }, stage.__temp_key__);
|
|
342
|
-
})
|
|
343
|
-
}
|
|
344
|
-
)
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index2) => {
|
|
319
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
Stage,
|
|
321
|
+
{
|
|
322
|
+
index: index2,
|
|
323
|
+
canDelete: stages.length > 1 && canDelete,
|
|
324
|
+
canReorder: stages.length > 1,
|
|
325
|
+
canUpdate,
|
|
326
|
+
stagesCount: stages.length,
|
|
327
|
+
defaultOpen: isCreating,
|
|
328
|
+
...stage
|
|
329
|
+
}
|
|
330
|
+
) }, stage.__temp_key__);
|
|
331
|
+
}) })
|
|
345
332
|
] }),
|
|
346
333
|
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
347
334
|
AddStage,
|
|
@@ -458,7 +445,7 @@ const Stage = ({
|
|
|
458
445
|
addFieldRow("stages", { name, color, permissions });
|
|
459
446
|
};
|
|
460
447
|
const id = React__namespace.useId();
|
|
461
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, children: [
|
|
448
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
462
449
|
liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
463
450
|
isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
464
451
|
designSystem.Box,
|
|
@@ -509,7 +496,7 @@ const Stage = ({
|
|
|
509
496
|
{
|
|
510
497
|
background: "transparent",
|
|
511
498
|
hasRadius: true,
|
|
512
|
-
|
|
499
|
+
variant: "ghost",
|
|
513
500
|
"data-handler-id": handlerId,
|
|
514
501
|
ref: dragRef,
|
|
515
502
|
label: formatMessage({
|
|
@@ -561,7 +548,7 @@ const Stage = ({
|
|
|
561
548
|
size: 6,
|
|
562
549
|
type: "permissions"
|
|
563
550
|
}
|
|
564
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
551
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
565
552
|
] })
|
|
566
553
|
}
|
|
567
554
|
)
|
|
@@ -666,20 +653,22 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
666
653
|
const { value = [], error, onChange } = strapiAdmin.useField(name);
|
|
667
654
|
const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
|
|
668
655
|
const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
|
|
669
|
-
const
|
|
656
|
+
const rolesErrorCount = React__namespace.useRef(0);
|
|
657
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
670
658
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
671
659
|
React__namespace.useEffect(() => {
|
|
672
|
-
if (!isLoading &&
|
|
660
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
661
|
+
rolesErrorCount.current = 1;
|
|
673
662
|
toggleNotification({
|
|
674
663
|
blockTransition: true,
|
|
675
664
|
type: "danger",
|
|
676
665
|
message: formatMessage({
|
|
677
666
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
678
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
667
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
679
668
|
})
|
|
680
669
|
});
|
|
681
670
|
}
|
|
682
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
671
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
683
672
|
if (!isLoading && filteredRoles.length === 0) {
|
|
684
673
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
685
674
|
designSystem.Field.Root,
|
|
@@ -760,7 +749,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
760
749
|
defaultMessage: "Apply to all stages"
|
|
761
750
|
}),
|
|
762
751
|
size: "L",
|
|
763
|
-
variant: "secondary",
|
|
764
752
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
|
|
765
753
|
}
|
|
766
754
|
) }),
|
|
@@ -805,7 +793,7 @@ const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
|
|
|
805
793
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
806
794
|
const { formatMessage } = reactIntl.useIntl();
|
|
807
795
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
808
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
809
797
|
strapiAdmin.InputRenderer,
|
|
810
798
|
{
|
|
811
799
|
disabled: !canUpdate,
|
|
@@ -818,7 +806,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
818
806
|
type: "string"
|
|
819
807
|
}
|
|
820
808
|
) }),
|
|
821
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
809
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
822
810
|
] });
|
|
823
811
|
};
|
|
824
812
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -973,7 +961,6 @@ const EditPage = () => {
|
|
|
973
961
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
|
974
962
|
const navigate = reactRouterDom.useNavigate();
|
|
975
963
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
976
|
-
const dispatch = reactRedux.useDispatch();
|
|
977
964
|
const {
|
|
978
965
|
isLoading: isLoadingWorkflow,
|
|
979
966
|
meta,
|
|
@@ -981,7 +968,7 @@ const EditPage = () => {
|
|
|
981
968
|
error,
|
|
982
969
|
update,
|
|
983
970
|
create
|
|
984
|
-
} = Layout.useReviewWorkflows(
|
|
971
|
+
} = Layout.useReviewWorkflows();
|
|
985
972
|
const permissions = index.useTypedSelector(
|
|
986
973
|
(state) => state.admin_app.permissions["settings"]?.["review-workflows"]
|
|
987
974
|
);
|
|
@@ -1024,36 +1011,13 @@ const EditPage = () => {
|
|
|
1024
1011
|
});
|
|
1025
1012
|
if ("error" in res && index.isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1026
1013
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1027
|
-
} else if ("data" in res) {
|
|
1028
|
-
for (const uid of res.data.contentTypes) {
|
|
1029
|
-
dispatch({
|
|
1030
|
-
type: "contentManagerApi/invalidateTags",
|
|
1031
|
-
payload: [
|
|
1032
|
-
{
|
|
1033
|
-
type: "ContentTypesConfiguration",
|
|
1034
|
-
id: uid
|
|
1035
|
-
}
|
|
1036
|
-
]
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
1014
|
}
|
|
1040
1015
|
} else {
|
|
1041
1016
|
const res = await create(data);
|
|
1042
1017
|
if ("error" in res && index.isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1043
1018
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1044
1019
|
} else if ("data" in res) {
|
|
1045
|
-
|
|
1046
|
-
dispatch({
|
|
1047
|
-
type: "contentManagerApi/invalidateTags",
|
|
1048
|
-
payload: [
|
|
1049
|
-
{
|
|
1050
|
-
type: "ContentTypesConfiguration",
|
|
1051
|
-
id: uid
|
|
1052
|
-
}
|
|
1053
|
-
]
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
navigate(`../${res.data.id}`);
|
|
1020
|
+
navigate(`../${res.data.id}`, { replace: true });
|
|
1057
1021
|
}
|
|
1058
1022
|
}
|
|
1059
1023
|
} catch (error2) {
|
|
@@ -1175,12 +1139,12 @@ const EditPage = () => {
|
|
|
1175
1139
|
}
|
|
1176
1140
|
),
|
|
1177
1141
|
/* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1178
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
|
|
1142
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1179
1143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1180
1144
|
Stages,
|
|
1181
1145
|
{
|
|
1182
1146
|
canDelete,
|
|
1183
|
-
canUpdate,
|
|
1147
|
+
canUpdate: canUpdate || canCreate,
|
|
1184
1148
|
isCreating: isCreatingWorkflow
|
|
1185
1149
|
}
|
|
1186
1150
|
)
|
|
@@ -1202,7 +1166,7 @@ const EditPage = () => {
|
|
|
1202
1166
|
},
|
|
1203
1167
|
{
|
|
1204
1168
|
count: contentTypesFromOtherWorkflows?.filter(
|
|
1205
|
-
(contentType) =>
|
|
1169
|
+
(contentType) => values.contentTypes.includes(contentType)
|
|
1206
1170
|
).length ?? 0
|
|
1207
1171
|
}
|
|
1208
1172
|
) }),
|
|
@@ -1271,4 +1235,4 @@ const ProtectedEditPage = () => {
|
|
|
1271
1235
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1272
1236
|
};
|
|
1273
1237
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1274
|
-
//# sourceMappingURL=_id-
|
|
1238
|
+
//# sourceMappingURL=_id-C7pCAzXV.js.map
|