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