Files
Disco/Disco.Web/Areas/Config/Views/SystemConfig/Index.cshtml
T
Gary Sharp e984221c95 Bug Fix: User Attachment Refs, AD Group Domain
User Attachments updated in the DataStore to reflect new UserId (which
includes the domain); AD Groups were using DnsName instead of
NetBiosName.
2014-04-11 19:56:17 +10:00

520 lines
22 KiB
Plaintext

@model Disco.Web.Areas.Config.Models.SystemConfig.IndexModel
@{
Authorization.Require(Claims.Config.System.Show);
var canConfigProxy = Authorization.Has(Claims.Config.System.ConfigureProxy);
var canConfigAD = Authorization.Has(Claims.Config.System.ConfigureActiveDirectory);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "System");
if (canConfigAD)
{
Html.BundleDeferred("~/Style/Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
}
}
<div class="form" style="width: 450px">
<table>
<tr>
<th style="width: 135px">Disco Version:
</th>
<td>
<div>
<code>@Model.DiscoVersion.ToString(4)</code>
</div>
<div class="smallMessage" title="@Model.DiscoVersionBuilt.ToFullDateTime()">
Built @CommonHelpers.FriendlyDate(Model.DiscoVersionBuilt, "Unknown")
</div>
</td>
</tr>
<tr>
<th style="width: 135px">Database Connection:
</th>
<td>
<table class="sub">
<tr>
<th>Server:</th>
<td><span class="code">@Model.DatabaseServer</span></td>
</tr>
<tr>
<th>Database:</th>
<td><span class="code">@Model.DatabaseName</span></td>
</tr>
<tr>
<th>Authentication:</th>
<td>@Model.DatabaseAuthentication</td>
</tr>
@{if (Model.DatabaseSqlAuthUsername != null)
{
<tr>
<th>SQL&nbsp;User:</th>
<td><span class="code">@Model.DatabaseSqlAuthUsername</span></td>
</tr>
}
}
</table>
</td>
</tr>
<tr>
<th style="width: 135px">Data Store Location:
</th>
<td>
<span class="code">@Model.DataStoreLocation</span>
</td>
</tr>
</table>
</div>
<div class="form" style="width: 450px; margin-top: 15px;">
<h2>Updates</h2>
<table>
@{
if (Model.UpdateLatestResponse == null)
{
<tr>
<th style="width: 135px">Last Check:
</th>
<td>
<div class="error"><i class="fa fa-exclamation-circle fa-lg"></i>&nbsp;Never</div>
</td>
</tr>
}
else
{
<tr>
<th style="width: 135px">Last Run:
</th>
<td>
<span>@CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.ResponseTimestamp)</span>
</td>
</tr>
if (Model.UpdateLatestResponse.IsUpdatable(typeof(DiscoApplication).Assembly.GetName().Version))
{
<tr>
<th style="width: 135px">Update Available:
</th>
<td>
<div>
<i class="fa fa-info-circle fa-lg information"></i>&nbsp;Version @(Model.UpdateLatestResponse.Version) is available
</div>
<div class="smallMessage">
[Released @(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.VersionReleasedTimestamp))]
</div>
<div class="smallMessage">@(new HtmlString(Model.UpdateLatestResponse.Blurb))</div>
<a href="@(Model.UpdateLatestResponse.UrlLink)" target="_blank">Download Now</a>
</td>
</tr>
}
else
{
<tr>
<th style="width: 135px">Status:
</th>
<td>
<i class="fa fa-check-square fa-lg success"></i>&nbsp;<span>The latest version is installed</span>
</td>
</tr>
}
}
}
<tr>
<th style="width: 135px">Check for Update:</th>
<td>
@{
if (Model.UpdateRunningStatus == null)
{
<span>@Html.ActionLinkSmallButton("Check Now", MVC.API.System.UpdateCheck())</span>
<span class="smallMessage">[Will run automatically <strong>@CommonHelpers.FriendlyDate(Model.UpdateNextScheduled, "Unknown")</strong>]</span>
}
else
{
<span>@Html.ActionLink("View Status", MVC.Config.Logging.TaskStatus(Model.UpdateRunningStatus.SessionId))</span>
<span class="smallMessage">[Running Now]</span>
}
}
@if (Model.UpdateBetaDeployment)
{
<hr />
<span class="alert"><i class="fa fa-info-circle fa-lg"></i>&nbsp;Beta Deployment</span>
}
</td>
</tr>
</table>
</div>
<div class="form" style="width: 450px; margin-top: 15px;">
<h2>Active Directory</h2>
<table>
<tr>
<th style="width: 135px">Primary Domain:
</th>
<td>
<code><strong>@Model.ADPrimaryDomain.DnsName</strong> <span>[@Model.ADPrimaryDomain.NetBiosName]</span></code>
</td>
</tr>
<tr>
<th style="width: 135px">Additional Domains:
</th>
<td>
@if (Model.ADAdditionalDomains.Count > 0)
{
var adDomainFirst = Model.ADAdditionalDomains.First();
<code>@adDomainFirst.DnsName <span>[@adDomainFirst.NetBiosName]</span></code>
foreach (var adDomain in Model.ADAdditionalDomains.Skip(1))
{
<hr />
<div>
<code>@adDomain.DnsName <span>[@adDomain.NetBiosName]</span></code>
</div>
}
}
else
{
<span class="smallMessage">&lt;None&gt;</span>
}
</td>
</tr>
<tr>
<th style="width: 135px">Site:
</th>
<td>
<code><strong>@Model.ADSite.Name</strong></code>
<hr />
<div>
@if (Model.ADSiteServers.Count > 0)
{
<span>Servers:</span>
<ul class="none">
@foreach (var siteServer in Model.ADSiteServers)
{
var server = siteServer.Item1;
var reachable = siteServer.Item2;
<li>
<i class="fa @(reachable ? "fa-check success" : "fa-exclamation warning") fa-fw fa-lg" title="@(reachable ? "Reachable" : "Unavailable")"></i>&nbsp;<code>@(server.Name)</code>
</li>
}
</ul>
}
else
{
<div class="error">
<i class="fa fa-exclamation-circle fa-lg"></i>&nbsp;<span>None Found</span>
</div>
}
</div>
</td>
</tr>
<tr>
<th style="width: 135px">Forest:
</th>
<td>
@if (Model.ADForestServers == null)
{
<div>
@Html.CheckBoxFor(m => m.ADSearchEntireForest, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchEntireForest)
</div>
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-info-circle information"></i>&nbsp;Forest servers are currently being retrieved.
<br />Try refreshing this page in a moment.
</div>
}
else
{
if (canConfigAD)
{
var canSearchEntireForest = (Model.ADForestServers.Count <= Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxForestServerSearch);
<div>
@if (!canSearchEntireForest)
{
@Html.CheckBoxFor(m => m.ADSearchEntireForest, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchEntireForest)
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-exclamation-circle warning"></i>&nbsp;Disco will not search entire forests which consist of more than @(Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxForestServerSearch) servers. Only servers within this site will be searched.
</div>
}
else
{
@Html.CheckBoxFor(m => m.ADSearchEntireForest) @Html.LabelFor(m => m.ADSearchEntireForest) @AjaxHelpers.AjaxLoader()
<div class="smallMessage">
If this setting is enabled, Disco will search all servers within the forest rather than only servers within this site.
</div>
<script>
$(function () {
document.DiscoFunctions.PropertyChangeHelper($('#ADSearchEntireForest'), null, '@(Url.Action(MVC.API.System.UpdateActiveDirectorySearchEntireForest()))', 'SearchEntireForest');
});
</script>
}
</div>
}
else
{
<div>
@Html.CheckBoxFor(m => m.ADSearchEntireForest, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchEntireForest)
<div class="smallMessage">
If this setting is enabled, Disco will search all servers within the forest rather than only servers within this site.
</div>
</div>
}
<div>
<hr />
<span>Servers:</span>
<ul id="Config_System_AD_ForestServers">
@foreach (var server in Model.ADForestServers.OrderBy(s => s))
{
<li><code>@server</code> @(Model.ADSiteServers.Count(ss => ss.Item1.Name.Equals(server, StringComparison.InvariantCultureIgnoreCase)) > 0 ? "[Site Server]" : null)</li>
}
</ul>
<script>
$(function () {
var toManyServers = 5;
var ul = $('#Config_System_AD_ForestServers');
var ulLi = ul.find('li');
if (ulLi.length > toManyServers) {
var liMore = $('<li>').append(
$('<a>').attr('href', '#')
.text('Show All Servers (' + (ulLi.length - toManyServers) + ' more)')
.click(function () {
$(this).closest('li').remove();
ul.find('li').show();
return false;
}))
.insertAfter(ulLi[(toManyServers - 1)]);
ulLi.each(function (i) {
if (i > (toManyServers - 1))
$(this).hide();
});
}
});
</script>
</div>
}
</td>
</tr>
<tr>
<th style="width: 135px">Search Scope:
</th>
<td>
@if (Model.ADSearchContainers != null && Model.ADSearchContainers.Count > 0)
{
<div>Searching is restricted to the following Organisational&nbsp;Unit containers</div>
<ul id="Config_System_AD_SearchScope_DistinguishedNames">
@foreach (var adContainer in Model.ADSearchContainers)
{
<li data-distinguishedname="@adContainer.Item1"><code>@adContainer.Item3</code></li>
}
</ul>
}
else
{
<div>No restrictions are in effect.</div>
<div class="smallMessage">When searching, the entire domain will be queried. This is suitable for most single-domain deployments.</div>
}
@if (canConfigAD)
{
<div>
<hr />
<a id="Config_System_AD_SearchScope_Update" href="#" class="button small">Update</a>
</div>
<div id="Config_System_AD_SearchScope_Dialog" class="dialog" title="Search Scope">
<div id="Config_System_AD_SearchScope_Tree" class="organisationalUnitTree">
</div>
@using (Html.BeginForm(MVC.API.System.UpdateActiveDirectorySearchScope(null, redirect: true)))
{
}
</div>
<script>
$(function () {
var $dialog, $tree, tree, distinguishedNames;
function expandNodeTree(node) {
var parent = node.parent;
if (parent) {
expandNodeTree(parent);
if (!parent.isExpanded())
parent.setExpanded(true, { noAnimation: true, noEvents: false });
}
}
function selectDistinguishedNames() {
if (!distinguishedNames) {
distinguishedNames = $('#Config_System_AD_SearchScope_DistinguishedNames')
.find('li')
.map(function () { return $(this).attr('data-distinguishedname'); }).get();
}
if (tree) {
tree.visit(function (node) {
if ($.inArray(node.key, distinguishedNames) >= 0) {
node.setSelected(true);
expandNodeTree(node);
} else if (node.isSelected()) {
node.setSelected(false);
}
});
}
}
function update() {
if (!$dialog) {
$dialog = $('#Config_System_AD_SearchScope_Dialog').dialog({
autoOpen: false,
buttons: null,
draggable: false,
modal: true,
resizable: false,
width: 500,
height: 500
});
$tree = $('#Config_System_AD_SearchScope_Tree');
$dialog.css('overflow', 'visible');
$tree.css('height', '100%');
$.getJSON('@(Url.Action(MVC.API.System.DomainOrganisationalUnits()))', null, function (data) {
tree = $tree.fancytree({
source: data,
checkbox: true,
selectMode: 2,
keyboard: false,
fx: null
}).fancytree('getTree');
tree.$container.css('position', 'relative');
// Set Buttons
$dialog.dialog('option', 'buttons', {
'Search Entire Forest': function () {
var $this = $(this);
$this.css('overflow', 'hidden');
$this.dialog("disable");
$this.dialog("option", "buttons", null);
var $form = $dialog.find('form');
$form.submit();
},
'Save': function () {
var $this = $(this);
$this.css('overflow', 'hidden');
$this.dialog("disable");
$this.dialog("option", "buttons", null);
var nodes = tree.getSelectedNodes();
var $form = $dialog.find('form');
$.each(nodes, function (i, node) {
$('<input>').attr({ 'type': 'hidden', 'name': 'Containers', 'value': node.key }).appendTo($form);
});
$form.submit();
}
});
// Select & Expand
selectDistinguishedNames();
tree.options.fx = { height: "toggle", duration: 200 };
});
}
selectDistinguishedNames();
$dialog.dialog('open');
return false;
}
$('#Config_System_AD_SearchScope_Update').click(update);
});
</script>
}
</td>
</tr>
</table>
</div>
@if (canConfigProxy)
{
using (Html.BeginForm(MVC.API.System.UpdateProxySettings()))
{
<div class="form" style="width: 450px; margin-top: 15px;">
<h2>Proxy Settings</h2>
<table>
<tr>
<th style="width: 135px">Address:
</th>
<td>
@Html.EditorFor(m => m.ProxyAddress)<br />
@Html.ValidationMessageFor(m => m.ProxyAddress)
</td>
</tr>
<tr>
<th style="width: 135px">Port:
</th>
<td>
@Html.EditorFor(m => m.ProxyPort)<br />
@Html.ValidationMessageFor(m => m.ProxyPort)
</td>
</tr>
<tr>
<th style="width: 135px">Username:
</th>
<td>
@Html.EditorFor(m => m.ProxyUsername)<br />
@Html.ValidationMessageFor(m => m.ProxyUsername)
</td>
</tr>
<tr>
<th style="width: 135px">Password:
</th>
<td>
@Html.EditorFor(m => m.ProxyPassword)<br />
@Html.ValidationMessageFor(m => m.ProxyPassword)
</td>
</tr>
<tr>
<th style="width: 135px">&nbsp;
</th>
<td>
<input type="submit" class="button small" value="Save Proxy Settings" />
</td>
</tr>
</table>
</div>
}
}
else
{
<div class="form" style="width: 450px; margin-top: 15px;">
<h2>Proxy Settings</h2>
<table>
<tr>
<th style="width: 135px">Address:
</th>
<td>
@Html.DisplayFor(m => m.ProxyAddress)
</td>
</tr>
<tr>
<th style="width: 135px">Port:
</th>
<td>
@Html.DisplayFor(m => m.ProxyPort)
</td>
</tr>
<tr>
<th style="width: 135px">Username:
</th>
<td>
@Html.DisplayFor(m => m.ProxyUsername)
</td>
</tr>
<tr>
<th style="width: 135px">Password:
</th>
<td>********
</td>
</tr>
</table>
</div>
}
<div class="actionBar">
@Html.ActionLinkButton("Update Device Last Network Logons", MVC.API.System.UpdateLastNetworkLogonDates())
</div>