@e-llm-studio/instant-learning 1.3.5 → 1.3.7

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 (147) hide show
  1. package/dist/CommonConstants/CommonConstants.js +10 -0
  2. package/dist/CommonConstants/CommonConstants.js.map +1 -0
  3. package/dist/ComponentRegistry.js +1 -0
  4. package/dist/ComponentRegistry.js.map +1 -1
  5. package/dist/ILMarketplaceWrapper.js +16 -11
  6. package/dist/ILMarketplaceWrapper.js.map +1 -1
  7. package/dist/cjs/CommonConstants/CommonConstants.js +15 -0
  8. package/dist/cjs/CommonConstants/CommonConstants.js.map +1 -0
  9. package/dist/cjs/ComponentRegistry.js +1 -0
  10. package/dist/cjs/ComponentRegistry.js.map +1 -1
  11. package/dist/cjs/ILMarketplaceWrapper.js +16 -11
  12. package/dist/cjs/ILMarketplaceWrapper.js.map +1 -1
  13. package/dist/cjs/features/IL-OTJ/ILOTJ.js +1 -1
  14. package/dist/cjs/features/IL-OTJ/ILOTJ.js.map +1 -1
  15. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +3 -10
  16. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js.map +1 -1
  17. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/NormalChat.js +3 -11
  18. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/NormalChat.js.map +1 -1
  19. package/dist/cjs/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.js +220 -0
  20. package/dist/cjs/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.js.map +1 -0
  21. package/dist/cjs/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.module.css.js +12 -0
  22. package/dist/cjs/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.module.css.js.map +1 -0
  23. package/dist/cjs/features/IL-marketplace/PromoteFlow/PromoteFlow.js +240 -183
  24. package/dist/cjs/features/IL-marketplace/PromoteFlow/PromoteFlow.js.map +1 -1
  25. package/dist/cjs/features/IL-marketplace/PromoteFlow/PromoteFlow.module.css.js +2 -2
  26. package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-constants.js +69 -0
  27. package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-constants.js.map +1 -0
  28. package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-flow.api.js +52 -12
  29. package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-flow.api.js.map +1 -1
  30. package/dist/cjs/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js +7 -4
  31. package/dist/cjs/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js.map +1 -1
  32. package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -4
  33. package/dist/cjs/features/LearningManagement/LearningManagement.js.map +1 -1
  34. package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js +25 -2
  35. package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js.map +1 -1
  36. package/dist/cjs/features/LearningManagement/Sidebar.js +25 -9
  37. package/dist/cjs/features/LearningManagement/Sidebar.js.map +1 -1
  38. package/dist/cjs/features/LearningManagement/SidebarWrapper.js +6 -2
  39. package/dist/cjs/features/LearningManagement/SidebarWrapper.js.map +1 -1
  40. package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js +15 -2
  41. package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js.map +1 -1
  42. package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +1 -0
  43. package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js.map +1 -1
  44. package/dist/cjs/features/LearningManagement/styles/LearningTemplateLayout.module.css.js +2 -2
  45. package/dist/cjs/features/LearningManagement/styles/Sidebar.module.css.js +2 -2
  46. package/dist/cjs/schema-driven/components/DropdownSectionField.js +26 -2
  47. package/dist/cjs/schema-driven/components/DropdownSectionField.js.map +1 -1
  48. package/dist/cjs/schema-driven/components/GroupEditRow.js +11 -5
  49. package/dist/cjs/schema-driven/components/GroupEditRow.js.map +1 -1
  50. package/dist/cjs/schema-driven/components/PageRangeInputField.js +91 -0
  51. package/dist/cjs/schema-driven/components/PageRangeInputField.js.map +1 -0
  52. package/dist/cjs/schema-driven/components/TableComponent.js +63 -51
  53. package/dist/cjs/schema-driven/components/TableComponent.js.map +1 -1
  54. package/dist/cjs/schema-driven/helper.js +69 -3
  55. package/dist/cjs/schema-driven/helper.js.map +1 -1
  56. package/dist/cjs/schema-driven/hooks/useSectionEditSession.js +5 -1
  57. package/dist/cjs/schema-driven/hooks/useSectionEditSession.js.map +1 -1
  58. package/dist/cjs/schema-driven/types.js.map +1 -1
  59. package/dist/cjs/schema-driven/utils/PayloadUtils.js +4 -2
  60. package/dist/cjs/schema-driven/utils/PayloadUtils.js.map +1 -1
  61. package/dist/features/IL-OTJ/ILOTJ.js +1 -1
  62. package/dist/features/IL-OTJ/ILOTJ.js.map +1 -1
  63. package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +3 -10
  64. package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js.map +1 -1
  65. package/dist/features/IL-OTJ/_components/ChatComponents/NormalChat.js +3 -11
  66. package/dist/features/IL-OTJ/_components/ChatComponents/NormalChat.js.map +1 -1
  67. package/dist/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.js +216 -0
  68. package/dist/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.js.map +1 -0
  69. package/dist/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.module.css.js +8 -0
  70. package/dist/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.module.css.js.map +1 -0
  71. package/dist/features/IL-marketplace/PromoteFlow/PromoteFlow.js +238 -177
  72. package/dist/features/IL-marketplace/PromoteFlow/PromoteFlow.js.map +1 -1
  73. package/dist/features/IL-marketplace/PromoteFlow/PromoteFlow.module.css.js +2 -2
  74. package/dist/features/IL-marketplace/PromoteFlow/promote-constants.js +51 -0
  75. package/dist/features/IL-marketplace/PromoteFlow/promote-constants.js.map +1 -0
  76. package/dist/features/IL-marketplace/PromoteFlow/promote-flow.api.js +52 -12
  77. package/dist/features/IL-marketplace/PromoteFlow/promote-flow.api.js.map +1 -1
  78. package/dist/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js +7 -4
  79. package/dist/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js.map +1 -1
  80. package/dist/features/LearningManagement/LearningManagement.js +1 -4
  81. package/dist/features/LearningManagement/LearningManagement.js.map +1 -1
  82. package/dist/features/LearningManagement/LearningTemplateLayout.js +27 -4
  83. package/dist/features/LearningManagement/LearningTemplateLayout.js.map +1 -1
  84. package/dist/features/LearningManagement/Sidebar.js +25 -9
  85. package/dist/features/LearningManagement/Sidebar.js.map +1 -1
  86. package/dist/features/LearningManagement/SidebarWrapper.js +6 -2
  87. package/dist/features/LearningManagement/SidebarWrapper.js.map +1 -1
  88. package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js +15 -2
  89. package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js.map +1 -1
  90. package/dist/features/LearningManagement/store/useLMSConfigStore.js +1 -0
  91. package/dist/features/LearningManagement/store/useLMSConfigStore.js.map +1 -1
  92. package/dist/features/LearningManagement/styles/LearningTemplateLayout.module.css.js +2 -2
  93. package/dist/features/LearningManagement/styles/Sidebar.module.css.js +2 -2
  94. package/dist/schema-driven/components/DropdownSectionField.js +26 -2
  95. package/dist/schema-driven/components/DropdownSectionField.js.map +1 -1
  96. package/dist/schema-driven/components/GroupEditRow.js +11 -5
  97. package/dist/schema-driven/components/GroupEditRow.js.map +1 -1
  98. package/dist/schema-driven/components/PageRangeInputField.js +87 -0
  99. package/dist/schema-driven/components/PageRangeInputField.js.map +1 -0
  100. package/dist/schema-driven/components/TableComponent.js +64 -52
  101. package/dist/schema-driven/components/TableComponent.js.map +1 -1
  102. package/dist/schema-driven/helper.js +65 -4
  103. package/dist/schema-driven/helper.js.map +1 -1
  104. package/dist/schema-driven/hooks/useSectionEditSession.js +5 -1
  105. package/dist/schema-driven/hooks/useSectionEditSession.js.map +1 -1
  106. package/dist/schema-driven/types.js.map +1 -1
  107. package/dist/schema-driven/utils/PayloadUtils.js +4 -2
  108. package/dist/schema-driven/utils/PayloadUtils.js.map +1 -1
  109. package/dist/types/src/CommonConstants/CommonConstants.d.ts +7 -0
  110. package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
  111. package/dist/types/src/ComponentRegistry.d.ts.map +1 -1
  112. package/dist/types/src/ILMarketplaceWrapper.d.ts +2 -2
  113. package/dist/types/src/ILMarketplaceWrapper.d.ts.map +1 -1
  114. package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts.map +1 -1
  115. package/dist/types/src/features/IL-OTJ/_components/ChatComponents/NormalChat.d.ts.map +1 -1
  116. package/dist/types/src/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.d.ts +9 -0
  117. package/dist/types/src/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.d.ts.map +1 -0
  118. package/dist/types/src/features/IL-marketplace/PromoteFlow/PromoteFlow.d.ts.map +1 -1
  119. package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-constants.d.ts +23 -0
  120. package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-constants.d.ts.map +1 -0
  121. package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.api.d.ts +1 -1
  122. package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.api.d.ts.map +1 -1
  123. package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.interfaces.d.ts +26 -0
  124. package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.interfaces.d.ts.map +1 -1
  125. package/dist/types/src/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.d.ts.map +1 -1
  126. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
  127. package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts.map +1 -1
  128. package/dist/types/src/features/LearningManagement/Sidebar.d.ts +3 -0
  129. package/dist/types/src/features/LearningManagement/Sidebar.d.ts.map +1 -1
  130. package/dist/types/src/features/LearningManagement/SidebarWrapper.d.ts +2 -0
  131. package/dist/types/src/features/LearningManagement/SidebarWrapper.d.ts.map +1 -1
  132. package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts +14 -1
  133. package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts.map +1 -1
  134. package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +2 -0
  135. package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -1
  136. package/dist/types/src/schema-driven/components/DropdownSectionField.d.ts.map +1 -1
  137. package/dist/types/src/schema-driven/components/GroupEditRow.d.ts.map +1 -1
  138. package/dist/types/src/schema-driven/components/PageRangeInputField.d.ts +8 -0
  139. package/dist/types/src/schema-driven/components/PageRangeInputField.d.ts.map +1 -0
  140. package/dist/types/src/schema-driven/components/TableComponent.d.ts.map +1 -1
  141. package/dist/types/src/schema-driven/helper.d.ts +13 -1
  142. package/dist/types/src/schema-driven/helper.d.ts.map +1 -1
  143. package/dist/types/src/schema-driven/hooks/useSectionEditSession.d.ts.map +1 -1
  144. package/dist/types/src/schema-driven/types.d.ts +11 -0
  145. package/dist/types/src/schema-driven/types.d.ts.map +1 -1
  146. package/dist/types/src/schema-driven/utils/PayloadUtils.d.ts.map +1 -1
  147. package/package.json +5 -4
