Browse Source

removed configuration page.

pull/997/head
Alper Ebicoglu 7 years ago
parent
commit
d75c98dcb8
  1. 6
      modules/docs/app/VoloDocs/Pages/Configure.cshtml
  2. 16
      modules/docs/app/VoloDocs/Pages/Configure.cshtml.cs
  3. 25
      modules/docs/app/VoloDocs/Pages/Index.cshtml
  4. 34
      modules/docs/app/VoloDocs/Pages/Index.cshtml.cs
  5. 2
      modules/docs/app/VoloDocs/appsettings.json

6
modules/docs/app/VoloDocs/Pages/Configure.cshtml

@ -1,6 +0,0 @@
@page
@model VoloDocs.Pages.ConfigureModel
@{
}
CONFIGURE

16
modules/docs/app/VoloDocs/Pages/Configure.cshtml.cs

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace VoloDocs.Pages
{
public class ConfigureModel : PageModel
{
public void OnGet()
{
}
}
}

25
modules/docs/app/VoloDocs/Pages/Index.cshtml

@ -16,24 +16,21 @@
</abp-style-bundle> </abp-style-bundle>
} }
<h3>Welcome to the VoloDocs!</h3>
<p>1- CHECK APPSETTINGS.JSON IS CONFIGURED </p>
<p>2- CHECK DATABASE EXIST </p>
<p>2- CHECK ANY PROJECT </p>
<div class="p-5"> <div class="p-5">
<h2 class="text-center mb-5">
Welcome to the VoloDocs!
</h2>
@if (!Model.Projects.Any()) @if (!Model.Projects.Any())
{ {
<div class="alert alert-secondary col-md-6 text-center" role="alert"> <div class="d-flex justify-content-center">
<h4 class="alert-heading">No project!</h4> <div class="alert alert-secondary col-md-6 text-center" role="alert">
<p>Welcome to VoloDocs! There`s no defined project yet.</p> <h4 class="alert-heading">No project!</h4>
<hr /> <p>There`s no defined project yet!</p>
<a href="@Model.CreateProjectLink">Click here to start your first project <i class="fa fa-arrow-circle-right"></i></a> <hr />
<a href="@Model.CreateProjectLink">Click here to start your first project <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div> </div>
} }
else if (Model.Projects.Count > 1) else if (Model.Projects.Count > 1)

34
modules/docs/app/VoloDocs/Pages/Index.cshtml.cs

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.Users; using Volo.Abp.Users;
using Volo.Docs; using Volo.Docs;
@ -16,14 +13,11 @@ namespace VoloDocs.Pages
public class IndexModel : PageModel public class IndexModel : PageModel
{ {
public IReadOnlyList<ProjectDto> Projects { get; set; } public IReadOnlyList<ProjectDto> Projects { get; set; }
public string ConnectionString { get; set; }
public string CreateProjectLink { get; set; } public string CreateProjectLink { get; set; }
private readonly IProjectAppService _projectAppService; private readonly IProjectAppService _projectAppService;
private readonly DbConnectionOptions _dbConnectionOptions; private readonly DbConnectionOptions _dbConnectionOptions;
private readonly ICurrentUser _currentUser; private readonly ICurrentUser _currentUser;
public IndexModel(IProjectAppService projectAppService, public IndexModel(IProjectAppService projectAppService,
IOptionsSnapshot<DbConnectionOptions> dbConnectionOptions, ICurrentUser currentUser) IOptionsSnapshot<DbConnectionOptions> dbConnectionOptions, ICurrentUser currentUser)
@ -35,20 +29,15 @@ namespace VoloDocs.Pages
public async Task<IActionResult> OnGet() public async Task<IActionResult> OnGet()
{ {
ConnectionString = _dbConnectionOptions.ConnectionStrings.Default;
if (string.IsNullOrWhiteSpace(ConnectionString))
{
return RedirectToPage("./Configure");
}
CreateProjectLink = _currentUser.Id.HasValue CreateProjectLink = _currentUser.Id.HasValue
? "/Docs/Admin/Projects" ? "/Docs/Admin/Projects"
: "/Account/Login?returnUrl=/Docs/Admin/Projects"; : "/Account/Login?returnUrl=/Docs/Admin/Projects";
Projects = (await _projectAppService.GetListAsync()).Items; Projects = (await _projectAppService.GetListAsync()).Items;
if (Projects.Count == 1) if (Projects.Count == 1)
{ {
return RedirectToPage("./Project/Index", new return RedirectToPage("./Documents/Project/Index", new
{ {
projectName = Projects[0].ShortName, projectName = Projects[0].ShortName,
version = DocsAppConsts.Latest, version = DocsAppConsts.Latest,
@ -56,21 +45,6 @@ namespace VoloDocs.Pages
}); });
} }
//if (!Projects.Any())
//{
// if (_currentUser.Id.HasValue)
// {
// return Redirect("./Docs/Admin/Projects");
// }
// return Redirect("./account/login?returnUrl=/Docs/Admin/Projects");
//}
return Page(); return Page();
} }
} }

2
modules/docs/app/VoloDocs/appsettings.json

@ -1,5 +1,5 @@
{ {
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true", "ConnectionString": "Server=localhost;Database=VoloDocsNew;Trusted_Connection=True;MultipleActiveResultSets=true",
"Title": "Volo Documents", "Title": "Volo Documents",
"LogoUrl": "/Assets/Images/Logo.png" "LogoUrl": "/Assets/Images/Logo.png"
} }
Loading…
Cancel
Save