Compare commits
No commits in common. "main" and "building-the-basics" have entirely different histories.
main
...
building-t
@ -26,21 +26,15 @@ void UServerAPI::SendFormData(const FUnrealzillaPostData &PostData)
|
||||
}
|
||||
|
||||
|
||||
void UServerAPI::ServerConnectionError(const EHttpRequestStatus::Type Status, const EHttpFailureReason Reason)
|
||||
void UServerAPI::ServerConnectionError(const EHttpRequestStatus::Type Status)
|
||||
{
|
||||
switch (Status) {
|
||||
case EHttpRequestStatus::Failed:
|
||||
switch (Reason) {
|
||||
case EHttpFailureReason::ConnectionError:
|
||||
case EHttpRequestStatus::Failed_ConnectionError:
|
||||
this->CreateError("There was an error connecting to the server. Please retry.", true);
|
||||
break;
|
||||
case EHttpFailureReason::Cancelled:
|
||||
this->CreateError("Connection to the server was cancelled.", true);
|
||||
break;
|
||||
default:
|
||||
case EHttpRequestStatus::Failed:
|
||||
this->CreateError("Connection to the server completed but then failed.", true);
|
||||
break;
|
||||
}
|
||||
case EHttpRequestStatus::NotStarted:
|
||||
this->CreateError("Connection was not started.");
|
||||
break;
|
||||
|
||||
@ -252,7 +252,7 @@ void UServerBugzillaAPI::ServerPOSTResponse(FHttpRequestPtr Request, FHttpRespon
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ void UServerBugzillaAPI::ServerPOSTUpdateMarkerResponse(FHttpRequestPtr Request,
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ void UServerBugzillaAPI::ServerProductInfoResponse(FHttpRequestPtr Request, FHtt
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ void UServerBugzillaAPI::ServerSeverityInfoResponse(FHttpRequestPtr Request, FHt
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,7 +404,7 @@ void UServerBugzillaAPI::ServerPlatformInfoResponse(FHttpRequestPtr Request, FHt
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ void UServerBugzillaAPI::ServerOSInfoResponse(FHttpRequestPtr Request, FHttpResp
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,17 +47,17 @@ void UServerJiraAPI::ListOfBoardsResponse(FHttpRequestPtr Request, FHttpResponse
|
||||
const TSharedRef<TJsonReader<>> &Reader = TJsonReaderFactory<>::Create(JSONResponse);
|
||||
if (FJsonSerializer::Deserialize(Reader, JSON))
|
||||
{
|
||||
const TArray<TSharedPtr<FJsonValue>>& BoardsArray = JSON->GetArrayField(TEXT("values"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &BoardsArray = JSON->GetArrayField("values");
|
||||
for (const TSharedPtr<FJsonValue> &BoardValue : BoardsArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Board = BoardValue->AsObject();
|
||||
const TSharedPtr<FJsonObject>& Location = Board->GetObjectField(TEXT("location"));
|
||||
if (Location->GetStringField(TEXT("projectName")) == GetDefault<UUnrealzillaGlobalSettings>()->JiraProjectName)
|
||||
const TSharedPtr<FJsonObject> &Location = Board->GetObjectField("location");
|
||||
if (Location->GetStringField("projectName") == GetDefault<UUnrealzillaGlobalSettings>()->JiraProjectName)
|
||||
{
|
||||
this->BoardID = Board->GetIntegerField(TEXT("id"));
|
||||
this->ProjectID = Location->GetIntegerField(TEXT("projectId"));
|
||||
this->ProjectKey = Location->GetStringField(TEXT("projectKey"));
|
||||
this->ProjectAvatarURI = Location->GetStringField(TEXT("avatarURI"));
|
||||
this->BoardID = Board->GetIntegerField("id");
|
||||
this->ProjectID = Location->GetIntegerField("projectId");
|
||||
this->ProjectKey = Location->GetStringField("projectKey");
|
||||
this->ProjectAvatarURI = Location->GetStringField("avatarURI");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -81,12 +81,12 @@ void UServerJiraAPI::ListOfFieldsResponse(FHttpRequestPtr Request, FHttpResponse
|
||||
const TSharedRef<TJsonReader<>> &Reader = TJsonReaderFactory<>::Create(JSONResponse);
|
||||
if (FJsonSerializer::Deserialize(Reader, JSON))
|
||||
{
|
||||
const TArray<TSharedPtr<FJsonValue>>& FieldArray = JSON->GetArrayField(TEXT("fields"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &FieldArray = JSON->GetArrayField("fields");
|
||||
for (const TSharedPtr<FJsonValue> &FieldValue : FieldArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Field = FieldValue->AsObject();
|
||||
const FString& Name = Field->GetStringField(TEXT("name"));
|
||||
const FString &Key = Field->GetStringField(TEXT("key"));
|
||||
const FString &Name = Field->GetStringField("name");
|
||||
const FString &Key = Field->GetStringField("key");
|
||||
if (Name == GetDefault<UUnrealzillaGlobalSettings>()->JiraMapNameField)
|
||||
{
|
||||
this->MapNameCustomField = Key;
|
||||
@ -154,25 +154,25 @@ void UServerJiraAPI::ListOfBugsResponse(FHttpRequestPtr Request, FHttpResponsePt
|
||||
const TSharedRef<TJsonReader<>> &Reader = TJsonReaderFactory<>::Create(JSONResponse);
|
||||
if (FJsonSerializer::Deserialize(Reader, JSON))
|
||||
{
|
||||
const TArray<TSharedPtr<FJsonValue>> &IssuesArray = JSON->GetArrayField(TEXT("issues"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &IssuesArray = JSON->GetArrayField("issues");
|
||||
for (const TSharedPtr<FJsonValue> &IssueValue : IssuesArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Issue = IssueValue->AsObject();
|
||||
const TSharedPtr<FJsonObject>& Fields = Issue->GetObjectField(TEXT("fields"));
|
||||
const TSharedPtr<FJsonObject>& Status = Fields->GetObjectField(TEXT("status"));
|
||||
const FString StatusName = Status->GetStringField(TEXT("name"));
|
||||
const TSharedPtr<FJsonObject> &Fields = Issue->GetObjectField("fields");
|
||||
const TSharedPtr<FJsonObject> &Status = Fields->GetObjectField("status");
|
||||
const FString StatusName = Status->GetStringField("name");
|
||||
|
||||
if ((GetDefault<UUnrealzillaGlobalSettings>()->bShowUnresolvedBugs && GetDefault<UUnrealzillaGlobalSettings>()->UnresolvedStatuses.Contains(StatusName)) ||
|
||||
(GetDefault<UUnrealzillaGlobalSettings>()->bShowInProgressBugs && GetDefault<UUnrealzillaGlobalSettings>()->InProgressStatuses.Contains(StatusName)) ||
|
||||
(GetDefault<UUnrealzillaGlobalSettings>()->bShowResolvedBugs && GetDefault<UUnrealzillaGlobalSettings>()->ResolvedStatuses.Contains(StatusName)))
|
||||
{
|
||||
const TSharedPtr<FJsonObject>& Priority = Fields->GetObjectField(TEXT("priority"));
|
||||
const TSharedPtr<FJsonObject> &Priority = Fields->GetObjectField("priority");
|
||||
|
||||
FUnrealzillaBugData Bug;
|
||||
Bug.ID = Issue->GetNumberField(TEXT("id"));
|
||||
Bug.ID = Issue->GetNumberField("id");
|
||||
Bug.Status = StatusName;
|
||||
Bug.Summary = Fields->GetStringField(TEXT("summary"));
|
||||
Bug.Severity = Priority->GetStringField(TEXT("name"));
|
||||
Bug.Summary = Fields->GetStringField("summary");
|
||||
Bug.Severity = Priority->GetStringField("name");
|
||||
//Bug.Component = BugzillaData.component;
|
||||
//Bug.Platform = BugzillaData.platform;
|
||||
//Bug.OperatingSystem = BugzillaData.op_sys;
|
||||
@ -201,7 +201,7 @@ void UServerJiraAPI::ListOfBugsResponse(FHttpRequestPtr Request, FHttpResponsePt
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,52 +247,52 @@ void UServerJiraAPI::ServerFieldOptionsResponse(FHttpRequestPtr Request, FHttpRe
|
||||
const TSharedRef<TJsonReader<>> &Reader = TJsonReaderFactory<>::Create(JSONResponse);
|
||||
if (FJsonSerializer::Deserialize(Reader, JSON))
|
||||
{
|
||||
const TArray<TSharedPtr<FJsonValue>>& ProjectsArray = JSON->GetArrayField(TEXT("projects"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &ProjectsArray = JSON->GetArrayField("projects");
|
||||
for (const TSharedPtr<FJsonValue> &ProjectValue : ProjectsArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Project = ProjectValue->AsObject();
|
||||
if (Project->GetStringField(TEXT("name")) == GetDefault<UUnrealzillaGlobalSettings>()->JiraProjectName)
|
||||
if (Project->GetStringField("name") == GetDefault<UUnrealzillaGlobalSettings>()->JiraProjectName)
|
||||
{
|
||||
const TArray<TSharedPtr<FJsonValue>> &IssueTypes = Project->GetArrayField(TEXT("issuetypes"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &IssueTypes = Project->GetArrayField("issuetypes");
|
||||
for (const TSharedPtr<FJsonValue> &IssueTypeValue : IssueTypes)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &IssueType = IssueTypeValue->AsObject();
|
||||
const TSharedPtr<FJsonObject>& Fields = IssueType->GetObjectField(TEXT("fields"));
|
||||
const TSharedPtr<FJsonObject> &Fields = IssueType->GetObjectField("fields");
|
||||
|
||||
// After all that boilerplate code, finally get all available field options here
|
||||
{
|
||||
// Components
|
||||
const TSharedPtr<FJsonObject> &Department = Fields->GetObjectField(this->DepartmentCustomField);
|
||||
const TArray<TSharedPtr<FJsonValue>>& AllowedDepartmentsArray = Department->GetArrayField(TEXT("allowedValues"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &AllowedDepartmentsArray = Department->GetArrayField("allowedValues");
|
||||
for (const TSharedPtr<FJsonValue> &AllowedDepartmentsValue : AllowedDepartmentsArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Value = AllowedDepartmentsValue->AsObject();
|
||||
this->ComponentsList.Add(Value->GetStringField(TEXT("value")));
|
||||
this->ComponentsList.Add(Value->GetStringField("value"));
|
||||
}
|
||||
|
||||
// Bug severity
|
||||
const TSharedPtr<FJsonObject> &Severity = Fields->GetObjectField(this->SeverityCustomField);
|
||||
const TArray<TSharedPtr<FJsonValue>>& AllowedSeveritiesArray = Severity->GetArrayField(TEXT("allowedValues"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &AllowedSeveritiesArray = Severity->GetArrayField("allowedValues");
|
||||
for (const TSharedPtr<FJsonValue> &AllowedSeveritiesValue : AllowedSeveritiesArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Value = AllowedSeveritiesValue->AsObject();
|
||||
this->SeverityList.Add(Value->GetStringField(TEXT("value")));
|
||||
this->SeverityList.Add(Value->GetStringField("value"));
|
||||
}
|
||||
|
||||
// Platform
|
||||
const TSharedPtr<FJsonObject> &Platform = Fields->GetObjectField(this->PlatformCustomField);
|
||||
const TArray<TSharedPtr<FJsonValue>>& PlatformsArray = Platform->GetArrayField(TEXT("allowedValues"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &PlatformsArray = Platform->GetArrayField("allowedValues");
|
||||
for (const TSharedPtr<FJsonValue> &PlatformsValue : PlatformsArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Value = PlatformsValue->AsObject();
|
||||
this->PlatformsList.Add(Value->GetStringField(TEXT("value")));
|
||||
this->PlatformsList.Add(Value->GetStringField("value"));
|
||||
|
||||
// Also get children and add them to the OS list here
|
||||
const TArray<TSharedPtr<FJsonValue>>& ChildrenArray = Value->GetArrayField(TEXT("children"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &ChildrenArray = Value->GetArrayField("children");
|
||||
for (const TSharedPtr<FJsonValue> &ChildValue : ChildrenArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Child = ChildValue->AsObject();
|
||||
this->OSList.AddUnique(Child->GetStringField(TEXT("value")));
|
||||
this->OSList.AddUnique(Child->GetStringField("value"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ void UServerJiraAPI::ServerFieldOptionsResponse(FHttpRequestPtr Request, FHttpRe
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
void UServerJiraAPI::ServerVersionsResponse(FHttpRequestPtr Request, FHttpResponsePtr Response, bool Success)
|
||||
@ -324,11 +324,11 @@ void UServerJiraAPI::ServerVersionsResponse(FHttpRequestPtr Request, FHttpRespon
|
||||
const TSharedRef<TJsonReader<>> &Reader = TJsonReaderFactory<>::Create(JSONResponse);
|
||||
if (FJsonSerializer::Deserialize(Reader, JSON))
|
||||
{
|
||||
const TArray<TSharedPtr<FJsonValue>> &ValuesArray = JSON->GetArrayField(TEXT("values"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &ValuesArray = JSON->GetArrayField("values");
|
||||
for (const TSharedPtr<FJsonValue> &ValueObject : ValuesArray)
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Value = ValueObject->AsObject();
|
||||
this->VersionsList.Add(Value->GetStringField(TEXT("name")));
|
||||
this->VersionsList.Add(Value->GetStringField("name"));
|
||||
}
|
||||
|
||||
this->CheckIfAllFormResponsesAreIn();
|
||||
@ -340,7 +340,7 @@ void UServerJiraAPI::ServerVersionsResponse(FHttpRequestPtr Request, FHttpRespon
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
void UServerJiraAPI::CheckIfAllFormResponsesAreIn()
|
||||
@ -513,13 +513,13 @@ void UServerJiraAPI::ServerPOSTResponse(FHttpRequestPtr Request, FHttpResponsePt
|
||||
if (FJsonSerializer::Deserialize(Reader, JSON))
|
||||
{
|
||||
// I'm not sure what is meant to show up in the "errorMessages" array, but this is where we handle that.
|
||||
const TArray<TSharedPtr<FJsonValue>>& ErrorMessageArray = JSON->GetArrayField(TEXT("errorMessages"));
|
||||
const TArray<TSharedPtr<FJsonValue>> &ErrorMessageArray = JSON->GetArrayField("errorMessages");
|
||||
if (!ErrorMessageArray.IsEmpty())
|
||||
{
|
||||
// Handle error messages here
|
||||
}
|
||||
|
||||
const TSharedPtr<FJsonObject> &Errors = JSON->GetObjectField(TEXT("errors"));
|
||||
const TSharedPtr<FJsonObject> &Errors = JSON->GetObjectField("errors");
|
||||
TArray<FString> ErrorStringBuilder;
|
||||
TArray<FString> ErrorKeys;
|
||||
Errors->Values.GenerateKeyArray(ErrorKeys);
|
||||
@ -539,7 +539,7 @@ void UServerJiraAPI::ServerPOSTResponse(FHttpRequestPtr Request, FHttpResponsePt
|
||||
|
||||
//const int32 &NewBugID = FCString::Atoi(*JSON->GetStringField("id"));
|
||||
//const FString &NewBugKey = JSON->GetStringField("key");
|
||||
const FString& NewBugURI = JSON->GetStringField(TEXT("self"));
|
||||
const FString &NewBugURI = JSON->GetStringField("self");
|
||||
|
||||
FHttpModule &HttpModule = FHttpModule::Get();
|
||||
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> NewBugRequest = HttpModule.CreateRequest();
|
||||
@ -557,7 +557,7 @@ void UServerJiraAPI::ServerPOSTResponse(FHttpRequestPtr Request, FHttpResponsePt
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -571,23 +571,23 @@ void UServerJiraAPI::ServerPOSTUpdateMarkerResponse(FHttpRequestPtr Request, FHt
|
||||
const TSharedRef<TJsonReader<>> &Reader = TJsonReaderFactory<>::Create(JSONResponse);
|
||||
if (FJsonSerializer::Deserialize(Reader, JSON))
|
||||
{
|
||||
if (JSON->HasTypedField<EJson::Object>(TEXT("fields")))
|
||||
if (JSON->HasTypedField<EJson::Object>("fields"))
|
||||
{
|
||||
const TSharedPtr<FJsonObject> &Fields = JSON->GetObjectField(TEXT("fields"));
|
||||
const TSharedPtr<FJsonObject> &Fields = JSON->GetObjectField("fields");
|
||||
const TSharedPtr<FJsonObject> &PlatformFields = Fields->GetObjectField(this->PlatformCustomField);
|
||||
|
||||
TArray<FUnrealzillaBugData> BugData;
|
||||
FUnrealzillaBugData Bug;
|
||||
Bug.ID = JSON->GetIntegerField(TEXT("id"));
|
||||
Bug.Summary = Fields->GetStringField(TEXT("summary"));
|
||||
Bug.Component = Fields->GetObjectField(this->DepartmentCustomField)->GetStringField(TEXT("value"));
|
||||
Bug.ID = JSON->GetIntegerField("id");
|
||||
Bug.Summary = Fields->GetStringField("summary");
|
||||
Bug.Component = Fields->GetObjectField(this->DepartmentCustomField)->GetStringField("value");
|
||||
Bug.MapName = Fields->GetStringField(this->MapNameCustomField);
|
||||
Bug.MarkerLocation = Fields->GetStringField(this->MarkerLocationCustomField);
|
||||
Bug.Platform = PlatformFields->GetStringField(TEXT("value"));
|
||||
Bug.OperatingSystem = PlatformFields->GetObjectField(TEXT("child"))->GetStringField(TEXT("value"));
|
||||
Bug.Severity = Fields->GetObjectField(this->SeverityCustomField)->GetStringField(TEXT("value"));
|
||||
Bug.Status = Fields->GetObjectField(TEXT("status"))->GetStringField(TEXT("name"));
|
||||
Bug.Resolution = Fields->GetStringField(TEXT("resolution"));
|
||||
Bug.Platform = PlatformFields->GetStringField("value");
|
||||
Bug.OperatingSystem = PlatformFields->GetObjectField("child")->GetStringField("value");
|
||||
Bug.Severity = Fields->GetObjectField(this->SeverityCustomField)->GetStringField("value");
|
||||
Bug.Status = Fields->GetObjectField("status")->GetStringField("name");
|
||||
Bug.Resolution = Fields->GetStringField("resolution");
|
||||
BugData.Add(Bug);
|
||||
this->BugDataResponse.Execute(BugData);
|
||||
}
|
||||
@ -599,7 +599,7 @@ void UServerJiraAPI::ServerPOSTUpdateMarkerResponse(FHttpRequestPtr Request, FHt
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ServerConnectionError(Request->GetStatus(), Request->GetFailureReason());
|
||||
this->ServerConnectionError(Request->GetStatus());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
FServerErrorResponseDelegate ErrorResponse;
|
||||
|
||||
protected:
|
||||
void ServerConnectionError(const EHttpRequestStatus::Type Status, const EHttpFailureReason Reason);
|
||||
void ServerConnectionError(const EHttpRequestStatus::Type Status);
|
||||
|
||||
void CreateError(const EErrorVerb &Verb, const FBugzillaJSONPostResponse &Data);
|
||||
void CreateError(const EErrorVerb &Verb, const FBugzillaJSONProductResponse &Data);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user