Add type="button" to all buttons and prevent display of Installer if already installed

This commit is contained in:
Shaun Walker 2019-08-01 12:53:02 -04:00
parent c9783c3b2f
commit 9fbc71b531
10 changed files with 123 additions and 114 deletions

View File

@ -63,7 +63,7 @@
</td>
</tr>
</table>
<button class="btn btn-success" @onclick="@SaveModule">Save</button>
<button type="button" class="btn btn-success" @onclick="@SaveModule">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@code {

View File

@ -111,7 +111,7 @@
</td>
</tr>
</table>
<button class="btn btn-success" @onclick="@SavePage">Save</button>
<button type="button" class="btn btn-success" @onclick="@SavePage">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@code {

View File

@ -111,7 +111,7 @@
</td>
</tr>
</table>
<button class="btn btn-danger" @onclick="@DeletePage">Delete</button>
<button type="button" class="btn btn-danger" @onclick="@DeletePage">Delete</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@code {

View File

@ -112,7 +112,7 @@
</td>
</tr>
</table>
<button class="btn btn-success" @onclick="@SavePage">Save</button>
<button type="button" class="btn btn-success" @onclick="@SavePage">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@code {

View File

@ -55,7 +55,7 @@ else
</td>
</tr>
</table>
<button class="btn btn-success" @onclick="@SaveSite">Save</button>
<button type="button" class="btn btn-success" @onclick="@SaveSite">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
}

View File

@ -2,7 +2,7 @@
@inherits ModuleBase
Current count: @currentCount
<br />
<button class="btn btn-primary" @onclick="@IncrementCount">Click me</button>
<button type="button" class="btn btn-primary" @onclick="@IncrementCount">Click me</button>
<br /><br />
@code {

View File

@ -20,7 +20,7 @@
</td>
</tr>
</table>
<button class="btn btn-success" @onclick="@SaveContent">Save</button>
<button type="button" class="btn btn-success" @onclick="@SaveContent">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
</form>

View File

@ -1,113 +1,116 @@
@using Oqtane.Services
@using Oqtane.Models
@inject IUriHelper UriHelper
@inject IInstallationService InstallationService
@inject IInstallationService InstallationService
@inject IUserService UserService
<div class="container">
<div class="row">
<div class="mx-auto text-center">
<img src="oqtane.png" />
@if (!Installed)
{
<div class="container">
<div class="row">
<div class="mx-auto text-center">
<img src="oqtane.png" />
</div>
</div>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" />
<h2 class="text-center">Database Configuration</h2>
<div class="row">
<div class="mx-auto text-center">
<table class="form-group" cellpadding="4" cellspacing="4">
<tbody>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Database Type: </label>
</td>
<td>
<select class="custom-select" @bind="@DatabaseType">
<option value="LocalDB">Local Database</option>
<option value="SQLServer">SQL Server</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Server: </label>
</td>
<td>
<input type="text" id="ServerName" class="form-control" @bind="@ServerName" />
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Database: </label>
</td>
<td>
<input type="text" id="DatabaseName" class="form-control" @bind="@DatabaseName" />
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Integrated Security: </label>
</td>
<td>
<select class="custom-select" @onchange="@SetIntegratedSecurity">
<option value="true" selected>True</option>
<option value="false">False</option>
</select>
</td>
</tr>
<tr style="@IntegratedSecurityDisplay">
<td>
<label for="Title" class="control-label" style="font-weight: bold">Username: </label>
</td>
<td>
<input type="text" id="Username" class="form-control" @bind="@Username" />
</td>
</tr>
<tr style="@IntegratedSecurityDisplay">
<td>
<label for="Title" class="control-label" style="font-weight: bold">Password: </label>
</td>
<td>
<input type="password" id="Password" class="form-control" @bind="@Password" />
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" />
<h2 class="text-center">Application Administrator</h2>
<div class="row">
<div class="mx-auto text-center">
<table class="form-group" cellpadding="4" cellspacing="4">
<tbody>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Username: </label>
</td>
<td>
<input type="text" id="Email" class="form-control" @bind="@HostUsername" />
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Password: </label>
</td>
<td>
<input type="password" id="Email" class="form-control" @bind="@HostPassword" />
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="mx-auto text-center">
<button type="button" class="btn btn-success" @onclick="@Install">Install Now</button><br /><br />
@((MarkupString)@Message)
</div>
<div class="loading" style="@LoadingDisplay"></div>
</div>
</div>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" />
<h2 class="text-center">Database Configuration</h2>
<div class="row">
<div class="mx-auto text-center">
<table class="form-group" cellpadding="4" cellspacing="4">
<tbody>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Database Type: </label>
</td>
<td>
<select class="custom-select" @bind="@DatabaseType">
<option value="LocalDB">Local Database</option>
<option value="SQLServer">SQL Server</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Server: </label>
</td>
<td>
<input type="text" id="ServerName" class="form-control" @bind="@ServerName" />
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Database: </label>
</td>
<td>
<input type="text" id="DatabaseName" class="form-control" @bind="@DatabaseName" />
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Integrated Security: </label>
</td>
<td>
<select class="custom-select" @onchange="@SetIntegratedSecurity">
<option value="true" selected>True</option>
<option value="false">False</option>
</select>
</td>
</tr>
<tr style="@IntegratedSecurityDisplay">
<td>
<label for="Title" class="control-label" style="font-weight: bold">Username: </label>
</td>
<td>
<input type="text" id="Username" class="form-control" @bind="@Username" />
</td>
</tr>
<tr style="@IntegratedSecurityDisplay">
<td>
<label for="Title" class="control-label" style="font-weight: bold">Password: </label>
</td>
<td>
<input type="password" id="Password" class="form-control" @bind="@Password" />
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" />
<h2 class="text-center">Application Administrator</h2>
<div class="row">
<div class="mx-auto text-center">
<table class="form-group" cellpadding="4" cellspacing="4">
<tbody>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Username: </label>
</td>
<td>
<input type="text" id="Email" class="form-control" @bind="@HostUsername" />
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="font-weight: bold">Password: </label>
</td>
<td>
<input type="password" id="Email" class="form-control" @bind="@HostPassword" />
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="mx-auto text-center">
<button class="btn btn-success" @onclick="@Install">Install Now</button><br /><br />
@((MarkupString)@Message)
</div>
<div class="loading" style="@LoadingDisplay"></div>
</div>
</div>
}
@code {
@ -124,6 +127,14 @@ private string Message = "";
private string IntegratedSecurityDisplay = "display:none;";
private string LoadingDisplay = "display:none;";
private bool Installed = true;
protected override async Task OnInitAsync()
{
var response = await InstallationService.IsInstalled();
Installed = response.Success;
}
private void SetIntegratedSecurity(UIChangeEventArgs e)
{
if (Convert.ToBoolean(e.Value))

View File

@ -4,14 +4,12 @@
@using System.Linq
@using System.Collections.Generic
@using Oqtane.Shared
@using Microsoft.JSInterop
@using Microsoft.AspNetCore.Components.Routing
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject SiteState SiteState
@inject IUriHelper UriHelper
@inject INavigationInterception NavigationInterception
@inject IComponentContext ComponentContext
@inject IJSRuntime jsRuntime
@inject IAliasService AliasService
@inject ITenantService TenantService
@inject ISiteService SiteService

View File

@ -7,7 +7,7 @@
@inject IPageModuleService PageModuleService
<div class="dropdown" style="@display">
<button class="btn dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<button type="button" class="btn dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
@foreach (var action in actions)
{