@using Zap.BI.Portal.Helpers
@using Zap.BI.Portal.Models
@using Zap.BI.Portal.Pages.Diagnostics
@model UpgradeViewModel
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <base href="~/" />
    <title>@DiagnosticText.UpgradeInProgressHeading</title>
    <meta http-equiv="X-UA-Compatible" content="IE=100" />
    <link href="@Url.Action("Css", "Startup", new { hash = Model.AllCssHash })" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        window.ctor = function (dependencies, constructor) {
            return constructor;
        };
    </script>
    <script src="@Url.Action("ClientObjects", "Upgrade", new { hash = Model.ClientObjectsScriptsHash })" type="text/javascript"></script>
    <script src="@Url.Action("File", "Content", new { path = "BI/Portal/dist/upgrade.js" })" type="text/javascript"></script>
</head>
<body>

    <div class="l-admin upgrade-container">
        <div class="l-admin-header">@Html.Partial("AdminHeader", Model.HeaderModel)</div>
        <div class="l-admin-body">
            <div>
                <div class="admin-form ui-fixed-width-wide">
                    <progress class="upgrade-progress" max="100" value="0"></progress>
                    <div class="upgrade-messages">
                        <span class="upgrade-progressMessage ui-subtitle"></span>
                        <span class="upgrade-redirectMessage ui-subtitle">@DiagnosticText.Message_LoadingApplication</span>
                    </div>
                </div>
                <div class="admin-form buttonContainer upgrade-buttonContainer is-admin-form-hidden">
                    <a class="upgrade-reportLink button-flat" href="">@DiagnosticText.Label_ViewUpgradeReport</a>
                    <a class="upgrade-continueLink button-raised button-primary" href="@(Model.ReturnUrl ?? "")">@DiagnosticText.Label_Continue</a>
                    <a class="upgrade-retryLink button-raised button-primary" href="@(Model.ReturnUrl ?? "")">@DiagnosticText.Troubleshoot_aspx_ButtonLabel_Retry</a>
                </div>
            </div>
        </div>
    </div>
    <script>
        (function () {
            var returnUrl = @Html.RawSanitizedScript(Json.Encode(Model.ReturnUrl));
            var initialProgress = @Html.RawSanitizedScript(Json.Encode(Model.InitialProgress));
            var getUpgradeStatusUrl = '@Url.Action("ApplicationUpgradeStatus", "Startup")';
            var eventTypes = {
                upgradeStatusUpdated: '@typeof(UpgradeStatusMessage).FullName',
                upgradeFailed: '@typeof(UpgradeFailedMessage).FullName',
                applicationReady: '@typeof(ApplicationReadyMessage).FullName'
            };
            window.monitorUpgrade(returnUrl, initialProgress, getUpgradeStatusUrl, eventTypes);
        })();
    </script>
</body>
</html>
