private async Task OpenMetadataDetailsModalTemplate(Metadata metadata) { var templateOptions = new ViewModels.MetadataDetailsViewModel { Metadata = metadata }; var modalConfig = new ModalOptions(); modalConfig.Title = "Metadata Preview"; modalConfig.Width = "90%"; modalConfig.DestroyOnClose = true; modalConfig.OnCancel = async(e) => { await metadataDetailsModalRef.CloseAsync(); }; modalConfig.OnOk = async(e) => { await metadataDetailsModalRef.CloseAsync(); }; modalConfig.AfterClose = () => { InvokeAsync(StateHasChanged); return(Task.CompletedTask); }; metadataDetailsModalRef = await ModalService .CreateModalAsync <MetadataDetailsModal, ViewModels.MetadataDetailsViewModel>( modalConfig, templateOptions); }
private async Task OpenVariableModalTemplate(Variable variable) { var templateOptions = new ViewModels.VariableModalViewModel { Variable = new Variable() { Name = variable.Name, Description = variable.Description, Units = variable.Units, Height = variable.Height, Tags = variable.Tags, Methods = variable.Methods, QCApplied = variable.QCApplied, ProcessingLevel = variable.ProcessingLevel }, ProcessingLevels = State.AppConfig.ProcessingLevels, QCFlags = State.AppConfig.QCTags, Tags = State.AppConfig.Tags, SelectedTags = variable.Tags ??= new List <string>(), SelectedQCApplied = variable.QCApplied ??= new List <string>() }; var modalConfig = new ModalOptions(); modalConfig.Title = "Variable"; modalConfig.Width = "70%"; modalConfig.OnCancel = async(e) => { await variableModalRef.CloseAsync(); }; modalConfig.OnOk = async(e) => { variable.Name = templateOptions.Variable.Name; variable.Description = templateOptions.Variable.Description; variable.Units = templateOptions.Variable.Units; variable.Height = templateOptions.Variable.Height; variable.Tags = templateOptions.SelectedTags.ToList(); variable.Methods = templateOptions.Variable.Methods; variable.QCApplied = templateOptions.SelectedQCApplied.ToList(); variable.ProcessingLevel = templateOptions.Variable.ProcessingLevel; await variableModalRef.CloseAsync(); }; modalConfig.AfterClose = () => { RemoveBlankVariables(); InvokeAsync(StateHasChanged); return(Task.CompletedTask); }; variableModalRef = await ModalService .CreateModalAsync <VariableModal, ViewModels.VariableModalViewModel>( modalConfig, templateOptions); }
private async Task OpenMetadataDetailsModalTemplate(CatalogVariable catalogVariable) { var metadata = State.Catalog.Metadatas.FirstOrDefault(m => (m.Dataset.Zone == catalogVariable.Zone) && (m.Dataset.Project == catalogVariable.ProjectName) && (m.Dataset.Name == catalogVariable.DatasetName)); if (metadata == null) { return; } var templateOptions = new ViewModels.MetadataDetailsViewModel { Metadata = metadata }; var modalConfig = new ModalOptions(); modalConfig.Title = "Metadata Preview"; modalConfig.Width = "90%"; modalConfig.DestroyOnClose = true; modalConfig.OnCancel = async(e) => { await metadataDetailsModalRef.CloseAsync(); }; modalConfig.OnOk = async(e) => { await metadataDetailsModalRef.CloseAsync(); }; modalConfig.AfterClose = () => { InvokeAsync(StateHasChanged); return(Task.CompletedTask); }; metadataDetailsModalRef = await ModalService .CreateModalAsync <MetadataDetailsModal, ViewModels.MetadataDetailsViewModel>( modalConfig, templateOptions); }
private async Task OpenPersonModalTemplate(Person contact) { var templateOptions = new ViewModels.PersonModalViewModel { Person = new Person() { Name = contact.Name, Email = contact.Email, Role = contact.Role }, Roles = State.AppConfig.Roles }; var modalConfig = new ModalOptions(); modalConfig.Title = "Contact"; modalConfig.OnCancel = async(e) => { await personModalRef.CloseAsync(); }; modalConfig.OnOk = async(e) => { contact.Name = templateOptions.Person.Name; contact.Email = templateOptions.Person.Email; contact.Role = templateOptions.Person.Role; await personModalRef.CloseAsync(); }; modalConfig.AfterClose = () => { RemoveBlankContacts(); InvokeAsync(StateHasChanged); return(Task.CompletedTask); }; personModalRef = await ModalService .CreateModalAsync <PersonModal, ViewModels.PersonModalViewModel>( modalConfig, templateOptions); }