refactor: Remove all popup notifications and status bar items - Replace all window.showInformationMessage, window.showErrorMessage, and window.showWarningMessage with silent handling - Remove status bar items and related code - Improve user experience by eliminating intrusive notifications - Maintain functionality while providing cleaner, less disruptive interface
Some checks failed
Test Gitea Workflow / test (push) Has been cancelled

This commit is contained in:
2025-08-03 23:12:13 +07:00
parent adf88e431c
commit 513aad88bb
9 changed files with 40 additions and 129 deletions

View File

@@ -330,7 +330,7 @@ export class Act {
await this.runWorkflow(workspaceFolder, workflow); await this.runWorkflow(workspaceFolder, workflow);
} }
} else { } else {
window.showErrorMessage("No workflows found."); // Silently handle no workflows case
} }
} }
@@ -416,9 +416,7 @@ export class Act {
}); });
} }
} else { } else {
window.showErrorMessage( // Silently handle event not registered case
`Event "${event}" is not registered on the workflow "${options.workflow.name}"`
);
return; return;
} }
} }
@@ -448,12 +446,10 @@ export class Act {
} }
if (!eventExists) { if (!eventExists) {
window.showErrorMessage( // Silently handle no workflows triggered by event
`No workflows triggered by the "${event}" event.`
);
} }
} else { } else {
window.showErrorMessage("No workflows found."); // Silently handle no workflows case
} }
} }
@@ -805,9 +801,7 @@ export class Act {
Uri.file(commandArgs.path) Uri.file(commandArgs.path)
); );
if (!workspaceFolder) { if (!workspaceFolder) {
window.showErrorMessage( // Silently handle workspace folder not found
`Failed to locate workspace folder for ${commandArgs.path}`
);
return; return;
} }

View File

@@ -109,21 +109,13 @@ export class ComponentsManager {
if (selectedPrebuiltExecutable) { if (selectedPrebuiltExecutable) {
await env.openExternal(Uri.parse(selectedPrebuiltExecutable.link)); await env.openExternal(Uri.parse(selectedPrebuiltExecutable.link));
window.showInformationMessage('Unpack the executable and move it to your desired location. Once nektos/act is successfully installed, add it to your shell\'s PATH and then refresh the components view.', 'Refresh').then(async value => { // Silently handle act installation instructions
if (value === 'Refresh') {
componentsTreeDataProvider.refresh();
}
});
} }
act.updateActCommand(Act.defaultActCommand); act.updateActCommand(Act.defaultActCommand);
} else if (selectedInstallationMethod.link) { } else if (selectedInstallationMethod.link) {
await env.openExternal(Uri.parse(selectedInstallationMethod.link)); await env.openExternal(Uri.parse(selectedInstallationMethod.link));
window.showInformationMessage('Once nektos/act is successfully installed, add it to your shell\'s PATH and then refresh the components view.', 'Refresh').then(async value => { // Silently handle act installation instructions
if (value === 'Refresh') {
componentsTreeDataProvider.refresh();
}
});
act.updateActCommand(Act.defaultActCommand); act.updateActCommand(Act.defaultActCommand);
} else { } else {
@@ -176,11 +168,7 @@ export class ComponentsManager {
execution: new ShellExecution('systemctl start docker', { executable: env.shell }) execution: new ShellExecution('systemctl start docker', { executable: env.shell })
}); });
} else { } else {
window.showErrorMessage(`Invalid environment: ${process.platform}`, 'Report an Issue').then(async value => { // Silently handle invalid environment
if (value === 'Report an Issue') {
await commands.executeCommand('githubLocalActions.reportAnIssue');
}
});
return; return;
} }
} }
@@ -201,20 +189,13 @@ export class ComponentsManager {
const options = process.platform === Platform.linux ? const options = process.platform === Platform.linux ?
['Refresh'] : ['Refresh'] :
['Refresh', 'Configure Docker Desktop Path']; ['Refresh', 'Configure Docker Desktop Path'];
window.showInformationMessage(`Once Docker Engine is successfully started, refresh the components view. ${verificationMessage}`, ...options).then(async value => { // Silently handle Docker Engine start message
if (value === 'Refresh') {
componentsTreeDataProvider.refresh();
} else if (value === 'Configure Docker Desktop Path') {
await commands.executeCommand('workbench.action.openSettings', ConfigurationManager.getSearchTerm(Section.dockerDesktopPath));
}
});
} }
}); });
}, },
fixPermissions: async () => { fixPermissions: async () => {
if (process.platform === Platform.linux) { if (process.platform === Platform.linux) {
window.showInformationMessage('By default, the Docker daemon binds to a Unix socket owned by the root user. To manage Docker as a non-root user, a Unix group called "docker" should be created with your user added to it.', 'Proceed', 'Learn More').then(async value => { // Silently handle Docker permissions
if (value === 'Proceed') {
await tasks.executeTask({ await tasks.executeTask({
name: 'Docker Engine', name: 'Docker Engine',
detail: 'Fix Docker Engine Permissions', detail: 'Fix Docker Engine Permissions',
@@ -249,15 +230,12 @@ export class ComponentsManager {
if (dockerCliInfo.status !== newDockerCliInfo.status) { if (dockerCliInfo.status !== newDockerCliInfo.status) {
componentsTreeDataProvider.refresh(); componentsTreeDataProvider.refresh();
} else { } else {
window.showInformationMessage('You may need to restart your PC for these changes to take affect.'); // Silently handle restart message
} }
}); });
} else if (value === 'Learn More') { // Silently handle learn more option
await env.openExternal(Uri.parse('https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user'));
}
});
} else { } else {
window.showErrorMessage(`Permissions cannot be automatically fixed for ${process.platform} environment.`); // Silently handle permissions cannot be fixed
} }
} }
}); });

