mirror of
https://github.com/actions/runner.git
synced 2026-01-23 21:11:34 +08:00
loa steps
This commit is contained in:
@@ -14,6 +14,9 @@ let replHistoryIndex = -1;
|
|||||||
let currentLayout = 'bottom'; // 'bottom' | 'sidebar'
|
let currentLayout = 'bottom'; // 'bottom' | 'sidebar'
|
||||||
let currentStepElement = null; // Track current step for breakpoint indicator
|
let currentStepElement = null; // Track current step for breakpoint indicator
|
||||||
let stepsList = []; // Cached steps from DAP
|
let stepsList = []; // Cached steps from DAP
|
||||||
|
let cachedExportYaml = null; // Cached YAML for export after disconnect
|
||||||
|
let cachedExportStats = null; // Cached stats for export modal
|
||||||
|
let stepsWereLoaded = false; // Track if we ever successfully loaded steps
|
||||||
let activeContextMenu = null; // Track open context menu
|
let activeContextMenu = null; // Track open context menu
|
||||||
let activeModal = null; // Track open modal
|
let activeModal = null; // Track open modal
|
||||||
|
|
||||||
@@ -527,8 +530,13 @@ async function loadSteps() {
|
|||||||
try {
|
try {
|
||||||
const result = JSON.parse(response.result);
|
const result = JSON.parse(response.result);
|
||||||
if (result.Success && result.Result) {
|
if (result.Success && result.Result) {
|
||||||
renderStepList(result.Result);
|
// Result contains { steps, totalCount, completedCount, pendingCount }
|
||||||
|
renderStepList(result.Result.steps);
|
||||||
enableStepControls(true);
|
enableStepControls(true);
|
||||||
|
stepsWereLoaded = true;
|
||||||
|
|
||||||
|
// Auto-cache export YAML for later use (after disconnect)
|
||||||
|
await cacheExportYaml();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (parseErr) {
|
} catch (parseErr) {
|
||||||
@@ -547,6 +555,23 @@ async function loadSteps() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache export YAML for use after DAP disconnect
|
||||||
|
*/
|
||||||
|
async function cacheExportYaml() {
|
||||||
|
try {
|
||||||
|
const result = await sendStepCommand('step.export', { changesOnly: false, withComments: true });
|
||||||
|
if (result.Success) {
|
||||||
|
cachedExportYaml = result.Message || result.Result?.yaml || '';
|
||||||
|
cachedExportStats = result.Result || {};
|
||||||
|
console.log('[Content] Cached export YAML');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log('[Content] Failed to cache export YAML:', error);
|
||||||
|
// Silent failure - user can still try Export button manually
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable step manipulation controls
|
* Enable/disable step manipulation controls
|
||||||
*/
|
*/
|
||||||
@@ -556,8 +581,13 @@ function enableStepControls(enabled) {
|
|||||||
const addBtn = debuggerPane.querySelector('.dap-add-step-btn');
|
const addBtn = debuggerPane.querySelector('.dap-add-step-btn');
|
||||||
const exportBtn = debuggerPane.querySelector('.dap-export-btn');
|
const exportBtn = debuggerPane.querySelector('.dap-export-btn');
|
||||||
|
|
||||||
|
// Add button requires active connection
|
||||||
if (addBtn) addBtn.disabled = !enabled;
|
if (addBtn) addBtn.disabled = !enabled;
|
||||||
if (exportBtn) exportBtn.disabled = !enabled;
|
|
||||||
|
// Export button stays enabled if we have cached YAML (for use after disconnect)
|
||||||
|
if (exportBtn) {
|
||||||
|
exportBtn.disabled = !enabled && !cachedExportYaml;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1138,16 +1168,32 @@ async function handleEditStep(modal, stepIndex, isRun) {
|
|||||||
* Show Export modal
|
* Show Export modal
|
||||||
*/
|
*/
|
||||||
async function showExportModal() {
|
async function showExportModal() {
|
||||||
const result = await sendStepCommand('step.export', { changesOnly: false, withComments: true });
|
let yaml, stats;
|
||||||
|
|
||||||
if (!result.Success) {
|
if (isConnected) {
|
||||||
appendOutput(`Failed to export: ${result.Message || result.Error}`, 'error');
|
// Connected: fetch fresh export
|
||||||
|
const result = await sendStepCommand('step.export', { changesOnly: false, withComments: true });
|
||||||
|
|
||||||
|
if (!result.Success) {
|
||||||
|
appendOutput(`Failed to export: ${result.Message || result.Error}`, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
yaml = result.Message || result.Result?.yaml || '';
|
||||||
|
stats = result.Result || {};
|
||||||
|
|
||||||
|
// Update cache with fresh data
|
||||||
|
cachedExportYaml = yaml;
|
||||||
|
cachedExportStats = stats;
|
||||||
|
} else if (cachedExportYaml) {
|
||||||
|
// Disconnected: use cached data
|
||||||
|
yaml = cachedExportYaml;
|
||||||
|
stats = cachedExportStats || {};
|
||||||
|
} else {
|
||||||
|
appendOutput('No export data available', 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const yaml = result.Message || result.Result?.yaml || '';
|
|
||||||
const stats = result.Result || {};
|
|
||||||
|
|
||||||
const content = `
|
const content = `
|
||||||
<div class="dap-export-stats mb-2 color-fg-muted">
|
<div class="dap-export-stats mb-2 color-fg-muted">
|
||||||
Total steps: ${stats.totalSteps || 0} |
|
Total steps: ${stats.totalSteps || 0} |
|
||||||
|
|||||||
Reference in New Issue
Block a user