Skip to content

Commit 01ab3a3

Browse files
committed
fix: resolve issue with Reload button not displaying results and update version to 1.5.1
1 parent 37989e8 commit 01ab3a3

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
66

77
## [Unreleased]
88

9+
## [1.5.1] - 2024-12-05
10+
11+
### Fixed
12+
13+
- Fixed an issue that caused the Reload button to not display any results
14+
915
## [1.5.0] - 2024-12-04
1016

1117
### Changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento-log-viewer",
33
"displayName": "Magento Log Viewer",
44
"description": "A Visual Studio Code extension to view and manage Magento log files.",
5-
"version": "1.5.0",
5+
"version": "1.5.1",
66
"publisher": "MathiasElle",
77
"icon": "resources/logo.png",
88
"repository": {
@@ -95,7 +95,7 @@
9595
},
9696
{
9797
"command": "magento-log-viewer.refreshLogFiles",
98-
"when": "view == logFiles",
98+
"when": "view == logFiles && magentoLogViewer.hasMagentoRoot",
9999
"group": "navigation"
100100
}
101101
]

src/logViewer.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,18 @@ export class LogViewerProvider implements vscode.TreeDataProvider<LogFile>, vsco
1515
this.statusBarItem.show();
1616
this.groupByMessage = vscode.workspace.getConfiguration('magentoLogViewer').get<boolean>('groupByMessage', true);
1717
this.updateBadge();
18+
this.updateRefreshButtonVisibility();
19+
}
20+
21+
private updateRefreshButtonVisibility(): void {
22+
vscode.commands.executeCommand('setContext', 'magentoLogViewer.hasMagentoRoot', !!this.workspaceRoot);
1823
}
1924

2025
refresh(): void {
26+
if (!this.workspaceRoot) {
27+
vscode.window.showErrorMessage('No workspace root found. Please open a Magento project.');
28+
return;
29+
}
2130
this._onDidChangeTreeData.fire();
2231
this.updateBadge();
2332
}
@@ -70,6 +79,10 @@ export class LogViewerProvider implements vscode.TreeDataProvider<LogFile>, vsco
7079
console.error('Invalid file path detected');
7180
return null;
7281
}
82+
if (!fs.lstatSync(filePath).isFile()) {
83+
console.error('Path is not a file:', filePath);
84+
return null;
85+
}
7386
const lineCount = getLineCount(filePath);
7487
const logFile = new LogFile(`${file} (${lineCount})`, vscode.TreeItemCollapsibleState.Collapsed, {
7588
command: 'magento-log-viewer.openFile',

0 commit comments

Comments
 (0)