Permalink
Browse files

Restored previous version's dashboard

  • Loading branch information...
ehelin committed Jun 10, 2018
1 parent 6e0b01a commit a0a974f2a1d6c7cb12bf504a3dce7e15a1143971
View
@@ -264,3 +264,4 @@ paket-files/
__pycache__/
*.pyc
/TestAPI/Credentials.cs
/Algorithms/PredictCategoryCountry/Perceptron/Data
View
@@ -19,19 +19,8 @@ public static string GetAppSetting(string key)
}
public static string GetDbSetting()
{
throw new NotImplementedException();
//NOTE: Credentials is a local file that must be added
//return Credentials.GetDbConnection();
//string Environment = Utilities.GetAppSetting(Constants.ENVIRONMENT);
//string dbConn = string.Empty;
//if (!string.IsNullOrEmpty(Environment) && Environment.Equals(Constants.ENVIRONMENT_PRODUCTION))
// dbConn = Utilities.GetAppSetting(Constants.DB_PROD);
//else
// dbConn = Utilities.GetAppSetting(Constants.DB_TEST);
//return dbConn;
return Credentials.GetDbConnection();
}
public static string DecodeClientBase64String(string encodedString)
{
View
@@ -17,10 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestAPI", "TestAPI\TestAPI.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TgimbaNetCoreWeb", "TgimbaNetCoreWeb\TgimbaNetCoreWeb.csproj", "{CF678192-CA9C-4ACD-B859-828F35EA5F8B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Algorithms", "Algorithms\Algorithms.csproj", "{20BBA591-06B1-4233-9979-F5DF475253DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAlgorithms", "TestAlgorithms\TestAlgorithms.csproj", "{2E12DF93-0900-4D68-9581-0231303A5A54}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -51,14 +47,6 @@ Global
{CF678192-CA9C-4ACD-B859-828F35EA5F8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF678192-CA9C-4ACD-B859-828F35EA5F8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF678192-CA9C-4ACD-B859-828F35EA5F8B}.Release|Any CPU.Build.0 = Release|Any CPU
{20BBA591-06B1-4233-9979-F5DF475253DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20BBA591-06B1-4233-9979-F5DF475253DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20BBA591-06B1-4233-9979-F5DF475253DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20BBA591-06B1-4233-9979-F5DF475253DE}.Release|Any CPU.Build.0 = Release|Any CPU
{2E12DF93-0900-4D68-9581-0231303A5A54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E12DF93-0900-4D68-9581-0231303A5A54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E12DF93-0900-4D68-9581-0231303A5A54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E12DF93-0900-4D68-9581-0231303A5A54}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -0,0 +1,13 @@
.DashboardSpan {
width: 100%;
height: 30%;
margin: auto;
font-family: Arial;
}
.DashboardPartSpan {
width: 30%;
height: 30%;
margin: auto;
font-family: Arial;
}
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Mvc;
using Shared.interfaces;
using API;
namespace TgimbaNetCoreWeb.Controllers
{
public class BaseController : Controller
{
protected ITgimbaService service = null;
public BaseController()
{
service = new TgimbaService();
}
}
}
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace TgimbaNetCoreWeb.Controllers
{
public class HomeController : Controller
{
public class HomeController : BaseController
{
public IActionResult Index()
{
return View();
@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Mvc;
using TgimbaNetCoreWeb.Models;
namespace TgimbaNetCoreWeb.Controllers
{
public class WelcomeController : BaseController
{
public IActionResult Index()
{
WelcomeModel model = new WelcomeModel(this.service);
return View(model);
}
}
}
@@ -0,0 +1,14 @@
using Shared.interfaces;
namespace TgimbaNetCoreWeb.Models
{
public class BaseModel
{
protected ITgimbaService service = null;
public BaseModel(ITgimbaService service)
{
this.service = service;
}
}
}
@@ -0,0 +1,14 @@
using Shared.interfaces;
namespace TgimbaNetCoreWeb.Models
{
public class WelcomeModel : BaseModel
{
public string[] DashboardData { get; set; }
public WelcomeModel(ITgimbaService service) : base(service)
{
this.DashboardData = this.service.GetDashboard();
}
}
}
@@ -47,11 +47,15 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
routes.MapRoute(
name: "default",
template: "{controller=Welcome}/{action=Index}/{id?}");
routes.MapRoute(
name: "angularEntry",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
//routes.MapSpaFallbackRoute(
// name: "spa-fallback",
// defaults: new { controller = "Welcome", action = "Index" });
});
}
}
@@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" />
</ItemGroup>
<ItemGroup>
@@ -47,6 +48,11 @@
<None Remove="ClientApp\app\components\staticdisplay\staticdisplay.component.ts" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\API\API.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="ClientApp\app\components\addedit\addedit.component.spec.ts" />
<TypeScriptCompile Include="ClientApp\app\components\addedit\addedit.component.ts" />
@@ -0,0 +1,112 @@
@model TgimbaNetCoreWeb.Models.WelcomeModel
@{
ViewData["Title"] = "Welcome Page";
}
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', { 'packages': ['corechart'] });
google.charts.setOnLoadCallback(drawChart);
google.charts.load('current', { 'packages': ['corechart'] });
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var userCnt = document.getElementById('UserCnt');
userCnt.innerHTML = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[0]) as String);
drawCategoryChart();
drawAchievedChart();
drawCreatedDateChart();
}
function drawCategoryChart(results) {
var data = google.visualization.arrayToDataTable([
['Category', 'Category'],
['Hot', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[1]) as String))],
['Warm', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[2]) as String))],
['Cool', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[3]) as String))]
]);
var options = {
title: 'Categories'
};
var chart = new google.visualization.PieChart(document.getElementById('Category'));
chart.draw(data, options);
}
function drawAchievedChart(results) {
var data = google.visualization.arrayToDataTable([
['Achieved', 'Achieved'],
['True', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[4]) as String))],
['False', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[5]) as String))]
]);
var options = {
title: 'Achieved'
};
var chart = new google.visualization.PieChart(document.getElementById('Achieved'));
chart.draw(data, options);
}
//TODO - Fix so the years are dynamic
function drawCreatedDateChart(results) {
var data = google.visualization.arrayToDataTable([
['Created Year', 'Created Year'],
['2015', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[6]) as String))],
['2016', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[7]) as String))],
['2017', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[8]) as String))],
['2018', Number(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DashboardData[9]) as String))]
]);
var options = {
title: 'Created Year'
};
var chart = new google.visualization.PieChart(document.getElementById('Created'));
chart.draw(data, options);
}
</script>
<div class="Html5JqueryBody" onload="drawChart()">
<div align="center"><h2>Welcome to 'The Globe In My Bucket <i>Application</i>' <br />(TGIMBA)</h2></div>
<div>
<table class="DashboardSpan">
<tr>
<td class="DashboardTotalUsers" >
<div id="UserCnt" name="UserCnt" ></div>
</td>
<td class="DashboardPartSpan" ><div id="Category" name="Category" ></div></td>
<td class="DashboardPartSpan" ><div id="Achieved" name="Achieved" ></div></td>
<td class="DashboardPartSpan" ><div id="Created" name="Created\" ></div></td>
</tr>
</table>
</div>
<p>NOTICE: TGIMBA is offline pending its .NET Core re-write deployment later this year.</p>
<p>
This is a site to place your desired list of things you wish to complete while you are alive.
</p>
<p>
I created TGIMBA because I am passionate about living my life through such a list. It keeps me focused
since there are so many things I wish to do. I truly believe that you have between now and the
time your number is up and what you do with it is up to you.
</p>
<p>
This is also a work in progress that is allowing me to explore different technologies and how they
can be applied to the Internet. There are no warranties (implied or otherwise) and everyone is free
to use it as is.
</p>
<p>
Please click <a id="login" href="http://localhost:50298/Home/Index">here</a>
to start.
</p>
@*<p>
Login as the demo user to preview the application functionality <a id="demoLogin" href="http://www.tgimba.com/WebRequest/DirectRequestDemoUser">here.</a>
</p>*@
</div>

0 comments on commit a0a974f

Please sign in to comment.