@@ -4,65 +4,47 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var Tooltip = require('@mui/material/Tooltip');
8
- var styles = require('@mui/material/styles');
9
7
  var lucideReact = require('lucide-react');
10
8
  var utils = require('../utils.js');
11
9
  var EnvironmentConfigurationModal = require('./EnvironmentConfigurationModal.js');
10
+ var PreflightDetailsPage = require('./PreflightDetailsPage.js');
11
+ var promoteConstants = require('./promote-constants.js');
12
12
  var promoteFlow_api = require('./promote-flow.api.js');
13
13
  var promoteFlow_store = require('./promote-flow.store.js');
14
14
  var promoteFlow_utils = require('./promote-flow.utils.js');
15
15
  var PromoteFlow_module = require('./PromoteFlow.module.css.js');
16
16
 
17
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
-
19
- var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
20
-
21
- const StyledPromoteTooltip = styles.styled(({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(Tooltip__default["default"], { ...props, classes: { popper: className } }))(() => ({
22
- [`& .${Tooltip.tooltipClasses.tooltip}`]: {
23
- backgroundColor: "#161616cf",
24
- color: "#ffffff",
25
- fontSize: "12px",
26
- padding: "7px 11px",
27
- borderRadius: 6,
28
- maxWidth: 250,
29
- textAlign: "center",
30
- whiteSpace: "normal",
31
- wordBreak: "break-word",
32
- lineHeight: 1.5
33
- },
34
- [`& .${Tooltip.tooltipClasses.arrow}`]: {
35
- color: "#000000"
36
- }
37
- }));
38
- const ACCORDIONS = [
39
- {
40
- id: "overview",
41
- title: "Overview"
42
- },
43
- {
44
- id: "history",
45
- title: "Promotion History",
46
- comingSoon: false
47
- },
48
- {
49
- id: "database",
50
- title: "Database Details",
51
- comingSoon: false
52
- }
53
- // {
54
- // id: 'knowledgebase',
55
- // title: 'Knowledgebase Details',
56
- // comingSoon: true,
57
- // },
58
- ];
17
+ const isTenantEnvironment = (environment) => environment === "tenantSource" || environment === "tenantDestination";
18
+ const isSourceEnvironment = (environment) => environment === "source" || environment === "tenantSource";
19
+ const getLatestPromotion = (history) => history.reduce((latest, entry) => {
20
+ if (!latest) return entry;
21
+ return Date.parse(entry.updated_at) > Date.parse(latest.updated_at) ? entry : latest;
22
+ }, null);
23
+ const getDefaultEnvironmentTier = (environment, selectedEnvironment, permittedDestinationTiers) => {
24
+ var _a;
25
+ return (_a = selectedEnvironment == null ? void 0 : selectedEnvironment.env_tier) != null ? _a : isSourceEnvironment(environment) ? promoteConstants.DEFAULT_SOURCE_ENVIRONMENT_TIER : permittedDestinationTiers[0];
26
+ };
27
+ const getPromotionActionRestriction = (isPromotionInProgress, hasScheduledPromotion) => {
28
+ if (isPromotionInProgress) return promoteConstants.PROMOTION_IN_PROGRESS_TOOLTIP;
29
+ if (hasScheduledPromotion) return promoteConstants.SCHEDULED_PROMOTION_TOOLTIP;
30
+ return null;
31
+ };
32
+ const getHistoryActionLabel = (isPending, canRollback) => {
33
+ if (!isPending) return canRollback ? "Rollback" : "View details";
34
+ return canRollback ? "Rolling back\u2026" : "Loading\u2026";
35
+ };
36
+ const getPreflightResultMessage = ({
37
+ ready,
38
+ items_ready,
39
+ items_checked
40
+ }) => ready ? `Migration is ready (${items_ready}/${items_checked} checks passed).` : `Migration readiness requires attention (${items_ready}/${items_checked} checks passed).`;
59
41
  const isMissingPromotionStatus = (error) => {
60
42
  var _a;
61
43
  if (error instanceof Error && error.message.includes("404")) return true;
62
44
  return typeof error === "object" && error !== null && "response" in error && ((_a = error.response) == null ? void 0 : _a.status) === 404;
63
45
  };
64
46
  function PromoteFlow({ guideline, onBack, onPromote, className }) {
65
- var _a, _b, _c, _d, _e, _f, _g;
47
+ var _a, _b, _c, _d;
66
48
  const [openSections, setOpenSections] = React.useState({
67
49
  overview: true
68
50
  });
@@ -83,6 +65,8 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
83
65
  const [isStatusPollingStopped, setIsStatusPollingStopped] = React.useState(false);
84
66
  const [isInitialStatusLoading, setIsInitialStatusLoading] = React.useState(true);
85
67
  const [isCheckingPreflight, setIsCheckingPreflight] = React.useState(false);
68
+ const [isViewingPreflightDetails, setIsViewingPreflightDetails] = React.useState(false);
69
+ const [promotionStatusForActions, setPromotionStatusForActions] = React.useState(null);
86
70
  const [preflightResult, setPreflightResult] = React.useState(null);
87
71
  const sourceEnvironment = promoteFlow_store.usePromoteFlowStore((state) => state.sourceEnvironment);
88
72
  const destinationEnvironment = promoteFlow_store.usePromoteFlowStore((state) => state.destinationEnvironment);
@@ -102,7 +86,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
102
86
  const resetPromotionSession = promoteFlow_store.usePromoteFlowStore((state) => state.resetPromotionSession);
103
87
  const title = utils.getGuidelineTitle(guideline);
104
88
  const versionLabel = guideline.version ? `v${guideline.version}` : "v1";
105
- const statusLabel = (_a = guideline.status) != null ? _a : "Published";
89
+ const statusLabel = (_a = guideline.status) != null ? _a : promoteConstants.DEFAULT_GUIDELINE_STATUS;
106
90
  const guidelineResourceId = promoteFlow_utils.getPromotionResourceId(guideline);
107
91
  const promotionTaskForGuideline = promotionResourceId === guidelineResourceId ? promotionTask : null;
108
92
  const errorForGuideline = errorResourceId === guidelineResourceId ? error : null;
@@ -118,13 +102,43 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
118
102
  );
119
103
  const isPromoting = Boolean(promotionTaskForGuideline);
120
104
  const canRetryPromotion = (promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.status) === "FAILED";
121
- const sourceTier = (_b = sourceEnvironment == null ? void 0 : sourceEnvironment.env_tier) != null ? _b : "dev";
105
+ const sourceTier = (_b = sourceEnvironment == null ? void 0 : sourceEnvironment.env_tier) != null ? _b : promoteConstants.DEFAULT_SOURCE_ENVIRONMENT_TIER;
122
106
  const permittedDestinationTiers = React.useMemo(
123
107
  () => promoteFlow_utils.getPermittedDestinationTiers(sourceTier),
124
108
  [sourceTier]
125
109
  );
126
- const permittedSourceTiers = ["dev", "qa", "prod", "external"];
127
- const selectedEnvironment = configuredEnvironment === "source" ? sourceEnvironment : configuredEnvironment === "destination" ? destinationEnvironment : configuredEnvironment === "tenantSource" ? tenantSourceEnvironment : tenantDestinationEnvironment;
110
+ const environments = {
111
+ source: sourceEnvironment,
112
+ destination: destinationEnvironment,
113
+ tenantSource: tenantSourceEnvironment,
114
+ tenantDestination: tenantDestinationEnvironment
115
+ };
116
+ const selectedEnvironment = configuredEnvironment ? environments[configuredEnvironment] : void 0;
117
+ const configuredEnvironmentDefaultTier = configuredEnvironment ? getDefaultEnvironmentTier(
118
+ configuredEnvironment,
119
+ selectedEnvironment,
120
+ permittedDestinationTiers
121
+ ) : promoteConstants.DEFAULT_SOURCE_ENVIRONMENT_TIER;
122
+ const configuredEnvironmentIsSource = configuredEnvironment ? isSourceEnvironment(configuredEnvironment) : true;
123
+ const configuredEnvironmentIsTenant = configuredEnvironment ? isTenantEnvironment(configuredEnvironment) : false;
124
+ const modalInitialConfiguration = selectedEnvironment ? {
125
+ env_name: selectedEnvironment.env_name,
126
+ env_tier: selectedEnvironment.env_tier,
127
+ db_type: selectedEnvironment.db_type,
128
+ host: selectedEnvironment.host,
129
+ port: String(selectedEnvironment.port),
130
+ username: selectedEnvironment.username,
131
+ password: "",
132
+ database_name: selectedEnvironment.database_name,
133
+ is_tenant_db: selectedEnvironment.is_tenant_db
134
+ } : {
135
+ ...promoteFlow_utils.EMPTY_ENVIRONMENT_CONFIGURATION,
136
+ env_tier: configuredEnvironmentDefaultTier,
137
+ db_type: !configuredEnvironmentIsSource && configuredEnvironmentDefaultTier === "external" ? "EXTERNAL" : "INTERNAL",
138
+ is_tenant_db: configuredEnvironmentIsTenant
139
+ };
140
+ const modalPermittedTiers = configuredEnvironmentIsSource ? promoteConstants.PERMITTED_SOURCE_TIERS : permittedDestinationTiers;
141
+ const modalPresetTier = configSearchTier != null ? configSearchTier : configuredEnvironmentDefaultTier;
128
142
  const latestPromotionForPair = React.useMemo(
129
143
  () => promoteFlow_utils.getLatestPromotionForEnvironmentPair(
130
144
  promotionHistory,
@@ -133,18 +147,36 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
133
147
  ),
134
148
  [destinationEnvironment, promotionHistory, sourceEnvironment]
135
149
  );
136
- const latestPromotionTaskId = React.useMemo(() => {
137
- var _a2;
138
- const latestPromotion = promotionHistory.reduce(
139
- (latest, entry) => {
140
- if (!latest) return entry;
141
- return Date.parse(entry.updated_at) > Date.parse(latest.updated_at) ? entry : latest;
142
- },
143
- null
144
- );
145
- return (_a2 = latestPromotion == null ? void 0 : latestPromotion.promotion_task_id) != null ? _a2 : null;
146
- }, [promotionHistory]);
150
+ const latestPromotion = React.useMemo(() => getLatestPromotion(promotionHistory), [promotionHistory]);
151
+ const latestPromotionTaskId = (_c = latestPromotion == null ? void 0 : latestPromotion.promotion_task_id) != null ? _c : null;
152
+ const isPromotionInProgress = promoteConstants.PROMOTION_IN_PROGRESS_STATUSES.some(
153
+ (status) => status === (promotionStatusForActions == null ? void 0 : promotionStatusForActions.status)
154
+ );
155
+ const hasScheduledPromotion = (latestPromotion == null ? void 0 : latestPromotion.status) === "SCHEDULED" || (promotionStatusForActions == null ? void 0 : promotionStatusForActions.status) === "SCHEDULED";
156
+ const promotionActionRestriction = getPromotionActionRestriction(
157
+ isPromotionInProgress,
158
+ hasScheduledPromotion
159
+ );
160
+ const canCheckPromotionReadiness = canPromote && !promotionActionRestriction;
161
+ const canPromoteNow = canPromote && !promotionActionRestriction;
162
+ const canPromoteLater = canPromote && !isPromotionInProgress;
163
+ const readinessAndNowTooltip = promotionActionRestriction != null ? promotionActionRestriction : promoteConstants.ENVIRONMENT_CONFIGURATION_TOOLTIP;
164
+ const promoteLaterTooltip = isPromotionInProgress ? promotionActionRestriction : promoteConstants.ENVIRONMENT_CONFIGURATION_TOOLTIP;
147
165
  const promoteActionLabel = (latestPromotionForPair == null ? void 0 : latestPromotionForPair.status) === "SUCCESS" ? "Sync" : "Promote Now";
166
+ const createPromotionRequest = () => {
167
+ if (!sourceEnvironment || !destinationEnvironment) return null;
168
+ return {
169
+ resource_id: guidelineResourceId,
170
+ resource_type: "PACKAGE",
171
+ target_version: "latest",
172
+ global_source_env_id: sourceEnvironment.env_id,
173
+ global_target_env_id: destinationEnvironment.env_id,
174
+ ...tenantSourceEnvironment && tenantDestinationEnvironment ? {
175
+ tenant_source_env_id: tenantSourceEnvironment.env_id,
176
+ tenant_target_env_id: tenantDestinationEnvironment.env_id
177
+ } : {}
178
+ };
179
+ };
148
180
  const toggleSection = (id) => {
149
181
  setOpenSections((current) => ({ ...current, [id]: !current[id] }));
150
182
  };
@@ -154,9 +186,11 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
154
186
  setIsInitialStatusLoading(true);
155
187
  setError(null);
156
188
  setPromotionTask(null);
189
+ setPromotionStatusForActions(null);
157
190
  const refreshInitialPromotionState = async () => {
158
191
  try {
159
- await promoteFlow_api.getPromotionStatus(guidelineResourceId);
192
+ const status = await promoteFlow_api.getPromotionStatus(guidelineResourceId);
193
+ if (isCurrent) setPromotionStatusForActions(status);
160
194
  } catch (statusError) {
161
195
  if (isCurrent && !isMissingPromotionStatus(statusError)) {
162
196
  setError(
@@ -192,14 +226,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
192
226
  promoteFlow_api.getSchemaPreview(guidelineResourceId).then((preview) => {
193
227
  if (!isCurrent) return;
194
228
  setSchemaPreview(
195
- Object.entries(preview != null ? preview : {}).reduce((groups, [key, value]) => {
196
- if (value && Array.isArray(value.tables)) groups[key] = value;
197
- return groups;
198
- }, {})
229
+ Object.entries(preview != null ? preview : {}).reduce(
230
+ (groups, [key, value]) => {
231
+ if (value && Array.isArray(value.tables)) groups[key] = value;
232
+ return groups;
233
+ },
234
+ {}
235
+ )
199
236
  );
200
237
  }).catch((schemaError) => {
201
238
  if (isCurrent) {
202
- console.error("Failed to load schema preview", { resourceId: guidelineResourceId, schemaError });
239
+ console.error("Failed to load schema preview", {
240
+ resourceId: guidelineResourceId,
241
+ schemaError
242
+ });
203
243
  setSchemaPreview({});
204
244
  }
205
245
  }).finally(() => {
@@ -210,18 +250,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
210
250
  };
211
251
  }, [guidelineResourceId]);
212
252
  React.useEffect(() => {
213
- var _a2, _b2, _c2, _d2;
214
253
  if (!configuredEnvironment) return;
215
- const selectedEnvironment2 = configuredEnvironment === "source" ? (_a2 = sourceEnvironment == null ? void 0 : sourceEnvironment.env_tier) != null ? _a2 : "dev" : configuredEnvironment === "destination" ? (_b2 = destinationEnvironment == null ? void 0 : destinationEnvironment.env_tier) != null ? _b2 : permittedDestinationTiers[0] : configuredEnvironment === "tenantSource" ? (_c2 = tenantSourceEnvironment == null ? void 0 : tenantSourceEnvironment.env_tier) != null ? _c2 : "dev" : (_d2 = tenantDestinationEnvironment == null ? void 0 : tenantDestinationEnvironment.env_tier) != null ? _d2 : permittedDestinationTiers[0];
216
- const defaultTier = selectedEnvironment2;
217
- const envTier = configSearchTier != null ? configSearchTier : defaultTier;
254
+ const defaultTier = getDefaultEnvironmentTier(
255
+ configuredEnvironment,
256
+ environments[configuredEnvironment],
257
+ permittedDestinationTiers
258
+ );
259
+ const environmentTier = configSearchTier != null ? configSearchTier : defaultTier;
218
260
  let isCurrent = true;
219
261
  setIsLoadingConfigs(true);
220
262
  setPromotionConfigs([]);
221
263
  promoteFlow_api.searchEnvironmentConfigs({
222
- env_tier: envTier,
223
- db_type: envTier === "external" ? "EXTERNAL" : "INTERNAL",
224
- is_tenant: configuredEnvironment === "tenantSource" || configuredEnvironment === "tenantDestination"
264
+ env_tier: environmentTier,
265
+ db_type: environmentTier === "external" ? "EXTERNAL" : "INTERNAL",
266
+ is_tenant: isTenantEnvironment(configuredEnvironment)
225
267
  }).then((configs) => {
226
268
  if (isCurrent) setPromotionConfigs(configs);
227
269
  }).catch(() => {
@@ -263,12 +305,15 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
263
305
  };
264
306
  }, [promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.created_by, promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.promotion_task_id]);
265
307
  React.useEffect(() => {
266
- if (!promotionTaskForGuideline || isStatusPollingStopped || !["MIGRATING", "ROLLBACK_IN_PROGRESS"].includes(promotionTaskForGuideline.status)) {
308
+ const promotionStatusToPoll = promotionTaskForGuideline != null ? promotionTaskForGuideline : promotionStatusForActions;
309
+ if (!promotionStatusToPoll || isStatusPollingStopped || !promoteConstants.PROMOTION_IN_PROGRESS_STATUSES.some((status) => status === promotionStatusToPoll.status)) {
267
310
  return;
268
311
  }
269
312
  const pollStatus = async () => {
270
313
  try {
271
- setPromotionTask(await promoteFlow_api.getPromotionStatus(guidelineResourceId), guidelineResourceId);
314
+ const status = await promoteFlow_api.getPromotionStatus(guidelineResourceId);
315
+ if (promotionTaskForGuideline) setPromotionTask(status, guidelineResourceId);
316
+ setPromotionStatusForActions(status);
272
317
  } catch (pollError) {
273
318
  setIsStatusPollingStopped(true);
274
319
  setError(
@@ -277,30 +322,31 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
277
322
  );
278
323
  }
279
324
  };
280
- const intervalId = window.setInterval(pollStatus, 3e4);
325
+ const intervalId = window.setInterval(pollStatus, promoteConstants.PROMOTION_POLL_INTERVAL_MS);
281
326
  return () => window.clearInterval(intervalId);
282
- }, [guidelineResourceId, isStatusPollingStopped, promotionTaskForGuideline, setError, setPromotionTask]);
327
+ }, [
328
+ guidelineResourceId,
329
+ isStatusPollingStopped,
330
+ promotionStatusForActions,
331
+ promotionTaskForGuideline,
332
+ setError,
333
+ setPromotionTask
334
+ ]);
283
335
  const handlePromoteNow = async () => {
284
- if (!canPromote || !sourceEnvironment || !destinationEnvironment) return;
336
+ const promotionRequest = createPromotionRequest();
337
+ if (!canPromoteNow || !promotionRequest) return;
285
338
  setSubmitting(true);
286
339
  setSubmittingAction("now");
287
340
  setError(null);
288
341
  try {
289
- const task = await promoteFlow_api.startPromotion({
290
- resource_id: promoteFlow_utils.getPromotionResourceId(guideline),
291
- resource_type: "PACKAGE",
292
- target_version: "latest",
293
- global_source_env_id: sourceEnvironment.env_id,
294
- global_target_env_id: destinationEnvironment.env_id,
295
- ...tenantSourceEnvironment && tenantDestinationEnvironment ? {
296
- tenant_source_env_id: tenantSourceEnvironment.env_id,
297
- tenant_target_env_id: tenantDestinationEnvironment.env_id
298
- } : {}
299
- });
342
+ const task = await promoteFlow_api.startPromotion(promotionRequest);
300
343
  setIsStatusPollingStopped(false);
301
344
  setPromotionTask(task, guidelineResourceId);
345
+ setPromotionStatusForActions(task);
302
346
  try {
303
- setPromotionTask(await promoteFlow_api.getPromotionStatus(guidelineResourceId), guidelineResourceId);
347
+ const status = await promoteFlow_api.getPromotionStatus(guidelineResourceId);
348
+ setPromotionTask(status, guidelineResourceId);
349
+ setPromotionStatusForActions(status);
304
350
  } catch (e) {
305
351
  }
306
352
  onPromote == null ? void 0 : onPromote(guideline);
@@ -315,27 +361,15 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
315
361
  }
316
362
  };
317
363
  const handlePreflightCheck = async () => {
318
- if (!sourceEnvironment || !destinationEnvironment || isCheckingPreflight) return;
364
+ const promotionRequest = createPromotionRequest();
365
+ if (!canCheckPromotionReadiness || !promotionRequest || isCheckingPreflight) return;
319
366
  setIsCheckingPreflight(true);
320
367
  setPreflightResult(null);
368
+ setIsViewingPreflightDetails(false);
321
369
  setError(null);
322
370
  try {
323
- const result = await promoteFlow_api.checkPromotionPreflight({
324
- resource_id: guidelineResourceId,
325
- resource_type: "PACKAGE",
326
- target_version: "latest",
327
- global_source_env_id: sourceEnvironment.env_id,
328
- global_target_env_id: destinationEnvironment.env_id,
329
- ...tenantSourceEnvironment && tenantDestinationEnvironment ? {
330
- tenant_source_env_id: tenantSourceEnvironment.env_id,
331
- tenant_target_env_id: tenantDestinationEnvironment.env_id
332
- } : {}
333
- });
334
- setPreflightResult({
335
- ready: result.ready,
336
- itemsChecked: result.items_checked,
337
- itemsReady: result.items_ready
338
- });
371
+ const result = await promoteFlow_api.checkPromotionPreflight(promotionRequest);
372
+ setPreflightResult(result);
339
373
  } catch (preflightError) {
340
374
  setError(
341
375
  preflightError instanceof Error ? preflightError.message : "Unable to complete pre-flight check.",
@@ -346,10 +380,9 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
346
380
  }
347
381
  };
348
382
  const handleSaveEnvironment = async (environment, configuration) => {
349
- const isTenantEnvironment = environment === "tenantSource" || environment === "tenantDestination";
350
383
  const configurationToSave = {
351
384
  ...configuration,
352
- is_tenant_db: isTenantEnvironment
385
+ is_tenant_db: isTenantEnvironment(environment)
353
386
  };
354
387
  const response = await promoteFlow_api.createEnvironmentConfig(
355
388
  promoteFlow_utils.toCreateEnvironmentConfigRequest(configurationToSave)
@@ -357,31 +390,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
357
390
  setEnvironment(environment, promoteFlow_utils.toRegistryRecord(response.env_id, configurationToSave));
358
391
  };
359
392
  const openEnvironmentConfiguration = (environment) => {
360
- var _a2;
361
- const selected = environment === "source" ? sourceEnvironment : environment === "destination" ? destinationEnvironment : environment === "tenantSource" ? tenantSourceEnvironment : tenantDestinationEnvironment;
362
393
  setConfigSearchTier(
363
- (_a2 = selected == null ? void 0 : selected.env_tier) != null ? _a2 : environment === "source" || environment === "tenantSource" ? "dev" : permittedDestinationTiers[0]
394
+ getDefaultEnvironmentTier(environment, environments[environment], permittedDestinationTiers)
364
395
  );
365
396
  setConfiguredEnvironment(environment);
366
397
  };
367
398
  const handlePromoteLater = async () => {
368
399
  var _a2, _b2;
369
- if (!canPromote || !sourceEnvironment || !destinationEnvironment) return;
400
+ const promotionRequest = createPromotionRequest();
401
+ if (!canPromoteLater || !promotionRequest) return;
370
402
  setSubmitting(true);
371
403
  setSubmittingAction("later");
372
404
  setError(null);
373
405
  try {
374
- const scheduledPromotion = await promoteFlow_api.schedulePromotion({
375
- resource_id: guidelineResourceId,
376
- resource_type: "PACKAGE",
377
- target_version: "latest",
378
- global_source_env_id: sourceEnvironment.env_id,
379
- global_target_env_id: destinationEnvironment.env_id,
380
- ...tenantSourceEnvironment && tenantDestinationEnvironment ? {
381
- tenant_source_env_id: tenantSourceEnvironment.env_id,
382
- tenant_target_env_id: tenantDestinationEnvironment.env_id
383
- } : {}
384
- });
406
+ const scheduledPromotion = await promoteFlow_api.schedulePromotion(promotionRequest);
385
407
  const now = (/* @__PURE__ */ new Date()).toISOString();
386
408
  setPromotionTask(
387
409
  {
@@ -396,6 +418,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
396
418
  },
397
419
  guidelineResourceId
398
420
  );
421
+ setPromotionStatusForActions(scheduledPromotion);
399
422
  onPromote == null ? void 0 : onPromote(guideline);
400
423
  } catch (promotionError) {
401
424
  setError(
@@ -417,8 +440,11 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
417
440
  const task = await promoteFlow_api.triggerScheduledPromotion(triggerUrl);
418
441
  setIsStatusPollingStopped(false);
419
442
  setPromotionTask(task, guidelineResourceId);
443
+ setPromotionStatusForActions(task);
420
444
  try {
421
- setPromotionTask(await promoteFlow_api.getPromotionStatus(guidelineResourceId), guidelineResourceId);
445
+ const status = await promoteFlow_api.getPromotionStatus(guidelineResourceId);
446
+ setPromotionTask(status, guidelineResourceId);
447
+ setPromotionStatusForActions(status);
422
448
  } catch (e) {
423
449
  }
424
450
  onPromote == null ? void 0 : onPromote(guideline);
@@ -463,9 +489,29 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
463
489
  setHistoryActionTaskId(null);
464
490
  }
465
491
  };
466
- const handleBack = () => {
492
+ const handleBack = async () => {
467
493
  if (promotionTaskForGuideline) {
468
494
  setPromotionTask(null);
495
+ setIsInitialStatusLoading(true);
496
+ setIsLoadingHistory(true);
497
+ try {
498
+ const [status, history] = await Promise.all([
499
+ promoteFlow_api.getPromotionStatus(guidelineResourceId),
500
+ promoteFlow_api.getPromotionHistory(guidelineResourceId)
501
+ ]);
502
+ setPromotionStatusForActions(status);
503
+ setPromotionHistory(history);
504
+ } catch (refreshError) {
505
+ if (!isMissingPromotionStatus(refreshError)) {
506
+ setError(
507
+ refreshError instanceof Error ? refreshError.message : "Unable to refresh promotion details.",
508
+ guidelineResourceId
509
+ );
510
+ }
511
+ } finally {
512
+ setIsInitialStatusLoading(false);
513
+ setIsLoadingHistory(false);
514
+ }
469
515
  return;
470
516
  }
471
517
  handleGoToMarketplace();
@@ -605,7 +651,10 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
605
651
  ),
606
652
  onClick: () => canRollback ? handleRollbackPromotion(row.promotion_task_id) : handleViewPromotionDetails(row.promotion_task_id),
607
653
  disabled: isInitialStatusLoading || historyActionTaskId !== null,
608
- children: historyActionTaskId === row.promotion_task_id ? canRollback ? "Rolling back\u2026" : "Loading\u2026" : canRollback ? "Rollback" : "View details"
654
+ children: getHistoryActionLabel(
655
+ historyActionTaskId === row.promotion_task_id,
656
+ canRollback
657
+ )
609
658
  }
610
659
  )
611
660
  ] })
@@ -614,9 +663,11 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
614
663
  ] }) }) });
