Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/simulation/workbench/components/baselineJSONPicker.tsx
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 { Dropdown, Option, OptionOnSelectData, SelectionEvents } from '@fluentui/react-components';
7
import * as mobx from 'mobx';
8
import * as mobxlite from 'mobx-react-lite';
9
import * as React from 'react';
10
import { assertType } from '../../../../src/util/vs/base/common/types';
11
import { SimulationTestsProvider } from '../stores/simulationTestsProvider';
12
import { useInternalToolbarPickerStyles } from './pickerStyle';
13
14
type Props = {
15
testsProvider: SimulationTestsProvider;
16
};
17
18
export const BaselineJSONPicker = mobxlite.observer(({ testsProvider }: Props) => {
19
20
const id = 'baselineJSONPicker';
21
const styles = useInternalToolbarPickerStyles();
22
23
const onOptionSelect = mobx.action((_e: SelectionEvents, { optionValue }: OptionOnSelectData) => {
24
assertType(optionValue === 'beforeRunBaselineJSON' || optionValue === 'workingTreeBaselineJSON');
25
testsProvider.comparedBaselineJSON = optionValue;
26
});
27
28
return (
29
<div className={styles.root}>
30
<label htmlFor={id}>Compare against baseline.json</label>
31
<Dropdown
32
aria-labelledby={id}
33
placeholder='which baseline.json'
34
size='small'
35
selectedOptions={[testsProvider.comparedBaselineJSON]}
36
value={testsProvider.comparedBaselineJSON === 'beforeRunBaselineJSON' ? 'Snapshot before run' : 'Working tree'}
37
onOptionSelect={onOptionSelect}
38
>
39
<Option key={0} value={'beforeRunBaselineJSON'}>
40
Snapshot before run
41
</Option>
42
<Option key={1} value={'workingTreeBaselineJSON'}>
43
Working tree
44
</Option>
45
</Dropdown>
46
</div>
47
);
48
});
49
50