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.context_menu.branchContextMenuItems
|
||||
import app.ui.dialogs.MergeDialog
|
||||
import app.ui.dialogs.RebaseDialog
|
||||
import app.viewmodels.BranchesViewModel
|
||||
import org.eclipse.jgit.lib.Ref
|
||||
|
||||
@ -30,7 +29,6 @@ fun Branches(
|
||||
val currentBranch = currentBranchState.value
|
||||
|
||||
val (mergeBranch, setMergeBranch) = remember { mutableStateOf<Ref?>(null) }
|
||||
val (rebaseBranch, setRebaseBranch) = remember { mutableStateOf<Ref?>(null) }
|
||||
|
||||
SideMenuPanel(
|
||||
title = "Local branches",
|
||||
@ -48,7 +46,7 @@ fun Branches(
|
||||
onCheckoutBranch = { branchesViewModel.checkoutRef(branch) },
|
||||
onMergeBranch = { setMergeBranch(branch) },
|
||||
onDeleteBranch = { branchesViewModel.deleteBranch(branch) },
|
||||
onRebaseBranch = { setRebaseBranch(branch) },
|
||||
onRebaseBranch = { branchesViewModel.rebaseBranch(branch) },
|
||||
onPushToRemoteBranch = { branchesViewModel.pushToRemoteBranch(branch) },
|
||||
onPullFromRemoteBranch = { branchesViewModel.pullFromRemoteBranch(branch) },
|
||||
)
|
||||
@ -63,15 +61,6 @@ fun Branches(
|
||||
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)
|
||||
|
@ -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,
|
||||
graphWidth = graphWidth,
|
||||
commitsLimit = logStatus.commitsLimit,
|
||||
onRebase = { ref ->
|
||||
logViewModel.rebaseBranch(ref)
|
||||
},
|
||||
onShowLogDialog = { dialog ->
|
||||
logViewModel.showDialog(dialog)
|
||||
}
|
||||
@ -364,6 +367,7 @@ fun MessagesList(
|
||||
commitList: GraphCommitList,
|
||||
logViewModel: LogViewModel,
|
||||
commitsLimit: Int,
|
||||
onRebase: (Ref) -> Unit,
|
||||
onShowLogDialog: (LogDialog) -> Unit,
|
||||
graphWidth: Dp,
|
||||
) {
|
||||
@ -401,7 +405,7 @@ fun MessagesList(
|
||||
showCreateNewTag = { onShowLogDialog(LogDialog.NewTag(graphNode)) },
|
||||
resetBranch = { onShowLogDialog(LogDialog.ResetBranch(graphNode)) },
|
||||
onMergeBranch = { ref -> onShowLogDialog(LogDialog.MergeBranch(ref)) },
|
||||
onRebaseBranch = { ref -> onShowLogDialog(LogDialog.RebaseBranch(ref)) },
|
||||
onRebaseBranch = { ref -> onRebase(ref ) },
|
||||
onRebaseInteractive = { logViewModel.rebaseInteractive(graphNode) },
|
||||
onRevCommitSelected = { logViewModel.selectLogLine(graphNode) },
|
||||
)
|
||||
@ -552,17 +556,6 @@ fun LogDialogs(
|
||||
logViewModel.resetToCommit(showLogDialog.graphNode, resetType)
|
||||
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 -> {
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,4 @@ sealed class LogDialog {
|
||||
data class NewTag(val graphNode: GraphNode) : LogDialog()
|
||||
data class ResetBranch(val graphNode: GraphNode) : LogDialog()
|
||||
data class MergeBranch(val ref: Ref) : LogDialog()
|
||||
data class RebaseBranch(val ref: Ref) : LogDialog()
|
||||
}
|
Loading…
Reference in New Issue
Block a user