@e-llm-studio/instant-learning 1.3.6 → 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.
- package/dist/ILMarketplaceWrapper.js +16 -11
- package/dist/ILMarketplaceWrapper.js.map +1 -1
- package/dist/cjs/ILMarketplaceWrapper.js +16 -11
- package/dist/cjs/ILMarketplaceWrapper.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/ILOTJ.js +1 -1
- package/dist/cjs/features/IL-OTJ/ILOTJ.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.js +220 -0
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.js.map +1 -0
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.module.css.js +12 -0
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.module.css.js.map +1 -0
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PromoteFlow.js +159 -171
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PromoteFlow.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PromoteFlow.module.css.js +2 -2
- package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-constants.js +69 -0
- package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-constants.js.map +1 -0
- package/dist/cjs/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js +7 -4
- package/dist/cjs/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js.map +1 -1
- package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -4
- package/dist/cjs/features/LearningManagement/LearningManagement.js.map +1 -1
- package/dist/features/IL-OTJ/ILOTJ.js +1 -1
- package/dist/features/IL-OTJ/ILOTJ.js.map +1 -1
- package/dist/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.js +216 -0
- package/dist/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.js.map +1 -0
- package/dist/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.module.css.js +8 -0
- package/dist/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.module.css.js.map +1 -0
- package/dist/features/IL-marketplace/PromoteFlow/PromoteFlow.js +156 -164
- package/dist/features/IL-marketplace/PromoteFlow/PromoteFlow.js.map +1 -1
- package/dist/features/IL-marketplace/PromoteFlow/PromoteFlow.module.css.js +2 -2
- package/dist/features/IL-marketplace/PromoteFlow/promote-constants.js +51 -0
- package/dist/features/IL-marketplace/PromoteFlow/promote-constants.js.map +1 -0
- package/dist/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js +7 -4
- package/dist/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js.map +1 -1
- package/dist/features/LearningManagement/LearningManagement.js +1 -4
- package/dist/features/LearningManagement/LearningManagement.js.map +1 -1
- package/dist/types/src/ILMarketplaceWrapper.d.ts +2 -2
- package/dist/types/src/ILMarketplaceWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.d.ts +9 -0
- package/dist/types/src/features/IL-marketplace/PromoteFlow/PreflightDetailsPage.d.ts.map +1 -0
- package/dist/types/src/features/IL-marketplace/PromoteFlow/PromoteFlow.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-constants.d.ts +23 -0
- package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-constants.d.ts.map +1 -0
- package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.interfaces.d.ts +26 -0
- package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.interfaces.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -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,
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
43
|
+
var _a, _b, _c, _d;
|
|
58
44
|
const [openSections, setOpenSections] = useState({
|
|
59
45
|
overview: true
|
|
60
46
|
});
|
|
@@ -75,6 +61,7 @@ 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);
|
|
78
65
|
const [promotionStatusForActions, setPromotionStatusForActions] = useState(null);
|
|
79
66
|
const [preflightResult, setPreflightResult] = useState(null);
|
|
80
67
|
const sourceEnvironment = usePromoteFlowStore((state) => state.sourceEnvironment);
|
|
@@ -95,7 +82,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
95
82
|
const resetPromotionSession = usePromoteFlowStore((state) => state.resetPromotionSession);
|
|
96
83
|
const title = getGuidelineTitle(guideline);
|
|
97
84
|
const versionLabel = guideline.version ? `v${guideline.version}` : "v1";
|
|
98
|
-
const statusLabel = (_a = guideline.status) != null ? _a :
|
|
85
|
+
const statusLabel = (_a = guideline.status) != null ? _a : DEFAULT_GUIDELINE_STATUS;
|
|
99
86
|
const guidelineResourceId = getPromotionResourceId(guideline);
|
|
100
87
|
const promotionTaskForGuideline = promotionResourceId === guidelineResourceId ? promotionTask : null;
|
|
101
88
|
const errorForGuideline = errorResourceId === guidelineResourceId ? error : null;
|
|
@@ -111,13 +98,43 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
111
98
|
);
|
|
112
99
|
const isPromoting = Boolean(promotionTaskForGuideline);
|
|
113
100
|
const canRetryPromotion = (promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.status) === "FAILED";
|
|
114
|
-
const sourceTier = (_b = sourceEnvironment == null ? void 0 : sourceEnvironment.env_tier) != null ? _b :
|
|
101
|
+
const sourceTier = (_b = sourceEnvironment == null ? void 0 : sourceEnvironment.env_tier) != null ? _b : DEFAULT_SOURCE_ENVIRONMENT_TIER;
|
|
115
102
|
const permittedDestinationTiers = useMemo(
|
|
116
103
|
() => getPermittedDestinationTiers(sourceTier),
|
|
117
104
|
[sourceTier]
|
|
118
105
|
);
|
|
119
|
-
const
|
|
120
|
-
|
|
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;
|
|
121
138
|
const latestPromotionForPair = useMemo(
|
|
122
139
|
() => getLatestPromotionForEnvironmentPair(
|
|
123
140
|
promotionHistory,
|
|
@@ -126,36 +143,36 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
126
143
|
),
|
|
127
144
|
[destinationEnvironment, promotionHistory, sourceEnvironment]
|
|
128
145
|
);
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (!latest) return entry;
|
|
134
|
-
return Date.parse(entry.updated_at) > Date.parse(latest.updated_at) ? entry : latest;
|
|
135
|
-
},
|
|
136
|
-
null
|
|
137
|
-
);
|
|
138
|
-
return (_a2 = latestPromotion2 == null ? void 0 : latestPromotion2.promotion_task_id) != null ? _a2 : null;
|
|
139
|
-
}, [promotionHistory]);
|
|
140
|
-
const latestPromotion = useMemo(
|
|
141
|
-
() => promotionHistory.reduce((latest, entry) => {
|
|
142
|
-
if (!latest) return entry;
|
|
143
|
-
return Date.parse(entry.updated_at) > Date.parse(latest.updated_at) ? entry : latest;
|
|
144
|
-
}, null),
|
|
145
|
-
[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)
|
|
146
150
|
);
|
|
147
|
-
const
|
|
148
|
-
|
|
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
|
|
149
155
|
);
|
|
150
|
-
const latestHistoryIsScheduled = (latestPromotion == null ? void 0 : latestPromotion.status) === "SCHEDULED" || (promotionStatusForActions == null ? void 0 : promotionStatusForActions.status) === "SCHEDULED";
|
|
151
|
-
const promotionActionRestriction = isPromotionInProgress ? "A promotion is currently in progress. Wait for it to complete before taking another promotion action." : latestHistoryIsScheduled ? "The latest promotion is scheduled. You may schedule another promotion, but cannot check readiness or promote now." : null;
|
|
152
156
|
const canCheckPromotionReadiness = canPromote && !promotionActionRestriction;
|
|
153
157
|
const canPromoteNow = canPromote && !promotionActionRestriction;
|
|
154
158
|
const canPromoteLater = canPromote && !isPromotionInProgress;
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
const promoteLaterTooltip = isPromotionInProgress ? promotionActionRestriction : environmentConfigurationTooltip;
|
|
159
|
+
const readinessAndNowTooltip = promotionActionRestriction != null ? promotionActionRestriction : ENVIRONMENT_CONFIGURATION_TOOLTIP;
|
|
160
|
+
const promoteLaterTooltip = isPromotionInProgress ? promotionActionRestriction : ENVIRONMENT_CONFIGURATION_TOOLTIP;
|
|
158
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
|
+
};
|
|
159
176
|
const toggleSection = (id) => {
|
|
160
177
|
setOpenSections((current) => ({ ...current, [id]: !current[id] }));
|
|
161
178
|
};
|
|
@@ -205,14 +222,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
205
222
|
getSchemaPreview(guidelineResourceId).then((preview) => {
|
|
206
223
|
if (!isCurrent) return;
|
|
207
224
|
setSchemaPreview(
|
|
208
|
-
Object.entries(preview != null ? preview : {}).reduce(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
+
)
|
|
212
232
|
);
|
|
213
233
|
}).catch((schemaError) => {
|
|
214
234
|
if (isCurrent) {
|
|
215
|
-
console.error("Failed to load schema preview", {
|
|
235
|
+
console.error("Failed to load schema preview", {
|
|
236
|
+
resourceId: guidelineResourceId,
|
|
237
|
+
schemaError
|
|
238
|
+
});
|
|
216
239
|
setSchemaPreview({});
|
|
217
240
|
}
|
|
218
241
|
}).finally(() => {
|
|
@@ -223,18 +246,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
223
246
|
};
|
|
224
247
|
}, [guidelineResourceId]);
|
|
225
248
|
useEffect(() => {
|
|
226
|
-
var _a2, _b2, _c2, _d2;
|
|
227
249
|
if (!configuredEnvironment) return;
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
250
|
+
const defaultTier = getDefaultEnvironmentTier(
|
|
251
|
+
configuredEnvironment,
|
|
252
|
+
environments[configuredEnvironment],
|
|
253
|
+
permittedDestinationTiers
|
|
254
|
+
);
|
|
255
|
+
const environmentTier = configSearchTier != null ? configSearchTier : defaultTier;
|
|
231
256
|
let isCurrent = true;
|
|
232
257
|
setIsLoadingConfigs(true);
|
|
233
258
|
setPromotionConfigs([]);
|
|
234
259
|
searchEnvironmentConfigs({
|
|
235
|
-
env_tier:
|
|
236
|
-
db_type:
|
|
237
|
-
is_tenant: configuredEnvironment
|
|
260
|
+
env_tier: environmentTier,
|
|
261
|
+
db_type: environmentTier === "external" ? "EXTERNAL" : "INTERNAL",
|
|
262
|
+
is_tenant: isTenantEnvironment(configuredEnvironment)
|
|
238
263
|
}).then((configs) => {
|
|
239
264
|
if (isCurrent) setPromotionConfigs(configs);
|
|
240
265
|
}).catch(() => {
|
|
@@ -277,7 +302,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
277
302
|
}, [promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.created_by, promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.promotion_task_id]);
|
|
278
303
|
useEffect(() => {
|
|
279
304
|
const promotionStatusToPoll = promotionTaskForGuideline != null ? promotionTaskForGuideline : promotionStatusForActions;
|
|
280
|
-
if (!promotionStatusToPoll || isStatusPollingStopped || !
|
|
305
|
+
if (!promotionStatusToPoll || isStatusPollingStopped || !PROMOTION_IN_PROGRESS_STATUSES.some((status) => status === promotionStatusToPoll.status)) {
|
|
281
306
|
return;
|
|
282
307
|
}
|
|
283
308
|
const pollStatus = async () => {
|
|
@@ -293,7 +318,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
293
318
|
);
|
|
294
319
|
}
|
|
295
320
|
};
|
|
296
|
-
const intervalId = window.setInterval(pollStatus,
|
|
321
|
+
const intervalId = window.setInterval(pollStatus, PROMOTION_POLL_INTERVAL_MS);
|
|
297
322
|
return () => window.clearInterval(intervalId);
|
|
298
323
|
}, [
|
|
299
324
|
guidelineResourceId,
|
|
@@ -304,22 +329,13 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
304
329
|
setPromotionTask
|
|
305
330
|
]);
|
|
306
331
|
const handlePromoteNow = async () => {
|
|
307
|
-
|
|
332
|
+
const promotionRequest = createPromotionRequest();
|
|
333
|
+
if (!canPromoteNow || !promotionRequest) return;
|
|
308
334
|
setSubmitting(true);
|
|
309
335
|
setSubmittingAction("now");
|
|
310
336
|
setError(null);
|
|
311
337
|
try {
|
|
312
|
-
const task = await startPromotion(
|
|
313
|
-
resource_id: getPromotionResourceId(guideline),
|
|
314
|
-
resource_type: "PACKAGE",
|
|
315
|
-
target_version: "latest",
|
|
316
|
-
global_source_env_id: sourceEnvironment.env_id,
|
|
317
|
-
global_target_env_id: destinationEnvironment.env_id,
|
|
318
|
-
...tenantSourceEnvironment && tenantDestinationEnvironment ? {
|
|
319
|
-
tenant_source_env_id: tenantSourceEnvironment.env_id,
|
|
320
|
-
tenant_target_env_id: tenantDestinationEnvironment.env_id
|
|
321
|
-
} : {}
|
|
322
|
-
});
|
|
338
|
+
const task = await startPromotion(promotionRequest);
|
|
323
339
|
setIsStatusPollingStopped(false);
|
|
324
340
|
setPromotionTask(task, guidelineResourceId);
|
|
325
341
|
setPromotionStatusForActions(task);
|
|
@@ -341,28 +357,15 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
341
357
|
}
|
|
342
358
|
};
|
|
343
359
|
const handlePreflightCheck = async () => {
|
|
344
|
-
|
|
345
|
-
|
|
360
|
+
const promotionRequest = createPromotionRequest();
|
|
361
|
+
if (!canCheckPromotionReadiness || !promotionRequest || isCheckingPreflight) return;
|
|
346
362
|
setIsCheckingPreflight(true);
|
|
347
363
|
setPreflightResult(null);
|
|
364
|
+
setIsViewingPreflightDetails(false);
|
|
348
365
|
setError(null);
|
|
349
366
|
try {
|
|
350
|
-
const result = await checkPromotionPreflight(
|
|
351
|
-
|
|
352
|
-
resource_type: "PACKAGE",
|
|
353
|
-
target_version: "latest",
|
|
354
|
-
global_source_env_id: sourceEnvironment.env_id,
|
|
355
|
-
global_target_env_id: destinationEnvironment.env_id,
|
|
356
|
-
...tenantSourceEnvironment && tenantDestinationEnvironment ? {
|
|
357
|
-
tenant_source_env_id: tenantSourceEnvironment.env_id,
|
|
358
|
-
tenant_target_env_id: tenantDestinationEnvironment.env_id
|
|
359
|
-
} : {}
|
|
360
|
-
});
|
|
361
|
-
setPreflightResult({
|
|
362
|
-
ready: result.ready,
|
|
363
|
-
itemsChecked: result.items_checked,
|
|
364
|
-
itemsReady: result.items_ready
|
|
365
|
-
});
|
|
367
|
+
const result = await checkPromotionPreflight(promotionRequest);
|
|
368
|
+
setPreflightResult(result);
|
|
366
369
|
} catch (preflightError) {
|
|
367
370
|
setError(
|
|
368
371
|
preflightError instanceof Error ? preflightError.message : "Unable to complete pre-flight check.",
|
|
@@ -373,10 +376,9 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
373
376
|
}
|
|
374
377
|
};
|
|
375
378
|
const handleSaveEnvironment = async (environment, configuration) => {
|
|
376
|
-
const isTenantEnvironment = environment === "tenantSource" || environment === "tenantDestination";
|
|
377
379
|
const configurationToSave = {
|
|
378
380
|
...configuration,
|
|
379
|
-
is_tenant_db: isTenantEnvironment
|
|
381
|
+
is_tenant_db: isTenantEnvironment(environment)
|
|
380
382
|
};
|
|
381
383
|
const response = await createEnvironmentConfig(
|
|
382
384
|
toCreateEnvironmentConfigRequest(configurationToSave)
|
|
@@ -384,31 +386,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
384
386
|
setEnvironment(environment, toRegistryRecord(response.env_id, configurationToSave));
|
|
385
387
|
};
|
|
386
388
|
const openEnvironmentConfiguration = (environment) => {
|
|
387
|
-
var _a2;
|
|
388
|
-
const selected = environment === "source" ? sourceEnvironment : environment === "destination" ? destinationEnvironment : environment === "tenantSource" ? tenantSourceEnvironment : tenantDestinationEnvironment;
|
|
389
389
|
setConfigSearchTier(
|
|
390
|
-
(
|
|
390
|
+
getDefaultEnvironmentTier(environment, environments[environment], permittedDestinationTiers)
|
|
391
391
|
);
|
|
392
392
|
setConfiguredEnvironment(environment);
|
|
393
393
|
};
|
|
394
394
|
const handlePromoteLater = async () => {
|
|
395
395
|
var _a2, _b2;
|
|
396
|
-
|
|
396
|
+
const promotionRequest = createPromotionRequest();
|
|
397
|
+
if (!canPromoteLater || !promotionRequest) return;
|
|
397
398
|
setSubmitting(true);
|
|
398
399
|
setSubmittingAction("later");
|
|
399
400
|
setError(null);
|
|
400
401
|
try {
|
|
401
|
-
const scheduledPromotion = await schedulePromotion(
|
|
402
|
-
resource_id: guidelineResourceId,
|
|
403
|
-
resource_type: "PACKAGE",
|
|
404
|
-
target_version: "latest",
|
|
405
|
-
global_source_env_id: sourceEnvironment.env_id,
|
|
406
|
-
global_target_env_id: destinationEnvironment.env_id,
|
|
407
|
-
...tenantSourceEnvironment && tenantDestinationEnvironment ? {
|
|
408
|
-
tenant_source_env_id: tenantSourceEnvironment.env_id,
|
|
409
|
-
tenant_target_env_id: tenantDestinationEnvironment.env_id
|
|
410
|
-
} : {}
|
|
411
|
-
});
|
|
402
|
+
const scheduledPromotion = await schedulePromotion(promotionRequest);
|
|
412
403
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
413
404
|
setPromotionTask(
|
|
414
405
|
{
|
|
@@ -656,7 +647,10 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
656
647
|
),
|
|
657
648
|
onClick: () => canRollback ? handleRollbackPromotion(row.promotion_task_id) : handleViewPromotionDetails(row.promotion_task_id),
|
|
658
649
|
disabled: isInitialStatusLoading || historyActionTaskId !== null,
|
|
659
|
-
children:
|
|
650
|
+
children: getHistoryActionLabel(
|
|
651
|
+
historyActionTaskId === row.promotion_task_id,
|
|
652
|
+
canRollback
|
|
653
|
+
)
|
|
660
654
|
}
|
|
661
655
|
)
|
|
662
656
|
] })
|
|
@@ -665,9 +659,11 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
665
659
|
] }) }) });
|
|
666
660
|
}
|
|
667
661
|
if (id === "database") {
|
|
668
|
-
if (isLoadingSchemaPreview)
|
|
662
|
+
if (isLoadingSchemaPreview)
|
|
663
|
+
return /* @__PURE__ */ jsx("div", { className: cssStyles.emptyBody, children: "Loading database details\u2026" });
|
|
669
664
|
const groups = Object.entries(schemaPreview);
|
|
670
|
-
if (groups.length === 0)
|
|
665
|
+
if (groups.length === 0)
|
|
666
|
+
return /* @__PURE__ */ jsx("div", { className: cssStyles.emptyBody, children: "No database details available." });
|
|
671
667
|
return /* @__PURE__ */ jsx("div", { className: cssStyles.databaseGrid, children: groups.flatMap(
|
|
672
668
|
([groupName, group]) => ["Source", "Destination"].map((environment) => /* @__PURE__ */ jsxs("div", { className: cssStyles.databaseCard, children: [
|
|
673
669
|
/* @__PURE__ */ jsxs("h3", { children: [
|
|
@@ -690,6 +686,15 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
690
686
|
}
|
|
691
687
|
return /* @__PURE__ */ jsx("div", { className: cssStyles.emptyBody, children: "No details available yet." });
|
|
692
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
|
+
}
|
|
693
698
|
return /* @__PURE__ */ jsxs("div", { className: cx(cssStyles.root, className), children: [
|
|
694
699
|
/* @__PURE__ */ jsxs("main", { className: cssStyles.body, children: [
|
|
695
700
|
/* @__PURE__ */ jsxs("div", { className: cssStyles.topRow, children: [
|
|
@@ -724,15 +729,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
724
729
|
) })
|
|
725
730
|
}
|
|
726
731
|
),
|
|
727
|
-
/* @__PURE__ */ jsx(
|
|
728
|
-
StyledPromoteTooltip,
|
|
729
|
-
{
|
|
730
|
-
title: "Runs a safe validation of the selected source and destination environments. It does not start a migration.",
|
|
731
|
-
placement: "top",
|
|
732
|
-
arrow: true,
|
|
733
|
-
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" }) })
|
|
734
|
-
}
|
|
735
|
-
)
|
|
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" }) }) })
|
|
736
733
|
] }),
|
|
737
734
|
isPromoting ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
738
735
|
canRetryPromotion && /* @__PURE__ */ jsxs(
|
|
@@ -809,9 +806,19 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
809
806
|
] })
|
|
810
807
|
] }),
|
|
811
808
|
preflightResult && /* @__PURE__ */ jsxs("div", { className: cssStyles.preflightSuccess, role: "status", children: [
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
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
|
+
)
|
|
815
822
|
] }),
|
|
816
823
|
isPromoting ? /* @__PURE__ */ jsxs("div", { className: cssStyles.promotionStatusBox, children: [
|
|
817
824
|
/* @__PURE__ */ jsx("div", { className: cssStyles.promotionStatusRow, children: /* @__PURE__ */ jsxs("div", { className: cssStyles.promotionStatusRowHeader, children: [
|
|
@@ -955,27 +962,12 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
955
962
|
EnvironmentConfigurationModal,
|
|
956
963
|
{
|
|
957
964
|
environment: configuredEnvironment,
|
|
958
|
-
initialConfiguration:
|
|
959
|
-
|
|
960
|
-
env_tier: selectedEnvironment.env_tier,
|
|
961
|
-
db_type: selectedEnvironment.db_type,
|
|
962
|
-
host: selectedEnvironment.host,
|
|
963
|
-
port: String(selectedEnvironment.port),
|
|
964
|
-
username: selectedEnvironment.username,
|
|
965
|
-
password: "",
|
|
966
|
-
database_name: selectedEnvironment.database_name,
|
|
967
|
-
is_tenant_db: selectedEnvironment.is_tenant_db
|
|
968
|
-
} : {
|
|
969
|
-
...EMPTY_ENVIRONMENT_CONFIGURATION,
|
|
970
|
-
env_tier: configuredEnvironment === "source" || configuredEnvironment === "tenantSource" ? "dev" : permittedDestinationTiers[0],
|
|
971
|
-
db_type: (configuredEnvironment === "destination" || configuredEnvironment === "tenantDestination") && permittedDestinationTiers[0] === "external" ? "EXTERNAL" : "INTERNAL",
|
|
972
|
-
is_tenant_db: configuredEnvironment === "tenantSource" || configuredEnvironment === "tenantDestination"
|
|
973
|
-
},
|
|
974
|
-
permittedTiers: configuredEnvironment === "source" || configuredEnvironment === "tenantSource" ? permittedSourceTiers : permittedDestinationTiers,
|
|
965
|
+
initialConfiguration: modalInitialConfiguration,
|
|
966
|
+
permittedTiers: modalPermittedTiers,
|
|
975
967
|
onSave: handleSaveEnvironment,
|
|
976
968
|
onSelectPreset: setEnvironment,
|
|
977
969
|
onPresetTierChange: setConfigSearchTier,
|
|
978
|
-
presetTier:
|
|
970
|
+
presetTier: modalPresetTier,
|
|
979
971
|
onClose: () => {
|
|
980
972
|
setConfiguredEnvironment(null);
|
|
981
973
|
setConfigSearchTier(null);
|