Skip to content

Commit 8a59959

Browse files
author
Alberto Iannaccone
authored
fix board selection and workspace input dialogs width and height (#1406)
* fix board selection and workspace input dialogs width and height * use same dialog for new file and rename * fix board list getting small when filtering * board select dialog: show variant text when no board is found * fix addition boards url outline
1 parent 8de6cf8 commit 8a59959

File tree

9 files changed

+74
-32
lines changed

9 files changed

+74
-32
lines changed

arduino-ide-extension/src/browser/boards/boards-config-dialog.ts

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class BoardsConfigDialog extends AbstractDialog<BoardsConfig.Config> {
3434
) {
3535
super({ ...props, maxWidth: 500 });
3636

37+
this.node.id = 'select-board-dialog-container';
3738
this.contentNode.classList.add('select-board-dialog');
3839
this.contentNode.appendChild(this.createDescription());
3940

arduino-ide-extension/src/browser/boards/boards-config.tsx

+24-14
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ export class BoardsConfig extends React.Component<
299299
}
300300
}
301301

302+
const boardsList = Array.from(distinctBoards.values()).map((board) => (
303+
<Item<BoardWithPackage>
304+
key={toKey(board)}
305+
item={board}
306+
label={board.name}
307+
details={board.details}
308+
selected={board.selected}
309+
onClick={this.selectBoard}
310+
missing={board.missing}
311+
/>
312+
));
313+
302314
return (
303315
<React.Fragment>
304316
<div className="search">
@@ -315,19 +327,17 @@ export class BoardsConfig extends React.Component<
315327
/>
316328
<i className="fa fa-search"></i>
317329
</div>
318-
<div className="boards list">
319-
{Array.from(distinctBoards.values()).map((board) => (
320-
<Item<BoardWithPackage>
321-
key={toKey(board)}
322-
item={board}
323-
label={board.name}
324-
details={board.details}
325-
selected={board.selected}
326-
onClick={this.selectBoard}
327-
missing={board.missing}
328-
/>
329-
))}
330-
</div>
330+
{boardsList.length > 0 ? (
331+
<div className="boards list">{boardsList}</div>
332+
) : (
333+
<div className="no-result">
334+
{nls.localize(
335+
'arduino/board/noBoardsFound',
336+
'No boards found for "{0}"',
337+
query
338+
)}
339+
</div>
340+
)}
331341
</React.Fragment>
332342
);
333343
}
@@ -342,7 +352,7 @@ export class BoardsConfig extends React.Component<
342352
);
343353
}
344354
return !ports.length ? (
345-
<div className="loading noselect">
355+
<div className="no-result">
346356
{nls.localize('arduino/board/noPortsDiscovered', 'No ports discovered')}
347357
</div>
348358
) : (

arduino-ide-extension/src/browser/dialogs/settings/settings-dialog.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export class AdditionalUrlsDialog extends AbstractDialog<string[]> {
155155

156156
this.textArea = document.createElement('textarea');
157157
this.textArea.className = 'theia-input';
158-
this.textArea.setAttribute('style', 'flex: 0;');
159158
this.textArea.value = urls
160159
.filter((url) => url.trim())
161160
.filter((url) => !!url)

arduino-ide-extension/src/browser/style/boards-config-dialog.css

+21
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1+
#select-board-dialog-container > .dialogBlock {
2+
width: 640px;
3+
height: 500px;
4+
}
5+
16
div#select-board-dialog {
27
margin: 5px;
8+
height: 100%;
39
}
410

511
div#select-board-dialog .selectBoardContainer {
612
display: flex;
713
gap: 10px;
814
overflow: hidden;
915
max-height: 100%;
16+
height: 100%;
1017
}
1118

1219
.select-board-dialog .head {
1320
margin: 5px;
1421
}
1522

23+
.dialogContent.select-board-dialog {
24+
height: 100%;
25+
}
26+
1627
div.dialogContent.select-board-dialog > div.head .title {
1728
font-weight: 400;
1829
letter-spacing: 0.02em;
@@ -63,6 +74,7 @@ div#select-board-dialog .selectBoardContainer .list .item.selected i {
6374
display: flex;
6475
flex-direction: column;
6576
max-height: 100%;
77+
height: 100%;
6678
}
6779

