Skip to content

Commit 8f256c6

Browse files
LEGLINK-937: Quick Launch – Open Selected Scenario in Edit Mode When Clicking Manage (#1831)
* Update Quick Launch Manage navigation to pass the currently selected scenario to the Scenarios page and automatically open it using the existing scenario editor. Added one-time scenario ID handling on the Scenarios page while preserving existing behavior when no scenario is selected. * Added a space to hopefully rename this branch --------- Co-authored-by: nmLantana <nick.montalto@lantanagroup.com>
1 parent 981fc88 commit 8f256c6

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

DotNet/Automation.UI/Views/Runs/Index.cshtml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@
265265
</button>
266266
</div>
267267
<div class="col-md-2">
268-
<a asp-controller="Scenarios" asp-action="Index" class="btn btn-outline-secondary w-100">
268+
<a asp-controller="Scenarios"
269+
asp-action="Index"
270+
class="btn btn-outline-secondary w-100"
271+
id="btnManageScenario">
269272
<i class="bi bi-journal-text me-1"></i> Manage
270273
</a>
271274
</div>
@@ -302,6 +305,7 @@
302305
var recentRunsPartialUrl = '@Url.Action("RecentRunsPartial", "Runs")';
303306
var cancelUrl = '@Url.Action("CancelJson", "Runs")';
304307
var deleteUrl = '@Url.Action("DeleteJson", "Runs")';
308+
var scenariosUrl = '@Url.Action("Index", "Scenarios")';
305309
306310
// --- KPI elements ---
307311
var kpiActive = document.getElementById('kpiActive');
@@ -612,6 +616,7 @@
612616
var noResults = document.getElementById('quickLaunchNoResults');
613617
var quickTypeFilter = document.getElementById('quickLaunchTypeFilter');
614618
var quickSort = document.getElementById('quickLaunchSort');
619+
var manageLink = document.getElementById('btnManageScenario');
615620
616621
function getQuickLaunchOptions() {
617622
return Array.from(
@@ -689,6 +694,12 @@
689694
dropdownButton.textContent =
690695
label || '-- Select a scenario --';
691696
}
697+
698+
if (manageLink) {
699+
manageLink.href = id
700+
? scenariosUrl + '?editScenarioId=' + encodeURIComponent(id)
701+
: scenariosUrl;
702+
}
692703
}
693704
694705
if (quickSearch) {
@@ -1019,6 +1030,7 @@
10191030
refreshRecentRunsCard({ pageSize: sel.value, pageNumber: '1' });
10201031
});
10211032
})();
1033+
10221034
</script>
10231035

10241036
@await Html.PartialAsync("_ScenarioEditorModal")

DotNet/Automation.UI/Views/Scenarios/Index.cshtml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,18 @@
247247
}
248248
249249
applyScenarioView();
250+
251+
// Open a scenario passed from Quick Launch directly in the editor.
252+
var editScenarioId = new URLSearchParams(window.location.search).get('editScenarioId');
253+
254+
if (editScenarioId && typeof window.openScenarioEditor === 'function') {
255+
window.openScenarioEditor(editScenarioId, 'edit');
256+
257+
// Remove the one-time navigation parameter so saving/reloading the
258+
// Scenarios page does not automatically reopen the editor.
259+
var url = new URL(window.location.href);
260+
url.searchParams.delete('editScenarioId');
261+
window.history.replaceState(null, '', url.toString());
262+
}
250263
})();
251264
</script>

0 commit comments

Comments
 (0)