﻿@using StackExchange.Opserver.Data.SQL
@{
    Layout = null;
    var clusters = SQLModule.Clusters;
    var standalone = SQLModule.StandaloneInstances;
}
@helper RenderInstances(IEnumerable<SQLInstance> instances)
{
    foreach (var i in instances)
    {
        var props = i.ServerProperties.SafeData(true);
        <a class="list-group-item" href="?node=@i.Name.UrlEncode()">
            @i.IconSpan() @i.Name
            <span class="badge" title="@props.FullVersion">@props.MajorVersion</span>
        </a>
    }
}
<h5 class="page-header">Please select a SQL instance.</h5>
<div class="row">
    @foreach (var c in clusters)
    {
        <div class="col-md-3">
            <div class="panel panel-default">
                <div class="panel-heading">@c.Name</div>
                <div class="panel-body small list-group">
                    @RenderInstances(c.Nodes)
                </div>
            </div>
        </div>
    }
    @if (standalone.Any())
    {
        <div class="col-md-3">
            <div class="panel panel-default">
                <div class="panel-heading">Standalone</div>
                <div class="panel-body small list-group">
                    @RenderInstances(standalone)
                </div>
            </div>
        </div>
    }
</div>
﻿@using StackExchange.Opserver.Data.SQL
@{
    Layout = null;
    var clusters = SQLModule.Clusters;
    var standalone = SQLModule.StandaloneInstances;
}
@helper RenderInstances(IEnumerable<SQLInstance> instances, bool showVersion)
{
    foreach (var i in instances)
    {
        var props = i.ServerProperties.SafeData(true);
        <a class="list-group-item" href="?node=@i.Name.UrlEncode()">
            @i.IconSpan() @i.Name
            <span class="badge" title="@props.FullVersion">
                @props.MajorVersion
                @if (showVersion)
                {
                    <span class="small"> (@i.Version.ToString())</span>
                }
            </span>
        </a>
    }
}
@helper RenderList(IEnumerable<SQLInstance> instances, string title)
{
    var versions = instances.Select(n => n.Version).Distinct().ToList();
    <div class="col-md-3">
        <div class="panel panel-default">
            <div class="panel-heading">
                @title
                @if (versions.Count == 1)
                {
                    <span class="small text-muted">(Version @versions[0].ToString())</span>
                }
            </div>
            <div class="panel-body small list-group">
                @RenderInstances(instances, versions.Count > 1)
            </div>
        </div>
    </div>
}
<h5 class="page-header">Please select a SQL instance.</h5>
<div class="row">
    @foreach (var c in clusters)
    {
        @RenderList(c.Nodes, c.Name)
    }
    @if (standalone.Any())
    {
        @RenderList(standalone, "Standalone")
    }
</div>
Add version to SQL instance selector screen
Add version to SQL instance selector screen

This selector now doubles as a dashboard for checking versions across
your infrastructure.
