Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Feat dashboard#49
Uh oh!
There was an error while loading. Please reload this page.
Feat dashboard #49
Changes from all commits
925ef4e59e2af67dbc15712939879aa85a444a4bd6e4b4b86aa2cd2aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| @page "/TeamDashboard" | ||
| @inject HttpClient Http | ||
| @inject IJSRuntime jsRuntime | ||
| <h1>Team Dashboard</h1> | ||
| <p> | ||
| <input @bind="@_teamName" @bind:event="oninput" /> | ||
| </p> | ||
| @if (_teamName is null) | ||
| { | ||
| <p><em>Please write team name</em></p> | ||
| } | ||
| else | ||
| { | ||
| <p>Team name: @_teamName </p> | ||
| } | ||
| <p> | ||
| <button class="btn btn-primary" @onclick="GenerateBarChart">Generate Bar Chart</button> | ||
| </p> | ||
| @if (_statsIsVisible) | ||
| { | ||
| <div id="chartdiv"></div> | ||
| } | ||
| else | ||
| { | ||
| <p><font size="1" color="red" face="Arial">No such team</font></p> | ||
| } | ||
| <!-- Styles --> | ||
| <style> | ||
| #chartdiv { | ||
| width: 100%; | ||
| height: 500px; | ||
| font-size: 11px; | ||
| } | ||
| </style> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| using Kysect.GithubActivityAnalyzer.WebDemo.Shared; | ||
| using Kysect.GithubActivityAnalyzer.Aggregators.Models; | ||
| using Microsoft.JSInterop; | ||
| using System.Net; | ||
| using System.Net.Http.Json; | ||
| namespace Kysect.GithubActivityAnalyzer.WebDemo.Client.Pages.Dashboards | ||
| { | ||
| public partial class TeamDashboard | ||
| { | ||
| private string _teamName = String.Empty; | ||
| private TeamResponse _team; | ||
| private bool _statsIsVisible = true; | ||
| private async Task GenerateBarChart() | ||
| { | ||
| await GetStat(); | ||
| StateHasChanged(); | ||
| if (_statsIsVisible) | ||
| { | ||
| var teamInfo = _team.Members; | ||
| await jsRuntime.InvokeVoidAsync("GenerateBarChart", teamInfo); | ||
| } | ||
| } | ||
| private async Task GetStat() | ||
| { | ||
| Team team = await GetTeam(); | ||
| if (team is not null) | ||
| { | ||
| var teamInfoResponse = await Http.PostAsJsonAsync("TeamInfo/GetTeamInfo", team); | ||
| _team = await teamInfoResponse.Content.ReadFromJsonAsync<TeamResponse>(); | ||
| _statsIsVisible = true; | ||
| } | ||
| else | ||
| { | ||
| _statsIsVisible = false; | ||
| } | ||
| } | ||
| private async Task<Team> GetTeam() | ||
| { | ||
| var teamResponse = await Http.PostAsJsonAsync("DBTeam/GetTeam", new Team(_teamName)); | ||
| if (teamResponse.StatusCode == HttpStatusCode.OK) | ||
| { | ||
| return await teamResponse.Content.ReadFromJsonAsync<Team>(); | ||
| } | ||
| else | ||
| { | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Threading.Tasks; | ||
| using Kysect.GithubActivityAnalyzer.WebDemo.Shared; | ||
| using Kysect.GithubActivityAnalyzer.Aggregators.Models; | ||
| using System.Net.Http.Json; | ||
| namespace Kysect.GithubActivityAnalyzer.WebDemo.Client.Pages | ||
| { | ||
| public partial class UnitedStat | ||
| { | ||
| private string _username = String.Empty; | ||
| private string _teamName = String.Empty; | ||
| private List<string> _usernames = new List<string>(); | ||
| private TeamResponse _team; | ||
| private bool _statsIsVisible = false; | ||
| protected async Task GetStat() | ||
| { | ||
| Team newTeamInfo = new Team() | ||
| { | ||
| TeamName = _teamName, | ||
| Usernames = _usernames | ||
ALEXXXANDRO marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }; | ||
| var response = await Http.PostAsJsonAsync("Team", newTeamInfo); | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Потыкай @MGSDS, он тебе расскажет как он в SeaInk планирует реализовывать Sdk проект и выносить такие запросы. | ||
| _team = await response.Content.ReadFromJsonAsync<TeamResponse>(); | ||
| _statsIsVisible = true; | ||
| } | ||
| private void AddStudent() | ||
| { | ||
| if (!_usernames.Contains(_username)) | ||
| _usernames.Add(_username); | ||
| } | ||
ALEXXXANDRO marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| function GenerateBarChart(teamInfo) { | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ты решил прям сразу на js писать?) | ||
| AmCharts.makeChart("chartdiv", { | ||
| "type": "serial", | ||
| "theme": "none", | ||
| "categoryField": "username", | ||
| "rotate": true, | ||
| "startDuration": 1, | ||
| "categoryAxis": { | ||
| "gridPosition": "start", | ||
| "position": "left" | ||
| }, | ||
| "trendLines": [], | ||
| "graphs": [ | ||
| { | ||
| "balloonText": "totalContributions:[[value]]", | ||
| "fillAlphas": 0.8, | ||
| "id": "AmGraph-1", | ||
| "lineAlpha": 0.2, | ||
| "title": "totalContributions", | ||
| "type": "column", | ||
| "valueField": "totalContributions" | ||
| }, | ||
| ], | ||
| "guides": [], | ||
| "valueAxes": [ | ||
| { | ||
| "id": "ValueAxis-1", | ||
| "position": "top", | ||
| "axisAlpha": 0 | ||
| } | ||
| ], | ||
| "allLabels": [], | ||
| "balloon": {}, | ||
| "titles": [], | ||
| "dataProvider": teamInfo, | ||
| "export": { | ||
| "enabled": true | ||
| }, | ||
| "hideCredits": true | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| using Kysect.GithubActivityAnalyzer.WebDemo.Server.Services; | ||
| using Kysect.GithubActivityAnalyzer.WebDemo.Shared; | ||
| using Microsoft.AspNetCore.Http; | ||
| using Microsoft.AspNetCore.Mvc; | ||
| namespace Kysect.GithubActivityAnalyzer.WebDemo.Server.Controllers | ||
| @@ -32,19 +33,29 @@ public void DeleteMember(string username) | ||
| _teamService.DeleteMember(username); | ||
| } | ||
| ///TO DO: to realize | ||
| [HttpPost("updateMember")] | ||
| public void UpdateMember() | ||
| { | ||
| } | ||
| ///TO DO: to realize | ||
| [HttpGet("GetAllTeams")] | ||
| public void GetAllTeams() | ||
| { | ||
| } | ||
| [HttpGet("GetTeam")] | ||
| public void GetTeam() | ||
| [HttpPost("GetTeam")] | ||
ALEXXXANDRO marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(Team))] | ||
| [ProducesResponseType(StatusCodes.Status404NotFound)] | ||
| public IActionResult GetTeam(Team teamName) | ||
| { | ||
| if (!_teamService.TryGetTeam(teamName, out var team)) | ||
| { | ||
| return NotFound(); | ||
| } | ||
| return Ok(team); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,17 @@ | ||
| using Microsoft.AspNetCore.Mvc; | ||
| using Kysect.GithubActivityAnalyzer.Aggregators; | ||
| using Kysect.GithubActivityAnalyzer.Aggregators.Models; | ||
| using Kysect.GithubActivityAnalyzer.ApiAccessor; | ||
| using Kysect.GithubActivityAnalyzer.WebDemo.Shared; | ||
| namespace Kysect.GithubActivityAnalyzer.WebDemo.Server.Controllers | ||
| { | ||
| [ApiController] | ||
| [Route("[controller]")] | ||
| public class TeamController : Controller | ||
| public class TeamInfoController : Controller | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Мне не очень нравится, что тут Info. Обычно, используют имя сущности. В данном случае - Team. Зачем Info - не понятно. ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Просто у нас есть сущность TeamResponse, которая представляет собой агрегацию статистики и members, и из неё как раз и происходит процесс извлечения всякой информации. У меня язык не повернулся назвать TeamResponseController, хотя мб я не прав. TeamController не очень подходит, т.к. есть DBTeamController который нужен для CRUD команд в базе Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ладно, потом перепишем всё ) | ||
| { | ||
| private readonly GithubActivityProvider _provider = new GithubActivityProvider(); | ||
| [HttpPost] | ||
| public TeamResponse GetStudyGroup(Shared.Team info) | ||
| [HttpPost("GetTeamInfo")] | ||
| public TeamResponse GetTeamInfo(Shared.Team info) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А тут можно убрать Namespace? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не очень, потому что есть Aggregators.Team и Shared.Team | ||
| { | ||
| return new TeamResponse(new Aggregators.Team(info.TeamName, info.Usernames, _provider)); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.