Skip to content

Commit 0b29f26

Browse files
committed
PR fixes: refactoring, syntax changes
1 parent 79c06d3 commit 0b29f26

File tree

7 files changed

+290
-380
lines changed

7 files changed

+290
-380
lines changed

packages/core/src/amazonqGumby/activation.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ export async function activate(context: ExtContext) {
7272
)
7373
}),
7474

75+
Commands.register(
76+
'aws.amazonq.transformationHub.updateContent',
77+
async (button, startTime, historyFileUpdated) => {
78+
await transformationHubViewProvider.updateContent(button, startTime, historyFileUpdated)
79+
}
80+
),
81+
7582
workspaceChangeEvent
7683
)
7784
}

packages/core/src/amazonqGumby/chat/controller/controller.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,8 @@ export class GumbyController {
191191

192192
private async transformInitiated(message: any) {
193193
// check if any jobs potentially still in progress on backend
194-
const history = readHistoryFile()
195-
let numInProgress = 0
196-
history.forEach((job) => {
197-
if (job.status === 'FAILED') {
198-
numInProgress += 1
199-
}
200-
})
194+
const history = await readHistoryFile()
195+
const numInProgress = history.filter((job) => job.status === 'FAILED').length
201196
this.messenger.sendViewHistoryMessage(message.tabID, numInProgress)
202197
if (transformByQState.isRefreshInProgress()) {
203198
this.messenger.sendMessage(CodeWhispererConstants.refreshInProgressChatMessage, message.tabID, 'ai-prompt')

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,15 +749,14 @@ export async function postTransformationJob() {
749749
})
750750
}
751751

752+
// delete original upload ZIP at very end of transformation
753+
fs.rmSync(transformByQState.getPayloadFilePath(), { force: true })
754+
752755
if (
753756
transformByQState.isSucceeded() ||
754757
transformByQState.isPartiallySucceeded() ||
755758
transformByQState.isCancelled()
756759
) {
757-
if (transformByQState.getPayloadFilePath()) {
758-
// delete original upload ZIP at very end of transformation
759-
fs.rmSync(transformByQState.getPayloadFilePath(), { force: true })
760-
}
761760
// delete the copy of the upload ZIP
762761
fs.rmSync(path.join(transformByQState.getJobHistoryPath(), 'zipped-code.zip'), { force: true })
763762
// delete transformation job metadata file (no longer needed)
@@ -801,7 +800,7 @@ export async function postTransformationJob() {
801800
]
802801

803802
const jobDetails = fields.join('\t') + '\n'
804-
fs.writeFileSync(historyLogFilePath, jobDetails, { flag: 'a' })
803+
fs.writeFileSync(historyLogFilePath, jobDetails, { flag: 'a' }) // 'a' flag used to append to file
805804
await vscode.commands.executeCommand(
806805
'aws.amazonq.transformationHub.updateContent',
807806
'job history',

packages/core/src/codewhisperer/models/constants.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,8 @@ export const viewHistoryMessage = (numInProgress: number) =>
812812
: 'View previous transformations run from the IDE'
813813

814814
export const transformationHistoryTableDescription =
815-
'This table lists the most recent jobs that you have run in the past 30 days. To open the diff patch and summary files, click the provided links. Jobs with a status of FAILED may still be in progress. Resume them within 12 hours of starting the job to get an updated job status and artifacts. Click the refresh icon to do so. The diff patch and summary will appear once they are available.'
815+
'This table lists the most recent jobs that you have run in the past 30 days. To open the diff patch and summary files, click the provided links. To get an updated job status, click the refresh icon. The diff patch and summary will appear once they are available.<br><br>' +
816+
'Jobs with a status of FAILED may still be in progress. Resume these jobs within 12 hours of starting the job to get an updated job status and artifacts.'
816817

817818
export const refreshErrorChatMessage =
818819
"Sorry, I couldn't refresh the job. Please try again or start a new transformation."
@@ -935,3 +936,13 @@ export const predictionTrackerDefaultConfig = {
935936
}
936937

937938
export const findingsSuffix = '_codeReviewFindings'
939+
940+
export interface HistoryObject {
941+
startTime: string
942+
projectName: string
943+
status: string
944+
duration: string
945+
diffPath: string
946+
summaryPath: string
947+
jobId: string
948+
}

packages/core/src/codewhisperer/models/model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,7 @@ export class TransformByQState {
11571157
this.buildLog = ''
11581158
this.customBuildCommand = ''
11591159
this.intervalId = undefined
1160+
this.jobHistoryPath = ''
11601161
}
11611162
}
11621163

0 commit comments

Comments
 (0)