615
664
  }
616
665
  if (id === "database") {
617
- if (isLoadingSchemaPreview) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].emptyBody, children: "Loading database details\u2026" });
666
+ if (isLoadingSchemaPreview)
667
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].emptyBody, children: "Loading database details\u2026" });
618
668
  const groups = Object.entries(schemaPreview);
619
- if (groups.length === 0) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].emptyBody, children: "No database details available." });
669
+ if (groups.length === 0)
670
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].emptyBody, children: "No database details available." });
620
671
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].databaseGrid, children: groups.flatMap(
621
672
  ([groupName, group]) => ["Source", "Destination"].map((environment) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].databaseCard, children: [
622
673
  /* @__PURE__ */ jsxRuntime.jsxs("h3", { children: [
@@ -639,6 +690,15 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
639
690
  }
640
691
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].emptyBody, children: "No details available yet." });
641
692
  };
693
+ if (isViewingPreflightDetails && preflightResult) {
694
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils.cx(PromoteFlow_module["default"].root, className), children: /* @__PURE__ */ jsxRuntime.jsx(
695
+ PreflightDetailsPage.PreflightDetailsPage,
696
+ {
697
+ result: preflightResult,
698
+ onBack: () => setIsViewingPreflightDetails(false)
699
+ }
700
+ ) });
701
+ }
642
702
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cx(PromoteFlow_module["default"].root, className), children: [
643
703
  /* @__PURE__ */ jsxRuntime.jsxs("main", { className: PromoteFlow_module["default"].body, children: [
644
704
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].topRow, children: [
@@ -652,35 +712,28 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
652
712
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].ctaRow, children: [
653
713
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].preflightAction, children: [
654
714
  /* @__PURE__ */ jsxRuntime.jsx(
655
- StyledPromoteTooltip,
715
+ promoteConstants.StyledPromoteTooltip,
656
716
  {
657
- title: canPromote ? "Optionally check that this migration is ready before promoting." : "Configure both source and destination environments first.",
717
+ title: canCheckPromotionReadiness ? "Optionally check that this migration is ready before promoting." : readinessAndNowTooltip,
718
+ disableHoverListener: canCheckPromotionReadiness,
658
719
  placement: "top",
659
720
  arrow: true,
660
- children: /* @__PURE__ */ jsxRuntime.jsxs(
721
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsxs(
661
722
  "button",
662
723
  {
663
724
  type: "button",
664
725
  className: PromoteFlow_module["default"].secondaryButton,
665
726
  onClick: handlePreflightCheck,
666
- disabled: !canPromote || isCheckingPreflight,
727
+ disabled: !canCheckPromotionReadiness || isCheckingPreflight,
667
728
  children: [
668
729
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheck, { className: PromoteFlow_module["default"].buttonIcon, strokeWidth: 2.2 }),
669
730
  isCheckingPreflight ? "Checking readiness\u2026" : "Check promotion readiness"
670
731
  ]
671
732
  }
672
- )
733
+ ) })
673
734
  }
674
735
  ),
675
- /* @__PURE__ */ jsxRuntime.jsx(
676
- StyledPromoteTooltip,
677
- {
678
- title: "Runs a safe validation of the selected source and destination environments. It does not start a migration.",
679
- placement: "top",
680
- arrow: true,
681
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: PromoteFlow_module["default"].preflightInfo, "aria-label": "About the pre-flight check", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: PromoteFlow_module["default"].helpIcon, strokeWidth: 2.2, "aria-hidden": "true" }) })
682
- }
683
- )
736
+ /* @__PURE__ */ jsxRuntime.jsx(promoteConstants.StyledPromoteTooltip, { title: promoteConstants.PREFLIGHT_TOOLTIP, placement: "top", arrow: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: PromoteFlow_module["default"].preflightInfo, "aria-label": "About the pre-flight check", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: PromoteFlow_module["default"].helpIcon, strokeWidth: 2.2, "aria-hidden": "true" }) }) })
684
737
  ] }),
