Enhanced boards toolbar item.

Signed-off-by: jbicker <jan.bicker@typefox.io>
This commit is contained in:
jbicker 2019-06-25 17:45:44 +02:00
parent 75ef8ea987
commit ff336dccc5
3 changed files with 13 additions and 11 deletions

View File

@ -27,6 +27,7 @@ import { ArduinoOpenSketchContextMenu } from './arduino-file-menu';
import { Sketch, SketchesService } from '../common/protocol/sketches-service'; import { Sketch, SketchesService } from '../common/protocol/sketches-service';
import { WindowService } from '@theia/core/lib/browser/window/window-service'; import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { CommonCommands } from '@theia/core/lib/browser/common-frontend-contribution' import { CommonCommands } from '@theia/core/lib/browser/common-frontend-contribution'
import { BoardsToolBarItem } from './components/boards-toolbar-item';
@injectable() @injectable()
export class ArduinoFrontendContribution implements TabBarToolbarContribution, CommandContribution { export class ArduinoFrontendContribution implements TabBarToolbarContribution, CommandContribution {
@ -118,15 +119,15 @@ export class ArduinoFrontendContribution implements TabBarToolbarContribution, C
}); });
registry.registerItem({ registry.registerItem({
id: ConnectedBoards.TOOLBAR_ID, id: ConnectedBoards.TOOLBAR_ID,
// render: () => <BoardsToolBarItem render: () => <BoardsToolBarItem
// onNoBoardsInstalled={this.onNoBoardsInstalled.bind(this)}
// onUnknownBoard={this.onUnknownBoard.bind(this)} />,
render: () => <ConnectedBoards
boardsService={this.boardService}
boardsNotificationService={this.boardsNotificationService}
quickPickService={this.quickPickService}
onNoBoardsInstalled={this.onNoBoardsInstalled.bind(this)} onNoBoardsInstalled={this.onNoBoardsInstalled.bind(this)}
onUnknownBoard={this.onUnknownBoard.bind(this)} />, onUnknownBoard={this.onUnknownBoard.bind(this)} />,
// render: () => <ConnectedBoards
// boardsService={this.boardService}
// boardsNotificationService={this.boardsNotificationService}
// quickPickService={this.quickPickService}
// onNoBoardsInstalled={this.onNoBoardsInstalled.bind(this)}
// onUnknownBoard={this.onUnknownBoard.bind(this)} />,
isVisible: widget => this.isArduinoToolbar(widget) isVisible: widget => this.isArduinoToolbar(widget)
}) })
} }

View File

@ -29,14 +29,14 @@ export class ConnectedBoards extends React.Component<ConnectedBoards.Props, Conn
content = [ <option key="loading" value="0">{label}</option> ]; content = [ <option key="loading" value="0">{label}</option> ];
} }
return <div className={`${ARDUINO_TOOLBAR_ITEM_CLASS} item ${ConnectedBoards.Styles.CONNECTED_BOARDS_CLASS}`}> return <div key='arduino-connected-boards' className={`${ARDUINO_TOOLBAR_ITEM_CLASS} item ${ConnectedBoards.Styles.CONNECTED_BOARDS_CLASS}`}>
<select disabled={!this.state.boards} <select key='arduino-connected-boards-select' disabled={!this.state.boards}
onChange={this.onBoardSelect.bind(this)} onChange={this.onBoardSelect.bind(this)}
value={this.state.selection}> value={this.state.selection}>
<optgroup label="Attached boards"> <optgroup key='arduino-connected-boards-select-opt-group' label="Attached boards">
{ content } { content }
</optgroup> </optgroup>
<optgroup label="_________"> <optgroup label="_________" key='arduino-connected-boards-select-opt-group2'>
{ !!this.state.otherBoard && <option value="selected-other" key="selected-other">{this.state.otherBoard.name} (not attached)</option> } { !!this.state.otherBoard && <option value="selected-other" key="selected-other">{this.state.otherBoard.name} (not attached)</option> }
<option value="select-other" key="select-other">Select other Board</option> <option value="select-other" key="select-other">Select other Board</option>
</optgroup> </optgroup>

View File

@ -65,6 +65,7 @@
} }
.arduino-open-boards-button { .arduino-open-boards-button {
background: white;
} }
.arduino-boards-toolbar-item { .arduino-boards-toolbar-item {