@argusoft/medplat-core 1.0.9 → 1.0.11

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.
Files changed (116) hide show
  1. package/dist/index-D6bNg8bx.js +66 -0
  2. package/dist/index-D6bNg8bx.js.map +1 -0
  3. package/dist/index.css +1 -1
  4. package/dist/index.js +99455 -445
  5. package/dist/index.js.map +1 -1
  6. package/package.json +4 -1
  7. package/dist/AccessRights-sgIhYR30.js +0 -1238
  8. package/dist/AccessRights-sgIhYR30.js.map +0 -1
  9. package/dist/AddEditQueryBuilder-BaZxS2Cm.js +0 -289
  10. package/dist/AddEditQueryBuilder-BaZxS2Cm.js.map +0 -1
  11. package/dist/AddEditQueryBuilder.css +0 -1
  12. package/dist/AddFeatures-DLbjDGei.js +0 -212
  13. package/dist/AddFeatures-DLbjDGei.js.map +0 -1
  14. package/dist/AddLabelModal-DE3ploGD.js +0 -734
  15. package/dist/AddLabelModal-DE3ploGD.js.map +0 -1
  16. package/dist/AddMenuConfiguration-QWfpcnuP.js +0 -2237
  17. package/dist/AddMenuConfiguration-QWfpcnuP.js.map +0 -1
  18. package/dist/AddMenuConfiguration.css +0 -1
  19. package/dist/AddRoleDrawer-ZK1eejxI.js +0 -453
  20. package/dist/AddRoleDrawer-ZK1eejxI.js.map +0 -1
  21. package/dist/AppModal-BgZyfrd-.js +0 -428
  22. package/dist/AppModal-BgZyfrd-.js.map +0 -1
  23. package/dist/ChangePasswordModal-MV7g8tkA.js +0 -176
  24. package/dist/ChangePasswordModal-MV7g8tkA.js.map +0 -1
  25. package/dist/ConditionConfig-GDCXIg3C.js +0 -395
  26. package/dist/ConditionConfig-GDCXIg3C.js.map +0 -1
  27. package/dist/ConditionConfig.css +0 -1
  28. package/dist/EntityManagement-D-x6Qzal.js +0 -50
  29. package/dist/EntityManagement-D-x6Qzal.js.map +0 -1
  30. package/dist/EventConfigurations-jGCJ4LqP.js +0 -384
  31. package/dist/EventConfigurations-jGCJ4LqP.js.map +0 -1
  32. package/dist/EventConfigurations.css +0 -1
  33. package/dist/EventsExceptionModal-BF6E1Np7.js +0 -200
  34. package/dist/EventsExceptionModal-BF6E1Np7.js.map +0 -1
  35. package/dist/EventsSkeleton-BN7_0IGs.js +0 -74
  36. package/dist/EventsSkeleton-BN7_0IGs.js.map +0 -1
  37. package/dist/FeatureMenu-BYSRoNm0.js +0 -249
  38. package/dist/FeatureMenu-BYSRoNm0.js.map +0 -1
  39. package/dist/Features-CKMmuqcs.js +0 -11
  40. package/dist/Features-CKMmuqcs.js.map +0 -1
  41. package/dist/FlywayQuery-Cx2sly6g.js +0 -169
  42. package/dist/FlywayQuery-Cx2sly6g.js.map +0 -1
  43. package/dist/ImmunizationConfigurationBase-DZ8EqXlF.js +0 -5166
  44. package/dist/ImmunizationConfigurationBase-DZ8EqXlF.js.map +0 -1
  45. package/dist/ImmunizationConfigurationBase.css +0 -1
  46. package/dist/ImmunizationConfigurationsList-CQnxWa09.js +0 -335
  47. package/dist/ImmunizationConfigurationsList-CQnxWa09.js.map +0 -1
  48. package/dist/ImmunizationSkeleton-D2tdv5k-.js +0 -186
  49. package/dist/ImmunizationSkeleton-D2tdv5k-.js.map +0 -1
  50. package/dist/LanguagesModal-rk6IGQwY.js +0 -394
  51. package/dist/LanguagesModal-rk6IGQwY.js.map +0 -1
  52. package/dist/ManageDynamicFeature-BKkCnQvF.js +0 -4189
  53. package/dist/ManageDynamicFeature-BKkCnQvF.js.map +0 -1
  54. package/dist/ManageEventConfiguration-BJxS2Su0.js +0 -1017
  55. package/dist/ManageEventConfiguration-BJxS2Su0.js.map +0 -1
  56. package/dist/ManageEventConfiguration.css +0 -1
  57. package/dist/ManageNotification-B4prX-9Z.js +0 -6819
  58. package/dist/ManageNotification-B4prX-9Z.js.map +0 -1
  59. package/dist/ManageRole-BjIIXAlK.js +0 -728
  60. package/dist/ManageRole-BjIIXAlK.js.map +0 -1
  61. package/dist/ManageTranslation-BTxvSYKb.js +0 -616
  62. package/dist/ManageTranslation-BTxvSYKb.js.map +0 -1
  63. package/dist/ManageTranslation.css +0 -1
  64. package/dist/ManageUser-PHiTNyF8.js +0 -2160
  65. package/dist/ManageUser-PHiTNyF8.js.map +0 -1
  66. package/dist/ManageUser.css +0 -1
  67. package/dist/MobileMenuManagement-DmQU5TTo.js +0 -108
  68. package/dist/MobileMenuManagement-DmQU5TTo.js.map +0 -1
  69. package/dist/MobileTypeEventConfigModal-ChhO_A4f.js +0 -783
  70. package/dist/MobileTypeEventConfigModal-ChhO_A4f.js.map +0 -1
  71. package/dist/NewServerManagement-5YcAtF-g.js +0 -1002
  72. package/dist/NewServerManagement-5YcAtF-g.js.map +0 -1
  73. package/dist/NotificationFlywayQuery-BY8Zzml_.js +0 -244
  74. package/dist/NotificationFlywayQuery-BY8Zzml_.js.map +0 -1
  75. package/dist/NotificationList-BkpOrCpM.js +0 -400
  76. package/dist/NotificationList-BkpOrCpM.js.map +0 -1
  77. package/dist/OtherTypeEventConfigModal-ZnCGWm9v.js +0 -1953
  78. package/dist/OtherTypeEventConfigModal-ZnCGWm9v.js.map +0 -1
  79. package/dist/QueryBuilder-Cus_mRwZ.js +0 -378
  80. package/dist/QueryBuilder-Cus_mRwZ.js.map +0 -1
  81. package/dist/QueryBuilder.css +0 -1
  82. package/dist/QueryManagement-DXA73N2j.js +0 -671
  83. package/dist/QueryManagement-DXA73N2j.js.map +0 -1
  84. package/dist/QueryManagement.css +0 -1
  85. package/dist/RoleManagement-v5Nyp1vr.js +0 -416
  86. package/dist/RoleManagement-v5Nyp1vr.js.map +0 -1
  87. package/dist/ServerSyncModal-uNjGCQJz.js +0 -869
  88. package/dist/ServerSyncModal-uNjGCQJz.js.map +0 -1
  89. package/dist/ShowFlywayQuery-DMsAbtOW.js +0 -130
  90. package/dist/ShowFlywayQuery-DMsAbtOW.js.map +0 -1
  91. package/dist/ShowFlywayQuery-DVRCd384.js +0 -259
  92. package/dist/ShowFlywayQuery-DVRCd384.js.map +0 -1
  93. package/dist/ShowQueryHistory-BDN0tzHg.js +0 -190
  94. package/dist/ShowQueryHistory-BDN0tzHg.js.map +0 -1
  95. package/dist/SubMenu-BHcSNSUF.js +0 -187
  96. package/dist/SubMenu-BHcSNSUF.js.map +0 -1
  97. package/dist/TableDetails-DzREeJkm.js +0 -1508
  98. package/dist/TableDetails-DzREeJkm.js.map +0 -1
  99. package/dist/TableList-B9hr05Hs.js +0 -428
  100. package/dist/TableList-B9hr05Hs.js.map +0 -1
  101. package/dist/TypeConfiguration-C-lk8Szs.js +0 -117
  102. package/dist/TypeConfiguration-C-lk8Szs.js.map +0 -1
  103. package/dist/UserList-BxB1tCwM.js +0 -13042
  104. package/dist/UserList-BxB1tCwM.js.map +0 -1
  105. package/dist/UserList.css +0 -1
  106. package/dist/UserListSkeleton-cglK2SaU.js +0 -184
  107. package/dist/UserListSkeleton-cglK2SaU.js.map +0 -1
  108. package/dist/WidgetList-BSApErov.js +0 -188
  109. package/dist/WidgetList-BSApErov.js.map +0 -1
  110. package/dist/_commonjsHelpers-BItOPCY9.js +0 -29
  111. package/dist/_commonjsHelpers-BItOPCY9.js.map +0 -1
  112. package/dist/i18next-CTOWN_jH.js +0 -1394
  113. package/dist/i18next-CTOWN_jH.js.map +0 -1
  114. package/dist/manageImmunization-B4swS745.js +0 -1204
  115. package/dist/manageImmunization-B4swS745.js.map +0 -1
  116. package/dist/manageImmunization.css +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServerSyncModal-uNjGCQJz.js","sources":["../src/views/Features/ServerSyncModal.jsx"],"sourcesContent":["/**\n * @author Sanya Srivastava <ssrivastava@argusoft.com>\n * @date 2025-02-24 (Monday)\n */\nimport { execute } from \"@/common/services/GlobalApis\";\nimport { showToast } from \"@/common/toaster/toaster\";\nimport {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Alert,\n Autocomplete,\n Backdrop,\n Button,\n Checkbox,\n Chip,\n CircularProgress,\n Divider,\n Fade,\n FormControl,\n FormHelperText,\n FormLabel,\n IconButton,\n InputAdornment,\n Modal,\n OutlinedInput,\n Tab,\n Tabs,\n TextField,\n Tooltip,\n Typography,\n} from \"@mui/material\";\nimport Grid from \"@mui/material/Grid2\";\nimport { Box } from \"@mui/system\";\nimport { t } from \"i18next\";\nimport PropTypes from \"prop-types\";\nimport React, { useEffect, useState } from \"react\";\nimport { Controller, useFieldArray, useForm } from \"react-hook-form\";\nimport { api as API } from \"@/common/interceptors/AxiosInterceptor\";\nimport {\n syncMenuConfigFormsWithServer,\n getSecurityUserList,\n downloadFeature,\n} from \"@/common/services/SyncWithServer\";\nimport { FormConfiguratorService } from \"@/common/services/FormConfiguratorService\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport {\n faArrowsRotate,\n faChevronDown,\n faCircleInfo,\n faDownload,\n faEye,\n faEyeSlash,\n faXmark,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport GeneralUtil from \"@/common/services/util/GeneralUtil\";\nimport InfoBadge from \"@/views/custom-components/InfoBadge\";\nimport AlertPlaceholder from \"@/views/custom-components/AlertPlaceholder\";\nimport PostgresEditor from \"@/views/custom-components/PostgresEditor\";\n\nexport default function ServerSyncModal({\n id,\n navigationState,\n selectedFeature,\n openServerSyncModal,\n openModalFunc,\n}) {\n const [linkedForms, setLinkedForms] = useState();\n const [allRouteMaps, setAllRouteMaps] = useState([]);\n // const [formSyncMap, setFormSyncMap] = useState([]);\n const [serverDetails, setServerDetails] = useState();\n const [usernamesList, setUsernamesList] = useState();\n const [showPassword, setShowPassword] = useState(false);\n const [currentSelectedMigrationTab, setCurrentSelectedMigrationTab] =\n useState(-1);\n const [loading, setLoading] = useState(false);\n const [selectedMigrationByFormCode, setSelectedMigrationByFormCode] =\n useState({});\n const [syncedMigrations, setSyncedMigrations] = useState([]);\n const [tabValue, setTabValue] = useState(\"SYNC\");\n\n const formCtrl = useForm({\n defaultValues: {\n serverName: \"\",\n formCode: [],\n formDetails: [],\n userName: \"\",\n password: \"\",\n requestMessage: \"\",\n },\n mode: \"onChange\",\n });\n\n const { fields, remove, append, replace } = useFieldArray({\n control: formCtrl.control,\n name: \"formDetails\",\n });\n\n const handleTabValueChange = (event, newValue) => {\n setSelectedMigrationByFormCode({});\n\n const fieldData = [...fields];\n fieldData.forEach((field) => {\n const linkedField = linkedForms.find(\n (f) => f.formCode === field.formCode\n );\n field.migrationList = linkedField.migrationListAll;\n field.migrationListAll = linkedField.migrationListAll;\n });\n\n replace(fieldData);\n setTabValue(newValue);\n };\n\n useEffect(() => {\n (async () => {\n try {\n await fetchForms();\n await fetchServerDet();\n await fetchAccessUsernames();\n } catch (error) {\n showToast({\n message: error,\n type: \"error\",\n });\n }\n })();\n }, [openServerSyncModal]);\n\n const fetchForms = async () => {\n try {\n const response = (\n await FormConfiguratorService.getAllLinkedFormsByMenuConfigId(id)\n ).data;\n if (response) {\n setAllRouteMaps(response);\n setLinkedForms(() => {\n const responseObj = response;\n const uniqueMap = new Map();\n responseObj.forEach((item) => {\n if (!uniqueMap.has(item.formCode)) {\n uniqueMap.set(item.formCode, {\n sourceFormCode: item.sourceFormCode,\n formName: item.formName,\n formCode: item.formCode,\n versions: JSON.parse(item.versions).filter(\n (v) => v.version !== \"DRAFT\"\n ),\n formUUID: item.uuid,\n builderType: item.builderType,\n migrationList: item.migrationList,\n migrationListAll: item.migrationList,\n });\n }\n });\n\n return Array.from(uniqueMap.values());\n });\n }\n } catch (error) {\n showToast({\n message: error,\n type: \"error\",\n });\n }\n };\n\n const handleServerChanged = async (server) => {\n if (server && linkedForms) {\n const formMasterUUIDs = linkedForms.map((item) => item.formUUID);\n\n try {\n const response = await API.get(\n `sync/migrationUUIDsByListOfFormMasterUUIDSource`,\n {\n params: {\n formMasterUUIDs,\n serverCode: server.code,\n },\n paramsSerializer: {\n serialize: (params) =>\n Object.entries(params)\n .map(([key, value]) =>\n Array.isArray(value)\n ? value\n .map((v) => `${key}=${encodeURIComponent(v)}`)\n .join(\"&\")\n : `${key}=${encodeURIComponent(value)}`\n )\n .join(\"&\"),\n },\n }\n );\n\n setSyncedMigrations([...response.data]);\n } catch (error) {\n console.error(\"Error fetching UUIDs:\", error);\n }\n } else {\n setSyncedMigrations([]);\n }\n\n // const response = (\n // await execute({\n // code: 'medplat_form_get_all_form_sync_map_by_destination_server_code',\n // parameters: {\n // destinationServerCode: serverCode,\n // },\n // })\n // ).data;\n // if (response.result) {\n // let formSyncMapResult = response.result;\n // formSyncMapResult.forEach((fsm) => {\n // fsm.syncVersionMap = JSON.parse(fsm.syncVersionMap) || [];\n // });\n // setFormSyncMap(formSyncMapResult);\n // }\n };\n\n const fetchServerDet = async () => {\n try {\n const response = (\n await execute({\n code: \"fetch_server_details\",\n })\n ).data;\n if (response.result) {\n setServerDetails(response.result);\n }\n } catch (error) {\n showToast({\n message: error,\n type: \"error\",\n });\n }\n };\n\n const fetchAccessUsernames = async () => {\n try {\n const response = (await getSecurityUserList()).data;\n if (response) {\n setUsernamesList(() => {\n let data = response;\n let usernames = data.split(\",\");\n let users = [];\n usernames.forEach((user) => {\n users.push({\n id: user,\n label: user,\n });\n });\n return users;\n });\n }\n } catch (error) {\n showToast({\n message: error,\n type: \"error\",\n });\n }\n };\n\n const onFormSelectionChange = () => {\n let formCodes = formCtrl.getValues(\"formCode\") || [];\n if (formCodes.length > 0) {\n setCurrentSelectedMigrationTab(formCodes[0]);\n let selectedFormDetails = formCodes\n .map((code) => {\n let form = linkedForms?.find((f) => f.formCode === code);\n return form\n ? {\n formName: form.formName,\n formCode: form.formCode,\n formUUID: form.formUUID,\n migrationList: form.migrationList?.filter(\n (ml) => !syncedMigrations.includes(ml.uuid)\n ),\n migrationListAll: form.migrationList,\n }\n : null;\n })\n .filter(Boolean);\n\n let currentFields = fields.map((field) => field.formCode);\n\n let newForms = selectedFormDetails.filter(\n (form) => !currentFields.includes(form.formCode)\n );\n\n let removedForms = currentFields.filter(\n (code) => !formCodes.includes(code)\n );\n\n newForms.forEach((form) => {\n const formDetails = linkedForms?.find(\n (item) => item.formCode === form.formCode\n );\n const maxVersion = formDetails.versions.reduce((max, current) =>\n parseInt(current.version) > parseInt(max.version) ? current : max\n );\n append({\n formName: form.formName,\n formCode: form.formCode,\n migrationList: form.migrationList,\n migrationListAll: form.migrationList,\n version: maxVersion.version,\n formUUID: form.formUUID,\n builderType: form.builderType,\n });\n });\n\n removedForms.forEach((code) => {\n let index = fields.findIndex((field) => field.formCode === code);\n if (index !== -1) remove(index);\n });\n } else {\n setCurrentSelectedMigrationTab(-1);\n replace([]);\n }\n };\n\n const handleClickShowPassword = () => setShowPassword((show) => !show);\n\n const handleDialogClose = () => {\n openModalFunc(false);\n };\n\n const encrypt = async (encryptionKey, initVector, data) => {\n try {\n return await GeneralUtil.getEncodedData(encryptionKey, initVector, data);\n } catch (error) {\n console.error(error);\n return null;\n }\n };\n\n const getSortedUUIDsByCreatedOn = (data, allowedUUIDs) => {\n return Object.entries(data)\n .filter(([uuid]) => !allowedUUIDs.includes(uuid))\n .sort(([, a], [, b]) => a.createdOn - b.createdOn)\n .map(([uuid]) => uuid);\n };\n\n const onSubmit = async (data) => {\n try {\n setLoading(true);\n const keyIv = await API.get(\"/login/get-key-and-iv\", {\n withCredentials: true,\n });\n const encryptedUserName = await encrypt(\n keyIv.data.key,\n keyIv.data.initVector,\n data.userName\n );\n const encryptedPassword = await encrypt(\n keyIv.data.key,\n keyIv.data.initVector,\n data.password\n );\n const formConfigsData = data.formDetails.map((form) => {\n let migrationUUIDList = getSortedUUIDsByCreatedOn(\n selectedMigrationByFormCode[form.formCode] || {},\n syncedMigrations || []\n );\n\n let obj = {\n formMasterUUID: form.formUUID,\n version: form.version,\n migrationUUIDList,\n builderType: form.builderType,\n };\n return obj;\n });\n\n const routeGraphMap = [];\n\n allRouteMaps.forEach((form) => {\n if (form.sourceFormCode != form.formCode) {\n routeGraphMap.push({ [form.sourceFormCode]: form.formCode });\n }\n });\n\n const requestBody = {\n menuConfigId: id,\n navigationState: navigationState,\n formConfigsData: formConfigsData,\n routeGraphMap: routeGraphMap,\n transactionRequestData: {\n serverCode: data.serverName,\n requestMessage: data.requestMessage,\n featureType: \"FORM_CONFIGURATOR\",\n featureReferenceType: \"FEATURE\",\n featureReferenceId: navigationState,\n },\n authRequestData: {\n userName: encryptedUserName,\n password: encryptedPassword,\n grantType: \"password\",\n clientId: \"imtecho-ui\",\n },\n };\n\n if (tabValue === \"SYNC\") {\n try {\n setLoading(true);\n const syncData = await syncMenuConfigFormsWithServer(requestBody);\n setLoading(false);\n if (syncData.data.isSuccess) {\n showToast({\n type: \"success\",\n message: \"Synced to server successfully.\",\n });\n openModalFunc(false);\n } else {\n showToast({\n type: \"error\",\n message: \"Issue in syncing with server.\",\n });\n console.error(\"error\", syncData.data.error);\n }\n } catch (error) {\n setLoading(false);\n showToast({\n type: \"error\",\n message: \"Sync failed: Unauthorized access\",\n });\n console.error(\"error\", error);\n }\n }\n\n if (tabValue === \"DOWNLOAD\") {\n try {\n setLoading(true);\n const response = await downloadFeature(requestBody);\n const timestamp = Date.now();\n const filename = `V${timestamp}__${requestBody.navigationState}__feature.json`;\n\n const blob = new Blob([response.data], { type: \"application/json\" });\n const url = window.URL.createObjectURL(blob);\n\n const link = document.createElement(\"a\");\n link.href = url;\n link.setAttribute(\"download\", filename);\n document.body.appendChild(link);\n link.click();\n link.remove();\n\n window.URL.revokeObjectURL(url);\n setLoading(false);\n } catch (error) {\n setLoading(false);\n showToast({\n type: \"error\",\n message: \"Download failed\",\n });\n console.error(\"error\", error);\n }\n }\n setLoading(false);\n } catch (error) {\n setLoading(false);\n console.error(\"error\", error);\n }\n };\n\n const handleSelectMigrationByForm = (event, formCode, migration) => {\n let existingSelectedMigration = { ...selectedMigrationByFormCode };\n if (event.target.checked) {\n if (\n Object.prototype.hasOwnProperty.call(\n existingSelectedMigration,\n formCode\n )\n ) {\n existingSelectedMigration[formCode][migration.uuid] = migration;\n } else {\n existingSelectedMigration[formCode] = {};\n existingSelectedMigration[formCode][migration.uuid] = migration;\n }\n } else {\n delete existingSelectedMigration[formCode][migration.uuid];\n }\n setSelectedMigrationByFormCode({ ...existingSelectedMigration });\n };\n\n // const formatDateForVersion = (dateString) => {\n // const date = new Date(dateString);\n // const day = String(date.getDate()).padStart(2, '0');\n // const month = String(date.getMonth() + 1).padStart(2, '0');\n // const year = date.getFullYear();\n // let hours = date.getHours();\n // const minutes = String(date.getMinutes()).padStart(2, '0');\n // hours = String(hours).padStart(2, '0');\n // return `${day}/${month}/${year} ${hours}:${minutes}`;\n // };\n\n // const truncateString = (str, maxLength) => {\n // if (!str) {\n // return 'Not available';\n // }\n // if (str.length > maxLength) {\n // return str.slice(0, maxLength - 3) + '...';\n // }\n // return str;\n // };\n\n // const checkIfVersionSynced = (formCode, version) => {\n // const form = formSyncMap.find((fsm) => fsm.formCode === formCode);\n // if (form) {\n // const syncedform = form?.syncVersionMap?.filter((f) => f.sourceVersion === version);\n // if (syncedform && syncedform.length > 0) {\n // const maxSyncedForm = syncedform.reduce((max, current) =>\n // parseInt(current.destinationVersion) > parseInt(max.destinationVersion) ? current : max\n // );\n // return `Version ${maxSyncedForm.sourceVersion} was synced with Version ${maxSyncedForm.destinationVersion} on (${formatDateForVersion(maxSyncedForm.createdOn)})`;\n // }\n // }\n // return '';\n // };\n\n const formatDate = (dateString) => {\n const date = new Date(dateString);\n\n const day = String(date.getDate()).padStart(2, \"0\");\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const year = date.getFullYear();\n\n let hours = date.getHours();\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n\n hours = String(hours).padStart(2, \"0\");\n\n return `${day}/${month}/${year} ${hours}:${minutes}`;\n };\n\n return (\n <Modal\n open={openServerSyncModal}\n slots={{ backdrop: Backdrop }}\n slotProps={{\n backdrop: {\n timeout: 500,\n },\n }}\n PaperProps={{\n style: {\n borderRadius: \"8px\",\n },\n }}\n >\n <Fade in={openServerSyncModal}>\n <Box\n sx={{\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n padding: \"10px 25px\",\n transform: \"translate(-50%, -50%)\",\n width: \"80%\",\n maxHeight: \"90%\",\n scrollbarWidth: \"none\",\n overflowY: \"scroll\",\n bgcolor: \"background.paper\",\n borderRadius: \"12px\",\n boxShadow: 12,\n transition: \"all 0.5s ease !important\",\n }}\n >\n <Box\n sx={{\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n }}\n >\n <Typography variant=\"h6\" className=\"text-customBlue\">\n {t(\"Sync\")} {selectedFeature?.name}\n </Typography>\n <IconButton onClick={handleDialogClose}>\n <FontAwesomeIcon icon={faXmark} />\n </IconButton>\n </Box>\n <form noValidate onSubmit={formCtrl.handleSubmit(onSubmit)}>\n <Box sx={{ my: 2 }}>\n <Backdrop\n sx={(theme) => ({\n color: \"#fff\",\n zIndex: theme.zIndex.drawer + 1,\n })}\n open={loading}\n >\n <Box\n sx={{\n backgroundColor: \"white\",\n p: 3,\n color: \"black\",\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n borderRadius: \"10px\",\n }}\n >\n <CircularProgress color=\"inherit\" />\n <Typography sx={{ ml: 2 }}>\n Syncing feature, it may take some time, please wait...\n </Typography>\n </Box>\n </Backdrop>\n <Grid container spacing={2}>\n <Grid size={5} container>\n <Grid size={12}>\n <Tabs\n value={tabValue}\n onChange={handleTabValueChange}\n variant=\"fullWidth\"\n >\n <Tab label=\"SYNC\" value=\"SYNC\" />\n <Tab label=\"DOWNLOAD\" value=\"DOWNLOAD\" />\n </Tabs>\n </Grid>\n {[\"SYNC\"].includes(tabValue) && (\n <>\n <Grid size={12}>\n <Divider>\n <Chip label=\"Server and form details\" size=\"small\" />\n </Divider>\n </Grid>\n <Grid size={12}>\n <FormControl fullWidth>\n <FormLabel required>Select server</FormLabel>\n <Controller\n name=\"serverName\"\n control={formCtrl.control}\n rules={{\n required: {\n value: true,\n message: `Select server`,\n },\n }}\n render={({\n field: { onChange, value },\n fieldState: { error },\n }) => {\n const selectedServers = serverDetails?.filter(\n (server) => value?.includes(server.code)\n );\n return (\n <Autocomplete\n fullWidth\n size=\"small\"\n options={serverDetails || []}\n getOptionLabel={(option) =>\n option.serverDetails || \"\"\n }\n value={selectedServers}\n getOptionDisabled={(option) =>\n value?.includes(option.code)\n }\n onChange={(_, newValue) => {\n const serverCodes = newValue?.code;\n onChange(serverCodes);\n handleServerChanged(newValue);\n }}\n renderInput={(params) => (\n <TextField\n {...params}\n placeholder=\"Select server\"\n variant=\"outlined\"\n error={error}\n helperText={error?.message}\n />\n )}\n />\n );\n }}\n />\n </FormControl>\n </Grid>\n </>\n )}\n {[\"DOWNLOAD\", \"SYNC\"].includes(tabValue) && (\n <>\n <Grid size={12}>\n <FormControl fullWidth>\n <FormLabel required>\n {t(\"Select\")} {t(\"forms\")}\n </FormLabel>\n <Controller\n name=\"formCode\"\n rules={{\n required: {\n value: true,\n message: `Select server`,\n },\n }}\n control={formCtrl.control}\n render={({\n field: { onChange, value },\n fieldState: { error },\n }) => {\n const selectedObjects = linkedForms?.filter(\n (form) => value?.includes(form.formCode)\n );\n return (\n <Autocomplete\n multiple\n size=\"small\"\n options={linkedForms || []}\n disableCloseOnSelect\n getOptionLabel={(option) =>\n option.formName || \"\"\n }\n value={selectedObjects}\n getOptionDisabled={(option) =>\n value?.includes(option.formCode)\n }\n onChange={(_, newValue) => {\n const formCodes = newValue.map(\n (item) => item.formCode\n );\n onChange(formCodes);\n onFormSelectionChange();\n }}\n renderInput={(params) => (\n <TextField\n {...params}\n placeholder=\"Select all forms to sync\"\n variant=\"outlined\"\n error={error}\n helperText={error?.message}\n />\n )}\n />\n );\n }}\n />\n </FormControl>\n </Grid>\n </>\n )}\n {[\"SYNC\"].includes(tabValue) && (\n <>\n <Grid size={12}>\n <Divider>\n <Chip\n label={\n <Box>\n <Box component={\"span\"} sx={{ mr: 0.5 }}>\n User authentication details\n </Box>\n <Tooltip title=\"Only selected users can perform the sync operation\">\n <FontAwesomeIcon icon={faCircleInfo} />\n </Tooltip>\n </Box>\n }\n size=\"small\"\n />\n </Divider>\n </Grid>\n <Grid size={12}>\n <FormControl variant=\"outlined\" fullWidth>\n <FormLabel required>\n {t(\"Select\")} {t(\"user\")}\n </FormLabel>\n <Controller\n name=\"userName\"\n rules={{\n required: {\n value: true,\n message: `Select username`,\n },\n }}\n control={formCtrl.control}\n render={({\n field: { onChange, value },\n fieldState: { error },\n }) => {\n return (\n <Autocomplete\n size=\"small\"\n options={usernamesList || []}\n getOptionLabel={(option) =>\n option?.label || \"\"\n }\n value={\n usernamesList?.find(\n (option) => option.id === value\n ) || null\n }\n onChange={(_, newValue) => {\n onChange(newValue ? newValue.id : null);\n }}\n renderInput={(params) => (\n <TextField\n {...params}\n placeholder=\"Select user\"\n variant=\"outlined\"\n error={error}\n helperText={error?.message}\n />\n )}\n />\n );\n }}\n />\n </FormControl>\n </Grid>\n <Grid size={12}>\n <FormControl fullWidth>\n <FormLabel\n required\n color=\"text.primary\"\n sx={{ mb: 0.5 }}\n >\n {t(\"Password\")}\n </FormLabel>\n <Controller\n name=\"password\"\n rules={{\n required: {\n value: true,\n message: `Enter password`,\n },\n }}\n control={formCtrl.control}\n errors={formCtrl.formState.errors}\n defaultValue=\"\"\n render={({\n field: { onChange, value },\n fieldState: { error },\n }) => (\n <Box sx={{ mb: 1 }}>\n <OutlinedInput\n fullWidth\n type={showPassword ? \"text\" : \"password\"}\n value={value}\n size=\"small\"\n placeholder=\"Enter password\"\n onChange={onChange}\n error={error}\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton\n aria-label={\n showPassword\n ? \"hide the password\"\n : \"display the password\"\n }\n onClick={handleClickShowPassword}\n onMouseDown={(e) => e.preventDefault()}\n onMouseUp={(e) => e.preventDefault()}\n edge=\"end\"\n >\n {showPassword ? (\n <FontAwesomeIcon\n icon={faEyeSlash}\n size=\"xs\"\n />\n ) : (\n <FontAwesomeIcon\n icon={faEye}\n size=\"xs\"\n />\n )}\n </IconButton>\n </InputAdornment>\n }\n />\n {error && (\n <FormHelperText error={error}>\n {error?.message}\n </FormHelperText>\n )}\n </Box>\n )}\n />\n </FormControl>\n </Grid>\n <Grid size={12}>\n <FormControl fullWidth>\n <FormLabel required>\n {t(\"Request\")} {t(\"message\")}\n </FormLabel>\n <Controller\n name=\"requestMessage\"\n rules={{\n required: {\n value: true,\n message: `Enter request message`,\n },\n }}\n control={formCtrl.control}\n render={({ field, fieldState: { error } }) => (\n <TextField\n multiline\n rows={4}\n size=\"small\"\n placeholder=\"Enter request message\"\n {...field}\n error={error}\n helperText={error?.message}\n />\n )}\n />\n </FormControl>\n </Grid>\n </>\n )}\n </Grid>\n <Grid size={7}>\n {/* {fields?.length > 0 && (\n <Grid size={12}>\n <FormControl variant=\"outlined\" className=\"m-3 flex flex-row\">\n <Box className=\"w-[97%] m-2\" sx={{ padding: '10px' }}>\n <TableContainer component={Paper} sx={{ maxHeight: '300px', overflowY: 'auto' }}>\n <Table>\n <TableHead sx={{ backgroundColor: 'background.default' }}>\n <TableRow>\n <TableCell align=\"center\">\n <strong>{t('Name')}</strong>\n </TableCell>\n <TableCell align=\"center\">\n <strong>{t('Code')}</strong>\n </TableCell>\n <TableCell align=\"center\" width={'50%'}>\n <strong>{t('Version')}</strong>\n </TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {fields?.map((selected, index) => {\n const formDet = linkedForms?.find((item) => item.formCode === selected.formCode);\n return (\n <TableRow key={selected.formCode}>\n <TableCell align=\"center\">{formDet?.formName}</TableCell>\n <TableCell align=\"center\">{selected.formCode}</TableCell>\n <TableCell align=\"center\">\n <Controller\n id=\"formDetails\"\n name={`formDetails.${index}.version`}\n control={formCtrl.control}\n render={({ field: { onChange, value }, fieldState: { error } }) => (\n <>\n <Autocomplete\n size=\"small\"\n disabled\n options={formDet?.versions || []}\n getOptionLabel={(option) => option.version || ''}\n renderOption={(props, option) => (\n <li {...props}>\n <Box sx={{ width: '100%' }}>\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n }}\n >\n <Box>{option?.version}</Box>\n <Box sx={{ pl: 2, color: '#444', fontSize: '0.8rem' }}>\n <kbd>({formatDateForVersion(option?.createdOn)})</kbd>\n </Box>\n </Box>\n <Box\n sx={{\n float: 'right',\n color: option.versionDescription ? '#444' : '#999',\n fontSize: '0.8rem',\n }}\n >\n <Tooltip title={option.versionDescription} arrow>\n ({truncateString(option.versionDescription, 30)})\n </Tooltip>\n </Box>\n </Box>\n </li>\n )}\n value={\n formDet?.versions?.find((option) => option.version === value) || null\n }\n clearOnBlur\n onChange={(_, newValue) => onChange(newValue ? newValue.version : null)}\n renderInput={(params) => (\n <TextField\n {...params}\n placeholder=\"Select Versions\"\n variant=\"outlined\"\n error={!!error}\n helperText={error ? error.message : ''}\n />\n )}\n />\n <FormHelperText sx={{ color: 'info.dark' }}>\n {value && checkIfVersionSynced(selected.formCode, value)}\n </FormHelperText>\n </>\n )}\n />\n </TableCell>\n </TableRow>\n );\n })}\n </TableBody>\n </Table>\n </TableContainer>\n </Box>\n </FormControl>\n </Grid>\n )} */}\n <Box>\n {fields.length > 0 ? (\n <React.Fragment>\n <Alert sx={{ mt: 1 }} severity=\"info\">\n Please select the migration corresponding to the\n respective form for synchronization\n </Alert>\n <Tabs\n value={currentSelectedMigrationTab}\n onChange={(_, value) => {\n setCurrentSelectedMigrationTab(value);\n }}\n >\n {fields?.map((field) => (\n <Tab\n key={field.formUUID}\n value={field.formCode}\n label={\n <InfoBadge\n label={field.formCode}\n value={`V${field.version}`}\n color=\"info.main\"\n tooltipValue={`Version ${field.version} of ${field.formName} will be synced`}\n showTooltip={true}\n valueSize={30}\n fontSize=\"0.8rem\"\n />\n }\n />\n ))}\n </Tabs>\n <Divider sx={{ mb: 1 }} />\n {currentSelectedMigrationTab != -1 &&\n (() => {\n const currentForm = fields.find(\n (field) =>\n field.formCode === currentSelectedMigrationTab\n );\n return (\n <Grid\n spacing={2}\n container\n key={currentForm.formCode}\n sx={{ maxHeight: \"50vh\", overflowY: \"scroll\" }}\n >\n {currentForm?.migrationList.length === 0 && (\n <Grid size={12}>\n <AlertPlaceholder height=\"250px\">\n No migration queries present for (\n {currentForm.formName})\n </AlertPlaceholder>\n </Grid>\n )}\n {currentForm?.migrationList?.map(\n (migration) => (\n <Grid\n size={12}\n container\n key={migration.uuid}\n >\n <Grid size={1}>\n <Checkbox\n value={\n Object.keys(\n selectedMigrationByFormCode[\n currentSelectedMigrationTab\n ] || {}\n )?.includes(migration.uuid) &&\n (!syncedMigrations?.includes(\n migration.uuid\n ) ||\n tabValue == \"DOWNLOAD\")\n }\n checked={\n Object.keys(\n selectedMigrationByFormCode[\n currentSelectedMigrationTab\n ] || {}\n )?.includes(migration.uuid) &&\n (!syncedMigrations?.includes(\n migration.uuid\n ) ||\n tabValue == \"DOWNLOAD\")\n }\n disabled={\n syncedMigrations?.includes(\n migration.uuid\n ) && tabValue === \"SYNC\"\n }\n sx={{\n \"& .MuiSvgIcon-root\": {\n fontSize: 32,\n },\n mr: 1,\n }}\n onChange={(e) => {\n handleSelectMigrationByForm(\n e,\n currentSelectedMigrationTab,\n migration\n );\n }}\n />\n </Grid>\n <Grid size={11}>\n <Accordion\n slotProps={{\n transition: { unmountOnExit: true },\n }}\n >\n <AccordionSummary\n expandIcon={\n <FontAwesomeIcon\n icon={faChevronDown}\n />\n }\n aria-controls=\"panel1-content\"\n id=\"panel1-header\"\n sx={{\n backgroundColor:\n \"background.default\",\n }}\n >\n <Typography component=\"span\">\n Created on :{\" \"}\n {formatDate(migration.createdOn)}\n <Chip\n sx={{ ml: 2 }}\n size=\"small\"\n color={\n migration.isExecuted\n ? \"success\"\n : \"warning\"\n }\n label={\n migration.isExecuted\n ? \"Executed\"\n : \"Not Executed\"\n }\n />\n {migration.isExecuted &&\n migration.isError && (\n <Chip\n sx={{ ml: 2 }}\n size=\"small\"\n color={\"error\"}\n label={\"Error\"}\n />\n )}\n {syncedMigrations?.includes(\n migration.uuid\n ) &&\n tabValue === \"SYNC\" && (\n <Chip\n sx={{ ml: 2 }}\n size=\"small\"\n color={\"info\"}\n label={\"Synced\"}\n />\n )}\n </Typography>\n </AccordionSummary>\n <AccordionDetails>\n <PostgresEditor\n mode=\"READ_ONLY\"\n defaultValue={migration?.query}\n />\n </AccordionDetails>\n </Accordion>\n </Grid>\n </Grid>\n )\n )}\n </Grid>\n );\n })()}\n </React.Fragment>\n ) : (\n <Box sx={{ mt: 1 }}>\n <AlertPlaceholder height=\"250px\">\n Please select forms to sync\n </AlertPlaceholder>\n </Box>\n )}\n </Box>\n </Grid>\n </Grid>\n </Box>\n <Box\n sx={{\n my: 1,\n display: \"flex\",\n justifyContent: \"end\",\n alignItems: \"center\",\n }}\n >\n {[\"SYNC\"].includes(tabValue) && (\n <Button\n type=\"submit\"\n startIcon={\n <FontAwesomeIcon size=\"lg\" icon={faArrowsRotate} />\n }\n color=\"success\"\n size=\"small\"\n variant=\"contained\"\n sx={{ mr: 1 }}\n >\n Start Syncing\n </Button>\n )}\n\n {[\"DOWNLOAD\"].includes(tabValue) && (\n <Button\n type=\"submit\"\n startIcon={<FontAwesomeIcon size=\"lg\" icon={faDownload} />}\n color=\"success\"\n size=\"small\"\n variant=\"contained\"\n sx={{ mr: 1 }}\n >\n Download Config\n </Button>\n )}\n </Box>\n </form>\n </Box>\n </Fade>\n </Modal>\n );\n}\n\nServerSyncModal.propTypes = {\n id: PropTypes.any,\n selectedFeature: PropTypes.any,\n navigationState: PropTypes.any,\n openServerSyncModal: PropTypes.any,\n openModalFunc: PropTypes.any,\n};\n"],"names":["ServerSyncModal","id","navigationState","selectedFeature","openServerSyncModal","openModalFunc","linkedForms","setLinkedForms","useState","allRouteMaps","setAllRouteMaps","serverDetails","setServerDetails","usernamesList","setUsernamesList","showPassword","setShowPassword","currentSelectedMigrationTab","setCurrentSelectedMigrationTab","loading","setLoading","selectedMigrationByFormCode","setSelectedMigrationByFormCode","syncedMigrations","setSyncedMigrations","tabValue","setTabValue","formCtrl","useForm","fields","remove","append","replace","useFieldArray","handleTabValueChange","event","newValue","fieldData","field","linkedField","f","useEffect","fetchForms","fetchServerDet","fetchAccessUsernames","error","showToast","response","FormConfiguratorService","responseObj","uniqueMap","item","v","handleServerChanged","server","formMasterUUIDs","API","params","key","value","execute","getSecurityUserList","usernames","users","user","onFormSelectionChange","formCodes","selectedFormDetails","code","form","_a","ml","currentFields","newForms","removedForms","maxVersion","max","current","index","handleClickShowPassword","show","handleDialogClose","encrypt","encryptionKey","initVector","data","GeneralUtil","getSortedUUIDsByCreatedOn","allowedUUIDs","uuid","a","b","onSubmit","keyIv","encryptedUserName","encryptedPassword","formConfigsData","migrationUUIDList","routeGraphMap","requestBody","syncData","syncMenuConfigFormsWithServer","downloadFeature","filename","blob","url","link","handleSelectMigrationByForm","formCode","migration","existingSelectedMigration","formatDate","dateString","date","day","month","year","hours","minutes","jsx","Modal","Backdrop","Fade","jsxs","Box","Typography","t","IconButton","FontAwesomeIcon","faXmark","theme","CircularProgress","Grid","Tabs","Tab","Fragment","Divider","Chip","FormControl","FormLabel","Controller","onChange","selectedServers","Autocomplete","option","_","serverCodes","TextField","selectedObjects","Tooltip","faCircleInfo","OutlinedInput","InputAdornment","e","faEyeSlash","faEye","FormHelperText","React","Alert","InfoBadge","currentForm","AlertPlaceholder","Checkbox","_b","Accordion","AccordionSummary","faChevronDown","AccordionDetails","PostgresEditor","Button","faArrowsRotate","faDownload","PropTypes"],"mappings":";;;;;;;;;;;;;;;;;;;AA4DA,SAAwBA,GAAgB;AAAA,EACtC,IAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,eAAAC;AACF,GAAG;AACD,QAAM,CAACC,GAAaC,EAAc,IAAIC,EAAA,GAChC,CAACC,IAAcC,EAAe,IAAIF,EAAS,CAAA,CAAE,GAE7C,CAACG,GAAeC,EAAgB,IAAIJ,EAAA,GACpC,CAACK,GAAeC,EAAgB,IAAIN,EAAA,GACpC,CAACO,GAAcC,EAAe,IAAIR,EAAS,EAAK,GAChD,CAACS,GAA6BC,CAA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AAAA,wBACL,WAAW,gBAAAlD,EAACS,GAAA,EAAgB,MAAK,MAAK,MAAM2C,IAAY;AAAA,wBACxD,OAAM;AAAA,wBACN,MAAK;AAAA,wBACL,SAAQ;AAAA,wBACR,IAAI,EAAE,IAAI,EAAA;AAAA,wBACX,UAAA;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAED;AAAA,gBAAA;AAAA,cAAA;AAAA,YAEJ,EAAA,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,EACF,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA3K,GAAgB,YAAY;AAAA,EAC1B,IAAI4K,EAAU;AAAA,EACd,iBAAiBA,EAAU;AAAA,EAC3B,iBAAiBA,EAAU;AAAA,EAC3B,qBAAqBA,EAAU;AAAA,EAC/B,eAAeA,EAAU;AAC3B;"}