685
738
  isPromoting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
686
739
  canRetryPromotion && /* @__PURE__ */ jsxRuntime.jsxs(
@@ -689,7 +742,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
689
742
  type: "button",
690
743
  className: PromoteFlow_module["default"].primaryButton,
691
744
  onClick: handlePromoteNow,
692
- disabled: !canPromote,
745
+ disabled: !canPromoteNow,
693
746
  children: [
694
747
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpRight, { className: PromoteFlow_module["default"].buttonIcon, strokeWidth: 2.2 }),
695
748
  isSubmitting ? "Starting promotion\u2026" : promoteActionLabel
@@ -709,55 +762,74 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
709
762
  }
710
763
  )
711
764
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
712
- submittingAction !== "now" && /* @__PURE__ */ jsxRuntime.jsxs(
713
- "button",
765
+ submittingAction !== "now" && /* @__PURE__ */ jsxRuntime.jsx(
766
+ promoteConstants.StyledPromoteTooltip,
714
767
  {
715
- type: "button",
716
- className: PromoteFlow_module["default"].secondaryButton,
717
- onClick: handlePromoteLater,
718
- disabled: !canPromote,
719
- children: [
720
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: PromoteFlow_module["default"].buttonIcon, strokeWidth: 2.2 }),
721
- submittingAction === "later" ? "Scheduling\u2026" : "Promote later"
722
- ]
768
+ title: canPromoteLater ? "" : promoteLaterTooltip,
769
+ disableHoverListener: canPromoteLater,
770
+ placement: "top",
771
+ arrow: true,
772
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsxs(
773
+ "button",
774
+ {
775
+ type: "button",
776
+ className: PromoteFlow_module["default"].secondaryButton,
777
+ onClick: handlePromoteLater,
778
+ disabled: !canPromoteLater,
779
+ children: [
780
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: PromoteFlow_module["default"].buttonIcon, strokeWidth: 2.2 }),
781
+ submittingAction === "later" ? "Scheduling\u2026" : "Promote later"
782
+ ]
783
+ }
784
+ ) })
723
785
  }
