Remove repoStates state tracking from model evaluation (#3496)
This commit is contained in:
@@ -749,8 +749,7 @@ interface StopEvaluationRunMessage {
|
||||
export type ToModelAlertsMessage =
|
||||
| SetModelAlertsViewStateMessage
|
||||
| SetVariantAnalysisMessage
|
||||
| SetRepoResultsMessage
|
||||
| SetRepoStatesMessage;
|
||||
| SetRepoResultsMessage;
|
||||
|
||||
export type FromModelAlertsMessage =
|
||||
| CommonFromViewMessages
|
||||
|
||||
@@ -18,7 +18,6 @@ import type { ExtensionPack } from "../shared/extension-pack";
|
||||
import type {
|
||||
VariantAnalysis,
|
||||
VariantAnalysisScannedRepositoryResult,
|
||||
VariantAnalysisScannedRepositoryState,
|
||||
} from "../../variant-analysis/shared/variant-analysis";
|
||||
import type { AppEvent, AppEventEmitter } from "../../common/events";
|
||||
|
||||
@@ -127,19 +126,6 @@ export class ModelAlertsView extends AbstractWebview<
|
||||
});
|
||||
}
|
||||
|
||||
public async updateRepoState(
|
||||
repoState: VariantAnalysisScannedRepositoryState,
|
||||
): Promise<void> {
|
||||
if (!this.isShowingPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.postMessage({
|
||||
t: "setRepoStates",
|
||||
repoStates: [repoState],
|
||||
});
|
||||
}
|
||||
|
||||
public async updateRepoResults(
|
||||
repositoryResult: VariantAnalysisScannedRepositoryResult,
|
||||
): Promise<void> {
|
||||
|
||||
@@ -260,14 +260,6 @@ export class ModelEvaluator extends DisposableObject {
|
||||
),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.variantAnalysisManager.onRepoStatesUpdated(async (e) => {
|
||||
if (e.variantAnalysisId === variantAnalysisId) {
|
||||
await this.modelAlertsView?.updateRepoState(e.repoState);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.variantAnalysisManager.onRepoResultsLoaded(async (e) => {
|
||||
if (e.variantAnalysisId === variantAnalysisId) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import type { ToModelAlertsMessage } from "../../common/interface-types";
|
||||
import type {
|
||||
VariantAnalysis,
|
||||
VariantAnalysisScannedRepositoryResult,
|
||||
VariantAnalysisScannedRepositoryState,
|
||||
} from "../../variant-analysis/shared/variant-analysis";
|
||||
import { vscode } from "../vscode-api";
|
||||
import { ModelAlertsHeader } from "./ModelAlertsHeader";
|
||||
@@ -12,14 +11,12 @@ import { ModelAlertsHeader } from "./ModelAlertsHeader";
|
||||
type Props = {
|
||||
initialViewState?: ModelAlertsViewState;
|
||||
variantAnalysis?: VariantAnalysis;
|
||||
repoStates?: VariantAnalysisScannedRepositoryState[];
|
||||
repoResults?: VariantAnalysisScannedRepositoryResult[];
|
||||
};
|
||||
|
||||
export function ModelAlerts({
|
||||
initialViewState,
|
||||
variantAnalysis: initialVariantAnalysis,
|
||||
repoStates: initialRepoStates = [],
|
||||
repoResults: initialRepoResults = [],
|
||||
}: Props): React.JSX.Element {
|
||||
const onOpenModelPackClick = useCallback((path: string) => {
|
||||
@@ -42,8 +39,6 @@ export function ModelAlerts({
|
||||
const [variantAnalysis, setVariantAnalysis] = useState<
|
||||
VariantAnalysis | undefined
|
||||
>(initialVariantAnalysis);
|
||||
const [repoStates, setRepoStates] =
|
||||
useState<VariantAnalysisScannedRepositoryState[]>(initialRepoStates);
|
||||
const [repoResults, setRepoResults] =
|
||||
useState<VariantAnalysisScannedRepositoryResult[]>(initialRepoResults);
|
||||
|
||||
@@ -60,18 +55,6 @@ export function ModelAlerts({
|
||||
setVariantAnalysis(msg.variantAnalysis);
|
||||
break;
|
||||
}
|
||||
case "setRepoStates": {
|
||||
setRepoStates((oldRepoStates) => {
|
||||
const newRepoIds = msg.repoStates.map((r) => r.repositoryId);
|
||||
return [
|
||||
...oldRepoStates.filter(
|
||||
(v) => !newRepoIds.includes(v.repositoryId),
|
||||
),
|
||||
...msg.repoStates,
|
||||
];
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "setRepoResults": {
|
||||
setRepoResults((oldRepoResults) => {
|
||||
const newRepoIds = msg.repoResults.map((r) => r.repositoryId);
|
||||
@@ -121,10 +104,6 @@ export function ModelAlerts({
|
||||
onViewLogsClick={onViewLogsClick}
|
||||
stopRunClick={onStopRunClick}
|
||||
></ModelAlertsHeader>
|
||||
<div>
|
||||
<h3>Repo states</h3>
|
||||
<p>{JSON.stringify(repoStates, null, 2)}</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Repo results</h3>
|
||||
<p>{JSON.stringify(repoResults, null, 2)}</p>
|
||||
|
||||
Reference in New Issue
Block a user