@@ -1,130 +0,0 @@
1
- import { jsxs as d, Fragment as f, jsx as a } from "react/jsx-runtime";
2
- import { useTranslateProvider as q } from "@/common/languageTranslator/TranslationContext";
3
- import { showToast as v } from "@/common/toaster/toaster";
4
- import I from "@/hooks/useTrackEvent";
5
- import O from "@/views/custom-components/CustomConfirmationModal";
6
- import { Dialog as S, DialogTitle as D, DialogContent as F, TextField as A, DialogActions as M, Button as c } from "@mui/material";
7
- import p from "prop-types";
8
- import { useState as m, useCallback as U, useEffect as z } from "react";
9
- import B from "@/common/services/util/GeneralUtil";
10
- const N = ({ configuredQuery: t, open: b, onClose: s }) => {
11
- const [n, _] = m(""), [C, E] = m(!1), [T, r] = m(!1), x = I(), { translate: i } = q(), y = B.isEkavach, w = U(() => {
12
- const o = t.query.includes("public");
13
- E(o);
14
- let e = `DELETE FROM QUERY_MASTER WHERE CODE='${t.code}';
15
-
16
- `;
17
- e += `INSERT INTO QUERY_MASTER (uuid, created_by, created_on, modified_by, modified_on, code, params, query, description, returns_result_set, state, is_mobile_query, is_public ${y ? ", is_clickhouse_query" : ""})
18
- VALUES (
19
- `, e += `'${t.uuid}', ${t.createdBy}, current_date, ${t.createdBy}, current_date, `, e += `'${t.code}',
20
- `, e += t.params ? `'${t.params}',
21
- ` : `null,
22
- `, e += `'${t.query.replace(/'/g, "''")}',
23
- `, e += t.description ? `'${t.description}',
24
- ` : `null,
25
- `, e += t.returnsResultSet !== void 0 ? `${t.returnsResultSet}, ` : "false, ", e += t.state ? `'${t.state}', ` : "'ACTIVE', ", e += ` ${t == null ? void 0 : t.isMobileQuery},`, e += `${t == null ? void 0 : t.isPublic}`, y && (e += `,${t.isClickhouseQuery || !1}`), e += ");", _(e);
26
- }, [t]), $ = () => {
27
- navigator.clipboard.writeText(n).then(() => {
28
- v({ message: "Query Copied", type: "success" }), s();
29
- });
30
- }, k = () => {
31
- h(), r((o) => !o);
32
- }, h = () => {
33
- const o = new Blob([n], { type: "text/plain" }), e = (o.size / 1024).toFixed(2), u = URL.createObjectURL(o), l = document.createElement("a");
34
- l.href = u, l.download = `V${(/* @__PURE__ */ new Date()).getTime()}__CHANGE_IN_${t.code}.sql`, document.body.appendChild(l), l.click(), x("file_download", {
35
- file_type: "sql",
36
- file_name: l.download,
37
- file_size: `${e} KB`,
38
- download_status: "success"
39
- }), document.body.removeChild(l), URL.revokeObjectURL(u), s();
40
- }, R = () => {
41
- C ? r((o) => !o) : h();
42
- };
43
- return z(() => {
44
- t && w();
45
- }, [t, w]), /* @__PURE__ */ d(f, { children: [
46
- /* @__PURE__ */ a(
47
- O,
48
- {
49
- description: "This Flyway contains keyword 'public'. Are you sure you want to download?",
50
- title: "CONFIRM ACTION",
51
- handleClick: k,
52
- open: T,
53
- handleClose: () => r((o) => !o),
54
- dataTestId: "showflywayquery-customconfirmationmodal"
55
- }
56
- ),
57
- /* @__PURE__ */ d(S, { open: b, onClose: s, fullWidth: !0, maxWidth: "md", children: [
58
- /* @__PURE__ */ a(D, { className: "p-2.5 px-5 flex border-b font-medium text-lg", children: i("Flyway Query") }),
59
- /* @__PURE__ */ a(F, { children: /* @__PURE__ */ a(
60
- A,
61
- {
62
- multiline: !0,
63
- rows: 10,
64
- variant: "outlined",
65
- fullWidth: !0,
66
- value: n,
67
- sx: {
68
- "& .MuiInputBase-input": {
69
- fontSize: "14px"
70
- },
71
- "& .MuiOutlinedInput-root": {
72
- // fontSize: '14px'
73
- borderRadius: "5px"
74
- }
75
- },
76
- slotProps: {
77
- input: {
78
- readOnly: !0
79
- }
80
- },
81
- "data-testid": "showflywayquery-textfield"
82
- }
83
- ) }),
84
- /* @__PURE__ */ d(M, { children: [
85
- /* @__PURE__ */ a(
86
- c,
87
- {
88
- onClick: R,
89
- variant: "contained",
90
- size: "small",
91
- color: "primary",
92
- "data-testid": "showflywayquery-button-download",
93
- children: i("Download")
94
- }
95
- ),
96
- /* @__PURE__ */ a(
97
- c,
98
- {
99
- onClick: $,
100
- variant: "contained",
101
- size: "small",
102
- color: "primary",
103
- "data-testid": "showflywayquery-button-copyquery",
104
- children: i("Copy Query")
105
- }
106
- ),
107
- /* @__PURE__ */ a(
108
- c,
109
- {
110
- onClick: s,
111
- variant: "contained",
112
- color: "secondary",
113
- size: "small",
114
- "data-testid": "showflywayquery-button-cancel",
115
- children: i("Cancel")
116
- }
117
- )
118
- ] })
119
- ] })
120
- ] });
121
- };
122
- N.propTypes = {
123
- configuredQuery: p.any,
124
- open: p.any,
125
- onClose: p.any
126
- };
127
- export {
128
- N as default
129
- };
130
- //# sourceMappingURL=ShowFlywayQuery-DMsAbtOW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShowFlywayQuery-DMsAbtOW.js","sources":["../src/views/QueryBuilder/ShowFlywayQuery.jsx"],"sourcesContent":["import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';\nimport { showToast } from '@/common/toaster/toaster';\nimport useTrackEvent from '@/hooks/useTrackEvent';\nimport CustomConfirmationModal from '@/views/custom-components/CustomConfirmationModal';\nimport { Button, Dialog, DialogActions, DialogContent, DialogTitle, TextField } from '@mui/material';\nimport PropTypes from 'prop-types';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport GeneralUtil from \"@/common/services/util/GeneralUtil\";\n\n/**\n * A React functional component that displays a configured Flyway query.\n * @mdoule ShowFlywayQuery\n * @param {Object} props - Component properties.\n * @param {Object} props.configuredQuery - The query configuration object to display.\n * @param {boolean} props.open - Boolean flag indicating if the component should be visible.\n * @param {function} props.onClose - Callback function to close the component.\n */\n\nconst ShowFlywayQuery = ({ configuredQuery, open, onClose }) => {\n const [text, setText] = useState('');\n const [isPublicKeyword, setIsPublicKeyword] = useState(false);\n const [openConfirm, setOpenConfirm] = useState(false);\n const trackEvent = useTrackEvent();\n const { translate } = useTranslateProvider();\n const isClickhouseEnabledEnv = GeneralUtil.isEkavach;\n\n /**\n *\n * Generates a SQL query string based on the `configuredQuery` object.\n * @function generateQueryText\n * @param {Object} configuredQuery - The query configuration object used to generate the SQL query.\n * @param {string} configuredQuery.code - The unique code for the query.\n * @param {string} configuredQuery.uuid - The unique identifier for the query.\n * @param {number} configuredQuery.createdBy - The ID of the user who created the query.\n * @param {string} [configuredQuery.params] - The parameters for the query.\n * @param {string} configuredQuery.query - The actual SQL query text.\n * @param {string} [configuredQuery.description] - A description of the query.\n * @param {boolean} [configuredQuery.returnsResultSet] - Flag indicating if the query returns a result set.\n * @param {string} [configuredQuery.state] - The state of the query (e.g., 'ACTIVE').\n * @returns {void}\n */\n\n const generateQueryText = useCallback(() => {\n const publicKeyword = configuredQuery.query.includes('public');\n setIsPublicKeyword(publicKeyword);\n\n let queryText = `DELETE FROM QUERY_MASTER WHERE CODE='${configuredQuery.code}';\\n\\n`;\n queryText += `INSERT INTO QUERY_MASTER (uuid, created_by, created_on, modified_by, modified_on, code, params, query, description, returns_result_set, state, is_mobile_query, is_public ${isClickhouseEnabledEnv ? ', is_clickhouse_query' : ''}) \\nVALUES ( \\n`;\n queryText += `'${configuredQuery.uuid}', ${configuredQuery.createdBy}, current_date, ${configuredQuery.createdBy}, current_date, `;\n queryText += `'${configuredQuery.code}', \\n`;\n\n queryText += configuredQuery.params ? `'${configuredQuery.params}', \\n` : 'null, \\n';\n queryText += `'${configuredQuery.query.replace(/'/g, \"''\")}', \\n`;\n queryText += configuredQuery.description ? `'${configuredQuery.description}', \\n` : 'null, \\n';\n queryText += configuredQuery.returnsResultSet !== undefined ? `${configuredQuery.returnsResultSet}, ` : 'false, ';\n queryText += configuredQuery.state ? `'${configuredQuery.state}', ` : `'ACTIVE', `;\n queryText += ` ${configuredQuery?.isMobileQuery},`;\n queryText += `${configuredQuery?.isPublic}`;\n if (isClickhouseEnabledEnv) queryText += `,${configuredQuery.isClickhouseQuery || false}`;\n queryText += ');';\n\n setText(queryText);\n }, [configuredQuery]);\n\n /**\n *\n * Copies the generated query text to the clipboard and displays a success message.\n * @function copyQuery\n * @returns {void}\n */\n\n const copyQuery = () => {\n navigator.clipboard.writeText(text).then(() => {\n showToast({ message: 'Query Copied', type: 'success' });\n onClose();\n });\n };\n\n /**\n * Triggers a download operation and toggles the confirmation dialog visibility.\n * The function assumes that `download` and `setOpenConfirm` are available in the current scope.\n * @function askForConfirmation\n * @returns {void}\n */\n\n const askForConfirmation = () => {\n download();\n setOpenConfirm((cur) => !cur);\n };\n\n /**\n * Creates and triggers a download of a text file containing the query text.\n *\n * @function download\n * @returns {void}\n */\n\n const download = () => {\n const blob = new Blob([text], { type: 'text/plain' });\n const blobSizeInKB = (blob.size / 1024).toFixed(2);\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = `V${new Date().getTime()}__CHANGE_IN_${configuredQuery.code}.sql`;\n document.body.appendChild(a);\n\n a.click();\n trackEvent('file_download', {\n file_type: 'sql',\n file_name: a.download,\n file_size: `${blobSizeInKB} KB`,\n download_status: 'success',\n });\n document.body.removeChild(a);\n URL.revokeObjectURL(url);\n onClose();\n };\n\n /**\n *\n * Handles the download process based on the presence of a public keyword in the query text.\n * @function handleDownload\n * @returns {void}\n */\n\n const handleDownload = () => {\n if (isPublicKeyword) {\n setOpenConfirm((cur) => !cur);\n } else {\n download();\n }\n };\n\n /**\n * `useEffect` Hook to Generate Query Text\n *\n * This effect hook is used to generate the SQL query text whenever the `configuredQuery` dependency changes.\n *\n * @function useEffect\n * @param {Object} configuredQuery - The query configuration object used to generate the SQL query text.\n * @param {function} generateQueryText - A function that generates the query text based on `configuredQuery`.\n */\n\n useEffect(() => {\n if (configuredQuery) {\n generateQueryText();\n }\n }, [configuredQuery, generateQueryText]);\n return (\n <>\n <CustomConfirmationModal\n description={\"This Flyway contains keyword 'public'. Are you sure you want to download?\"}\n title={'CONFIRM ACTION'}\n handleClick={askForConfirmation}\n open={openConfirm}\n handleClose={() => setOpenConfirm((cur) => !cur)}\n dataTestId=\"showflywayquery-customconfirmationmodal\"\n />\n <Dialog open={open} onClose={onClose} fullWidth maxWidth=\"md\">\n <DialogTitle className=\"p-2.5 px-5 flex border-b font-medium text-lg\">{translate('Flyway Query')}</DialogTitle>\n <DialogContent>\n <TextField\n multiline\n rows={10}\n variant=\"outlined\"\n fullWidth\n value={text}\n sx={{\n '& .MuiInputBase-input': {\n fontSize: '14px',\n },\n '& .MuiOutlinedInput-root': {\n // fontSize: '14px'\n borderRadius: '5px',\n },\n }}\n slotProps={{\n input: {\n readOnly: true,\n },\n }}\n data-testid=\"showflywayquery-textfield\"\n />\n </DialogContent>\n <DialogActions>\n <Button\n onClick={handleDownload}\n variant=\"contained\"\n size=\"small\"\n color=\"primary\"\n data-testid=\"showflywayquery-button-download\"\n >\n {translate('Download')}\n </Button>\n <Button\n onClick={copyQuery}\n variant=\"contained\"\n size=\"small\"\n color=\"primary\"\n data-testid=\"showflywayquery-button-copyquery\"\n >\n {translate('Copy Query')}\n </Button>\n <Button\n onClick={onClose}\n variant=\"contained\"\n color=\"secondary\"\n size=\"small\"\n data-testid=\"showflywayquery-button-cancel\"\n >\n {translate('Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n </>\n );\n};\n\nShowFlywayQuery.propTypes = {\n configuredQuery: PropTypes.any,\n open: PropTypes.any,\n onClose: PropTypes.any,\n};\n\nexport default ShowFlywayQuery;\n"],"names":["ShowFlywayQuery","configuredQuery","open","onClose","text","setText","useState","isPublicKeyword","setIsPublicKeyword","openConfirm","setOpenConfirm","trackEvent","useTrackEvent","translate","useTranslateProvider","isClickhouseEnabledEnv","GeneralUtil","generateQueryText","useCallback","publicKeyword","queryText","copyQuery","showToast","askForConfirmation","download","cur","blob","blobSizeInKB","url","a","handleDownload","useEffect","jsxs","Fragment","jsx","CustomConfirmationModal","Dialog","DialogTitle","DialogContent","TextField","DialogActions","Button","PropTypes"],"mappings":";;;;;;;;;AAkBA,MAAMA,IAAkB,CAAC,EAAE,iBAAAC,GAAiB,MAAAC,GAAM,SAAAC,QAAc;AAC9D,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAE,GAC7B,CAACC,GAAiBC,CAAkB,IAAIF,EAAS,EAAK,GACtD,CAACG,GAAaC,CAAc,IAAIJ,EAAS,EAAK,GAC9CK,IAAaC,EAAA,GACb,EAAE,WAAAC,EAAA,IAAcC,EAAA,GAChBC,IAAyBC,EAAY,WAkBrCC,IAAoBC,EAAY,MAAM;AAC1C,UAAMC,IAAgBlB,EAAgB,MAAM,SAAS,QAAQ;AAC7D,IAAAO,EAAmBW,CAAa;AAEhC,QAAIC,IAAY,wCAAwCnB,EAAgB,IAAI;AAAA;AAAA;AAC5E,IAAAmB,KAAa,6KAA6KL,IAAyB,0BAA0B,EAAE;AAAA;AAAA,GAC/OK,KAAa,IAAInB,EAAgB,IAAI,MAAMA,EAAgB,SAAS,mBAAmBA,EAAgB,SAAS,oBAChHmB,KAAa,IAAInB,EAAgB,IAAI;AAAA,GAErCmB,KAAanB,EAAgB,SAAS,IAAIA,EAAgB,MAAM;AAAA,IAAU;AAAA,GAC1EmB,KAAa,IAAInB,EAAgB,MAAM,QAAQ,MAAM,IAAI,CAAC;AAAA,GAC1DmB,KAAanB,EAAgB,cAAc,IAAIA,EAAgB,WAAW;AAAA,IAAU;AAAA,GACpFmB,KAAanB,EAAgB,qBAA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ASpB;AAAA,YACT,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,OAAM;AAAA,YACN,eAAY;AAAA,YAEX,YAAU,YAAY;AAAA,UAAA;AAAA,QAAA;AAAA,QAEzB,gBAAAa;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,SAAStC;AAAA,YACT,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,MAAK;AAAA,YACL,eAAY;AAAA,YAEX,YAAU,QAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,MACrB,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;AAEAH,EAAgB,YAAY;AAAA,EAC1B,iBAAiB0C,EAAU;AAAA,EAC3B,MAAMA,EAAU;AAAA,EAChB,SAASA,EAAU;AACrB;"}
@@ -1,259 +0,0 @@
1
- import { jsxs as N, Fragment as J, jsx as o } from "react/jsx-runtime";
2
- import { useState as c, useCallback as L, useEffect as U } from "react";
3
- import u from "prop-types";
4
- import { Dialog as W, DialogTitle as k, DialogContent as B, TextField as V, DialogActions as P, Button as w } from "@mui/material";
5
- import { showToast as I } from "@/common/toaster/toaster";
6
- import j from "@/views/custom-components/CustomConfirmationModal";
7
- import C from "moment/moment";
8
- import f from "@/hooks/useTrackEvent";
9
- import { useTranslateProvider as z } from "@/common/languageTranslator/TranslationContext";
10
- const H = ({ configuredQuery: t, open: O, onClose: m, dataTestId: F }) => {
11
- const [r, S] = c(""), [T, R] = c(!1), { translate: _ } = z(), [y, p] = c(!1), M = L(() => {
12
- var n;
13
- const l = (n = t == null ? void 0 : t.configJson) == null ? void 0 : n.includes("public");
14
- R(l);
15
- let e = `DELETE FROM EVENT_CONFIGURATION WHERE uuid = '${t.uuid}';
16
-
17
- `;
18
- if (e += `INSERT INTO EVENT_CONFIGURATION (created_by, created_on, modified_by, modified_on, day, description, event_type, event_type_detail_id, form_type_id, hour, minute, name, config_json, state, trigger_when, event_type_detail_code, uuid)
19
- VALUES (
20
- `, e += `${t.createdBy}, current_date, ${t.createdBy}, current_date, `, e += t.day !== void 0 && t.day !== null ? `${t.day}, ` : "null, ", e += t.description ? `'${t.description.replace(/'/g, "''")}', ` : "null, ", e += `'${t.eventType}', `, e += t.eventTypeDetailId !== void 0 && t.eventTypeDetailId !== null ? `${t.eventTypeDetailId}, ` : "null, ", e += t.formTypeId !== void 0 && t.formTypeId !== null ? `${t.formTypeId}, ` : "null, ", e += t.hour !== void 0 && t.hour !== null ? `${t.hour}, ` : "null, ", e += t.minute !== void 0 && t.minute !== null ? `${t.minute}, ` : "null, ", e += `'${t.name.replace(/'/g, "''")}', `, e += `'${t.configJson.replace(/'/g, "''")}', `, e += `'${t.state}', `, e += t.trigerWhen !== void 0 && t.trigerWhen !== null ? `'${t.trigerWhen}', ` : "null, ", e += t.eventTypeDetailCode !== void 0 && t.eventTypeDetailCode !== null ? `${t.eventTypeDetailCode}, ` : "null, ", e += `'${t.uuid}');
21
- `, t.eventType === "TIMMER_BASED" && t.state !== "INACTIVE") {
22
- let s = C();
23
- switch (t.trigerWhen) {
24
- case "MONTHLY":
25
- s.add(1, "months").set({
26
- date: t.day,
27
- hour: t.hour || 0,
28
- minute: t.minute || 0,
29
- second: 0
30
- });
31
- break;
32
- case "DAILY":
33
- s.add($(t), "days").set({
34
- hour: t.hour || 0,
35
- minute: t.minute || 0,
36
- second: 0
37
- });
38
- break;
39
- case "HOURLY":
40
- s.add(1, "hours").set({ minute: $(t), second: 0 });
41
- break;
42
- case "MINUTE":
43
- s.add(t.minute, "minutes").set({ second: 0 });
44
- break;
45
- }
46
- e += `
47
- DELETE FROM TIMER_EVENT WHERE event_config_uuid = '${t.uuid}' AND status = 'NEW';
48
-
49
- `, e += `INSERT INTO timer_event (event_config_uuid, processed, status, type, system_trigger_on)
50
- VALUES (
51
- `, e += `'${t.uuid}', false, 'NEW', 'TIMER_EVENT', '${s.format("MM-DD-yyyy HH:mm:ss")}');
52
- `;
53
- }
54
- if (t.configJson !== null) {
55
- const s = JSON.parse(t.configJson);
56
- let D = !0;
57
- s.forEach((E) => {
58
- E.conditions !== null && E.conditions.length > 0 && E.conditions.forEach((h) => {
59
- h.notificaitonConfigsType !== null && h.notificaitonConfigsType.length > 0 && (D && (e += `
60
- DELETE FROM EVENT_CONFIGURATION_TYPE WHERE event_config_uuid = '${t.uuid}';
61
- `, D = !1), h.notificaitonConfigsType.forEach((a) => {
62
- e += `
63
- INSERT INTO EVENT_CONFIGURATION_TYPE (id, base_date_field_name, event_config_uuid, day, email_subject, email_subject_parameter, hour, minute, mobile_notification_type, template, template_parameter, triger_when, type, user_field_name, family_field_name, member_field_name, query_master_id, query_master_param_json, query_code, sms_config_json, push_notification_config_json)
64
- VALUES (
65
- `, e += `'${a.id}', `, e += a.baseDateFieldName ? `'${a.baseDateFieldName}', ` : "null, ", e += `'${t.uuid}', `, e += a.day !== void 0 && a.day !== null ? `${a.day}, ` : "null, ", e += a.emailSubject ? `'${a.emailSubject.replace(/'/g, "''")}', ` : "null, ", e += a.emailSubjectParameter ? `'${a.emailSubjectParameter}', ` : "null, ", e += a.hour !== void 0 && a.hour !== null ? `${a.hour}, ` : "null, ", e += a.miniute !== void 0 && a.miniute !== null ? `${a.miniute}, ` : "null, ", e += a.mobileNotificationType !== void 0 && a.mobileNotificationType !== null ? `${a.mobileNotificationType}, ` : "null, ", e += a.template ? `'${a.template.replace(/'/g, "''")}', ` : "null, ", e += a.templateParameter ? `'${a.templateParameter.replace(/'/g, "''")}', ` : "null, ", e += a.trigerWhen ? `'${a.trigerWhen}', ` : "null, ", e += a.type ? `'${a.type}', ` : "null, ", e += a.userFieldName ? `'${a.userFieldName}', ` : "null, ", e += a.familyFieldName ? `'${a.familyFieldName}', ` : "null, ", e += a.memberFieldName ? `'${a.memberFieldName}', ` : "null, ", e += a.queryMasterId !== void 0 && a.queryMasterId !== null ? `${a.queryMasterId}, ` : "null, ", e += a.queryMasterParamJson !== void 0 && a.queryMasterParamJson !== null ? `'${JSON.stringify(a.queryMasterParamJson).replace(/'/g, "''")}', ` : "null, ", e += a.queryCode ? `'${a.queryCode}', ` : "null, ", e += a.smsConfigJson !== void 0 && a.smsConfigJson !== null ? `'${JSON.stringify(a.smsConfigJson).replace(/'/g, "''")}', ` : "null, ", e += a.pushNotificationConfigJson !== void 0 && a.pushNotificationConfigJson !== null ? `'${JSON.stringify(a.pushNotificationConfigJson).replace(/'/g, "''")}'` : "null", e += `);
66
- `, a.mobileNotificationConfigs && a.mobileNotificationConfigs.length > 0 && (e += `
67
- DELETE FROM EVENT_MOBILE_CONFIGURATION WHERE notification_type_config_id = '${a.id}';
68
- `, a.mobileNotificationConfigs.forEach(
69
- (d) => {
70
- e += `
71
- INSERT INTO EVENT_MOBILE_CONFIGURATION (id, notification_code, notification_type_config_id, number_of_days_added_for_due_date, number_of_days_added_for_expiry_date, number_of_days_added_for_on_date)
72
- VALUES (
73
- `, e += `'${d.id}', '${d.notificationCode}', '${d.notificationTypeConfigId}', ${d.numberOfDaysAddedForDueDate}, ${d.numberOfDaysAddedForExpiryDate}, ${d.numberOfDaysAddedForOnDate});
74
- `;
75
- }
76
- ));
77
- }));
78
- });
79
- });
80
- }
81
- let i = {
82
- id: t.id,
83
- name: t.name,
84
- description: t.description,
85
- eventType: t.eventType,
86
- eventTypeDetailId: t.eventTypeDetailId,
87
- formTypeId: t.formTypeId,
88
- eventTypeDetailCode: t.eventTypeDetailCode,
89
- trigerWhen: t.trigerWhen,
90
- day: t.day,
91
- hour: t.hour,
92
- minute: t.minute,
93
- state: t.state,
94
- createdBy: t.createdBy,
95
- createdOn: C().valueOf(),
96
- notificationConfigDetails: JSON.parse(t.configJson),
97
- status: null,
98
- completionTime: null,
99
- configJson: null,
100
- uuid: t.uuid
101
- };
102
- e += `
103
- INSERT INTO SYNC_SYSTEM_CONFIGURATION_MASTER (feature_type, config_json, created_on, created_by, feature_uuid, feature_name)
104
- VALUES (
105
- `, e += `'EVENT_BUILDER', '${JSON.stringify(i).replace(/'/g, "''")}', current_date, ${t.createdBy}, '${t.uuid}', '${t.name}');
106
- `, S(e);
107
- }, [t]), $ = function(l) {
108
- const e = /* @__PURE__ */ new Date();
109
- return new Date(
110
- e.getFullYear(),
111
- e.getMonth(),
112
- e.getDate(),
113
- l.hour,
114
- l.minute
115
- ) > e ? 0 : 1;
116
- }, x = () => {
117
- var l;
118
- (l = navigator == null ? void 0 : navigator.clipboard) == null || l.writeText(r).then(() => {
119
- I({ message: "Query Copied", type: "success" }), m();
120
- });
121
- }, A = () => {
122
- v(), p((l) => !l);
123
- }, b = f(), v = async () => {
124
- if (window.showSaveFilePicker)
125
- try {
126
- const l = {
127
- suggestedName: `V${(/* @__PURE__ */ new Date()).getTime()}__CHANGE_IN_${t.code}.sql`,
128
- types: [
129
- {
130
- description: "SQL Files",
131
- accept: { "text/plain": [".sql"] }
132
- }
133
- ]
134
- }, e = await window.showSaveFilePicker(l), i = await e.createWritable();
135
- await i.write(r), await i.close();
136
- const n = (new Blob([r], { type: "text/plain" }).size / 1024).toFixed(2);
137
- b("file_download", {
138
- file_type: "sql",
139
- file_name: e.name,
140
- file_size: `${n} KB`,
141
- download_status: "success"
142
- }), I({
143
- message: "Query Downloaded SuccessFully",
144
- type: "success"
145
- }), m();
146
- } catch (l) {
147
- console.error("Something went wrong while downloading: ", l);
148
- }
149
- else {
150
- const l = new Blob([r], { type: "text/plain" }), e = (l.size / 1024).toFixed(2), i = URL.createObjectURL(l), n = document.createElement("a");
151
- n.href = i, n.download = `V${(/* @__PURE__ */ new Date()).getTime()}__CHANGE_IN_${t.code}.sql`, document.body.appendChild(n), n.click(), b("file_download", {
152
- file_type: "sql",
153
- file_name: n.download,
154
- file_size: `${e} KB`,
155
- download_status: "success"
156
- }), document.body.removeChild(n), URL.revokeObjectURL(i), I({ message: "Query Downloaded SuccessFully", type: "success" }), m();
157
- }
158
- }, q = () => {
159
- T ? p((l) => !l) : v();
160
- };
161
- return U(() => {
162
- t && M();
163
- }, [t]), /* @__PURE__ */ N(J, { children: [
164
- /* @__PURE__ */ o(
165
- j,
166
- {
167
- description: "This Flyway contains keyword 'public'. Are you sure you want to download?",
168
- title: "CONFIRM ACTION",
169
- handleClick: A,
170
- open: y,
171
- handleClose: () => p((l) => !l),
172
- dataTestId: "showflywayquery-customconfirmationmodal-confirmation-modal"
173
- }
174
- ),
175
- /* @__PURE__ */ N(
176
- W,
177
- {
178
- open: O,
179
- onClose: m,
180
- fullWidth: !0,
181
- maxWidth: "md",
182
- "data-testid": F,
183
- children: [
184
- /* @__PURE__ */ o(k, { className: "font-medium text-lg border-b p-2.5 px-5", children: _("Flyway Query") }),
185
- /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(
186
- V,
187
- {
188
- multiline: !0,
189
- rows: 10,
190
- variant: "outlined",
191
- fullWidth: !0,
192
- value: r,
193
- sx: {
194
- "& .MuiInputBase-input": {
195
- fontSize: "14px"
196
- },
197
- "& .MuiOutlinedInput-root": {
198
- // fontSize: '14px'
199
- borderRadius: "5px"
200
- }
201
- },
202
- slotProps: {
203
- input: {
204
- readOnly: !0
205
- }
206
- },
207
- "data-testid": "showflywayquery-textfield-query-display"
208
- }
209
- ) }),
210
- /* @__PURE__ */ N(P, { children: [
211
- /* @__PURE__ */ o(
212
- w,
213
- {
214
- onClick: q,
215
- variant: "contained",
216
- size: "small",
217
- color: "primary",
218
- "data-testid": "showflywayquery-button-download-action",
219
- children: _("Download")
220
- }
221
- ),
222
- /* @__PURE__ */ o(
223
- w,
224
- {
225
- onClick: x,
226
- variant: "contained",
227
- size: "small",
228
- color: "primary",
229
- "data-testid": "showflywayquery-button-copyquery-action",
230
- children: _("Copy Query")
231
- }
232
- ),
233
- /* @__PURE__ */ o(
234
- w,
235
- {
236
- onClick: m,
237
- variant: "contained",
238
- color: "secondary",
239
- size: "small",
240
- "data-testid": "showflywayquery-button-cancel-action",
241
- children: _("Cancel")
242
- }
243
- )
244
- ] })
245
- ]
246
- }
247
- )
248
- ] });
249
- };
250
- H.propTypes = {
251
- configuredQuery: u.any,
252
- open: u.any,
253
- onClose: u.any,
254
- dataTestId: u.any
255
- };
256
- export {
257
- H as default
258
- };
259
- //# sourceMappingURL=ShowFlywayQuery-DVRCd384.js.map