feat: complete Epic 1 production foundation
This commit is contained in:
+13
-6
@@ -35,6 +35,9 @@ var selectedUpstreamId = window.selectedUpstreamId;
|
||||
var editingUpstreamId = window.editingUpstreamId;
|
||||
|
||||
async function initWizardPage() {
|
||||
var initialParams = new URLSearchParams(window.location.search);
|
||||
var returnContext = initialParams.get('return') || '';
|
||||
if (!/^\/[A-Za-z0-9/_?&=.%~-]{0,512}$/.test(returnContext)) returnContext = '';
|
||||
renderSidebarBrand('create');
|
||||
document.querySelector('.btn-continue').addEventListener('click', function() {
|
||||
currentStep = window.currentStep || 1;
|
||||
@@ -57,14 +60,14 @@ async function initWizardPage() {
|
||||
var backToCatalog = document.getElementById('back-to-catalog');
|
||||
if (backToCatalog) {
|
||||
backToCatalog.addEventListener('click', function() {
|
||||
window.location.href = (window.CrankRoutes && window.CrankRoutes.home) || '/';
|
||||
window.location.href = returnContext || ((window.CrankRoutes && window.CrankRoutes.home) || '/');
|
||||
});
|
||||
}
|
||||
|
||||
var closeBtn = document.querySelector('.progress-close');
|
||||
if (closeBtn) {
|
||||
closeBtn.addEventListener('click', function() {
|
||||
window.location.href = (window.CrankRoutes && window.CrankRoutes.home) || '/';
|
||||
window.location.href = returnContext || ((window.CrankRoutes && window.CrankRoutes.home) || '/');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -132,10 +135,11 @@ async function initWizardPage() {
|
||||
});
|
||||
}
|
||||
|
||||
var params = new URLSearchParams(window.location.search);
|
||||
if (params.get('mode') === 'edit' && params.get('operationId')) {
|
||||
var params = initialParams;
|
||||
var requestedOperationId = params.get('operationId') || '';
|
||||
if (params.get('mode') === 'edit' && /^[A-Za-z0-9_-]{1,128}$/.test(requestedOperationId)) {
|
||||
wizardMode = 'edit';
|
||||
wizardEditId = params.get('operationId');
|
||||
wizardEditId = requestedOperationId;
|
||||
window.wizardMode = wizardMode;
|
||||
window.wizardEditId = wizardEditId;
|
||||
document.title = 'Crank — ' + tKey('wizard.progress.edit');
|
||||
@@ -144,7 +148,10 @@ async function initWizardPage() {
|
||||
}
|
||||
|
||||
updateWizardProtocolVisibility();
|
||||
_doGoToStep(1);
|
||||
var requestedStep = Number(params.get('step') || 1);
|
||||
_doGoToStep(Number.isInteger(requestedStep) && requestedStep >= 1 && requestedStep <= TOTAL_STEPS ? requestedStep : 1);
|
||||
window.CrankWizardReady = true;
|
||||
document.dispatchEvent(new CustomEvent('crank:wizard-ready'));
|
||||
}
|
||||
|
||||
function renderEditionCapabilityHints(capabilities) {
|
||||
|
||||
Reference in New Issue
Block a user