WIP: Improve "Project does not exists" popup with a Remove all button to clean up the unreachable projects

This commit is contained in:
Koza 2024-03-13 16:44:30 +01:00
parent 7d2d876cf2
commit 733bf61c5f
2 changed files with 36 additions and 2 deletions

View File

@ -764,7 +764,12 @@ describe('AtomEnvironment', () => {
expect(atom.notifications.addWarning).toHaveBeenCalledWith(
'Unable to open project folders',
{
description: `The directories \`${nonExistent}\` and \`${existingFile}\` do not exist.`
description: `The directories \`${nonExistent}\` and \`${existingFile}\` do not exist.`,
dismissable: true,
buttons: [
{ text: 'Remove all', onDidClick: jasmine.any(Function) },
{ text: 'Skip for now', onDidClick: jasmine.any(Function) }
]
}
);
});

View File

@ -1739,7 +1739,36 @@ or use Pane::saveItemAs for programmatic saving.`);
'` do not exist.';
}
this.notifications.addWarning(message, { description });
let notification;
let removeMissingPaths = async () => {
this.applicationDelegate.setProjectRoots(this.project.getPaths());
for (const missingFolder of missingFolders) {
const { pathToOpen } = missingFolder;
this.notifications.addWarning(`Removed ${pathToOpen}`);
}
if (notification) {
notification.dismiss();
}
};
let skipRemove = () => {
if (notification) {
notification.dismiss();
}
}
notification = this.notifications.addWarning(message, {
description,
dismissable: true,
buttons: [
{ text: 'Remove all', onDidClick: removeMissingPaths },
{ text: 'Skip for now', onDidClick: skipRemove }
]
});
}
ipcRenderer.send('window-command', 'window:locations-opened');