724
786
  ),
725
787
  submittingAction !== "later" && /* @__PURE__ */ jsxRuntime.jsx(
726
- StyledPromoteTooltip,
788
+ promoteConstants.StyledPromoteTooltip,
727
789
  {
728
- title: canPromote ? "" : "Configure both source and destination environments first.",
729
- disableHoverListener: canPromote,
790
+ title: canPromoteNow ? "" : readinessAndNowTooltip,
791
+ disableHoverListener: canPromoteNow,
730
792
  placement: "top",
731
793
  arrow: true,
732
- children: /* @__PURE__ */ jsxRuntime.jsxs(
794
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsxs(
733
795
  "button",
734
796
  {
735
797
  type: "button",
736
798
  className: PromoteFlow_module["default"].primaryButton,
737
799
  onClick: handlePromoteNow,
738
- disabled: !canPromote,
800
+ disabled: !canPromoteNow,
739
801
  children: [
740
802
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpRight, { className: PromoteFlow_module["default"].buttonIcon, strokeWidth: 2.2 }),
741
803
  submittingAction === "now" ? "Starting promotion\u2026" : promoteActionLabel
742
804
  ]
743
805
  }
744
- )
806
+ ) })
745
807
  }
746
808
  )
747
809
  ] })
748
810
  ] })
