Skip to content

fix: handle APPLIED_LOCALLY state better in cloud fix ui #2642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .nx/workflows/windows-distribution-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ distribute-on:
small-changeset: 3 windows-medium-js
medium-changeset: 4 windows-medium-js
large-changeset: 6 windows-medium-js

assignment-rules:
- project: intellij
target: build
runs-on:
- windows-medium-js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,21 @@ export const Applied: Story = {
},
};

export const AppliedLocally: Story = {
args: {
details: {
...mockDetails,
runGroup: {
...mockDetails.runGroup,
aiFix: {
...mockDetails.runGroup.aiFix!,
userAction: 'APPLIED_LOCALLY',
},
},
},
},
};

export const Ignored: Story = {
args: {
details: {
Expand All @@ -178,6 +193,22 @@ export const Ignored: Story = {
},
},
};
export const UncommittedChanges: Story = {
args: {
details: {
...mockDetails,
runGroup: {
...mockDetails.runGroup,
aiFix: {
...mockDetails.runGroup.aiFix!,
userAction: 'NONE',
},
},
hasUncommittedChanges: true,
},
onApplyLocally: (...args) => console.log('onApplyLocally', args),
},
};

export const VerificationFailed: Story = {
args: {
Expand Down
29 changes: 28 additions & 1 deletion libs/shared/cloud-fix-webview/src/nx-cloud-fix-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ export class NxCloudFixComponent extends EditorContext(LitElement) {
}

private handleApplyLocally() {
if (this.details && this.onApplyLocally) {
if (
this.details &&
this.onApplyLocally &&
!this.details?.hasUncommittedChanges
) {
this.onApplyLocally(this.details);
}
}
Expand Down Expand Up @@ -356,6 +360,29 @@ export class NxCloudFixComponent extends EditorContext(LitElement) {
`;
}

if (aiFix.userAction === 'APPLIED_LOCALLY') {
return html`
<div
class="border-border bg-background relative m-0 border p-6 text-center"
>
<div
class="mx-auto mb-4 flex h-16 w-16 flex-col items-center justify-center"
>
<icon-element
icon="git-branch"
class="text-success leading-none"
></icon-element>
</div>
<h2 class="text-foreground m-0 mb-2 text-lg font-semibold">
Fix Applied Locally
</h2>
<p class="text-foreground m-0 text-sm opacity-80">
The suggested changes have been applied locally.
</p>
</div>
`;
}

const showActions = true;

return html`
Expand Down
6 changes: 5 additions & 1 deletion libs/shared/types/src/lib/cloud-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export type AITaskFixStatus =
| 'FAILED'
| 'NOT_EXECUTABLE';

export type AITaskFixUserAction = 'NONE' | 'APPLIED' | 'REJECTED';
export type AITaskFixUserAction =
| 'NONE'
| 'APPLIED'
| 'REJECTED'
| 'APPLIED_LOCALLY';

export type AITaskFixUserActionOrigin =
| 'NX_CLOUD_APP'
Expand Down
8 changes: 8 additions & 0 deletions libs/vscode/nx-cloud-view/src/nx-cloud-fix-tree-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ export class NxCloudFixTreeItem
'check',
new ThemeColor('notebookStatusSuccessIcon.foreground'),
);
} else if (userAction === 'APPLIED_LOCALLY') {
this.contextValue += '-appliedLocally';
this.label =
'The suggested changes have been applied to your local branch';
this.iconPath = new ThemeIcon(
'git-branch',
new ThemeColor('notebookStatusSuccessIcon.foreground'),
);
} else if (userAction === 'REJECTED') {
this.contextValue += '-rejected';
this.label = 'Fix rejected by user';
Expand Down
Loading