6880
#select-board-dialog .selectBoardContainer .left.container .content {
@@ -131,6 +143,7 @@ div#select-board-dialog .selectBoardContainer .list .item.selected i {
131143
#select-board-dialog .selectBoardContainer .list {
132144
max-height: 200px;
133145
overflow-y: auto;
146+
flex: 1;
134147
}
135148

136149
#select-board-dialog .selectBoardContainer .ports.list {
@@ -282,3 +295,11 @@ div#select-board-dialog .selectBoardContainer .list .item.selected i {
282295
display: none;
283296
}
284297
}
298+
299+
#select-board-dialog .no-result {
300+
text-transform: uppercase;
301+
height: 100%;
302+
user-select: none;
303+
padding: 10px 5px;
304+
overflow-wrap: break-word;
305+
}

arduino-ide-extension/src/browser/style/dialogs.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
total = padding + margin = 96px
1010
*/
1111
max-width: calc(100% - 96px) !important;
12-
min-width: unset;
12+
13+
min-width: 424px;
1314
max-height: 560px;
1415
padding: 0 28px;
1516
}
@@ -85,3 +86,4 @@
8586
max-height: 400px;
8687
}
8788
}
89+

arduino-ide-extension/src/browser/style/settings-dialog.css

+4-2
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@
8888
}
8989

9090
.additional-urls-dialog textarea {
91-
width: 100%;
91+
resize: none;
9292
}
9393

9494
.p-Widget.dialogOverlay .dialogBlock .dialogContent.additional-urls-dialog {
95-
display: block;
95+
display: flex;
9696
overflow: hidden;
97+
padding: 0 1px;
98+
margin: 0 -1px;
9799
}

arduino-ide-extension/src/browser/theia/workspace/workspace-commands.ts

+19-14
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
SketchesServiceClientImpl,
1818
} from '../../../common/protocol/sketches-service-client-impl';
1919
import { SaveAsSketch } from '../../contributions/save-as-sketch';
20-
import { SingleTextInputDialog } from '@theia/core/lib/browser';
2120
import { nls } from '@theia/core/lib/common';
2221

2322
@injectable()
@@ -161,20 +160,26 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
161160
return;
162161
}
163162
const initialValue = uri.path.base;
164-
const dialog = new SingleTextInputDialog({
165-
title: nls.localize('theia/workspace/newFileName', 'New name for file'),
166-
initialValue,
167-
initialSelectionRange: {
168-
start: 0,
169-
end: uri.path.name.length,
170-
},
171-
validate: (name, mode) => {
172-
if (initialValue === name && mode === 'preview') {
173-
return false;
174-
}
175-
return this.validateFileName(name, parent, false);
163+
const parentUri = parent.resource;
164+
165+
const dialog = new WorkspaceInputDialog(
166+
{
167+
title: nls.localize('theia/workspace/newFileName', 'New name for file'),
168+
initialValue,
169+
parentUri,
170+
initialSelectionRange: {
171+
start: 0,
172+
end: uri.path.name.length,
173+
},
174+
validate: (name, mode) => {
175+
if (initialValue === name && mode === 'preview') {
176+
return false;
177+
}
178+
return this.validateFileName(name, parent, false);
179+
},
176180
},
177-
});
181+
this.labelProvider
182+
);
178183
const newName = await dialog.open();
179184
const newNameWithExt = this.maybeAppendInoExt(newName);
180185
if (newNameWithExt) {

arduino-ide-extension/src/browser/theia/workspace/workspace-input-dialog.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class WorkspaceInputDialog extends TheiaWorkspaceInputDialog {
1818
protected override readonly labelProvider: LabelProvider
1919
) {
2020
super(props, labelProvider);
21+
this.node.classList.add('workspace-input-dialog');
2122
this.appendCloseButton(
2223
nls.localize('vscode/issueMainService/cancel', 'Cancel')
2324
);

i18n/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"getBoardInfo": "Get Board Info",
1616
"inSketchbook": " (in Sketchbook)",
1717
"installNow": "The \"{0} {1}\" core has to be installed for the currently selected \"{2}\" board. Do you want to install it now?",
18+
"noBoardsFound": "No boards found for \"{0}\"",
1819
"noFQBN": "The FQBN is not available for the selected board \"{0}\". Do you have the corresponding core installed?",
1920
"noPortsDiscovered": "No ports discovered",
2021
"noPortsSelected": "No ports selected for board: '{0}'.",

0 commit comments

Comments
 (0)