File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
CodeEdit/Features/SourceControl/Views Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ struct SourceControlPullView: View {
1313
1414 @EnvironmentObject var sourceControlManager : SourceControlManager
1515
16+ @State var loading : Bool = false
17+
1618 var body : some View {
1719 VStack ( spacing: 0 ) {
1820 Form {
@@ -34,18 +36,29 @@ struct SourceControlPullView: View {
3436 . scrollDisabled ( true )
3537 . scrollContentBackground ( . hidden)
3638 HStack {
39+ if loading {
40+ HStack ( spacing: 7.5 ) {
41+ ProgressView ( )
42+ . progressViewStyle ( . circular)
43+ . controlSize ( . small)
44+ Text ( " Pulling changes... " )
45+ . font ( . subheadline)
46+ }
47+ }
3748 Spacer ( )
3849 Button {
3950 dismiss ( )
4051 } label: {
4152 Text ( " Cancel " )
4253 . frame ( minWidth: 56 )
4354 }
55+ . disabled ( loading)
4456 Button ( action: submit) {
4557 Text ( " Pull " )
4658 . frame ( minWidth: 56 )
4759 }
4860 . buttonStyle ( . borderedProminent)
61+ . disabled ( loading)
4962 }
5063 . padding ( . horizontal, 20 )
5164 . padding ( . bottom, 20 )
@@ -59,14 +72,17 @@ struct SourceControlPullView: View {
5972 if !sourceControlManager. changedFiles. isEmpty {
6073 sourceControlManager. stashSheetIsPresented = true
6174 } else {
75+ self . loading = true
6276 try await sourceControlManager. pull (
6377 remote: sourceControlManager. operationRemote? . name ?? nil ,
6478 branch: sourceControlManager. operationBranch? . name ?? nil ,
6579 rebase: sourceControlManager. operationRebase
6680 )
81+ self . loading = false
6782 dismiss ( )
6883 }
6984 } catch {
85+ self . loading = false
7086 await sourceControlManager. showAlertForError ( title: " Failed to pull " , error: error)
7187 }
7288 }
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ struct SourceControlPushView: View {
1313
1414 @EnvironmentObject var sourceControlManager : SourceControlManager
1515
16+ @State var loading : Bool = false
17+
1618 var body : some View {
1719 VStack ( spacing: 0 ) {
1820 Form {
@@ -35,18 +37,29 @@ struct SourceControlPushView: View {
3537 . scrollDisabled ( true )
3638 . scrollContentBackground ( . hidden)
3739 HStack {
40+ if loading {
41+ HStack ( spacing: 7.5 ) {
42+ ProgressView ( )
43+ . progressViewStyle ( . circular)
44+ . controlSize ( . small)
45+ Text ( " Pushing changes... " )
46+ . font ( . subheadline)
47+ }
48+ }
3849 Spacer ( )
3950 Button {
4051 dismiss ( )
4152 } label: {
4253 Text ( " Cancel " )
4354 . frame ( minWidth: 56 )
4455 }
56+ . disabled ( loading)
4557 Button ( action: submit) {
4658 Text ( " Push " )
4759 . frame ( minWidth: 56 )
4860 }
4961 . buttonStyle ( . borderedProminent)
62+ . disabled ( loading)
5063 }
5164 . padding ( . horizontal, 20 )
5265 . padding ( . bottom, 20 )
@@ -57,13 +70,16 @@ struct SourceControlPushView: View {
5770 func submit( ) {
5871 Task {
5972 do {
73+ self . loading = true
6074 try await sourceControlManager. push (
6175 remote: sourceControlManager. operationRemote? . name ?? nil ,
6276 branch: sourceControlManager. operationBranch? . name ?? nil ,
6377 setUpstream: sourceControlManager. currentBranch? . upstream == nil
6478 )
79+ self . loading = false
6580 dismiss ( )
6681 } catch {
82+ self . loading = false
6783 await sourceControlManager. showAlertForError ( title: " Failed to push " , error: error)
6884 }
6985 }
You can’t perform that action at this time.
0 commit comments