Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show project version overview on the Dashboard
- Loading branch information
1 parent
44bad52
commit 77037c3
Showing
18 changed files
with
251 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/DeploymentCockpit.BusinessLogic/Services/DashboardService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using DeploymentCockpit.ApiDtos; | ||
using DeploymentCockpit.Interfaces; | ||
using DeploymentCockpit.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DeploymentCockpit.Services | ||
{ | ||
public class DashboardService : DataService, IDashboardService | ||
{ | ||
public DashboardService(IUnitOfWorkFactory unitOfWorkFactory) | ||
: base(unitOfWorkFactory) | ||
{ | ||
} | ||
|
||
public IEnumerable<ProjectVersionInfo> GetProjectVersionInfo() | ||
{ | ||
using (var uow = _unitOfWorkFactory.Create()) | ||
{ | ||
return uow.DashboardRepository.GetProjectVersionInfo(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DeploymentCockpit.ApiDtos | ||
{ | ||
public class ProjectVersionInfo | ||
{ | ||
public string ProjectName { get; set; } | ||
public string EnvironmentName { get; set; } | ||
public int? DeploymentJobID { get; set; } | ||
public string ProductVersion { get; set; } | ||
public string DeploymentJobTime { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/DeploymentCockpit.Core/Interfaces/IDashboardRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using DeploymentCockpit.ApiDtos; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DeploymentCockpit.Interfaces | ||
{ | ||
public interface IDashboardRepository | ||
{ | ||
IEnumerable<ProjectVersionInfo> GetProjectVersionInfo(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/DeploymentCockpit.Core/Interfaces/IDashboardService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using DeploymentCockpit.ApiDtos; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DeploymentCockpit.Interfaces | ||
{ | ||
public interface IDashboardService | ||
{ | ||
IEnumerable<ProjectVersionInfo> GetProjectVersionInfo(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/DeploymentCockpit.Data/Repositories/DashboardRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using DeploymentCockpit.ApiDtos; | ||
using DeploymentCockpit.Common; | ||
using DeploymentCockpit.Interfaces; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Insula.Common; | ||
|
||
namespace DeploymentCockpit.Data.Repositories | ||
{ | ||
public class DashboardRepository : IDashboardRepository | ||
{ | ||
protected readonly DeploymentCockpitEntities _db; | ||
|
||
public DashboardRepository(DeploymentCockpitEntities db) | ||
{ | ||
if (db == null) | ||
throw new ArgumentNullException("db"); | ||
_db = db; | ||
} | ||
|
||
public IEnumerable<ProjectVersionInfo> GetProjectVersionInfo() | ||
{ | ||
var statusKey = DeploymentStatus.Finished.GetName(); | ||
|
||
return _db.ProjectEnvironments | ||
.Select(e => | ||
new | ||
{ | ||
ProjectName = e.Project.Name, | ||
EnvironmentName = e.Name, | ||
DeploymentJob = e.DeploymentJobs | ||
.Where(j => j.StatusKey == statusKey) | ||
.OrderByDescending(j => j.DeploymentJobID) | ||
.FirstOrDefault() | ||
}) | ||
.ToList() | ||
.Select(i => | ||
new ProjectVersionInfo | ||
{ | ||
ProjectName = i.ProjectName, | ||
EnvironmentName = i.EnvironmentName, | ||
DeploymentJobID = i.DeploymentJob != null | ||
? i.DeploymentJob.DeploymentJobID as int? | ||
: null, | ||
DeploymentJobTime = i.DeploymentJob != null | ||
? i.DeploymentJob.SubmissionTime.ToString(DomainContext.DateTimeFormatString) | ||
: null, | ||
ProductVersion = i.DeploymentJob != null | ||
? i.DeploymentJob.ProductVersion | ||
: null, | ||
}) | ||
.ToList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/DeploymentCockpit.Server/Controllers/Api/DashboardController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using DeploymentCockpit.ApiDtos; | ||
using DeploymentCockpit.Interfaces; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Web.Http; | ||
|
||
namespace DeploymentCockpit.Server.Controllers.Api | ||
{ | ||
public class DashboardController : ApiController | ||
{ | ||
private readonly IDashboardService _dashboardService; | ||
|
||
public DashboardController(IDashboardService dashboardService) | ||
{ | ||
if (dashboardService == null) | ||
throw new ArgumentNullException("dashboardService"); | ||
_dashboardService = dashboardService; | ||
} | ||
|
||
public IEnumerable<ProjectVersionInfo> GetProjectVersionInfo() | ||
{ | ||
return _dashboardService.GetProjectVersionInfo(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/DeploymentCockpit.Server/app/dashboard/dashboardDataSvc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"use strict"; | ||
|
||
app.factory("dashboardDataSvc", function ($resource) { | ||
return { | ||
getProjectVersionInfo: function () { | ||
return $resource("api/Dashboard/GetProjectVersionInfo").query(); | ||
} | ||
}; | ||
}); |
30 changes: 30 additions & 0 deletions
30
src/DeploymentCockpit.Server/app/dashboard/myProjectVersionInfo.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<div class="panel panel-info panel-borderless"> | ||
<div class="panel-heading"> | ||
Project Version Overview | ||
<a href="" class="pull-right" title="Refresh" ng-click="reloadData()"> | ||
<span class="glyphicon glyphicon-refresh"></span> | ||
</a> | ||
</div> | ||
<div class="panel-body"> | ||
<table class="table table-condensed table-hover table-striped table-borderless"> | ||
<thead> | ||
<tr> | ||
<th>Project</th> | ||
<th>Environment</th> | ||
<th>Version</th> | ||
<th>Time</th> | ||
</tr> | ||
</thead> | ||
<tr ng-repeat="versionInfo in data | orderBy:['projectName', 'projectEnvironmentName']"> | ||
<td>{{versionInfo.projectName}}</td> | ||
<td>{{versionInfo.environmentName}}</td> | ||
<td>{{versionInfo.productVersion}}</td> | ||
<td> | ||
<a href="#/DeploymentJob/Details/{{versionInfo.deploymentJobID}}"> | ||
{{versionInfo.deploymentJobTime}} | ||
</a> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> |
19 changes: 19 additions & 0 deletions
19
src/DeploymentCockpit.Server/app/dashboard/myProjectVersionInfo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use strict"; | ||
|
||
app.directive("myProjectVersionInfo", function () { | ||
return { | ||
templateUrl: "app/dashboard/myProjectVersionInfo.html", | ||
scope: {}, | ||
controller: function ($scope, $interval, dashboardDataSvc) { | ||
$scope.reloadData = function () { | ||
$scope.data = dashboardDataSvc.getProjectVersionInfo(); | ||
}; | ||
|
||
$scope.reloadData(); | ||
|
||
$scope.isLoading = function () { | ||
return !$scope.data.$resolved; | ||
}; | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters