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

Add Git Panel #7235

Merged
merged 21 commits into from
Nov 13, 2017
Merged

Add Git Panel #7235

merged 21 commits into from
Nov 13, 2017

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Nov 7, 2017

What does this PR do?

Adds git panel to Che. The panel contains list of git repositories in workspace with label for each repository which shows number of changed files in it.
If selected repository have some changes, they will be displayed on the panel. Double click on changed file will show its diff.
The panel is updated dynamically and always keep actual state.

git-panel

To quick show git panel Alt + g shortcut could be used.

Selenium test is added for most common use cases.

What issues does this PR fix or reference?

#5128
#7022

Git panel added into Che.

Release Notes

Git panel with list of repositories and changed files list is added into Che.

Docs PR

@benoitf benoitf added target/che6 kind/task Internal things, technical debt, and to-do tasks to be performed. status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. labels Nov 7, 2017
this.changes = new HashMap<>();

for (Project project : appContext.getProjects()) {
if (projectUnderGit(project)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isGitProject

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To me isProjectUnderGit looks better. Do you mind?

}

/** Queries from server all data needed to initialize the panel. */
private void loadPanelData() {
Copy link
Contributor

@tolusha tolusha Nov 7, 2017

Choose a reason for hiding this comment

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

resolveGitRepositories

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 think, that current name is better, because there is noting to resolve here, just request data from wsagent.

Copy link
Contributor

Choose a reason for hiding this comment

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

exposeGitRepositories

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok...


private static final String EVENT_GIT_FILE_CHANGED = "event/git-change";
private static final String EVENT_GIT_STATUS_CHANGED = "event/git/status-changed";
private static final String EVENT_GIT_CHECKOUT = "event/git-checkout";
Copy link
Member

Choose a reason for hiding this comment

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

it would be nice to have these constants shared between server and client 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.

Yes, it would be great. But the issue is common for all rpc channels and probably we have to find general solution.

interface ActionDelegate extends BaseActionDelegate {

/**
* Invoked each time when user changes selection in repositories list. Returns null if no
Copy link
Member

Choose a reason for hiding this comment

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

Returns null if no selected items

it returns void

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! I meant argument...

}

@Override
public void onFileChanged(String endpointId, FileChangedEventDto dto) {
Copy link
Contributor

Choose a reason for hiding this comment

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

dto -> fileChangedEvent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

@vinokurig vinokurig left a comment

Choose a reason for hiding this comment

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

It would be great to use icons from http://fontawesome.io instead of your SVG icons where possible

@mmorhun
Copy link
Contributor Author

mmorhun commented Nov 9, 2017

ci-test

@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

@mmorhun
Copy link
Contributor Author

mmorhun commented Nov 10, 2017

@slemeur we are going to merge it, do you have any concerns?

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@mmorhun
Copy link
Contributor Author

mmorhun commented Nov 10, 2017

ci-test

@slemeur
Copy link
Contributor

slemeur commented Nov 10, 2017

Yes.

The PR must not be merged: In this state, the panel can't be delivered to end-users!

As I told in few discussions, there are few problems to fix in what the panel is showing currently:

  • It misses information about the branch name: so when I see the git status, user does not know on which branch he is working on.
  • Butons: If you check the requirements, the buttons to manage the list's settings are not handled this way, and they have a different style.
  • Icons: git icon is incorrect. in the mockup there is no icon for the repositories.

Then, there is a bigger issue:
The goal of the panel is to fasten the interactions with the mostly used git features such as fetch, pull, commit, push. At this moment, the panel does not reach this goal and does not complete the user stories.
I would say, if it had only the ability to commit, we could consider merging it - but as it is currently, it is really too limited and there is very narrow value to merge it.

The current state, is really a WIP. I would say that you might need to consider feature flag to introduce this kind of WIP/experimental feature.

@dmytro-ndp
Copy link
Contributor

@mmorhun: if you decide to merge it with turned-off Git-panel, along with selenium test GitPanelTest.java for the panel, please, make sure that this test is excluded from test execution properly, that means:

  • GitPanelTest.java excluded from CheSuite.xml;
  • all tests inside the GitPanelTest.java disabled (that are annotated with @Test(enabled = false)) to prevent run in package mode.

Anyway, I don't like an idea of presence of selenium tests, which are aimed to test absent functionality, so as they should being supported as others tests, but this support would be useless.

@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

@mmorhun
Copy link
Contributor Author

mmorhun commented Nov 10, 2017

We decided to merge this changes, but don't include it in IDE functionality. This is due to refactoring of some git events mechanism which probably will have merge conflicts very soon. To avoid hard merging and taking into account that we don't refuse git panel we are going to merge git panel code too.

@mmorhun
Copy link
Contributor Author

mmorhun commented Nov 10, 2017

@dmytro-ndp can you elaborate please, what king of support we have to do for disabled tests?

@dmytro-ndp
Copy link
Contributor

We should support various things which GitPanelTest uses:

  • methods of page objects and helper classes (Loader, TestProjectServiceClient, Wizard, Menu, ProjectExplorer, CodenvyEditor, MachineTerminal, AskDialog, AskForValueDialog, TestUserPreferencesServiceClient, Git, GitCompare, GitPanel)
  • resources ("/projects/node-js-simple", "/projects/ProjectWithDifferentTypeOfFiles", "/projects/plain-java-project").

That means that we can't change them without the risk to break the test logic, so as we can't ensure that without turning on the Git Panel and run the test.

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@Inject private AskDialog askDialog;
@Inject private AskForValueDialog askForValueDialog;
@Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient;
@Inject private org.eclipse.che.selenium.pageobject.git.Git git;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add org.eclipse.che.selenium.pageobject.git.Git into the import section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you

commitAllChangesInProject(JAVA_SPRING_GIT_PROJECT_NAME, "initial commit");
}

@Test(priority = 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to have independent tests inside the test class.

}

/**
* Converts file name to editor tab title for java projects.
Copy link
Contributor

Choose a reason for hiding this comment

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

Example of conversion will be quite useful here.

public void waitRepositoryPresent(String repository) {
loadWait.until(
ExpectedConditions.presenceOfElementLocated(
By.xpath(String.format(Locators.REPOSITORY_BY_NAME, repository))));
Copy link
Contributor

@dmytro-ndp dmytro-ndp Nov 10, 2017

Choose a reason for hiding this comment

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

It's better to use static imports to improve readability.
Compare:
By.xpath(String.format(Locators.REPOSITORY_BY_NAME, repository))));
and
xpath(format(REPOSITORY_BY_NAME, repository))));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I am just afraid that many static imports could make our code less clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

Believe me - in case of Page Object many static imports make code much clear. @tolusha can confirm it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I won't confirm that. It is matter of personal preferences and certain cases

Copy link
Contributor

@dmytro-ndp dmytro-ndp Nov 13, 2017

Choose a reason for hiding this comment

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

@tolusha: hm, I thought you was supporter of usage of static imports, basing on your earlier comments like this https://github.com/codenvy-legacy/qa/pull/644#discussion_r104435935 :-|
Anyway, usage of static import for constants like Locators.REPOSITORY_BY_NAME is obvious improvement so as Locators is just an interface for constants.

@mmorhun
Copy link
Contributor Author

mmorhun commented Nov 10, 2017

We should support various things which GitPanelTest uses
methods of page objects and helper classes

We have to support them anyway, regardless of GitPanelTest.

resources ("/projects/node-js-simple", "/projects/ProjectWithDifferentTypeOfFiles", "/projects/plain-java-project")

I didn't add new resources, just reused existing. By the way, what kind of support you meant?

As about the git panel test. The functionality will be hidden... nothing to test. We'll retest the scenario when include git panel functionality. I think this is optimal way.

@mmorhun
Copy link
Contributor Author

mmorhun commented Nov 10, 2017

ci-test

@dmytro-ndp
Copy link
Contributor

dmytro-ndp commented Nov 10, 2017

@mmorhun:

By the way, what kind of support you meant?

By support I mean keeping track of changes in methods of Page Objects and libraries, and content of resources which are used by TestGitPanel. When we will be changing the logic or signature of methods of dependent classes, or content of resources, we will need to ensure that changes don't break the test. To do this, we ought to turn-on the git panel, to run the test and potentially to correct it, and it will take a time. Otherwise this test will "dead" and we will remove it later anyway.

@mmorhun mmorhun merged commit 46ddf5e into che6 Nov 13, 2017
@mmorhun mmorhun deleted the git-panel branch November 13, 2017 07:24
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Nov 13, 2017
@benoitf benoitf added this to the 6.0.0-M2 milestone Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.