749
811
  ] }),
750
812
  preflightResult && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].preflightSuccess, role: "status", children: [
751
- "Pre-flight check completed successfully.",
752
- " ",
753
- preflightResult.ready ? `Migration is ready (${preflightResult.itemsReady}/${preflightResult.itemsChecked} checks passed).` : `Migration readiness requires attention (${preflightResult.itemsReady}/${preflightResult.itemsChecked} checks passed).`
813
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
814
+ "Pre-flight check completed successfully. ",
815
+ getPreflightResultMessage(preflightResult)
816
+ ] }),
817
+ preflightResult.ready && /* @__PURE__ */ jsxRuntime.jsx(
818
+ "button",
819
+ {
820
+ type: "button",
821
+ className: PromoteFlow_module["default"].preflightDetailsButton,
822
+ onClick: () => setIsViewingPreflightDetails(true),
823
+ children: "View preflight details"
824
+ }
825
+ )
754
826
  ] }),
755
827
  isPromoting ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].promotionStatusBox, children: [
756
828
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].promotionStatusRow, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].promotionStatusRowHeader, children: [
757
829
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].promotionStatusField, children: [
758
830
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: PromoteFlow_module["default"].metaLabel, children: "Promotion Status" }),
759
831
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].statusWithPill, children: [
760
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: PromoteFlow_module["default"].statusValue, children: (_c = promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.status) != null ? _c : "In Progress" }),
832
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: PromoteFlow_module["default"].statusValue, children: (_d = promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.status) != null ? _d : "In Progress" }),
761
833
  (promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.status) === "MIGRATING" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: PromoteFlow_module["default"].ingestingPill, children: [
762
834
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LoaderCircle, { className: PromoteFlow_module["default"].migrationLoader, "aria-hidden": "true" }),
763
835
  "Migration in progress"
