Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/simulation/workbench/stores/resolvedSimulationRun.ts
13399 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import * as mobx from 'mobx';
7
import { ObservablePromise } from '../utils/utils';
8
import { SimulationRunsProvider } from './simulationBaseline';
9
import { SimulationRunner, TestRuns } from './simulationRunner';
10
11
/**
12
* Provides the current selected baseline (resolved with test runs info)
13
*/
14
15
export class ResolvedSimulationRun {
16
17
@mobx.computed
18
public get runs(): ObservablePromise<TestRuns[]> {
19
const outputFolderName = this.simulationRunsProvider.selectedBaselineRun?.name ?? '';
20
if (!outputFolderName) {
21
return ObservablePromise.resolve([]);
22
}
23
return new ObservablePromise(SimulationRunner.readFromPreviousRun(outputFolderName), []);
24
}
25
26
constructor(
27
private readonly simulationRunsProvider: SimulationRunsProvider
28
) {
29
mobx.makeObservable(this);
30
}
31
}
32
33