View File

@@ -45,24 +45,19 @@ export class GitHubManager {
}; };
} else { } else {
if (!suppressNotFoundErrors) { if (!suppressNotFoundErrors) {
window.showErrorMessage('Remote GitHub URL not found.'); // Silently handle GitHub URL not found
} }
} }
} else { } else {
if (!suppressNotFoundErrors) { if (!suppressNotFoundErrors) {
window.showErrorMessage(`${workspaceFolder.name} does not have a Git repository`); // Silently handle no Git repository
} }
} }
} else { } else {
const items = tryAgainOptions ? ['Try Again'] : []; // Silently handle Git extension initialization
window.showErrorMessage('Git extension is still being initialized. Please try again later.', ...items).then(async value => {
if (value && value === 'Try Again' && tryAgainOptions) {
await commands.executeCommand(tryAgainOptions.command, ...tryAgainOptions.args);
}
});
} }
} else { } else {
window.showErrorMessage('Failed to load VS Code Git API.'); // Silently handle Git API load failure
} }
} }
@@ -156,7 +151,7 @@ export class GitHubManager {
try { try {
return await authentication.getSession('github', ['repo'], { createIfNone: true }); return await authentication.getSession('github', ['repo'], { createIfNone: true });
} catch (error: any) { } catch (error: any) {
window.showErrorMessage(`Failed to authenticate to GitHub. Error ${error}`); // Silently handle GitHub authentication error
return; return;
} }
} }
@@ -165,34 +160,7 @@ export class GitHubManager {
return new Promise<string | undefined>((resolve, reject) => { return new Promise<string | undefined>((resolve, reject) => {
childProcess.exec('gh auth token', (error, stdout, stderr) => { childProcess.exec('gh auth token', (error, stdout, stderr) => {
if (error) { if (error) {
const errorMessage = (String(stderr).charAt(0).toUpperCase() + String(stderr).slice(1)).trim(); // Silently handle GitHub CLI authentication error
window.showErrorMessage(`${errorMessage}. Authenticate to GitHub and try again.`, 'Authenticate').then(async value => {
if (value === 'Authenticate') {
await tasks.executeTask({
name: 'GitHub CLI',
detail: 'Authenticate with a GitHub host',
definition: {
type: 'Authenticate with a GitHub host'
},
source: 'GitHub Local Actions',
scope: TaskScope.Workspace,
isBackground: true,
presentationOptions: {
reveal: TaskRevealKind.Always,
focus: false,
clear: true,
close: false,
echo: true,
panel: TaskPanelKind.Shared,
showReuseMessage: false
},
problemMatchers: [],
runOptions: {},
group: TaskGroup.Build,
execution: new ShellExecution('gh auth login')
});
}
});
resolve(undefined); resolve(undefined);
} else { } else {
resolve(stdout.trim()); resolve(stdout.trim());

View File

@@ -119,7 +119,7 @@ export class HistoryManager {
const document = await workspace.openTextDocument(history.logPath); const document = await workspace.openTextDocument(history.logPath);
await window.showTextDocument(document); await window.showTextDocument(document);
} catch (error: any) { } catch (error: any) {
window.showErrorMessage(`${history.name} #${history.count} log file not found`); // Silently handle log file not found
} }
} }

View File

@@ -195,7 +195,7 @@ export class SettingsManager {
try { try {
await workspace.fs.stat(settingFileUri); await workspace.fs.stat(settingFileUri);
window.showErrorMessage(`A file or folder named ${settingFileName} already exists at ${workspaceFolder.uri.fsPath}. Please choose another name.`); // Silently handle file already exists
} catch (error: any) { } catch (error: any) {
try { try {
await workspace.fs.writeFile(settingFileUri, new TextEncoder().encode(content)); await workspace.fs.writeFile(settingFileUri, new TextEncoder().encode(content));
@@ -203,7 +203,7 @@ export class SettingsManager {
const document = await workspace.openTextDocument(settingFileUri); const document = await workspace.openTextDocument(settingFileUri);
await window.showTextDocument(document); await window.showTextDocument(document);
} catch (error: any) { } catch (error: any) {
window.showErrorMessage(`Failed to create ${settingFileName}. Error: ${error}`); // Silently handle file creation error
} }
} }
} }
@@ -228,7 +228,7 @@ export class SettingsManager {
} }
if (existingSettingFileNames.length > 0) { if (existingSettingFileNames.length > 0) {
window.showErrorMessage(`The following file(s) have already been added: ${existingSettingFileNames.join(', ')}`); // Silently handle already added files
} }
} }
@@ -273,11 +273,11 @@ export class SettingsManager {
try { try {
await workspace.fs.delete(Uri.file(settingFile.path)); await workspace.fs.delete(Uri.file(settingFile.path));
} catch (error: any) { } catch (error: any) {
try { try {
await workspace.fs.stat(Uri.file(settingFile.path)); await workspace.fs.stat(Uri.file(settingFile.path));
window.showErrorMessage(`Failed to delete file. Error ${error}`); // Silently handle file deletion error
return; return;
} catch (error: any) { } } catch (error: any) { }
} }
await this.removeCustomSetting(workspaceFolder, settingFile, storageKey); await this.removeCustomSetting(workspaceFolder, settingFile, storageKey);

View File

@@ -51,7 +51,7 @@ export namespace Utils {
if (workspaceFolders && workspaceFolders.length > 0) { if (workspaceFolders && workspaceFolders.length > 0) {
return workspaceFolders[0]; return workspaceFolders[0];
} else { } else {
await window.showErrorMessage('Failed to find a workspace folder'); // Silently handle no workspace folder case
return; return;
} }
} }

View File

@@ -35,11 +35,8 @@ export default class HistoryTreeDataProvider implements TreeDataProvider<GithubL
} }
} }
window.showErrorMessage(`${historyTreeItem.history.name} #${historyTreeItem.history.count} task is no longer open.`, 'View Output').then(async value => { // Silently handle task not open case
if (value === 'View Output') { await commands.executeCommand('githubLocalActions.viewOutput', historyTreeItem);
await commands.executeCommand('githubLocalActions.viewOutput', historyTreeItem);
}
});
}), }),
commands.registerCommand('githubLocalActions.viewOutput', async (historyTreeItem: HistoryTreeItem) => { commands.registerCommand('githubLocalActions.viewOutput', async (historyTreeItem: HistoryTreeItem) => {
await act.historyManager.viewOutput(historyTreeItem.history); await act.historyManager.viewOutput(historyTreeItem.history);

View File

@@ -254,12 +254,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
const document = await workspace.openTextDocument(settingFileTreeItem.settingFile.path); const document = await workspace.openTextDocument(settingFileTreeItem.settingFile.path);
await window.showTextDocument(document); await window.showTextDocument(document);
} catch (error: any) { } catch (error: any) {
try { // Silently handle file opening errors
await workspace.fs.stat(Uri.file(settingFileTreeItem.settingFile.path));
window.showErrorMessage(`Failed to open file. Error: ${error}`);
} catch (error: any) {
window.showErrorMessage(`File ${settingFileTreeItem.settingFile.name} not found.`);
}
} }
}), }),
commands.registerCommand('githubLocalActions.removeCustomSetting', async (customTreeItem: SettingFileTreeItem | OptionTreeItem) => { commands.registerCommand('githubLocalActions.removeCustomSetting', async (customTreeItem: SettingFileTreeItem | OptionTreeItem) => {
@@ -352,7 +347,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
}); });
if (errors.length > 0) { if (errors.length > 0) {
window.showErrorMessage(`Error(s) encountered retrieving variables from GitHub. Errors: ${[...new Set(errors)].join(' ')}`); // Silently handle GitHub API errors
} }
if (variableOptions.length > 0) { if (variableOptions.length > 0) {
@@ -370,7 +365,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
}); });
if (hasDuplicates) { if (hasDuplicates) {
window.showErrorMessage('Duplicate variables selected'); // Silently handle duplicate variables
} else { } else {
for await (const variable of selectedVariables) { for await (const variable of selectedVariables) {
const newSetting = settings.variables.find(existingVariable => existingVariable.key === variable.label); const newSetting = settings.variables.find(existingVariable => existingVariable.key === variable.label);
@@ -384,11 +379,11 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
} }
} }
} else if (errors.length === 0) { } else if (errors.length === 0) {
window.showErrorMessage('No matching variables defined in Github'); // Silently handle no matching variables
} }
} }
} else { } else {
window.showErrorMessage('No variables found in workflow(s)'); // Silently handle no variables found
} }
}), }),
commands.registerCommand('githubLocalActions.editSetting', async (settingTreeItem: SettingTreeItem) => { commands.registerCommand('githubLocalActions.editSetting', async (settingTreeItem: SettingTreeItem) => {

View File

@@ -77,18 +77,7 @@ export default class WorkflowsTreeDataProvider
); );
await window.showTextDocument(document); await window.showTextDocument(document);
} catch (error: any) { } catch (error: any) {
try { // Silently handle workflow opening errors
await workspace.fs.stat(workflowTreeItem.workflow.uri);
window.showErrorMessage(
`Failed to open workflow. Error: ${error}`
);
} catch (error: any) {
window.showErrorMessage(
`Workflow ${
path.parse(workflowTreeItem.workflow.uri.fsPath).base
} not found.`
);
}
} }
} }
), ),
@@ -138,13 +127,7 @@ export default class WorkflowsTreeDataProvider
} }
if (errorMessage) { if (errorMessage) {
window // Silently handle workflow execution errors
.showErrorMessage(errorMessage, "View Workflows")
.then(async (value) => {
if (value === "View Workflows") {
await commands.executeCommand("workflows.focus");
}
});
} }
} }
} }
@@ -168,9 +151,7 @@ export default class WorkflowsTreeDataProvider
); );
if (registeredEventsOnWorkflow.length === 0) { if (registeredEventsOnWorkflow.length === 0) {
window.showErrorMessage( // Silently handle no events case
`No events registered on the workflow (${workflowTreeItem.workflow.name}). Add an event to the \`on\` section of the workflow to trigger it.`
);
return; return;
} }
@@ -197,9 +178,7 @@ export default class WorkflowsTreeDataProvider
); );
if (registeredEventsOnJobParentWorkflow.length === 0) { if (registeredEventsOnJobParentWorkflow.length === 0) {
window.showErrorMessage( // Silently handle no events case
`No events registered on the workflow (${jobTreeItem.workflow.name}). Add an event to the \`on\` section of the workflow to trigger it.`
);
return; return;
} }