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

Tenants UI #8015

Merged
merged 22 commits into from
Dec 17, 2020
Merged
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 98 additions & 85 deletions src/OrchardCore.Modules/OrchardCore.Tenants/Views/Admin/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,11 @@
<input type="submit" name="submit.Filter" id="submitFilter" class="d-none" />
<input type="submit" name="submit.BulkAction" class="d-none" />
<input name="BulkAction" type="hidden" />

<div class="card mb-3 position-sticky action-bar">
<div class="card-body bg-primary p-3">
<div class="form-group mb-n1">
<div class="input-group input-group-sm w-lg-50 d-inline-flex has-filter">
<div class="input-group-prepend">
<button class="btn btn-sm dropdown-toggle" style="border:1px solid lightgrey" type="button" data-toggle="dropdown" id="filter-dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-filter" title="@T["Filters"]"></i>
</button>
<div class="dropdown-menu @if(CultureInfo.CurrentUICulture.IsRightToLeft()){<text>dropdown-menu-right</text>}" aria-labelledby="filter-dropdown">
<a class="dropdown-item" href="?Options.Filter=Running">@T["Only running tenants"]</a>
<a class="dropdown-item" href="?Options.Filter=Disabled">@T["Only disabled tenants"]</a>
<a class="dropdown-item" href="?Options.Filter=Uninitialized">@T["Only uninitialized tenants"]</a>
</div>
</div>
<div class="input-group input-group-sm w-lg-50 d-inline-flex has-search">
<i class="fa fa-search form-control-feedback"></i>
<input id="search-box" asp-for="Options.Search" class="form-control" placeholder="@T["Search"]" type="search" autofocus />
</div>
Expand All @@ -103,87 +93,110 @@
</div>
</div>
<ul class="list-group with-checkbox">
@if (Model.ShellSettingsEntries.Count > 0)
{
<li class="list-group-item bg-primary">
<div class="row">
<div class="form-group col mb-n1 text-nowrap">
<div class="custom-control custom-checkbox mt-2 mr-n2">
<input type="checkbox" class="custom-control-input" id="select-all">
<label class="custom-control-label" for="select-all" id="select-all-label" title="@T["Select All"]"></label>
<label id="items" for="select-all">@T.Plural(Model.ShellSettingsEntries.Count, "1 item", "{0} items")<span class="text-muted" title="@T["Items {0} to {1}", startIndex, endIndex]">@T.Plural((int)Model.Pager.TotalItemCount, " / {0} item in total", " / {0} items in total")</span></label>
<label id="selected-items" class="text-muted" for="select-all"></label>
</div>
<li class="list-group-item bg-primary">
<div class="row">
<div class="form-group col mb-n1 text-nowrap">
<div class="custom-control custom-checkbox mt-2 mr-n2">
<input type="checkbox" class="custom-control-input" id="select-all">
<label class="custom-control-label" for="select-all" id="select-all-label" title="@T["Select All"]"></label>
<label id="items" for="select-all">@T.Plural(Model.ShellSettingsEntries.Count, "1 item", "{0} items")<span class="text-muted" title="@T["Items {0} to {1}", startIndex, endIndex]">@T.Plural((int)Model.Pager.TotalItemCount, " / {0} item in total", " / {0} items in total")</span></label>
<label id="selected-items" class="text-muted" for="select-all"></label>
</div>
<div class="form-group col-2 mb-n1" style="display:none" id="actions">
<span class="dropdown float-right mt-1">
<button class="btn btn-sm btn-light dropdown-toggle" type="button" id="bulk-action-menu-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@T["Actions"]
</button>
<span class="dropdown-menu dropdown-menu-right" aria-labelledby="bulk-action-menu-button">
@foreach (var item in Model.Options.TenantsBulkAction)
{
<a class="dropdown-item" href="javascript:void(0)" data-action="@item.Value" data-title="@T["Bulk Action"]" data-message="@T["Are you sure you want to {0} these items?", @item.Text.ToLower()]">@item.Text</a>
}
</span>
</div>
<div class="form-group col-2 mb-n1" style="display:none" id="actions">
<span class="dropdown float-right mt-1">
<button class="btn btn-sm btn-light dropdown-toggle" type="button" id="bulk-action-menu-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@T["Actions"]
</button>
<span class="dropdown-menu dropdown-menu-right" aria-labelledby="bulk-action-menu-button">
@foreach (var item in Model.Options.TenantsBulkAction)
{
<a class="dropdown-item" href="javascript:void(0)" data-action="@item.Value" data-title="@T["Bulk Action"]" data-message="@T["Are you sure you want to {0} these items?", @item.Text.ToLower()]">@item.Text</a>
}
</span>
</div>
<div class="form-group col mb-n1 filter">
<div class="btn-group float-right mt-1">
<select asp-for="Options.Filter" asp-items="@Model.Options.TenantsStates" class="selectpicker show-tick mr-2" data-header="@T["Filter by state"]" data-width="fit" data-selected-text-format="static" data-dropdown-align-right="true" title="@T["State"]" data-style="btn-sm"></select>
<select asp-for="Options.OrderBy" asp-items="@Model.Options.TenantsSorts" class="selectpicker show-tick" data-header="@T["Sort by"]" data-width="fit" data-selected-text-format="static" data-dropdown-align-right="true" title="@T["Sort"]" data-style="btn-sm"></select>
</div>
</span>
</div>
<div class="form-group col mb-n1 filter">
<div class="btn-group float-right mt-1">
<select asp-for="Options.Filter" asp-items="@Model.Options.TenantsStates" class="selectpicker show-tick mr-2" data-header="@T["Filter by state"]" data-width="fit" data-selected-text-format="static" data-dropdown-align-right="true" title="@T["State"]" data-style="btn-sm"></select>
<select asp-for="Options.OrderBy" asp-items="@Model.Options.TenantsSorts" class="selectpicker show-tick" data-header="@T["Sort by"]" data-width="fit" data-selected-text-format="static" data-dropdown-align-right="true" title="@T["Sort"]" data-style="btn-sm"></select>
</div>
</div>
</li>
</div>
</li>
@if (Model.ShellSettingsEntries.Count > 0)
{
@foreach (var entry in Model.ShellSettingsEntries)
{
<li class="list-group-item">
<div class="custom-control custom-checkbox float-left">
<input type="checkbox" class="custom-control-input" value="@entry.Name" name="tenantNames" id="tenantNames-@entry.Name">
<label class="custom-control-label" for="tenantNames-@entry.Name"></label>
</div>
<div class="properties">
<div class="related">
<a asp-action="Edit" asp-route-id="@entry.Name" class="btn btn-primary btn-sm">@T["Edit"]</a>
@if (!entry.IsDefaultTenant && entry.ShellSettings.State == TenantState.Running)
{
<a asp-action="Disable" asp-route-id="@entry.Name" class="btn btn-danger btn-sm" itemprop="UnsafeUrl">@T["Disable"]</a>
}
@if (entry.ShellSettings.State == TenantState.Disabled)
{
<a asp-action="Enable" asp-route-id="@entry.Name" class="btn btn-success btn-sm" itemprop="UnsafeUrl">@T["Enable"]</a>
}
@if (entry.ShellSettings.State == TenantState.Uninitialized)
{
<a class="btn btn-info btn-sm" id="btn-setup-@entry.Name" href="@GetEncodedUrl(entry, originalPathBase)">@T["Setup"]</a>
}
<a asp-action="Reload" asp-route-id="@entry.Name" class="btn btn-secondary btn-sm" itemprop="UnsafeUrl">@T["Reload"]</a>
<div class="row">
<div class="col-xl-6 col-sm-12 title">
Skrypt marked this conversation as resolved.
Show resolved Hide resolved
<div class="custom-control custom-checkbox float-left">
<input type="checkbox" class="custom-control-input" value="@entry.Name" name="tenantNames" id="tenantNames-@entry.Name">
<label class="custom-control-label" for="tenantNames-@entry.Name"></label>
</div>
<div class="d-inline">
<a href="@GetEncodedUrl(entry, originalPathBase)">@entry.Name</a>
@if (!string.IsNullOrEmpty(entry.ShellSettings["DatabaseProvider"]))
{
<span class="badge badge-light font-weight-normal"><i class="fa fa-database text-info"></i> @entry.ShellSettings["DatabaseProvider"]</span>
}
@if (!string.IsNullOrEmpty(entry.ShellSettings["RecipeName"]))
{
<span class="badge badge-light font-weight-normal"><i class="fa fa-image text-info"></i> @entry.ShellSettings["RecipeName"]</span>
}
<a href="@FullRequestPath&Options.Filter=@entry.ShellSettings.State">
@switch (entry.ShellSettings.State)
{
case TenantState.Uninitialized:
<span class="badge badge-light font-weight-normal"><i class="fa fa-cog text-secondary"></i> @T["Uninitialized"]</span>
break;
case TenantState.Initializing:
<span class="badge badge-light font-weight-normal"><i class="fa fa-hourglass-start text-info"></i> @T["Initializing"]</span>
break;
case TenantState.Running:
<span class="badge badge-light font-weight-normal"><i class="fa fa-check text-success"></i> @T["Running"]</span>
break;
case TenantState.Disabled:
<span class="badge badge-light font-weight-normal"><i class="fa fa-remove text-danger"></i> @T["Disabled"]</span>
break;
case TenantState.Invalid:
<span class="badge badge-light font-weight-normal"><i class="fa fa-exclamation-triangle text-warning"></i> @T["Invalid"]</span>
break;
}
</a>
@if (!string.IsNullOrEmpty(entry.ShellSettings.RequestUrlHost))
{
<p class="mb-0 mx-4"><code data-toggle="tooltip" title="@T["Url host"]">@entry.ShellSettings.RequestUrlHost</code></p>
}
@if (!string.IsNullOrEmpty(entry.Description))
{
<p class="mb-0 mx-4"><small class="text-muted">@entry.Description</small></p>
}
</div>
</div>
<div class="col-xl-6 col-sm-12 related">
<div class="float-right">
<a asp-action="Edit" asp-route-id="@entry.Name" class="btn text-primary btn-sm" data-toggle="tooltip" title="@T["Edit"]"><i class="fa fa-edit"></i></a>
@if (entry.ShellSettings.State == TenantState.Running)
{
<a class="btn text-info btn-sm" href="@GetDisplayUrl(entry, originalPathBase)" target="_blank" data-toggle="tooltip" title="@GetDisplayUrl(entry, originalPathBase)"><i class="fa fa-external-link"></i></a>
}
@if (!entry.IsDefaultTenant && entry.ShellSettings.State == TenantState.Running)
{
<a asp-action="Disable" asp-route-id="@entry.Name" class="btn text-danger btn-sm" itemprop="UnsafeUrl" data-toggle="tooltip" title="@T["Disable"]"><i class="fa fa-toggle-off"></i></a>
}
@if (entry.ShellSettings.State == TenantState.Disabled)
{
<a asp-action="Enable" asp-route-id="@entry.Name" class="btn text-success btn-sm" itemprop="UnsafeUrl" data-toggle="tooltip" title="@T["Enable"]"><i class="fa fa-toggle-on"></i></a>
}
@if (entry.ShellSettings.State == TenantState.Uninitialized)
{
<a class="btn text-info btn-sm" id="btn-setup-@entry.Name" href="@GetEncodedUrl(entry, originalPathBase)" data-toggle="tooltip" title="@T["Setup"]"><i class="fa fa-cog"></i></a>
}
<a asp-action="Reload" asp-route-id="@entry.Name" class="btn text-secondary btn-sm" itemprop="UnsafeUrl" data-toggle="tooltip" title="@T["Reload"]"><i class="fa fa-redo"></i></a>
</div>
</div>
@switch (entry.ShellSettings.State)
{
case TenantState.Uninitialized:
<small><i class="fa fa-xs fa-circle text-secondary" title="@T["Uninitialized"]"></i></small>
break;
case TenantState.Initializing:
<small><i class="fa fa-xs fa-circle text-info" title="@T["Initializing"]"></i></small>
break;
case TenantState.Running:
<small><i class="fa fa-xs fa-circle text-success" title="@T["Running"]"></i></small>
break;
case TenantState.Disabled:
<small><i class="fa fa-xs fa-circle text-danger" title="@T["Disabled"]"></i></small>
break;
case TenantState.Invalid:
<small><i class="fa fa-xs fa-circle text-warning" title="@T["Invalid"]"></i></small>
break;
}
<a href="@GetEncodedUrl(entry, originalPathBase)" target="_blank">@entry.Name</a>
<code class="hint">@GetDisplayUrl(entry, originalPathBase)</code>
@if (!string.IsNullOrEmpty(entry.Description))
{
<p class="mb-0"><small class="text-muted">@entry.Description</small></p>
}
</div>
</li>
}
Expand Down