Skip to content

Commit 24d8194

Browse files
committed
Fix(screenshots): Update screenshot tool and docs. Remove Node View, adjust targets, implement postAction, renumber files, and update README.
1 parent f6a54a1 commit 24d8194

File tree

7 files changed

+32
-27
lines changed

7 files changed

+32
-27
lines changed

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ A lightweight monitoring application for Proxmox VE that displays real-time stat
1313
<details>
1414
<summary><strong>Click to view other UI tabs</strong></summary>
1515

16-
**Nodes Tab:**
17-
![Nodes View](docs/images/02-node-view.png)
18-
1916
**Main Tab (Filtered for VMs):**
20-
![VM Filtered View](docs/images/03-vm-container-view.png)
17+
![VM Filtered View](docs/images/02-vm-container-view.png)
2118

2219
**PBS Tab:**
23-
![PBS View](docs/images/04-pbs-view.png)
20+
![PBS View](docs/images/03-pbs-view.png)
2421

2522
**Backups Tab:**
26-
![Backups View](docs/images/05-backups-view.png)
23+
![Backups View](docs/images/04-backups-view.png)
2724

2825
**Threshold Logging:**
29-
![Threshold Logging View](docs/images/06-thresholds-logging.png)
26+
![Threshold Logging View](docs/images/05-thresholds-logging.png)
3027

3128
</details>
3229

docs/images/01-dashboard.png

44.9 KB
Loading

docs/images/02-vm-container-view.png

95.4 KB
Loading

docs/images/03-pbs-view.png

388 KB
Loading

docs/images/04-backups-view.png

400 KB
Loading

docs/images/05-thresholds-logging.png

40.8 KB
Loading

scripts/take-screenshots.js

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,9 @@ const sections = [
2323
}
2424
},
2525

26-
// Node View: Click tab, wait for table rows, capture nodes tab content
27-
{ name: '02-node-view',
28-
screenshotTarget: '#nodes',
29-
action: async (page) => {
30-
console.log(' Action: Clicking Nodes tab');
31-
await page.locator('[data-tab="nodes"]').click();
32-
console.log(' Action: Waiting for nodes table to be visible');
33-
await page.locator('#nodes #nodes-table').waitFor({ state: 'visible', timeout: 10000 });
34-
console.log(' Action: Nodes table visible');
35-
// Optional: wait for rows as well, though table visibility might be enough
36-
// await page.locator('#nodes-table-body tr').first().waitFor({ state: 'visible', timeout: 10000 });
37-
}
38-
},
39-
4026
// VM View: Click main tab, click VM filter, wait, capture main content
41-
{ name: '03-vm-container-view', // Renaming slightly as it shows filtered list
42-
screenshotTarget: '#main',
27+
{ name: '02-vm-container-view', // Renumbered from 03
28+
screenshotTarget: '#nested-tab-dashboard', // Changed from #main
4329
action: async (page) => {
4430
console.log(' Action: Clicking Main tab (if not already active)');
4531
// Ensure main tab is active first
@@ -59,11 +45,20 @@ const sections = [
5945
await vmFilterLabel.click(); // Click the label
6046
await page.waitForTimeout(1000);
6147
console.log(' Action: VM filter applied');
48+
49+
// Hide node summary cards
50+
console.log(' Action: Hiding node summary cards');
51+
await page.locator('#node-summary-cards-container').evaluate(element => element.style.display = 'none');
52+
},
53+
// Add a postAction to make the cards visible again
54+
postAction: async (page) => {
55+
console.log(' Action: Showing node summary cards');
56+
await page.locator('#node-summary-cards-container').evaluate(element => element.style.display = ''); // Reset display
6257
}
6358
},
6459

6560
// PBS View: Click tab, wait for PBS container content, capture PBS tab content
66-
{ name: '04-pbs-view',
61+
{ name: '03-pbs-view', // Renumbered from 04
6762
screenshotTarget: '#pbs',
6863
action: async (page) => {
6964
console.log(' Action: Clicking PBS tab');
@@ -78,7 +73,7 @@ const sections = [
7873
},
7974

8075
// Backups View: Click tab, wait for table content, capture backups tab content
81-
{ name: '05-backups-view', // Added new section
76+
{ name: '04-backups-view', // Renumbered from 05
8277
screenshotTarget: '#backups',
8378
action: async (page) => {
8479
console.log(' Action: Clicking Backups tab');
@@ -91,8 +86,8 @@ const sections = [
9186
},
9287

9388
// Threshold & Logging View: Toggle thresholds, set one, start log, capture main area
94-
{ name: '06-thresholds-logging', // New section
95-
screenshotTarget: '#main', // Capture the main dashboard/log area
89+
{ name: '05-thresholds-logging', // Renumbered from 06
90+
screenshotTarget: '#log-session-area', // Changed to capture the log entries area
9691
action: async (page) => {
9792
console.log(' Action: Ensuring Main tab is active');
9893
const mainTabIsActive = await page.locator('[data-tab="main"].active').isVisible();
@@ -121,12 +116,16 @@ const sections = [
121116
console.log(' Action: Clicking Start Log button');
122117
await page.locator('#start-log-button').click();
123118
console.log(' Action: Waiting for Log tab and content to appear');
119+
// Ensure the log session area itself is made visible by the button click.
120+
await page.locator('#log-session-area:not(.hidden)').waitFor({ state: 'visible', timeout: 10000 });
124121
await page.locator('.nested-tab[data-nested-tab^="log-session-"]').waitFor({ state: 'visible', timeout: 10000 });
125122
await page.locator('.log-session-panel').waitFor({ state: 'visible', timeout: 10000 });
126123
console.log(' Action: Log session started and visible');
127124
console.log(' Action: Waiting 8 seconds for potential log entries...');
128125
await page.waitForTimeout(8000); // Increase pause to 8 seconds
126+
// Node summary cards are not part of the log view, so no need to hide/show them here.
129127
}
128+
// No postAction needed here as we are not modifying shared elements like node-summary-cards for this specific screenshot
130129
},
131130

132131
// { name: '06-task-view', url: '/#tasks', screenshotTarget: '#task-list-element', action: async (page) => { /* Navigate to task view if separate */ } }, // Uncomment and adjust if needed
@@ -250,6 +249,15 @@ async function takeScreenshots() {
250249

251250
console.log(` Successfully captured ${section.name}`);
252251

252+
// Perform post-action if defined (e.g., to restore UI state)
253+
if (section.postAction) {
254+
console.log(` Performing post-action for ${section.name}...`);
255+
await section.postAction(page);
256+
// Optionally wait for UI to settle after post-action
257+
await page.waitForLoadState('networkidle', { timeout: 5000 });
258+
console.log(' Post-action completed and network idle.');
259+
}
260+
253261
} catch (error) {
254262
console.error(` Failed to capture section ${section.name}: ${error.message}`);
255263
// Optionally, decide if you want to continue or stop on error

0 commit comments

Comments
 (0)