Removed rebase dialog
This commit is contained in:
parent
cbedb0e82c
commit
5c879961ac
@ -15,7 +15,6 @@ import app.ui.components.SideMenuPanel
|
|||||||
import app.ui.components.SideMenuSubentry
|
import app.ui.components.SideMenuSubentry
|
||||||
import app.ui.context_menu.branchContextMenuItems
|
import app.ui.context_menu.branchContextMenuItems
|
||||||
import app.ui.dialogs.MergeDialog
|
import app.ui.dialogs.MergeDialog
|
||||||
import app.ui.dialogs.RebaseDialog
|
|
||||||
import app.viewmodels.BranchesViewModel
|
import app.viewmodels.BranchesViewModel
|
||||||
import org.eclipse.jgit.lib.Ref
|
import org.eclipse.jgit.lib.Ref
|
||||||
|
|
||||||
@ -30,7 +29,6 @@ fun Branches(
|
|||||||
val currentBranch = currentBranchState.value
|
val currentBranch = currentBranchState.value
|
||||||
|
|
||||||
val (mergeBranch, setMergeBranch) = remember { mutableStateOf<Ref?>(null) }
|
val (mergeBranch, setMergeBranch) = remember { mutableStateOf<Ref?>(null) }
|
||||||
val (rebaseBranch, setRebaseBranch) = remember { mutableStateOf<Ref?>(null) }
|
|
||||||
|
|
||||||
SideMenuPanel(
|
SideMenuPanel(
|
||||||
title = "Local branches",
|
title = "Local branches",
|
||||||
@ -48,7 +46,7 @@ fun Branches(
|
|||||||
onCheckoutBranch = { branchesViewModel.checkoutRef(branch) },
|
onCheckoutBranch = { branchesViewModel.checkoutRef(branch) },
|
||||||
onMergeBranch = { setMergeBranch(branch) },
|
onMergeBranch = { setMergeBranch(branch) },
|
||||||
onDeleteBranch = { branchesViewModel.deleteBranch(branch) },
|
onDeleteBranch = { branchesViewModel.deleteBranch(branch) },
|
||||||
onRebaseBranch = { setRebaseBranch(branch) },
|
onRebaseBranch = { branchesViewModel.rebaseBranch(branch) },
|
||||||
onPushToRemoteBranch = { branchesViewModel.pushToRemoteBranch(branch) },
|
onPushToRemoteBranch = { branchesViewModel.pushToRemoteBranch(branch) },
|
||||||
onPullFromRemoteBranch = { branchesViewModel.pullFromRemoteBranch(branch) },
|
onPullFromRemoteBranch = { branchesViewModel.pullFromRemoteBranch(branch) },
|
||||||
)
|
)
|
||||||
@ -63,15 +61,6 @@ fun Branches(
|
|||||||
onAccept = { ff -> branchesViewModel.mergeBranch(mergeBranch, ff) }
|
onAccept = { ff -> branchesViewModel.mergeBranch(mergeBranch, ff) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rebaseBranch != null && currentBranch != null) {
|
|
||||||
RebaseDialog(
|
|
||||||
currentBranchName = currentBranch.simpleName,
|
|
||||||
rebaseBranchName = rebaseBranch.name,
|
|
||||||
onReject = { setRebaseBranch(null) },
|
|
||||||
onAccept = { branchesViewModel.rebaseBranch(rebaseBranch) }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
package app.ui.dialogs
|
|
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.material.Text
|
|
||||||
import androidx.compose.material.TextButton
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import app.theme.primaryTextColor
|
|
||||||
import app.theme.textButtonColors
|
|
||||||
import app.ui.components.PrimaryButton
|
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
|
||||||
fun RebaseDialog(
|
|
||||||
currentBranchName: String,
|
|
||||||
rebaseBranchName: String,
|
|
||||||
onReject: () -> Unit,
|
|
||||||
onAccept: () -> Unit
|
|
||||||
) {
|
|
||||||
MaterialDialog(onCloseRequested = onReject) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.background(MaterialTheme.colors.background),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
verticalArrangement = Arrangement.Center,
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = currentBranchName,
|
|
||||||
fontWeight = FontWeight.Medium,
|
|
||||||
color = MaterialTheme.colors.primaryTextColor,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = "will rebase ",
|
|
||||||
modifier = Modifier.padding(horizontal = 8.dp),
|
|
||||||
color = MaterialTheme.colors.primaryTextColor,
|
|
||||||
)
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = rebaseBranchName,
|
|
||||||
fontWeight = FontWeight.Medium,
|
|
||||||
color = MaterialTheme.colors.primaryTextColor,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = "After completing the operation, $currentBranchName will contain $rebaseBranchName changes",
|
|
||||||
color = MaterialTheme.colors.primaryTextColor,
|
|
||||||
)
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.padding(top = 16.dp)
|
|
||||||
.align(Alignment.End)
|
|
||||||
) {
|
|
||||||
TextButton(
|
|
||||||
modifier = Modifier.padding(end = 8.dp),
|
|
||||||
colors = textButtonColors(),
|
|
||||||
onClick = {
|
|
||||||
onReject()
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
Text("Cancel")
|
|
||||||
}
|
|
||||||
PrimaryButton(
|
|
||||||
onClick = {
|
|
||||||
onAccept()
|
|
||||||
},
|
|
||||||
text = "Rebase"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -179,6 +179,9 @@ fun Log(
|
|||||||
logViewModel = logViewModel,
|
logViewModel = logViewModel,
|
||||||
graphWidth = graphWidth,
|
graphWidth = graphWidth,
|
||||||
commitsLimit = logStatus.commitsLimit,
|
commitsLimit = logStatus.commitsLimit,
|
||||||
|
onRebase = { ref ->
|
||||||
|
logViewModel.rebaseBranch(ref)
|
||||||
|
},
|
||||||
onShowLogDialog = { dialog ->
|
onShowLogDialog = { dialog ->
|
||||||
logViewModel.showDialog(dialog)
|
logViewModel.showDialog(dialog)
|
||||||
}
|
}
|
||||||
@ -364,6 +367,7 @@ fun MessagesList(
|
|||||||
commitList: GraphCommitList,
|
commitList: GraphCommitList,
|
||||||
logViewModel: LogViewModel,
|
logViewModel: LogViewModel,
|
||||||
commitsLimit: Int,
|
commitsLimit: Int,
|
||||||
|
onRebase: (Ref) -> Unit,
|
||||||
onShowLogDialog: (LogDialog) -> Unit,
|
onShowLogDialog: (LogDialog) -> Unit,
|
||||||
graphWidth: Dp,
|
graphWidth: Dp,
|
||||||
) {
|
) {
|
||||||
@ -401,7 +405,7 @@ fun MessagesList(
|
|||||||
showCreateNewTag = { onShowLogDialog(LogDialog.NewTag(graphNode)) },
|
showCreateNewTag = { onShowLogDialog(LogDialog.NewTag(graphNode)) },
|
||||||
resetBranch = { onShowLogDialog(LogDialog.ResetBranch(graphNode)) },
|
resetBranch = { onShowLogDialog(LogDialog.ResetBranch(graphNode)) },
|
||||||
onMergeBranch = { ref -> onShowLogDialog(LogDialog.MergeBranch(ref)) },
|
onMergeBranch = { ref -> onShowLogDialog(LogDialog.MergeBranch(ref)) },
|
||||||
onRebaseBranch = { ref -> onShowLogDialog(LogDialog.RebaseBranch(ref)) },
|
onRebaseBranch = { ref -> onRebase(ref ) },
|
||||||
onRebaseInteractive = { logViewModel.rebaseInteractive(graphNode) },
|
onRebaseInteractive = { logViewModel.rebaseInteractive(graphNode) },
|
||||||
onRevCommitSelected = { logViewModel.selectLogLine(graphNode) },
|
onRevCommitSelected = { logViewModel.selectLogLine(graphNode) },
|
||||||
)
|
)
|
||||||
@ -552,17 +556,6 @@ fun LogDialogs(
|
|||||||
logViewModel.resetToCommit(showLogDialog.graphNode, resetType)
|
logViewModel.resetToCommit(showLogDialog.graphNode, resetType)
|
||||||
onResetShowLogDialog()
|
onResetShowLogDialog()
|
||||||
})
|
})
|
||||||
is LogDialog.RebaseBranch -> {
|
|
||||||
if (currentBranch != null) {
|
|
||||||
RebaseDialog(currentBranchName = currentBranch.simpleName,
|
|
||||||
rebaseBranchName = showLogDialog.ref.simpleName,
|
|
||||||
onReject = onResetShowLogDialog,
|
|
||||||
onAccept = {
|
|
||||||
logViewModel.rebaseBranch(showLogDialog.ref)
|
|
||||||
onResetShowLogDialog()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LogDialog.None -> {
|
LogDialog.None -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,4 @@ sealed class LogDialog {
|
|||||||
data class NewTag(val graphNode: GraphNode) : LogDialog()
|
data class NewTag(val graphNode: GraphNode) : LogDialog()
|
||||||
data class ResetBranch(val graphNode: GraphNode) : LogDialog()
|
data class ResetBranch(val graphNode: GraphNode) : LogDialog()
|
||||||
data class MergeBranch(val ref: Ref) : LogDialog()
|
data class MergeBranch(val ref: Ref) : LogDialog()
|
||||||
data class RebaseBranch(val ref: Ref) : LogDialog()
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user