diff --git a/package.json b/package.json index f963e83..49a8025 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "@auth0/auth0-react": "1.10.2", "@emotion/react": "11.7.1", "@emotion/styled": "11.6.0", - "@kingsrook/qqq-frontend-core": "1.0.81", + "@kingsrook/qqq-frontend-core": "1.0.82", "@mui/icons-material": "5.4.1", "@mui/material": "5.11.1", "@mui/styles": "5.11.1", @@ -57,9 +57,7 @@ "npm-install": "npm install --legacy-peer-deps", "prepublishOnly": "tsc -p ./ --outDir lib/", "start": "BROWSER=none react-scripts --max-http-header-size=65535 start", - "test": "react-scripts test", - "cypress:open": "cypress open", - "cypress:run": "cypress run" + "test": "react-scripts test" }, "eslintConfig": { "extends": [ @@ -87,8 +85,6 @@ "@types/react-table": "7.7.9", "@typescript-eslint/eslint-plugin": "5.10.2", "@typescript-eslint/parser": "5.10.2", - "cypress": "11.0.1", - "cypress-wait-for-stable-dom": "0.1.0", "eslint": "8.8.0", "eslint-import-resolver-typescript": "2.5.0", "eslint-plugin-import": "2.25.4", diff --git a/src/qqq/pages/processes/ProcessRun.tsx b/src/qqq/pages/processes/ProcessRun.tsx index 172652c..d0e0a0b 100644 --- a/src/qqq/pages/processes/ProcessRun.tsx +++ b/src/qqq/pages/processes/ProcessRun.tsx @@ -76,7 +76,7 @@ interface Props isModal?: boolean; isWidget?: boolean; isReport?: boolean; - recordIds?: string | QQueryFilter; + recordIds?: string[] | QQueryFilter; closeModalHandler?: (event: object, reason: string) => void; forceReInit?: number; overrideLabel?: string; @@ -1089,8 +1089,10 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is let queryStringPairsForInit = []; if (urlSearchParams.get("recordIds")) { + const recordIdsFromQueryString = urlSearchParams.get("recordIds").split(","); + const encodedRecordIds = recordIdsFromQueryString.map(r => encodeURIComponent(r)).join(","); queryStringPairsForInit.push("recordsParam=recordIds"); - queryStringPairsForInit.push(`recordIds=${urlSearchParams.get("recordIds")}`); + queryStringPairsForInit.push(`recordIds=${encodedRecordIds}`); } else if (urlSearchParams.get("filterJSON")) { @@ -1104,16 +1106,17 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is // } else if (recordIds) { - if (typeof recordIds === "string") - { - queryStringPairsForInit.push("recordsParam=recordIds"); - queryStringPairsForInit.push(`recordIds=${recordIds}`); - } - else if (recordIds instanceof QQueryFilter) + if (recordIds instanceof QQueryFilter) { queryStringPairsForInit.push("recordsParam=filterJSON"); queryStringPairsForInit.push(`filterJSON=${JSON.stringify(recordIds)}`); } + else if (typeof recordIds === "object" && recordIds.length) + { + const encodedRecordIds = recordIds.map(r => encodeURIComponent(r)).join(","); + queryStringPairsForInit.push("recordsParam=recordIds"); + queryStringPairsForInit.push(`recordIds=${encodedRecordIds}`); + } } if (tableVariantLocalStorageKey && localStorage.getItem(tableVariantLocalStorageKey)) @@ -1169,7 +1172,7 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is if (tableMetaData) { - queryStringPairsForInit.push(`tableName=${tableMetaData.name}`); + queryStringPairsForInit.push(`tableName=${encodeURIComponent(tableMetaData.name)}`); } try diff --git a/src/qqq/pages/records/query/RecordQuery.tsx b/src/qqq/pages/records/query/RecordQuery.tsx index 03cac2c..e3f5a62 100644 --- a/src/qqq/pages/records/query/RecordQuery.tsx +++ b/src/qqq/pages/records/query/RecordQuery.tsx @@ -234,7 +234,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element const [activeModalProcess, setActiveModalProcess] = useState(null as QProcessMetaData); const [launchingProcess, setLaunchingProcess] = useState(launchProcess); - const [recordIdsForProcess, setRecordIdsForProcess] = useState(null as string | QQueryFilter); + const [recordIdsForProcess, setRecordIdsForProcess] = useState([] as string[] | QQueryFilter); const [columnStatsFieldName, setColumnStatsFieldName] = useState(null as string); const [columnStatsField, setColumnStatsField] = useState(null as QFieldMetaData); const [columnStatsFieldTableName, setColumnStatsFieldTableName] = useState(null as string) @@ -926,11 +926,11 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element { if (table.primaryKeyField !== "id") { - navigate(`${metaData.getTablePathByName(tableName)}/${params.row[tableMetaData.primaryKeyField]}`); + navigate(`${metaData.getTablePathByName(tableName)}/${encodeURIComponent(params.row[tableMetaData.primaryKeyField])}`); } else { - navigate(`${metaData.getTablePathByName(tableName)}/${params.id}`); + navigate(`${metaData.getTablePathByName(tableName)}/${encodeURIComponent(params.id)}`); } }, 100); } @@ -1190,17 +1190,17 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element { if (selectFullFilterState === "filter") { - return `?recordsParam=filterJSON&filterJSON=${JSON.stringify(buildQFilter(tableMetaData, filterModel))}`; + return `?recordsParam=filterJSON&filterJSON=${encodeURIComponent(JSON.stringify(buildQFilter(tableMetaData, filterModel)))}`; } if (selectFullFilterState === "filterSubset") { - return `?recordsParam=filterJSON&filterJSON=${JSON.stringify(buildQFilter(tableMetaData, filterModel, selectionSubsetSize))}`; + return `?recordsParam=filterJSON&filterJSON=${encodeURIComponent(JSON.stringify(buildQFilter(tableMetaData, filterModel, selectionSubsetSize)))}`; } if (selectedIds.length > 0) { - return `?recordsParam=recordIds&recordIds=${selectedIds.join(",")}`; + return `?recordsParam=recordIds&recordIds=${selectedIds.map(r => encodeURIComponent(r)).join(",")}`; } return ""; @@ -1218,11 +1218,11 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element } else if (selectedIds.length > 0) { - setRecordIdsForProcess(selectedIds.join(",")); + setRecordIdsForProcess(selectedIds); } else { - setRecordIdsForProcess(""); + setRecordIdsForProcess([]); } navigate(`${metaData?.getTablePathByName(tableName)}/${process.name}${getRecordsQueryString()}`); diff --git a/src/qqq/pages/records/view/RecordView.tsx b/src/qqq/pages/records/view/RecordView.tsx index b7e4727..733f712 100644 --- a/src/qqq/pages/records/view/RecordView.tsx +++ b/src/qqq/pages/records/view/RecordView.tsx @@ -931,7 +931,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element activeModalProcess && closeModalProcess(event, reason)}>
- +
} diff --git a/src/qqq/utils/DataGridUtils.tsx b/src/qqq/utils/DataGridUtils.tsx index 7a1c0c2..7ca67da 100644 --- a/src/qqq/utils/DataGridUtils.tsx +++ b/src/qqq/utils/DataGridUtils.tsx @@ -246,7 +246,7 @@ export default class DataGridUtils if (key === tableMetaData.primaryKeyField && linkBase) { column.renderCell = (cellValues: any) => ( - e.stopPropagation()}>{cellValues.value} + e.stopPropagation()}>{cellValues.value} ); } });