Skip to content
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

Merged
merged 17 commits into from
May 31, 2017
Merged

CHE-3614: Rework Git commit window #5081

merged 17 commits into from
May 31, 2017

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented May 15, 2017

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:
git_commit
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.
git_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:

  • amending the previous commit
  • automatically push the changes to the remote repository
    [add animated gif]

Docs PR

N/A Is not mantioned in current documentation.

@vinokurig vinokurig added the kind/enhancement A feature request - must adhere to the feature request template. label May 15, 2017
@codenvy-ci
Copy link

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()),
Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Contributor

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.

Copy link
Contributor Author

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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use simple for cycle.

Copy link
Contributor Author

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();
Copy link
Contributor

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.

Copy link
Contributor Author

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())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to understand

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments

@codenvy-ci
Copy link

@iamslite iamslite mentioned this pull request May 19, 2017
15 tasks
@codenvy-ci
Copy link

@vinokurig vinokurig requested a review from bmicklea May 19, 2017 12:10
@bmicklea bmicklea requested review from slemeur and removed request for bmicklea May 19, 2017 14:29
@bmicklea
Copy link

@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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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 :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

committed

Copy link
Contributor Author

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?
Copy link
Contributor

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(),
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@slemeur
Copy link
Contributor

slemeur commented May 19, 2017

@bmicklea : done. will add the images for the RN once merged.

@codenvy-ci
Copy link

Build # 2639 - FAILED

Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2639/ to view the results.

Copy link
Contributor

@dmytro-ndp dmytro-ndp left a 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single line

Copy link
Contributor Author

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);
Copy link
Contributor

@vzhukovs vzhukovs May 23, 2017

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?

Copy link
Contributor Author

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()
Copy link
Contributor

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?

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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 -> {
Copy link
Contributor

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

Copy link
Contributor Author

@vinokurig vinokurig May 24, 2017

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"/>
Copy link
Contributor

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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

Copy link
Contributor Author

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();
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would -> would ?

Copy link
Contributor Author

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

@codenvy-ci
Copy link

Build # 2656 - FAILED

Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2656/ to view the results.

@codenvy-ci
Copy link

Build # 2660 - FAILED

Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2660/ to view the results.

@codenvy-ci
Copy link

Build # 2663 - FAILED

Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2663/ to view the results.

@vinokurig
Copy link
Contributor Author

vinokurig commented May 31, 2017

Selenium tests report:

[TEST] Command line: ./webdriver.sh --test=com.codenvy.ide.git.*
[TEST]
[TEST] Local results:
[TEST] 	- Run: 	     36
[TEST] 	- Failed:     4
[TEST]
[TEST] REGRESSION (4):
[TEST] 	com.codenvy.ide.git.ImportProjectIntoSpecifiedBranchTest.prepare
[TEST] 	com.codenvy.ide.git.ImportRecursiveSubmoduleTest.checkImportProjectSubmoduleByHttpsUrl
[TEST] 	com.codenvy.ide.git.ImportRecursiveSubmoduleTest.checkImportProjectSubmoduleBySshUrl
[TEST] 	com.codenvy.ide.git.ImportRecursiveSubmoduleTest.checkImportProjectSubmoduleFromGithub

Same tests are also failed on nightly-onprem-selenium-tests of current ci job

@tolusha
Copy link
Contributor

tolusha commented May 31, 2017

What is the reason. It is possible to fix them?

@vinokurig
Copy link
Contributor Author

ImportProjectIntoSpecifiedBranchTest: reruned with local mode without regression
ImportRecursiveSubmoduleTest is failing with a known bug (#5178)

@vinokurig vinokurig merged commit f2047ea into master May 31, 2017
@vinokurig vinokurig deleted the CHE-3614 branch May 31, 2017 19:00
@vinokurig vinokurig added this to the 5.12.0 milestone Jun 12, 2017
JPinkney pushed a commit to JPinkney/che that referenced this pull request Aug 17, 2017
Reworked Git commit window with changed files panel and check-boxes to select witch file or folder to commit or not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants