1- <FluentLayout Id =" @Id" Style =" margin: 10px;" >
2- <div style =" display : flex ; align-items : center ; margin-bottom : 5px ;" >
3- <label id =" deployment-model-label" for =" deployment-model-list-options" style =" margin-right : 5px ;" >Deployment</label >
4- <span style =" color : red ;" >*</span >
5- </div >
6-
7- <FluentSelect Items =@deploymentModelOptions Id =" deployment-model-list-options" name =" deployment-models"
8- TOption =" Option<string>" Height =" 300px"
9- OptionText =" @(e => e.Text?.ToString())"
10- OptionValue =" @(e => e.Value?.ToString())"
11- OptionSelected =" @(e => e.Selected)"
12- @bind-SelectedOption =" @selectedOption"
13- @onclick =" OnValueChanged"
14- aria-labelledby =" deployment-model-label" >
15- </FluentSelect >
16- </FluentLayout >
1+ <FluentStack Id =" @Id" Style =" width: 100%;" Orientation =" Orientation.Vertical" VerticalAlignment =" VerticalAlignment.Top" >
2+ <FluentSelect Id =" deployment-model-list-options" Label =" Deployment" Required =" true"
3+ Placeholder =" Select a deployment model"
4+ Items =@deploymentModels
5+ TOption =" Option<string>"
6+ OptionText =" @(option => option.Text!)"
7+ OptionValue =" @(option => option.Value!)"
8+ @bind-SelectedOption =" @selectedOption"
9+ @onchange =" SetDeploymentModel" />
10+ </FluentStack >
1711
1812@code {
19- private Option <string >? selectedOption { get ; set ; } = new ();
13+ private List <Option <string >> ? deploymentModels ;
14+ private Option <string >? selectedOption { get ; set ; }
2015
2116 [Parameter ]
2217 public string ? Id { get ; set ; }
2318
2419 [Parameter ]
2520 public EventCallback <string > OnUserOptionSelected { get ; set ; }
26-
27- private async Task OnValueChanged ()
21+
22+ protected override async Task OnInitializedAsync ()
2823 {
29- string ? selectedValue = selectedOption ? .Value ? .ToString ();
30- await OnUserOptionSelected .InvokeAsync (selectedValue );
24+ this .deploymentModels = new ()
25+ {
26+ new Option <string > { Value = " model-gpt35turbo16k-0613" , Text = " model-gpt35turbo16k-0613" },
27+ new Option <string > { Value = " model-gpt4o-20240513" , Text = " model-gpt4o-20240513" },
28+ };
29+
30+ await Task .CompletedTask ;
3131 }
3232
33- static List < Option < string > > deploymentModelOptions = new ()
33+ private async Task SetDeploymentModel ()
3434 {
35- new Option <string > { Value = " AL" , Text = " Alabama" },
36- new Option <string > { Value = " AK" , Text = " Alaska" },
37- new Option <string > { Value = " AZ" , Text = " Arizona" },
38- new Option <string > { Value = " AR" , Text = " Arkansas" },
39- new Option <string > { Value = " CA" , Text = " California" },
40- new Option <string > { Value = " CO" , Text = " Colorado" },
41- new Option <string > { Value = " CT" , Text = " Connecticut" },
42- new Option <string > { Value = " DE" , Text = " Delaware" },
43- new Option <string > { Value = " FL" , Text = " Florida" },
44- new Option <string > { Value = " GA" , Text = " Georgia" },
45- new Option <string > { Value = " HI" , Text = " Hawaii" },
46- new Option <string > { Value = " ID" , Text = " Idaho" },
47- new Option <string > { Value = " IL" , Text = " Illinois" },
48- new Option <string > { Value = " IN" , Text = " Indiana" },
49- new Option <string > { Value = " IA" , Text = " Iowa" },
50- new Option <string > { Value = " KS" , Text = " Kansas" },
51- new Option <string > { Value = " KY" , Text = " Kentucky" },
52- new Option <string > { Value = " LA" , Text = " Louisiana" },
53- new Option <string > { Value = " ME" , Text = " Maine" },
54- new Option <string > { Value = " MD" , Text = " Maryland" },
55- new Option <string > { Value = " MA" , Text = " Massachussets" },
56- new Option <string > { Value = " MI" , Text = " Michigain" },
57- new Option <string > { Value = " MN" , Text = " Minnesota" },
58- new Option <string > { Value = " MS" , Text = " Mississippi" },
59- new Option <string > { Value = " MO" , Text = " Missouri" },
60- new Option <string > { Value = " MT" , Text = " Montana" },
61- new Option <string > { Value = " NE" , Text = " Nebraska" },
62- new Option <string > { Value = " NV" , Text = " Nevada" },
63- new Option <string > { Value = " NH" , Text = " New Hampshire" },
64- new Option <string > { Value = " NJ" , Text = " New Jersey" },
65- new Option <string > { Value = " NM" , Text = " New Mexico" },
66- new Option <string > { Value = " NY" , Text = " New York" },
67- new Option <string > { Value = " NC" , Text = " North Carolina" },
68- new Option <string > { Value = " ND" , Text = " North Dakota" },
69- new Option <string > { Value = " OH" , Text = " Ohio" },
70- new Option <string > { Value = " OK" , Text = " Oklahoma" },
71- new Option <string > { Value = " OR" , Text = " Oregon" },
72- new Option <string > { Value = " PA" , Text = " Pennsylvania" }
73- };
35+ var selectedValue = selectedOption ? .Value ! ;
36+
37+ await OnUserOptionSelected .InvokeAsync (selectedValue );
38+ }
7439}
0 commit comments