Fix contact add link to use Contacts_Edit_Action SPA route
Add multi-route support for controllers and SPA actions Add screenshot feature to rsx:debug and convert contacts edit to SPA 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,16 @@ function parse_args() {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Device viewport presets
|
||||
const device_presets = {
|
||||
'mobile': 412, // Pixel 7
|
||||
'iphone-mobile': 390, // iPhone 12/13/14
|
||||
'tablet': 768, // iPad Mini
|
||||
'desktop-small': 1366, // Common laptop
|
||||
'desktop-medium': 1920, // Full HD
|
||||
'desktop-large': 2560 // 2K/WQHD
|
||||
};
|
||||
|
||||
const options = {
|
||||
route: null,
|
||||
user_id: null,
|
||||
@@ -83,7 +93,9 @@ function parse_args() {
|
||||
console_debug_filter: null,
|
||||
console_debug_benchmark: false,
|
||||
console_debug_all: false,
|
||||
console_debug_disable: false
|
||||
console_debug_disable: false,
|
||||
screenshot_width: null,
|
||||
screenshot_path: null
|
||||
};
|
||||
|
||||
for (const arg of args) {
|
||||
@@ -146,6 +158,16 @@ function parse_args() {
|
||||
options.console_debug_all = true;
|
||||
} else if (arg === '--console-debug-disable') {
|
||||
options.console_debug_disable = true;
|
||||
} else if (arg.startsWith('--screenshot-width=')) {
|
||||
const width_value = arg.substring(19);
|
||||
// Check if it's a preset name or numeric value
|
||||
if (device_presets[width_value]) {
|
||||
options.screenshot_width = device_presets[width_value];
|
||||
} else {
|
||||
options.screenshot_width = parseInt(width_value);
|
||||
}
|
||||
} else if (arg.startsWith('--screenshot-path=')) {
|
||||
options.screenshot_path = arg.substring(18);
|
||||
} else if (!arg.startsWith('--')) {
|
||||
options.route = arg;
|
||||
}
|
||||
@@ -188,10 +210,23 @@ function parse_args() {
|
||||
headless: true,
|
||||
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||
});
|
||||
|
||||
const context = await browser.newContext({
|
||||
|
||||
// Set viewport for screenshot if requested
|
||||
const contextOptions = {
|
||||
ignoreHTTPSErrors: true
|
||||
});
|
||||
};
|
||||
|
||||
if (options.screenshot_path) {
|
||||
// Default to 1920 if width not specified
|
||||
const screenshot_width = options.screenshot_width || 1920;
|
||||
contextOptions.viewport = {
|
||||
width: screenshot_width,
|
||||
height: 1080 // Will expand to full page height on screenshot
|
||||
};
|
||||
options.screenshot_width = screenshot_width; // Store for later use
|
||||
}
|
||||
|
||||
const context = await browser.newContext(contextOptions);
|
||||
|
||||
const page = await context.newPage();
|
||||
|
||||
@@ -1075,7 +1110,26 @@ function parse_args() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Take screenshot if requested
|
||||
if (options.screenshot_path) {
|
||||
try {
|
||||
await page.screenshot({
|
||||
path: options.screenshot_path,
|
||||
fullPage: true,
|
||||
clip: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: options.screenshot_width,
|
||||
height: Math.min(5000, await page.evaluate(() => document.documentElement.scrollHeight))
|
||||
}
|
||||
});
|
||||
console.log(`Screenshot saved to: ${options.screenshot_path} (width: ${options.screenshot_width}px)`);
|
||||
} catch (e) {
|
||||
console.error(`Failed to save screenshot: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
|
||||
// Exit with appropriate code
|
||||
|
||||
Reference in New Issue
Block a user