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

User connected to a cloud server can open the Dashboard #90

Merged
merged 6 commits into from
Sep 19, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 37 additions & 3 deletions Source/PlasticSourceControl/Private/PlasticSourceControlMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,15 @@ void FPlasticSourceControlMenu::VisitSupportURLClicked() const
}
}

void FPlasticSourceControlMenu::VisitLockRulesURLClicked(const FString InOrganizationName) const
{
const FString OrganizationLockRulesURL = FString::Printf(
TEXT("https://dashboard.unity3d.com/devops/organizations/default/plastic-scm/organizations/%s/lock-rules"),
*InOrganizationName
);
FPlatformProcess::LaunchURL(*OrganizationLockRulesURL, NULL, NULL);
}

// Display an ongoing notification during the whole operation
void FPlasticSourceControlMenu::DisplayInProgressNotification(const FText& InOperationInProgressString)
{
Expand Down Expand Up @@ -536,9 +545,10 @@ void FPlasticSourceControlMenu::AddMenuExtension(FToolMenuSection& Menu)
)
);

#if ENGINE_MAJOR_VERSION == 5
Menu.AddMenuEntry(
#if ENGINE_MAJOR_VERSION == 5
"SourceControlEditorPreferences",
#endif
LOCTEXT("SourceControlEditorPreferences", "Editor Preferences - Source Control"),
LOCTEXT("SourceControlEditorPreferencesTooltip", "Open the Load & Save section with Source Control in the Editor Preferences."),
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1
Expand All @@ -551,9 +561,8 @@ void FPlasticSourceControlMenu::AddMenuExtension(FToolMenuSection& Menu)
FCanExecuteAction()
)
);
#endif

#if ENGINE_MAJOR_VERSION == 5
#if ENGINE_MAJOR_VERSION == 5 // Disable the "Source Control Project Settings" for UE4 since this section is new to UE5
Menu.AddMenuEntry(
"SourceControlProjectSettings",
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 2
Expand Down Expand Up @@ -629,6 +638,31 @@ void FPlasticSourceControlMenu::AddMenuExtension(FToolMenuSection& Menu)
FCanExecuteAction()
)
);

FPlasticSourceControlProvider& Provider = FPlasticSourceControlModule::Get().GetProvider();
const FString& ServerUrl = Provider.GetServerUrl();
const int32 CloudIndex = ServerUrl.Find(TEXT("@cloud"));
if (CloudIndex > INDEX_NONE)
{
const FString& OrganizationName = ServerUrl.Left(CloudIndex);

Menu.AddMenuEntry(
#if ENGINE_MAJOR_VERSION == 5
"PlasticLockRulesURL",
#endif
LOCTEXT("PlasticLockRulesURL", "Configure Lock Rules"),
LOCTEXT("PlasticLockRulesURLTooltip", "Navigate to lock rules configuration page in the Unity Dashboard."),
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1
FSlateIcon(FAppStyle::GetAppStyleSetName(), "PropertyWindow.Locked"),
#else
FSlateIcon(FEditorStyle::GetStyleSetName(), "PropertyWindow.Locked"),
SRombautsU marked this conversation as resolved.
Show resolved Hide resolved
#endif
FUIAction(
FExecuteAction::CreateRaw(this, &FPlasticSourceControlMenu::VisitLockRulesURLClicked, OrganizationName),
FCanExecuteAction()
)
);
}
}

#if ENGINE_MAJOR_VERSION == 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class FPlasticSourceControlMenu
void ShowSourceControlPlasticScmProjectSettings() const;
void VisitDocsURLClicked() const;
void VisitSupportURLClicked() const;
void VisitLockRulesURLClicked(const FString InOrganizationName) const;

private:
bool IsSourceControlConnected() const;
Expand Down