@@ -858,7 +930,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
858
930
  errorForGuideline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: PromoteFlow_module["default"].promotionError, role: "alert", children: errorForGuideline })
859
931
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
860
932
  errorForGuideline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: PromoteFlow_module["default"].promotionError, role: "alert", children: errorForGuideline }),
861
- /* @__PURE__ */ jsxRuntime.jsx("section", { className: PromoteFlow_module["default"].accordionList, "aria-label": "Promotion details", children: ACCORDIONS.map((item) => {
933
+ /* @__PURE__ */ jsxRuntime.jsx("section", { className: PromoteFlow_module["default"].accordionList, "aria-label": "Promotion details", children: promoteConstants.ACCORDIONS.map((item) => {
862
934
  const isOpen = Boolean(openSections[item.id]);
863
935
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].accordion, children: [
864
936
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -894,27 +966,12 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
894
966
  EnvironmentConfigurationModal.EnvironmentConfigurationModal,
895
967
  {
896
968
  environment: configuredEnvironment,
897
- initialConfiguration: selectedEnvironment ? {
898
- env_name: selectedEnvironment.env_name,
899
- env_tier: selectedEnvironment.env_tier,
900
- db_type: selectedEnvironment.db_type,
901
- host: selectedEnvironment.host,
902
- port: String(selectedEnvironment.port),
903
- username: selectedEnvironment.username,
904
- password: "",
905
- database_name: selectedEnvironment.database_name,
906
- is_tenant_db: selectedEnvironment.is_tenant_db
907
- } : {
908
- ...promoteFlow_utils.EMPTY_ENVIRONMENT_CONFIGURATION,
909
- env_tier: configuredEnvironment === "source" || configuredEnvironment === "tenantSource" ? "dev" : permittedDestinationTiers[0],
910
- db_type: (configuredEnvironment === "destination" || configuredEnvironment === "tenantDestination") && permittedDestinationTiers[0] === "external" ? "EXTERNAL" : "INTERNAL",
911
- is_tenant_db: configuredEnvironment === "tenantSource" || configuredEnvironment === "tenantDestination"
912
- },
913
- permittedTiers: configuredEnvironment === "source" || configuredEnvironment === "tenantSource" ? permittedSourceTiers : permittedDestinationTiers,
969
+ initialConfiguration: modalInitialConfiguration,
970
+ permittedTiers: modalPermittedTiers,
914
971
  onSave: handleSaveEnvironment,
915
972
  onSelectPreset: setEnvironment,
916
973
  onPresetTierChange: setConfigSearchTier,
917
- presetTier: configSearchTier != null ? configSearchTier : configuredEnvironment === "source" ? (_d = sourceEnvironment == null ? void 0 : sourceEnvironment.env_tier) != null ? _d : "dev" : configuredEnvironment === "destination" ? (_e = destinationEnvironment == null ? void 0 : destinationEnvironment.env_tier) != null ? _e : permittedDestinationTiers[0] : configuredEnvironment === "tenantSource" ? (_f = tenantSourceEnvironment == null ? void 0 : tenantSourceEnvironment.env_tier) != null ? _f : "dev" : (_g = tenantDestinationEnvironment == null ? void 0 : tenantDestinationEnvironment.env_tier) != null ? _g : permittedDestinationTiers[0],
974
+ presetTier: modalPresetTier,
918
975
  onClose: () => {
919
976
  setConfiguredEnvironment(null);
920
977
  setConfigSearchTier(null);