-
Notifications
You must be signed in to change notification settings - Fork 22
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
Enterprise hosting support #53
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import Foundation | ||
|
||
public protocol GitHubCredentialsStore: AnyObject { | ||
var selfHostedURL: URL? { get async } | ||
var organizationName: String? { get async } | ||
var repositoryName: String? { get async } | ||
var ownerName: String? { get async } | ||
var enterpriseName: String? { get async } | ||
var appId: String? { get async } | ||
var privateKey: Data? { get async } | ||
func setSelfHostedURL(_ selfHostedURL: URL?) async | ||
func setOrganizationName(_ organizationName: String?) async | ||
func setRepository(_ repositoryName: String?, withOwner ownerName: String?) async | ||
func setEnterpriseName(_ enterpriseName: String?) async | ||
func setAppID(_ appID: String?) async | ||
func setPrivateKey(_ privateKeyData: Data?) async | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Foundation | ||
|
||
public enum GitHubServiceVersion { | ||
case dotCom | ||
case enterprise(URL) | ||
|
||
public enum Kind: String, CaseIterable { | ||
case dotCom | ||
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. I wonder if there's an official name for "standard GitHub" that we can use or if that's just "GitHub.com". |
||
case enterprise | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ struct GitHubPrivateKeyPicker: View { | |
L10n.Settings.Github.PrivateKey.Scopes.organization | ||
case .repo: | ||
L10n.Settings.Github.PrivateKey.Scopes.repository | ||
case .enterpriseServer: | ||
"Check permissions: `manage_runners:enterprise`" | ||
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. This text needs to be localized and formatted similar to the other texts listing required permissions. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -14,6 +14,21 @@ struct GitHubSettingsView: View { | |||||||
var body: some View { | ||||||||
Form { | ||||||||
Section { | ||||||||
Picker("Version", selection: $viewModel.version) { | ||||||||
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. This text needs to be localized and accessed through the L10n constant. |
||||||||
ForEach(GitHubServiceVersion.Kind.allCases, id: \.self) { scope in | ||||||||
Text(scope.title) | ||||||||
} | ||||||||
} | ||||||||
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. Would it make sense to turn this picker into a segmented control to align with the Runner Scope setting?
Suggested change
|
||||||||
|
||||||||
if viewModel.version == .enterprise { | ||||||||
TextField( | ||||||||
"Self hosted URL", | ||||||||
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. This text needs to be localized and accessed through the L10n constant. |
||||||||
text: $viewModel.selfHostedRaw, | ||||||||
prompt: Text("Github Service raw value") | ||||||||
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. This text needs to be localized and accessed through the L10n constant. |
||||||||
) | ||||||||
.disabled(!viewModel.isSettingsEnabled) | ||||||||
} | ||||||||
|
||||||||
Picker(L10n.Settings.Github.runnerScope, selection: $viewModel.runnerScope) { | ||||||||
ForEach(GitHubRunnerScope.allCases, id: \.self) { scope in | ||||||||
Text(scope.title) | ||||||||
|
@@ -41,6 +56,13 @@ struct GitHubSettingsView: View { | |||||||
prompt: Text(L10n.Settings.Github.RepositoryName.prompt) | ||||||||
) | ||||||||
.disabled(!viewModel.isSettingsEnabled) | ||||||||
case .enterpriseServer: | ||||||||
TextField( | ||||||||
"Enterprise name", | ||||||||
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. This text needs to be localized and accessed through the L10n constant. |
||||||||
text: $viewModel.enterpriseName, | ||||||||
prompt: Text("Acme Enterprise") | ||||||||
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. This text needs to be localized and accessed through the L10n constant. |
||||||||
) | ||||||||
.disabled(!viewModel.isSettingsEnabled) | ||||||||
} | ||||||||
} | ||||||||
Section { | ||||||||
|
@@ -77,6 +99,19 @@ private extension GitHubRunnerScope { | |||||||
L10n.Settings.RunnerScope.organization | ||||||||
case .repo: | ||||||||
L10n.Settings.RunnerScope.repository | ||||||||
case .enterpriseServer: | ||||||||
"Enterprise" | ||||||||
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. This text needs to be localized and accessed through the L10n constant. |
||||||||
} | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
private extension GitHubServiceVersion.Kind { | ||||||||
var title: String { | ||||||||
switch self { | ||||||||
case .dotCom: | ||||||||
return "github.com" | ||||||||
case .enterprise: | ||||||||
return "github self hosted" | ||||||||
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. I'm unfamiliar with enterprise GitHub setups and self-hosting so please correct me if I'm wrong but the |
||||||||
} | ||||||||
} | ||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These enum cases don't seem to be used. Can we remove them and simplify this enum?