public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { if (!(_html is IViewContextAware htmlHelper)) { throw new Exception("Uncontextualizable IHtmlHelper."); } htmlHelper.Contextualize(ViewContext); var viewModel = new VercelLatestDeploymentViewModel { InitializationStatus = _deploymentService.GetInitializationStatus(), }; if ( viewModel.InitializationStatus.IsReadConfigured ) { try { viewModel.LatestDeployment = await _deploymentService.GetLatestProductionDeploymentAsync(); viewModel.IsWaitingForDeployment = _deploymentStatusService.IsWaitingForDeployment(); } catch (Exception e) { _logger.LogWarning(e, "Couldn't get latest production deployment."); } } var renderedHtml = await _html.PartialAsync("VercelLatestDeployment", viewModel); output.TagName = null; output.Content.SetHtmlContent(renderedHtml); }
public async Task <IActionResult> Index() { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageDeploymentSettings)) { return(Forbid()); } IEnumerable <Deployment> deployments = null; try { deployments = await _deploymentService.GetDeploymentsAsync(); } catch (Exception e) { _logger.LogError(e, "Could not get latest Vercel Deployments."); } var model = new VercelDeploymentsAdminIndexViewModel { InitializationStatus = _deploymentService.GetInitializationStatus(), Deployments = deployments, }; return(View(model)); }