@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
|
@@ -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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
|
47
|
+
var _a, _b, _c, _d;
|
|
66
48
|
const [openSections, setOpenSections] = React.useState({
|
|
67
49
|
overview: true
|
|
68
50
|
});
|
|
@@ -83,6 +65,7 @@ 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);
|
|
86
69
|
const [promotionStatusForActions, setPromotionStatusForActions] = React.useState(null);
|
|
87
70
|
const [preflightResult, setPreflightResult] = React.useState(null);
|
|
88
71
|
const sourceEnvironment = promoteFlow_store.usePromoteFlowStore((state) => state.sourceEnvironment);
|
|
@@ -103,7 +86,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
103
86
|
const resetPromotionSession = promoteFlow_store.usePromoteFlowStore((state) => state.resetPromotionSession);
|
|
104
87
|
const title = utils.getGuidelineTitle(guideline);
|
|
105
88
|
const versionLabel = guideline.version ? `v${guideline.version}` : "v1";
|
|
106
|
-
const statusLabel = (_a = guideline.status) != null ? _a :
|
|
89
|
+
const statusLabel = (_a = guideline.status) != null ? _a : promoteConstants.DEFAULT_GUIDELINE_STATUS;
|
|
107
90
|
const guidelineResourceId = promoteFlow_utils.getPromotionResourceId(guideline);
|
|
108
91
|
const promotionTaskForGuideline = promotionResourceId === guidelineResourceId ? promotionTask : null;
|
|
109
92
|
const errorForGuideline = errorResourceId === guidelineResourceId ? error : null;
|
|
@@ -119,13 +102,43 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
119
102
|
);
|
|
120
103
|
const isPromoting = Boolean(promotionTaskForGuideline);
|
|
121
104
|
const canRetryPromotion = (promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.status) === "FAILED";
|
|
122
|
-
const sourceTier = (_b = sourceEnvironment == null ? void 0 : sourceEnvironment.env_tier) != null ? _b :
|
|
105
|
+
const sourceTier = (_b = sourceEnvironment == null ? void 0 : sourceEnvironment.env_tier) != null ? _b : promoteConstants.DEFAULT_SOURCE_ENVIRONMENT_TIER;
|
|
123
106
|
const permittedDestinationTiers = React.useMemo(
|
|
124
107
|
() => promoteFlow_utils.getPermittedDestinationTiers(sourceTier),
|
|
125
108
|
[sourceTier]
|
|
126
109
|
);
|
|
127
|
-
const
|
|
128
|
-
|
|
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;
|
|
129
142
|
const latestPromotionForPair = React.useMemo(
|
|
130
143
|
() => promoteFlow_utils.getLatestPromotionForEnvironmentPair(
|
|
131
144
|
promotionHistory,
|
|
@@ -134,36 +147,36 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
134
147
|
),
|
|
135
148
|
[destinationEnvironment, promotionHistory, sourceEnvironment]
|
|
136
149
|
);
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (!latest) return entry;
|
|
142
|
-
return Date.parse(entry.updated_at) > Date.parse(latest.updated_at) ? entry : latest;
|
|
143
|
-
},
|
|
144
|
-
null
|
|
145
|
-
);
|
|
146
|
-
return (_a2 = latestPromotion2 == null ? void 0 : latestPromotion2.promotion_task_id) != null ? _a2 : null;
|
|
147
|
-
}, [promotionHistory]);
|
|
148
|
-
const latestPromotion = React.useMemo(
|
|
149
|
-
() => promotionHistory.reduce((latest, entry) => {
|
|
150
|
-
if (!latest) return entry;
|
|
151
|
-
return Date.parse(entry.updated_at) > Date.parse(latest.updated_at) ? entry : latest;
|
|
152
|
-
}, null),
|
|
153
|
-
[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
154
|
);
|
|
155
|
-
const
|
|
156
|
-
|
|
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
|
|
157
159
|
);
|
|
158
|
-
const latestHistoryIsScheduled = (latestPromotion == null ? void 0 : latestPromotion.status) === "SCHEDULED" || (promotionStatusForActions == null ? void 0 : promotionStatusForActions.status) === "SCHEDULED";
|
|
159
|
-
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;
|
|
160
160
|
const canCheckPromotionReadiness = canPromote && !promotionActionRestriction;
|
|
161
161
|
const canPromoteNow = canPromote && !promotionActionRestriction;
|
|
162
162
|
const canPromoteLater = canPromote && !isPromotionInProgress;
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
const promoteLaterTooltip = isPromotionInProgress ? promotionActionRestriction : environmentConfigurationTooltip;
|
|
163
|
+
const readinessAndNowTooltip = promotionActionRestriction != null ? promotionActionRestriction : promoteConstants.ENVIRONMENT_CONFIGURATION_TOOLTIP;
|
|
164
|
+
const promoteLaterTooltip = isPromotionInProgress ? promotionActionRestriction : promoteConstants.ENVIRONMENT_CONFIGURATION_TOOLTIP;
|
|
166
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
|
+
};
|
|
167
180
|
const toggleSection = (id) => {
|
|
168
181
|
setOpenSections((current) => ({ ...current, [id]: !current[id] }));
|
|
169
182
|
};
|
|
@@ -213,14 +226,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
213
226
|
promoteFlow_api.getSchemaPreview(guidelineResourceId).then((preview) => {
|
|
214
227
|
if (!isCurrent) return;
|
|
215
228
|
setSchemaPreview(
|
|
216
|
-
Object.entries(preview != null ? preview : {}).reduce(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
+
)
|
|
220
236
|
);
|
|
221
237
|
}).catch((schemaError) => {
|
|
222
238
|
if (isCurrent) {
|
|
223
|
-
console.error("Failed to load schema preview", {
|
|
239
|
+
console.error("Failed to load schema preview", {
|
|
240
|
+
resourceId: guidelineResourceId,
|
|
241
|
+
schemaError
|
|
242
|
+
});
|
|
224
243
|
setSchemaPreview({});
|
|
225
244
|
}
|
|
226
245
|
}).finally(() => {
|
|
@@ -231,18 +250,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
231
250
|
};
|
|
232
251
|
}, [guidelineResourceId]);
|
|
233
252
|
React.useEffect(() => {
|
|
234
|
-
var _a2, _b2, _c2, _d2;
|
|
235
253
|
if (!configuredEnvironment) return;
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
254
|
+
const defaultTier = getDefaultEnvironmentTier(
|
|
255
|
+
configuredEnvironment,
|
|
256
|
+
environments[configuredEnvironment],
|
|
257
|
+
permittedDestinationTiers
|
|
258
|
+
);
|
|
259
|
+
const environmentTier = configSearchTier != null ? configSearchTier : defaultTier;
|
|
239
260
|
let isCurrent = true;
|
|
240
261
|
setIsLoadingConfigs(true);
|
|
241
262
|
setPromotionConfigs([]);
|
|
242
263
|
promoteFlow_api.searchEnvironmentConfigs({
|
|
243
|
-
env_tier:
|
|
244
|
-
db_type:
|
|
245
|
-
is_tenant: configuredEnvironment
|
|
264
|
+
env_tier: environmentTier,
|
|
265
|
+
db_type: environmentTier === "external" ? "EXTERNAL" : "INTERNAL",
|
|
266
|
+
is_tenant: isTenantEnvironment(configuredEnvironment)
|
|
246
267
|
}).then((configs) => {
|
|
247
268
|
if (isCurrent) setPromotionConfigs(configs);
|
|
248
269
|
}).catch(() => {
|
|
@@ -285,7 +306,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
285
306
|
}, [promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.created_by, promotionTaskForGuideline == null ? void 0 : promotionTaskForGuideline.promotion_task_id]);
|
|
286
307
|
React.useEffect(() => {
|
|
287
308
|
const promotionStatusToPoll = promotionTaskForGuideline != null ? promotionTaskForGuideline : promotionStatusForActions;
|
|
288
|
-
if (!promotionStatusToPoll || isStatusPollingStopped || !
|
|
309
|
+
if (!promotionStatusToPoll || isStatusPollingStopped || !promoteConstants.PROMOTION_IN_PROGRESS_STATUSES.some((status) => status === promotionStatusToPoll.status)) {
|
|
289
310
|
return;
|
|
290
311
|
}
|
|
291
312
|
const pollStatus = async () => {
|
|
@@ -301,7 +322,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
301
322
|
);
|
|
302
323
|
}
|
|
303
324
|
};
|
|
304
|
-
const intervalId = window.setInterval(pollStatus,
|
|
325
|
+
const intervalId = window.setInterval(pollStatus, promoteConstants.PROMOTION_POLL_INTERVAL_MS);
|
|
305
326
|
return () => window.clearInterval(intervalId);
|
|
306
327
|
}, [
|
|
307
328
|
guidelineResourceId,
|
|
@@ -312,22 +333,13 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
312
333
|
setPromotionTask
|
|
313
334
|
]);
|
|
314
335
|
const handlePromoteNow = async () => {
|
|
315
|
-
|
|
336
|
+
const promotionRequest = createPromotionRequest();
|
|
337
|
+
if (!canPromoteNow || !promotionRequest) return;
|
|
316
338
|
setSubmitting(true);
|
|
317
339
|
setSubmittingAction("now");
|
|
318
340
|
setError(null);
|
|
319
341
|
try {
|
|
320
|
-
const task = await promoteFlow_api.startPromotion(
|
|
321
|
-
resource_id: promoteFlow_utils.getPromotionResourceId(guideline),
|
|
322
|
-
resource_type: "PACKAGE",
|
|
323
|
-
target_version: "latest",
|
|
324
|
-
global_source_env_id: sourceEnvironment.env_id,
|
|
325
|
-
global_target_env_id: destinationEnvironment.env_id,
|
|
326
|
-
...tenantSourceEnvironment && tenantDestinationEnvironment ? {
|
|
327
|
-
tenant_source_env_id: tenantSourceEnvironment.env_id,
|
|
328
|
-
tenant_target_env_id: tenantDestinationEnvironment.env_id
|
|
329
|
-
} : {}
|
|
330
|
-
});
|
|
342
|
+
const task = await promoteFlow_api.startPromotion(promotionRequest);
|
|
331
343
|
setIsStatusPollingStopped(false);
|
|
332
344
|
setPromotionTask(task, guidelineResourceId);
|
|
333
345
|
setPromotionStatusForActions(task);
|
|
@@ -349,28 +361,15 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
349
361
|
}
|
|
350
362
|
};
|
|
351
363
|
const handlePreflightCheck = async () => {
|
|
352
|
-
|
|
353
|
-
|
|
364
|
+
const promotionRequest = createPromotionRequest();
|
|
365
|
+
if (!canCheckPromotionReadiness || !promotionRequest || isCheckingPreflight) return;
|
|
354
366
|
setIsCheckingPreflight(true);
|
|
355
367
|
setPreflightResult(null);
|
|
368
|
+
setIsViewingPreflightDetails(false);
|
|
356
369
|
setError(null);
|
|
357
370
|
try {
|
|
358
|
-
const result = await promoteFlow_api.checkPromotionPreflight(
|
|
359
|
-
|
|
360
|
-
resource_type: "PACKAGE",
|
|
361
|
-
target_version: "latest",
|
|
362
|
-
global_source_env_id: sourceEnvironment.env_id,
|
|
363
|
-
global_target_env_id: destinationEnvironment.env_id,
|
|
364
|
-
...tenantSourceEnvironment && tenantDestinationEnvironment ? {
|
|
365
|
-
tenant_source_env_id: tenantSourceEnvironment.env_id,
|
|
366
|
-
tenant_target_env_id: tenantDestinationEnvironment.env_id
|
|
367
|
-
} : {}
|
|
368
|
-
});
|
|
369
|
-
setPreflightResult({
|
|
370
|
-
ready: result.ready,
|
|
371
|
-
itemsChecked: result.items_checked,
|
|
372
|
-
itemsReady: result.items_ready
|
|
373
|
-
});
|
|
371
|
+
const result = await promoteFlow_api.checkPromotionPreflight(promotionRequest);
|
|
372
|
+
setPreflightResult(result);
|
|
374
373
|
} catch (preflightError) {
|
|
375
374
|
setError(
|
|
376
375
|
preflightError instanceof Error ? preflightError.message : "Unable to complete pre-flight check.",
|
|
@@ -381,10 +380,9 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
381
380
|
}
|
|
382
381
|
};
|
|
383
382
|
const handleSaveEnvironment = async (environment, configuration) => {
|
|
384
|
-
const isTenantEnvironment = environment === "tenantSource" || environment === "tenantDestination";
|
|
385
383
|
const configurationToSave = {
|
|
386
384
|
...configuration,
|
|
387
|
-
is_tenant_db: isTenantEnvironment
|
|
385
|
+
is_tenant_db: isTenantEnvironment(environment)
|
|
388
386
|
};
|
|
389
387
|
const response = await promoteFlow_api.createEnvironmentConfig(
|
|
390
388
|
promoteFlow_utils.toCreateEnvironmentConfigRequest(configurationToSave)
|
|
@@ -392,31 +390,20 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
392
390
|
setEnvironment(environment, promoteFlow_utils.toRegistryRecord(response.env_id, configurationToSave));
|
|
393
391
|
};
|
|
394
392
|
const openEnvironmentConfiguration = (environment) => {
|
|
395
|
-
var _a2;
|
|
396
|
-
const selected = environment === "source" ? sourceEnvironment : environment === "destination" ? destinationEnvironment : environment === "tenantSource" ? tenantSourceEnvironment : tenantDestinationEnvironment;
|
|
397
393
|
setConfigSearchTier(
|
|
398
|
-
(
|
|
394
|
+
getDefaultEnvironmentTier(environment, environments[environment], permittedDestinationTiers)
|
|
399
395
|
);
|
|
400
396
|
setConfiguredEnvironment(environment);
|
|
401
397
|
};
|
|
402
398
|
const handlePromoteLater = async () => {
|
|
403
399
|
var _a2, _b2;
|
|
404
|
-
|
|
400
|
+
const promotionRequest = createPromotionRequest();
|
|
401
|
+
if (!canPromoteLater || !promotionRequest) return;
|
|
405
402
|
setSubmitting(true);
|
|
406
403
|
setSubmittingAction("later");
|
|
407
404
|
setError(null);
|
|
408
405
|
try {
|
|
409
|
-
const scheduledPromotion = await promoteFlow_api.schedulePromotion(
|
|
410
|
-
resource_id: guidelineResourceId,
|
|
411
|
-
resource_type: "PACKAGE",
|
|
412
|
-
target_version: "latest",
|
|
413
|
-
global_source_env_id: sourceEnvironment.env_id,
|
|
414
|
-
global_target_env_id: destinationEnvironment.env_id,
|
|
415
|
-
...tenantSourceEnvironment && tenantDestinationEnvironment ? {
|
|
416
|
-
tenant_source_env_id: tenantSourceEnvironment.env_id,
|
|
417
|
-
tenant_target_env_id: tenantDestinationEnvironment.env_id
|
|
418
|
-
} : {}
|
|
419
|
-
});
|
|
406
|
+
const scheduledPromotion = await promoteFlow_api.schedulePromotion(promotionRequest);
|
|
420
407
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
421
408
|
setPromotionTask(
|
|
422
409
|
{
|
|
@@ -664,7 +651,10 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
664
651
|
),
|
|
665
652
|
onClick: () => canRollback ? handleRollbackPromotion(row.promotion_task_id) : handleViewPromotionDetails(row.promotion_task_id),
|
|
666
653
|
disabled: isInitialStatusLoading || historyActionTaskId !== null,
|
|
667
|
-
children:
|
|
654
|
+
children: getHistoryActionLabel(
|
|
655
|
+
historyActionTaskId === row.promotion_task_id,
|
|
656
|
+
canRollback
|
|
657
|
+
)
|
|
668
658
|
}
|
|
669
659
|
)
|
|
670
660
|
] })
|
|
@@ -673,9 +663,11 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
673
663
|
] }) }) });
|
|
674
664
|
}
|
|
675
665
|
if (id === "database") {
|
|
676
|
-
if (isLoadingSchemaPreview)
|
|
666
|
+
if (isLoadingSchemaPreview)
|
|
667
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].emptyBody, children: "Loading database details\u2026" });
|
|
677
668
|
const groups = Object.entries(schemaPreview);
|
|
678
|
-
if (groups.length === 0)
|
|
669
|
+
if (groups.length === 0)
|
|
670
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].emptyBody, children: "No database details available." });
|
|
679
671
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].databaseGrid, children: groups.flatMap(
|
|
680
672
|
([groupName, group]) => ["Source", "Destination"].map((environment) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].databaseCard, children: [
|
|
681
673
|
/* @__PURE__ */ jsxRuntime.jsxs("h3", { children: [
|
|
@@ -698,6 +690,15 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
698
690
|
}
|
|
699
691
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].emptyBody, children: "No details available yet." });
|
|
700
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
|
+
}
|
|
701
702
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cx(PromoteFlow_module["default"].root, className), children: [
|
|
702
703
|
/* @__PURE__ */ jsxRuntime.jsxs("main", { className: PromoteFlow_module["default"].body, children: [
|
|
703
704
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].topRow, children: [
|
|
@@ -711,7 +712,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
711
712
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].ctaRow, children: [
|
|
712
713
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].preflightAction, children: [
|
|
713
714
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
714
|
-
StyledPromoteTooltip,
|
|
715
|
+
promoteConstants.StyledPromoteTooltip,
|
|
715
716
|
{
|
|
716
717
|
title: canCheckPromotionReadiness ? "Optionally check that this migration is ready before promoting." : readinessAndNowTooltip,
|
|
717
718
|
disableHoverListener: canCheckPromotionReadiness,
|
|
@@ -732,15 +733,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
732
733
|
) })
|
|
733
734
|
}
|
|
734
735
|
),
|
|
735
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
736
|
-
StyledPromoteTooltip,
|
|
737
|
-
{
|
|
738
|
-
title: "Runs a safe validation of the selected source and destination environments. It does not start a migration.",
|
|
739
|
-
placement: "top",
|
|
740
|
-
arrow: true,
|
|
741
|
-
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" }) })
|
|
742
|
-
}
|
|
743
|
-
)
|
|
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" }) }) })
|
|
744
737
|
] }),
|
|
745
738
|
isPromoting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
746
739
|
canRetryPromotion && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -770,7 +763,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
770
763
|
)
|
|
771
764
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
772
765
|
submittingAction !== "now" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
773
|
-
StyledPromoteTooltip,
|
|
766
|
+
promoteConstants.StyledPromoteTooltip,
|
|
774
767
|
{
|
|
775
768
|
title: canPromoteLater ? "" : promoteLaterTooltip,
|
|
776
769
|
disableHoverListener: canPromoteLater,
|
|
@@ -792,7 +785,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
792
785
|
}
|
|
793
786
|
),
|
|
794
787
|
submittingAction !== "later" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
795
|
-
StyledPromoteTooltip,
|
|
788
|
+
promoteConstants.StyledPromoteTooltip,
|
|
796
789
|
{
|
|
797
790
|
title: canPromoteNow ? "" : readinessAndNowTooltip,
|
|
798
791
|
disableHoverListener: canPromoteNow,
|
|
@@ -817,9 +810,19 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
817
810
|
] })
|
|
818
811
|
] }),
|
|
819
812
|
preflightResult && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].preflightSuccess, role: "status", children: [
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
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
|
+
)
|
|
823
826
|
] }),
|
|
824
827
|
isPromoting ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].promotionStatusBox, children: [
|
|
825
828
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: PromoteFlow_module["default"].promotionStatusRow, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].promotionStatusRowHeader, children: [
|
|
@@ -927,7 +930,7 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
927
930
|
errorForGuideline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: PromoteFlow_module["default"].promotionError, role: "alert", children: errorForGuideline })
|
|
928
931
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
929
932
|
errorForGuideline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: PromoteFlow_module["default"].promotionError, role: "alert", children: errorForGuideline }),
|
|
930
|
-
/* @__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) => {
|
|
931
934
|
const isOpen = Boolean(openSections[item.id]);
|
|
932
935
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: PromoteFlow_module["default"].accordion, children: [
|
|
933
936
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -963,27 +966,12 @@ function PromoteFlow({ guideline, onBack, onPromote, className }) {
|
|
|
963
966
|
EnvironmentConfigurationModal.EnvironmentConfigurationModal,
|
|
964
967
|
{
|
|
965
968
|
environment: configuredEnvironment,
|
|
966
|
-
initialConfiguration:
|
|
967
|
-
|
|
968
|
-
env_tier: selectedEnvironment.env_tier,
|
|
969
|
-
db_type: selectedEnvironment.db_type,
|
|
970
|
-
host: selectedEnvironment.host,
|
|
971
|
-
port: String(selectedEnvironment.port),
|
|
972
|
-
username: selectedEnvironment.username,
|
|
973
|
-
password: "",
|
|
974
|
-
database_name: selectedEnvironment.database_name,
|
|
975
|
-
is_tenant_db: selectedEnvironment.is_tenant_db
|
|
976
|
-
} : {
|
|
977
|
-
...promoteFlow_utils.EMPTY_ENVIRONMENT_CONFIGURATION,
|
|
978
|
-
env_tier: configuredEnvironment === "source" || configuredEnvironment === "tenantSource" ? "dev" : permittedDestinationTiers[0],
|
|
979
|
-
db_type: (configuredEnvironment === "destination" || configuredEnvironment === "tenantDestination") && permittedDestinationTiers[0] === "external" ? "EXTERNAL" : "INTERNAL",
|
|
980
|
-
is_tenant_db: configuredEnvironment === "tenantSource" || configuredEnvironment === "tenantDestination"
|
|
981
|
-
},
|
|
982
|
-
permittedTiers: configuredEnvironment === "source" || configuredEnvironment === "tenantSource" ? permittedSourceTiers : permittedDestinationTiers,
|
|
969
|
+
initialConfiguration: modalInitialConfiguration,
|
|
970
|
+
permittedTiers: modalPermittedTiers,
|
|
983
971
|
onSave: handleSaveEnvironment,
|
|
984
972
|
onSelectPreset: setEnvironment,
|
|
985
973
|
onPresetTierChange: setConfigSearchTier,
|
|
986
|
-
presetTier:
|
|
974
|
+
presetTier: modalPresetTier,
|
|
987
975
|
onClose: () => {
|
|
988
976
|
setConfiguredEnvironment(null);
|
|
989
977
|
setConfigSearchTier(null);
|