diff --git a/addons/isl-server/src/OperationQueue.ts b/addons/isl-server/src/OperationQueue.ts index e4a68a58929b0..4e5e52c532aa5 100644 --- a/addons/isl-server/src/OperationQueue.ts +++ b/addons/isl-server/src/OperationQueue.ts @@ -80,6 +80,9 @@ export class OperationQueue { case 'inlineProgress': onProgress({id: operation.id, kind: 'inlineProgress', hash: args[1], message: args[2]}); break; + case 'warning': + onProgress({id: operation.id, kind: 'warning', warning: args[1]}); + break; case 'stderr': onProgress({id: operation.id, kind: 'stderr', message: args[1]}); break; diff --git a/addons/isl-server/src/Repository.ts b/addons/isl-server/src/Repository.ts index 5915760be28a0..c3105f558d6e0 100644 --- a/addons/isl-server/src/Repository.ts +++ b/addons/isl-server/src/Repository.ts @@ -677,23 +677,25 @@ export class Repository { try { // eslint-disable-next-line no-await-in-loop const message = await child.getOneMessage(); - if ( - message === null || - typeof message !== 'object' || - !('progress_bar_update' in message) - ) { + if (message === null || typeof message !== 'object') { break; } - const bars = message.progress_bar_update as IpcProgressBar[]; - const blen = bars.length; - if (blen > 0) { - const msg = bars[blen - 1]; - onProgress('progress', { - message: msg.topic, - progress: msg.position, - progressTotal: msg.total, - unit: msg.unit, - }); + if ('progress_bar_update' in message) { + const bars = message.progress_bar_update as IpcProgressBar[]; + const blen = bars.length; + if (blen > 0) { + const msg = bars[blen - 1]; + onProgress('progress', { + message: msg.topic, + progress: msg.position, + progressTotal: msg.total, + unit: msg.unit, + }); + } + } else if ('warning' in message) { + onProgress('warning', message.warning as string); + } else { + break; } } catch (err) { break; diff --git a/addons/isl/src/CommandHistoryAndProgress.tsx b/addons/isl/src/CommandHistoryAndProgress.tsx index 87cd1ed241f45..968bdfa68b531 100644 --- a/addons/isl/src/CommandHistoryAndProgress.tsx +++ b/addons/isl/src/CommandHistoryAndProgress.tsx @@ -268,6 +268,14 @@ export function CommandHistoryAndProgress() {
{icon} {label} + {progress.warnings?.map(warning => ( + } + alwaysShowButtons + kind={BannerKind.warning}> + $provider + + ))}
{showLastLineOfOutput ? (
diff --git a/addons/isl/src/operationsState.ts b/addons/isl/src/operationsState.ts index 6e0e7e8554aff..2bb4fe76b66cb 100644 --- a/addons/isl/src/operationsState.ts +++ b/addons/isl/src/operationsState.ts @@ -33,6 +33,7 @@ export type OperationInfo = { hasCompletedUncommittedChangesOptimisticState?: boolean; /** if true, the operation process has exited AND there's no more optimistic changes to merge conflicts to show */ hasCompletedMergeConflictsOptimisticState?: boolean; + warnings?: Array; } & EnsureAssignedTogether<{ endTime: Date; exitCode: number; @@ -193,6 +194,22 @@ registerDisposable( }; }); break; + case 'warning': + writeAtom(operationList, current => { + const currentOperation = current.currentOperation; + if (currentOperation == null) { + return current; + } + const warnings = [...(currentOperation?.warnings ?? []), progress.warning]; + return { + ...current, + currentOperation: { + ...currentOperation, + warnings, + }, + }; + }); + break; case 'exit': case 'forgot': writeAtom(operationList, current => { diff --git a/addons/isl/src/types.ts b/addons/isl/src/types.ts index b7850b1762a4e..0d7ab7d01f338 100644 --- a/addons/isl/src/types.ts +++ b/addons/isl/src/types.ts @@ -580,6 +580,7 @@ export type OperationProgress = | {id: string; kind: 'inlineProgress'; hash?: string; message?: string} | {id: string; kind: 'exit'; exitCode: number; timestamp: number} | {id: string; kind: 'error'; error: string} + | {id: string; kind: 'warning'; warning: string} // used by requestMissedOperationProgress, client thinks this operation is running but server no longer knows about it. | {id: string; kind: 'forgot'}; @@ -598,6 +599,7 @@ export type OperationCommandProgressReporter = ( // null message -> clear inline progress for this hash. Null hash -> apply to all affected hashes (set message or clear) | [type: 'inlineProgress', hash?: string, message?: string] | ['progress', ProgressStep] + | ['warning', string] | ['exit', number] ) => void;