File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1- @using System .Text .Json
1+ @using System .Text .Json
22@using FWO .Ui .Pages .NetworkModelling
33
44@page " /settings/modelling"
1515@( userConfig .GetText (" U5322" ))
1616<hr />
1717
18- @if (configData != null && initComplete )
18+ @if (configData != null && initComplete )
1919{
2020 <form onsubmit =" return false" >
2121 <button type =" button" class =" btn btn-sm btn-dark ms-5" data-toggle =" tooltip" title =" @(userConfig.PureLine(" H5602 " ))"
8282 <div class =" form-group row mt-4" data-toggle =" tooltip" title =" @(userConfig.PureLine(" H9055 " ))" >
8383 <label class =" col-form-label col-sm-4" >@userConfig.GetText( " import_app_server" ): </label >
8484 <div class =" row col-sm-6" >
85- <CSVFileUpload AuthorizedRoles =" @Roles.Admin" OnAddAppServerError =" OnAddAppServerError" OnAddAppServerWarning =" OnAddAppServerWarning" OnImportSuccess =" OnAppServerImportSuccess" ></CSVFileUpload >
85+ <CSVFileUpload SupportedFileFormats = " .csv " AuthorizedRoles =" @Roles.Admin" OnAddAppServerError =" OnAddAppServerError" OnAddAppServerWarning =" OnAddAppServerWarning" OnImportSuccess =" OnAppServerImportSuccess" ></CSVFileUpload >
8686 </div >
8787 </div >
8888 <hr />
Original file line number Diff line number Diff line change 1- @using FWO .Ui .Data
1+ @using FWO .Ui .Data
22@using FWO .Data .Modelling
33@using NetTools
44@using System .Net
1515 @( ModellingHandlerBase .DisplayButton (userConfig , " import" , Icons .Add ))
1616 <span class =" ms-2" >@( userConfig .GetText (" add" )) </span >
1717 </label >
18- <InputFile id =" fileUpload" hidden accept =" .csv " OnChange =" @SingleUpload" />
18+ <InputFile id =" fileUpload" hidden accept =" @SupportedFileFormats " OnChange =" @SingleUpload" />
1919 @if (InputFileChangeEventArgs is not null && ! string .IsNullOrEmpty (InputFileChangeEventArgs .File .Name ))
2020 {
2121 <label class =" d-inline" >@InputFileChangeEventArgs.File.Name </label >
7474 [Parameter ]
7575 public EventCallback OnImportSuccess { get ; set ; }
7676
77+ /// <summary >
78+ /// Defines a set of supported file formats.
79+ /// </summary >
80+ [Parameter , EditorRequired ]
81+ public string SupportedFileFormats { get ; set ; } = " " ;
82+
7783 private List <AppServerType > AppServerTypes = new ();
7884
7985 protected override void OnParametersSet ()
8389 throw new UnauthorizedAccessException ($" Parameter {nameof (AuthorizedRoles )} cannot be empty!" );
8490 }
8591
92+ if (string .IsNullOrWhiteSpace (SupportedFileFormats ))
93+ {
94+ throw new ArgumentNullException ($" Parameter {nameof (SupportedFileFormats )} cannot be empty!" );
95+ }
96+
8697 base .OnParametersSet ();
8798 }
8899
You can’t perform that action at this time.
0 commit comments