Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an updatestatus on the index page #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions App/StackExchange.DataExplorer/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public ActionResult Index()

ViewData["LastUpdate"] = Current.DB.Query<DateTime?>("SELECT MAX(LastPost) FROM Sites").FirstOrDefault();

// sp_Refresh_Database https://gist.github.com/NickCraver/f009ab6e0d6b85ae54f6
// will create a [name]_Temp database when the restore starts
// we rely on that implementation detail to determine if
// a restore of data is in progress
ViewData["UpdateStatus"] = Current.DB.Query<string>(@"SELECT TOP 1 CASE WHEN [name] LIKE '%_Temp' THEN 'restoring' ELSE NULL END [status]
FROM [sys].[databases]
ORDER BY [create_date] DESC").FirstOrDefault();

return View(sites);
}

Expand Down
2 changes: 1 addition & 1 deletion App/StackExchange.DataExplorer/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@{this.SetPageTitle("Stack Exchange Data Explorer");}
<div id="mainbar-full">
<div class="info-wrapper">
<span class="info">Data updated @((ViewData["LastUpdate"] as DateTime?).ToRelativeTime())</span>
<span class="info">Data updated @((ViewData["LastUpdate"] as DateTime?).ToRelativeTime()) <i>@(ViewData["UpdateStatus"])</i></span>
</div>
<ul class="site-list">
@foreach (Site site in Model)
Expand Down