Replace contextual menu on the bluetooth device running item by a menu#43
Conversation
fb77013 to
4fb07e4
Compare
| this.device = device; | ||
| this.commands = new CommandRegistry(); | ||
| this.commands.addCommand(disconnectMoveHub, { | ||
| const commands = new CommandRegistry() |
There was a problem hiding this comment.
In extension code, you should never need to instantiate a CommandRegistry. The only command registry that should exist in a given Jupyter front-end should be the one that is instantiated by the application itself, i.e., the JupyterLab app.commands.
| const commandList = commands.listCommands(); | ||
| commandList.map((command: string) => { | ||
| if (command.includes('bluetooth-manager') && !command.includes("disconnect")) { | ||
| menu.addItem({ command: command}) | ||
| } | ||
| }) |
There was a problem hiding this comment.
Instead of searching through the command registry for commands that match a certain name, it would be more flexible and less risky (because you can't protect against command names that don't follow this convention) to all the BluetoothManager.Device instance that you have a reference to here this._device and create a public attribute on it, i.e. this._device.contextCommands or something like this and to pass the deviceID like you do in the line above.
…ands attribute to the BluetoothManager.Device class. Move the connectMoveHub and disconnectMoveHub commands from the ConnectionStatus component to the index.
ac19dde to
1d05396
Compare
Fixes sub-issue 12 of #7