Skip to content
This repository was archived by the owner on Aug 28, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions Kysect.GithubActivityAnalyzer.WebDemo/Client/Pages/DatabaseTeam.razor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
@page "/databaseTeam"
@using Kysect.GithubActivityAnalyzer.WebDemo.Shared
@using Kysect.GithubActivityAnalyzer.Aggregators.Models
@inject HttpClient Http
<h1>TestFunc</h1>
<p>
<input @bind="_teamName" @bind:event="oninput" />
</p>
<p>
<input @bind="_username" @bind:event="oninput" />
</p>
<button class="btn btn-primary" @onclick="AddTeam">Add team</button>
<button class="btn btn-primary" @onclick="DeleteTeam">Delete team</button>
<button class="btn btn-primary" @onclick="DeleteMember">Delete member</button>
<button class="btn btn-primary" @onclick="GetStat">Get Stat</button>
<p>
<button class="btn btn-primary" @onclick="AddMember">Add member</button>
<button class="btn btn-primary" @onclick="ClearTeamList">Clear</button>
</p>
@if (_teamName == null && !_statsIsVisible)
{
<p><em>Please write group name</em></p>
}
else
{
<p>Team name: @_teamName </p>
}
@if (_usernames.Count == 0 && !_statsIsVisible)
{
<p>Add names</p>
}
else
{
<table class="table">
<thead>
<tr><th>Имя</th></tr>
</thead>
<tbody>
@for (int i = 0; i < _usernames.Count; i++)
{
<tr><td>@_usernames[i]</td></tr>
}
</tbody>
</table>
}
@if (_statsIsVisible)
{
<p>All Contributions: @_team.TotalContributions</p>
<table class="table">
<thead>
<tr><th>Username</th><th>Contributions:</th></tr>
</thead>
<tbody>
@foreach (var person in _team.DetailedStatisticsList[0].DetailedStat)
{
<tr><td>@person.Username</td><td>@person.MonthlyContributions</td></tr>

}
</tbody>
</table>

}

@code {
private string _username = String.Empty;
private string _teamName = String.Empty;
private List<string> _usernames = new List<string>();
private TeamResponse _team;
private bool _statsIsVisible = false;
private bool _result;

private void ClearTeamList()
{
_usernames.Clear();
}
private void AddMember()
{
_usernames.Add(_username);
}
protected async Task GetStat()
{
Team newGroupInfo = new Team()
{
TeamName = _teamName,
Usernames = _usernames
};
var response = await Http.PostAsJsonAsync("Team", newGroupInfo);
_team = await response.Content.ReadFromJsonAsync<TeamResponse>();
_statsIsVisible = true;
}

protected async Task AddTeam()
{
Team newTeam = new Team()
{
TeamName = _teamName,
Usernames = _usernames
};
await Http.PostAsJsonAsync("DBTeam/addTeam", newTeam);
}
protected async Task DeleteTeam()
{
Team team = new Team()
{
TeamName = _teamName,
Usernames = _usernames
};
await Http.PostAsJsonAsync("DBTeam/deleteTeam", _teamName);
}
protected async Task DeleteMember()
{
await Http.PostAsJsonAsync("DBTeam/deleteMember", _username);
}

@*
protected async Task UpdateMember()
{
await Http.PostAsJsonAsync("DBTeam/updateMember");
}
protected async Task GetAllTeams()
{
}
protected async Task GetTeam() { }*@
}

This file was deleted.

This file was deleted.

84 changes: 84 additions & 0 deletions Kysect.GithubActivityAnalyzer.WebDemo/Client/Pages/GetTeam.razor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
@page "/Team"
@using Kysect.GithubActivityAnalyzer.WebDemo.Shared
@using Kysect.GithubActivityAnalyzer.Aggregators.Models
@inject HttpClient Http
<h1>TestFunc</h1>
<p>
<input @bind="_teamName" @bind:event="oninput" />
</p>
<p>
<input @bind="_username" @bind:event="oninput" />
</p>
<button class="btn btn-primary" @onclick="AddStudent">Add member</button>
<p>
<button class="btn btn-primary" @onclick="GetStat">Get Stat</button>
</p>
@if (_teamName == null && !_statsIsVisible)
{
<p><em>Please write team name</em></p>
}
else
{
<p>Team name: @_teamName </p>
}
@if (_usernames.Count == 0 && !_statsIsVisible)
{
<p>Add names</p>
}
else
{
<table class="table">
<thead>
<tr><th>Имя</th></tr>
</thead>
<tbody>
@for (int i = 0; i < _usernames.Count; i++)
{
<tr><td>@_usernames[i]</td></tr>
}
</tbody>
</table>
}
@if (_statsIsVisible)
{
<p>All Contributions: @_team.TotalContributions</p>
<table class="table">
<thead>
<tr><th>Username</th><th>Contributions:</th></tr>
</thead>
<tbody>
@foreach (var person in _team.DetailedStatisticsList[0].DetailedStat)
{
<tr><td>@person.Username</td><td>@person.MonthlyContributions</td></tr>

}
</tbody>
</table>

}

@code {
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
};
var response = await Http.PostAsJsonAsync("Team", newTeamInfo);
_team = await response.Content.ReadFromJsonAsync<TeamResponse>();
_statsIsVisible = true;
}

private void AddStudent()
{
_usernames.Add(_username);
}
}
27 changes: 16 additions & 11 deletions Kysect.GithubActivityAnalyzer.WebDemo/Client/Pages/TestPage.razor
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
@page "/testpage"
@using System.Text.Json
@using Kysect.GithubActivityAnalyzer.ApiAccessor.ApiResponses
@inject HttpClient Http
<h1>TestFunc</h1>
<p>
<input @bind="SetName" @bind:event="oninput" />
<input @bind="_setName" @bind:event="oninput" />
</p>
<button class="btn btn-primary" @onclick="CreateClient">Click me</button>
@if(SetName == null)
<button class="btn btn-primary" @onclick="GetActivityFromGithub">From Github</button>
<button class="btn btn-primary" @onclick="GetActivityFromDB">From DB</button>
@if(_setName == null)
{
<p><em>Please write name</em></p>
}
else
{
<p>Name: @SetName </p>
<p>Name: @_setName </p>
}
@if (Info == null)
@if (_info == null)
{
<p>Please wait...</p>
}
else
{
<p>Contributions: @Info.Total</p>
<p>Contributions: @_info.Total</p>
}

@code {
private string SetName { get; set; } = String.Empty;
private ActivityInfo Info { get; set; }
private string _setName = String.Empty;
private ActivityInfo _info;



protected async Task CreateClient()
protected async Task GetActivityFromGithub()
{
Info = await Http.GetFromJsonAsync<ActivityInfo>($"GitHubApi?username={SetName}");
_info = await Http.GetFromJsonAsync<ActivityInfo>($"GitHubApi/fromGithub?username={_setName}");
}

protected async Task GetActivityFromDB()
{
_info = await Http.GetFromJsonAsync<ActivityInfo>($"GitHubApi/fromDB?username={_setName}");
}
}
Loading