Skip to content

Commit f473909

Browse files
wolfibDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[Patch agent] Add nudge to use automatic workspaces to
SelectWorkspaceDialog drive-by: styling fixes Screenshots: https://imgur.com/a/y8Ienrd Bug: 399560823 Change-Id: I3c55ef4424a43500ccb617619ff1e50e4a1c6c6a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6440441 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Auto-Submit: Wolfgang Beyer <wolfi@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
1 parent ea8b232 commit f473909

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

front_end/panels/ai_assistance/SelectWorkspaceDialog.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import * as Workspace from '../../models/workspace/workspace.js';
1313
import * as Buttons from '../../ui/components/buttons/buttons.js';
1414
import * as UI from '../../ui/legacy/legacy.js';
1515
import {html, nothing, render} from '../../ui/lit/lit.js';
16+
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
1617

1718
import selectWorkspaceDialogStyles from './selectWorkspaceDialog.css.js';
1819

@@ -23,7 +24,7 @@ const UIStringsNotTranslate = {
2324
/**
2425
*@description Heading of dialog box which asks user to select a workspace folder.
2526
*/
26-
selectFolder: 'Select project root folder',
27+
selectFolder: 'Select folder',
2728
/**
2829
*@description Button text for canceling workspace selection.
2930
*/
@@ -40,11 +41,7 @@ const UIStringsNotTranslate = {
4041
*@description Explanation for selecting the correct workspace folder.
4142
*/
4243
selectProjectRoot:
43-
'To save patches directly to your project, select the project root folder containing the source files of the inspected page.',
44-
/*
45-
*@description Explainer stating that selected folder's contents are being sent to Google.
46-
*/
47-
sourceCodeSent: 'Relevant code snippets will be sent to Google to generate code suggestions.'
44+
'To save patches directly to your project, select the project root folder containing the source files of the inspected page. Relevant code snippets will be sent to Google to generate code suggestions.',
4845
} as const;
4946

5047
const lockedString = i18n.i18n.lockedString;
@@ -59,6 +56,7 @@ interface Folder {
5956
interface ViewInput {
6057
folders: Folder[];
6158
selectedIndex: number;
59+
showAutomaticWorkspaceNudge: boolean;
6260
onProjectSelected: (index: number) => void;
6361
onSelectButtonClick: () => void;
6462
onCancelButtonClick: () => void;
@@ -104,7 +102,18 @@ export class SelectWorkspaceDialog extends UI.Widget.VBox {
104102
<h2 class="dialog-header">${lockedString(UIStringsNotTranslate.selectFolder)}</h2>
105103
<div class="main-content">
106104
<div class="select-project-root">${lockedString(UIStringsNotTranslate.selectProjectRoot)}</div>
107-
<div>${lockedString(UIStringsNotTranslate.sourceCodeSent)}</div>
105+
${input.showAutomaticWorkspaceNudge ? html`
106+
<!-- Hardcoding, because there is no 'getFormatLocalizedString' equivalent for 'lockedString' -->
107+
<div>
108+
Tip: provide a
109+
<x-link
110+
class="devtools-link"
111+
href="https://goo.gle/devtools-automatic-workspace-folders"
112+
jslog=${VisualLogging.link().track({click: true, keydown:'Enter|Space'}).context('automatic-workspaces-documentation')}
113+
>com.chrome.devtools.json</x-link>
114+
file to automatically connect your project to DevTools.
115+
</div>
116+
` : nothing}
108117
</div>
109118
${hasFolders ? html`
110119
<ul role="listbox" aria-label=${lockedString(UIStringsNotTranslate.selectFolder)} tabindex="0">
@@ -187,6 +196,8 @@ export class SelectWorkspaceDialog extends UI.Widget.VBox {
187196
const viewInput = {
188197
folders: this.#folders,
189198
selectedIndex: this.#selectedIndex,
199+
showAutomaticWorkspaceNudge: this.#automaticFileSystemManager.automaticFileSystem === null &&
200+
this.#automaticFileSystemManager.availability === 'available',
190201
onProjectSelected: (index: number) => {
191202
this.#selectedIndex = index;
192203
this.requestUpdate();

front_end/panels/ai_assistance/selectWorkspaceDialog.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616

1717
.buttons {
1818
margin: var(--sys-size-6) var(--sys-size-8) var(--sys-size-8);
19-
display: flex;
19+
display: flex;
2020
justify-content: flex-start;
2121
gap: var(--sys-size-5);
2222
}
2323

2424
.main-content {
2525
color: var(--sys-color-on-surface-subtle);
2626
margin: 0 var(--sys-size-8);
27+
line-height: 18px;
2728
}
2829

2930
.add-folder-button {
@@ -34,7 +35,7 @@ ul {
3435
list-style-type: none;
3536
padding: 0;
3637
margin: var(--sys-size-6) 0 var(--sys-size-4) 0;
37-
max-height: var(--sys-size-23);
38+
max-height: var(--sys-size-20);
3839
overflow-y: auto;
3940
}
4041

0 commit comments

Comments
 (0)