Repository navigation
CLI: new feature: add collapsible notebooks functionality - #12718
Conversation
- Allows to collapse notebooks with nested notebooks - Visual indicator for collapsed [+] and expanded [-] notebooks - Collapse states persistent across restarts (cli.folderCollapseState setting) - Keyboard shortcut 'z' toggles between collase/expand (partially addresses laurent22#6475)
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
laurent22
left a comment
There was a problem hiding this comment.
Thank you for implementing this! I've left a few comments below
|
|
||
| export default class FolderListWidget extends ListWidget { | ||
| // Service for managing folder collapse states | ||
| class FolderCollapseService { |
There was a problem hiding this comment.
What is the need for this service? Presumably it shouldn't need to manage any state since everything is saved/loaded from the settings? Settings already handle caching so it's fast to read/write from them
There was a problem hiding this comment.
Indeed, I cleaned this up while preserving the functionality
| const folderIds = Array.from(this.collapsedFolders_); | ||
| Setting.setValue('cli.folderCollapseState', JSON.stringify(folderIds)); | ||
| } catch (error) { | ||
| // Silently ignore save errors |
There was a problem hiding this comment.
Please don't ignore errors - our philosophy is to let things crash if there's an error. It's much easier to manage over the long term since there will be less hidden errors
| } | ||
| } catch (error) { | ||
| // If there's an error loading, start with empty state | ||
| this.collapsedFolders_ = new Set(); |
There was a problem hiding this comment.
Likewise, please don't catch the error. Not being able to read the settings is a critical error that needs to be fixed
| isGlobal: true, | ||
| }, | ||
|
|
||
| 'cli.folderCollapseState': { |
There was a problem hiding this comment.
We already have the setting collapsedFolderIds, please use this. Maybe you can also reuse some of the existing logic?
There was a problem hiding this comment.
Agree for reusing the logic.
As for using the same setting this would mean that the setting would be common across the desktop and cli right?
Is this what users would expect?
I don't have a strong opinion, most of the time I've everything collapsed anyway.
Removed unused collapseAll/expandAll functions. Removed FolderCollapseService.
|
Any comments on the newer changes? |
|
@miguelammatos FYI you need to sign the CLA, as per the comment from the bot |
| Setting.value('showNoteCounts') && | ||
| !item.deleted_time && | ||
| item.id !== getTrashFolderId() |
| if ( | ||
| item && | ||
| item.type_ === Folder.modelType() && | ||
| this.folderHasChildren_(this.folders, item.id) | ||
| ) { |
There was a problem hiding this comment.
On one line please - there's a strange mix of tabs and spaces
| isGlobal: true, | ||
| }, | ||
|
|
||
|
|
There was a problem hiding this comment.
Please remove the whitespace change
|
@miguelammatos, that looks good but indeed please sign the CLA. If you need information on how to do this let us know. Also please check the few comments I left |
|
Just checking if you're ok with signing the CLA? I'll leave the PR open two more days and then will assume you're not interested anymore and will close it |
|
I have read the CLA Document and I hereby sign the CLA |
|
Fixed the remaining issues and signed the CLA. |
That was quite a short time-span for saying this since the last comments you left which had not been replied to. Was that a bluff? It seemed to work invoking a speedy response anyhow 😆 |
|
No, not a bluff. I'm drowning in PR reviews so I need to clear the backlog. So if someone is not able to complete their PR, as it often happens, I need to close it. I appreciate that Miguel was able to complete it as it's definitely a good change |
|
I was busy in the past few days hence the delay, apologies. All seems to be in order right? |
Partially resolves #6475