Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Access Rework #582

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -9899,7 +9899,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7e4872dd45210c84bb1134b01b4b6c33, type: 3}
m_Name:
m_EditorClassIdentifier:
clientDataObject: {fileID: 11400000, guid: 17933bb104c1395408420ed026a401ed, type: 2}
clientDataObject: {fileID: 11400000, guid: 4b4554d42966bb6458cf30184dfb1a82, type: 2}
loginCaption: {fileID: 1009365461409116616}
statusCaption: {fileID: 828242988404845599}
statusLed: {fileID: 1009626218954954769}
Expand Down Expand Up @@ -10921,7 +10921,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c85daea7479c8e442b56bf859332d0de, type: 3}
m_Name:
m_EditorClassIdentifier:
clientDataObject: {fileID: 11400000, guid: fb2ae7f2504b7c7429507e37671fe103, type: 2}
clientDataObject: {fileID: 11400000, guid: 99a9bb57e8cc35b41940c9e6eeac3099, type: 2}
loginCaption: {fileID: 6365370226358055450}
statusCaption: {fileID: 8542734968993604344}
statusLed: {fileID: 2785659790907189970}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,9 @@ PrefabInstance:
propertyPath: m_LocalScale.y
value: 0.01
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 8362453174100900506, guid: 171f717c846f82349ae46e1af72a2966, type: 3}
- {fileID: 8362453175129801660, guid: 171f717c846f82349ae46e1af72a2966, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 171f717c846f82349ae46e1af72a2966, type: 3}
--- !u!4 &3305895592121612024 stripped
Transform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,9 @@ PrefabInstance:
propertyPath: m_LocalScale.y
value: 0.01
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 8362453174100900506, guid: 171f717c846f82349ae46e1af72a2966, type: 3}
- {fileID: 8362453175129801660, guid: 171f717c846f82349ae46e1af72a2966, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 171f717c846f82349ae46e1af72a2966, type: 3}
--- !u!114 &6798500909607908661 stripped
MonoBehaviour:
Expand Down
7 changes: 4 additions & 3 deletions Frontend/VIAProMa/Assets/Scenes/MainScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44402242, g: 0.49316543, b: 0.5722324, a: 1}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -3148,9 +3148,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 118d10d69a3818346be0c79a169265a7, type: 3}
m_Name:
m_EditorClassIdentifier:
learningLayersClientData: {fileID: 11400000, guid: fb2ae7f2504b7c7429507e37671fe103,
learningLayersClientData: {fileID: 11400000, guid: 99a9bb57e8cc35b41940c9e6eeac3099,
type: 2}
gitHubClientData: {fileID: 11400000, guid: 17933bb104c1395408420ed026a401ed, type: 2}
gitHubClientData: {fileID: 11400000, guid: 4b4554d42966bb6458cf30184dfb1a82, type: 2}
--- !u!4 &926572256
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -3409,6 +3409,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 177bddf229f8d8445a70c0652f03b7df, type: 3}
m_Name:
m_EditorClassIdentifier:
DisconnectAfterKeepAlive: 0
KeepAliveInBackground: 60000
ApplyDontDestroyOnLoad: 1
--- !u!4 &1452304941
Expand Down
102 changes: 100 additions & 2 deletions Frontend/VIAProMa/Assets/Scripts/DataModel/API/Issue.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using i5.VIAProMa.UI.ListView.Core;
using i5.VIAProMa.DataModel.GitHub;
using i5.VIAProMa.DataModel.ReqBaz;
using i5.VIAProMa.UI.ListView.Core;
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -45,6 +47,10 @@ public class Issue : IListViewItemData
/// Timestamp string when the issue was created
/// </summary>
[SerializeField] private string creationDate;
/*/// <summary>
/// Timestamp string when the issue was last updated
/// </summary>
[SerializeField] private string lastUpdatedDate;*/
/// <summary>
/// Timestamp string when the issue was closed
/// </summary>
Expand Down Expand Up @@ -90,6 +96,10 @@ public class Issue : IListViewItemData
/// The string representation of the point in time when the issue was created
/// </summary>
public string CreationDateString { get => creationDate; }
/*/// <summary>
/// The string representation of the point in time when the issue was last updated
/// </summary>
public string LastUpdatedDateString { get => lastUpdatedDate; }*/
/// <summary>
/// The string representation of the point in time when the issue was closed
/// </summary>
Expand Down Expand Up @@ -124,7 +134,7 @@ public Issue()
/// <param name="closedDate">The string representation of the point in time when the issue was closed</param>
/// <param name="developers">The array of developers who are assigned to the issue and are working on it</param>
/// <param name="commenters">The array of users who have commented on the issue</param>
public Issue(DataSource source, int id, string name, string description, int projectId, User creator, IssueStatus status, string creationDate, string closedDate, User[] developers, User[] commenters)
public Issue(DataSource source, int id, string name, string description, int projectId, User creator, IssueStatus status, string creationDate, /*string lastUpdatedDate, */string closedDate, User[] developers, User[] commenters)
{
this.source = source;
this.id = id;
Expand All @@ -134,12 +144,100 @@ public Issue(DataSource source, int id, string name, string description, int pro
this.creator = creator;
this.status = status;
this.creationDate = creationDate;
//this.lastUpdatedDate = lastUpdatedDate;
this.closedDate = closedDate;
this.developers = developers;
this.commenters = commenters;
}

/// <summary>
/// Generates an Issue object from a Requirement (from the Requirements Bazaar)
/// </summary>
/// <param name="req">The requirement from the requirements bazaar</param>
/// <returns>The generic Issue</returns>
public static Issue fromRequirement(RequirementIssue req, User[] contributors, User[] developers)
{
string closedDate = "";
IssueStatus state = req.Status;
if (state == IssueStatus.CLOSED)
closedDate = req.LastUpdatedDateString;
if (state == IssueStatus.OPEN && developers.Length > 0)
state = IssueStatus.IN_PROGRESS;
Issue issue = new Issue(DataSource.REQUIREMENTS_BAZAAR,
req.Id,
req.Name,
req.Description,
req.ProjectId,
User.fromReqBazUser(req.Creator),
state,
req.CreationDateString,
//req.LastUpdatedDateString,
closedDate,
developers,
contributors
);
return issue;
}

/// <summary>
/// Generates an Issue object array from a Requirement array (from the Requirements Bazaar)
/// </summary>
/// <param name="req">The requirement array from the requirements bazaar</param>
/// <returns>The generic Issue array</returns>
public static Issue[] fromRequirements(RequirementIssue[] reqs, ReqBazUser[][] contributors, ReqBazUser[][] developers)
{
Issue[] issues = new Issue[reqs.Length];
for (int i = 0; i < reqs.Length; i++)
{
issues[i] = fromRequirement(reqs[i], User.fromReqBazUsers(contributors[i]), User.fromReqBazUsers(developers[i]));
}
return issues;
}

/// <summary>
/// Generates an Issue object from a GitHub Issue (from GitHub)
/// </summary>
/// <param name="ghi">The issue from github</param>
/// <returns>The generic</returns>
public static Issue fromGitHubIssue(GitHubIssue ghi)
{
IssueStatus status;
if (ghi.State.Equals("closed"))
status = IssueStatus.CLOSED;
else if (ghi.Assignees != null && ghi.Assignees.Length > 0)
status = IssueStatus.IN_PROGRESS;
else
status = IssueStatus.OPEN;
Issue issue = new Issue(DataSource.GITHUB,
ghi.Number,
ghi.Title,
ghi.Body,
ghi.ProjectId,
User.fromGitHubUser(ghi.User),
status,
ghi.CreationDateString,
//ghi.LastUpdatedDateString,
"",
User.fromGitHubUsers(ghi.Assignees),
new User[0]
);
return issue;
}

/// <summary>
/// Generates an Issue object array from a GitHub Issue array (from GitHub)
/// </summary>
/// <param name="ghis">The issue array from github</param>
/// <returns>The generic Issue array</returns>
public static Issue[] fromGitHubIssues(GitHubIssue[] ghis)
{
Issue[] issues = new Issue[ghis.Length];
for (int i = 0; i < ghis.Length; i++)
{
issues[i] = fromGitHubIssue(ghis[i]);
}
return issues;
}

/// <summary>
/// Deep-comparion between this issue and obj based on the issue's source and id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task<Issue> FetchFullIssue()
}
else // GitHub
{
res = await GitHub.GetIssue(projectId, issueId);
res = await WebConnection.GitHub.GetIssue(projectId, issueId);
}
if (res.Successful)
{
Expand Down
42 changes: 41 additions & 1 deletion Frontend/VIAProMa/Assets/Scripts/DataModel/API/User.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using i5.VIAProMa.UI.ListView.Core;
using i5.VIAProMa.DataModel.GitHub;
using i5.VIAProMa.DataModel.ReqBaz;
using i5.VIAProMa.UI.ListView.Core;
using System;
using UnityEngine;

Expand Down Expand Up @@ -62,5 +64,43 @@ public User(DataSource source, int id, string userName, string firstName, string
this.profileImageUrl = profileImageUrl;
this.eMail = eMail;
}

public static User fromReqBazUser(ReqBazUser reqBazUser)
{
return new User(DataSource.REQUIREMENTS_BAZAAR, reqBazUser.id, reqBazUser.userName, reqBazUser.userName, "", reqBazUser.profileImage, "");
}

public static User[] fromReqBazUsers(ReqBazUser[] reqBazUsers)
{
if(reqBazUsers == null)
{
return new User[0];
}
User[] users = new User[reqBazUsers.Length];
for (int i = 0; i < reqBazUsers.Length; i++)
{
users[i] = fromReqBazUser(reqBazUsers[i]);
}
return users;
}

public static User fromGitHubUser(GitHubUser gitHubUser)
{
return new User(DataSource.GITHUB, gitHubUser.Id, gitHubUser.UserName, gitHubUser.UserName, "", gitHubUser.ProfileImageUrl, "");
}

public static User[] fromGitHubUsers(GitHubUser[] gitHubUsers)
{
if (gitHubUsers == null)
{
return new User[0];
}
User[] users = new User[gitHubUsers.Length];
for (int i = 0; i < gitHubUsers.Length; i++)
{
users[i] = fromGitHubUser(gitHubUsers[i]);
}
return users;
}
}
}
8 changes: 8 additions & 0 deletions Frontend/VIAProMa/Assets/Scripts/DataModel/GitHub.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading