-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CHE-3614: Rework Git commit window #5081
Conversation
Build # 2594 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2594/ to view the results. |
view.showDialog(); | ||
view.focusInMessageField(); | ||
checkState(project != null, "Null project occurred"); | ||
checkState(project.getLocation().isPrefixOf(appContext.getResource().getLocation()), |
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.
Should be CommitAction disabled if one of conditions above are true?
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.
Removed this section
items.put(item.substring(2, item.length()), defineStatus(item.substring(0, 1))); | ||
} | ||
filesToCommit.clear(); | ||
allFiles = items.keySet(); |
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.
I guess items
collect files to commit. Separate related code into a method with understandable name.
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.
done
DevMachine devMachine = appContext.getDevMachine(); | ||
Path location = project.getLocation(); | ||
Path[] filesToCommitArray = new Path[filesToCommit.size()]; | ||
filesToCommit.forEach(file -> filesToCommitArray[filesToCommit.indexOf(file)] = Path.valueOf(file)); |
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.
Use simple for
cycle.
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.
I prefer stream, because it fits in one row. Moved to separate method
.then(revision -> { | ||
onCommitSuccess(revision); | ||
if (view.isPushAfterCommit()) { | ||
String remoteBranch = view.getRemoteBranch(); |
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.
Push action extract to another method.
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.
done
.then(log -> { | ||
final List<Revision> commits = log.getCommits(); | ||
String message = ""; | ||
if (commits != null && (!commits.isEmpty())) { |
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.
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.
done
} | ||
|
||
@Override | ||
public Element render(final Node node, final String domID, final Tree.Joint joint, final int depth) { |
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.
Hard to understand
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.
Added comments
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/2630/ |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/2633/ |
@slemeur can you write up a bigger release note section for this PR - it's a pretty big deal. |
final List<Revision> commits = log.getCommits(); | ||
String message = ""; | ||
if (commits != null && (!commits.isEmpty())) { | ||
final Revision tip = commits.get(0); |
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.
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.
done
view.commit.amend_field_title=Amend previous commit | ||
view.commit.grid.date=Date | ||
view.commit.grid.commiter=Committer | ||
view.commit.grid.comment=Comment | ||
view.commit.push.checkbox.title=Push commited changes to : |
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.
committed
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.
done
view.commit.amend_field_title=Amend previous commit | ||
view.commit.grid.date=Date | ||
view.commit.grid.commiter=Committer | ||
view.commit.grid.comment=Comment | ||
view.commit.push.checkbox.title=Push commited changes to : | ||
view.commit.nothing_to_commit.text=Nothing to commit, working directory clean, Would you like to perform amend commit? |
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.
working directory is clean.
service.log(appContext.getDevMachine(), project.getLocation(), null, -1, -1, false) | ||
.then(arg -> { | ||
if (diff.isEmpty()) { | ||
dialogFactory.createConfirmDialog(constant.commitTitle(), |
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.
Extract to a method to simplify code.
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.
done
@bmicklea : done. will add the images for the RN once merged. |
Build # 2639 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2639/ to view the results. |
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.
(sorry - wrong issue)
this.commitAllSelection.setValue(event.getValue()); | ||
@Override | ||
public void | ||
checkCheckBoxes(Set<Path> paths) { |
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.
Single line
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.
done
} | ||
@Override | ||
public void setChangedPanelView(ChangedPanelView changedPanelView) { | ||
this.render = new ChangedPanelRender(changedPanelView); |
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.
Can you initialize renderer once? Inside implementation of ChangedPanelView?
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.
The idea is to have an abbility to set custom render to ChangesPanelView
to not to overload this widget with logic that is used only for commit window. Changes list window uses this panel with default render.
} | ||
|
||
void handleNodeCheckBox(Path nodePath, boolean value) { | ||
allNodePaths.stream() |
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.
What does this method do? Can you add a little comment to understand the logic?
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.
added javadoc
.forEach(path -> saveCheckBoxSelection(value, path)); | ||
} | ||
|
||
private void saveCheckBoxSelection(boolean checkBoxValue, Path path) { |
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.
checkBoxValue
has greater priority than path
?
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.
fliped parameters
this.changedPanelPresenter = changedPanelPresenter; | ||
this.view.setDelegate(this); | ||
|
||
callBack = node -> { |
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.
What callback? Rename variable to more informative
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.
Removed this and used existed SelectionChangedHandler
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' | ||
xmlns:g='urn:import:com.google.gwt.user.client.ui'> | ||
<g:FlowPanel> | ||
<g:FlowPanel ui:field="changedPanel"/> |
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.
changedPanel
-> changesPanel
. It sounds like your panel has been changed.
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.
done
/** | ||
* Callback for triggering actions in changed files panel. | ||
*/ | ||
public interface CallBack { |
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.
Node selection callback. But I'd propose to reuse existed components either org.eclipse.che.ide.ui.smartTree.event.SelectionChangedEvent.SelectionChangedHandler
or com.google.gwt.event.logical.shared.SelectionHandler
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.
done
} | ||
|
||
private void viewChangedFiles() { | ||
if (treeViewEnabled) { |
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.
Replace treeViewEnabled
with enum with two values TREE
and LIST
. It would be better to understand the logic
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.
done
/** | ||
* Clear panel from old nodes. | ||
*/ | ||
void clearNodeStorage(); |
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.
clearNodeStorage
-> resetPanelState
or smth else.
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.
done
@@ -60,49 +59,68 @@ | |||
* @param files | |||
* Map of changed files with their status | |||
*/ | |||
void viewChangedFilesAsList(@NotNull Map<String, Status> files); | |||
void viewChangedFilesAsList(Map<String, Status> files); |
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.
You have two method to show files, as above I mentioned, create enum and only one method, which will consume file list and view mode.
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.
done
view.commit.amend_field_title=Amend previous commit | ||
view.commit.grid.date=Date | ||
view.commit.grid.commiter=Committer | ||
view.commit.grid.comment=Comment | ||
view.commit.push.checkbox.title=Push committed changes to : | ||
view.commit.nothing_to_commit.text=Nothing to commit, working directory is clean, Would you like to perform amend commit? |
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.
Would
-> would
?
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.
Changed the question to new sentence
Build # 2656 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2656/ to view the results. |
Build # 2660 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2660/ to view the results. |
Build # 2663 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2663/ to view the results. |
Selenium tests report:
Same tests are also failed on |
What is the reason. It is possible to fix them? |
|
Reworked Git commit window with changed files panel and check-boxes to select witch file or folder to commit or not
What does this PR do?
Reworked Git commit window with changed files panel and check-boxes to select witch file or folder to commit or not:
Made Git chnged files panel as a separate widget to reuse it in 'Commit window' and in 'Changed files window'.
What issues does this PR fix or reference?
#3614
Changelog
Introduction of a new Git commit popup
Release Notes
As preliminary of a bigger work to improve the Git experience inside of Che, this version is introducing a new way to handle your Git commits, with less interactions needed. A new Git commit popup has been added which allow to see the list of changed files from your current
HEAD
commit.You can double-click on one of the file in order to review the changes with the
diff view
.[add screenshot]
The list of changes can either be displayed as a flat list, or as a tree view. You can select the files you want to commit by using the checkboxes.
We also added options to the popup to allow:
[add animated gif]
Docs PR
N/A Is not mantioned in current documentation.