Skip to content

Commit 3d6f800

Browse files
wolfibDevtools-frontend LUCI CQ
authored andcommitted
[AIAssistant] Add change workspace button to "Changes summary"
Also adds dummy dialog on button click Screenshots: https://imgur.com/a/93tocHB Bug: 393266352 Change-Id: Ia5749eaa3c025ac9235d6a4e5b76ee849bd17a41 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6298058 Auto-Submit: Wolfgang Beyer <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]> Commit-Queue: Ergün Erdoğmuş <[email protected]>
1 parent f2f4a6a commit 3d6f800

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

front_end/panels/ai_assistance/components/ChatView.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,18 @@ const UIStringsNotTranslate = {
196196
*@description Title for the x-link which wraps the image input rendered in chat messages.
197197
*/
198198
openImageInNewTab: 'Open image in a new tab',
199+
/**
200+
*@description Button text to change the selected workspace
201+
*/
202+
change: 'Change',
203+
/**
204+
*@description Button text while data is being loaded
205+
*/
206+
loading: 'Loading...',
207+
/**
208+
*@description Label for the selected workspace/folder
209+
*/
210+
selectedFolder: 'Selected folder:'
199211
} as const;
200212

201213
const str_ = i18n.i18n.registerUIStrings('panels/ai_assistance/components/ChatView.ts', UIStrings);
@@ -538,6 +550,12 @@ export class ChatView extends HTMLElement {
538550
}
539551
}
540552

553+
async function onChangeWorkspaceClick(): Promise<void> {
554+
await UI.UIUtils.ConfirmDialog.show(
555+
'Changing workspace is not implemented yet', 'Change workspace', undefined,
556+
{jslogContext: 'change-workspace-dialog'});
557+
}
558+
541559
function renderChangeSummary({
542560
changeSummary,
543561
patchSuggestion,
@@ -570,14 +588,24 @@ function renderChangeSummary({
570588
.displayNotice=${true}
571589
></devtools-code-block>
572590
<div class="workspace">
591+
<div class="change-workspace">
592+
<div class="selected-folder">
593+
${lockedString(UIStringsNotTranslate.selectedFolder)} ${projectName}
594+
</div>
595+
<devtools-button
596+
@click=${onChangeWorkspaceClick}
597+
.jslogContext=${'change-workspace'}
598+
.variant=${Buttons.Button.Variant.TEXT}>
599+
${lockedString(UIStringsNotTranslate.change)}
600+
</devtools-button>
601+
</div>
573602
<devtools-button
574603
class='apply-to-workspace'
575604
@click=${onApplyToWorkspace}
576605
.jslogContext=${'stage-to-workspace'}
577606
.variant=${Buttons.Button.Variant.OUTLINED}>
578-
${!patchSuggestionLoading ? lockedString(UIStringsNotTranslate.applyToWorkspace) : 'Loading...'}
607+
${!patchSuggestionLoading ? lockedString(UIStringsNotTranslate.applyToWorkspace) : lockedString(UIStringsNotTranslate.loading)}
579608
</devtools-button>
580-
<div>Selected folder: ${projectName}</div>
581609
</div>
582610
${patchSuggestion ? html`<div class="patch-tmp-message">
583611
${patchSuggestion}

front_end/panels/ai_assistance/components/chatView.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,16 @@ main {
790790
display: flex;
791791
flex-direction: row;
792792
justify-content: space-between;
793-
padding: var(--sys-size-4);
793+
margin: var(--sys-size-5);
794+
}
795+
796+
.selected-folder {
797+
margin: var(--sys-size-3) var(--sys-size-3) 0 0;
798+
}
799+
800+
.change-workspace {
801+
display: flex;
802+
flex-direction: row;
794803
}
795804

796805
.patch-tmp-message {

front_end/ui/visual_logging/KnownContextValues.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ export const knownContextValues = new Set([
668668
'caret-color',
669669
'category',
670670
'change',
671+
'change-workspace-dialog',
671672
'changes',
672673
'changes.changes',
673674
'changes.copy',

0 commit comments

Comments
 (0)