Skip to content

[#603][1] Add the basic components for the new frontend - #604

Merged
zuozhiw merged 16 commits into
masterfrom
new-gui-foundation
Mar 31, 2018
Merged

zuozhiw merged 16 commits into
masterfrom
new-gui-foundation

Conversation

@zuozhiw

@zuozhiw zuozhiw commented Mar 27, 2018 •

Copy link
Copy Markdown
Contributor

This is the first PR of the integration of the new gui implementation. This PR creates a new Angular project generated using the latest Angular cli, adds important dependencies that will be used in the project, and creates the dummy components using CSS grid layout.

To run the new GUI:

Install NPM: https://www.npmjs.com/get-npm
Install Angular CLI: https://github.com/angular/angular-cli
cd new-gui, then npm install, then ng serve. Open localhost:4200 and you can see the UI

New GUI General Structure

The frontend project is organized as this file structure:

  • src
    • app
      • common (includes some commonly used type declarations)
      • workspace (the main workspace application to run workflow plan)
        • component (includes all the angular components, each component corresponds to a section in the UI)
          • component 1
          • component 2
          • ......

Current Components:

Currently the UI consists of 5 sub-components:
navigation component: the navigation header
operator panel component: the operator sidebar on the left
property editor component: the property editor sidebar on the right
result panel component: the table to show the results in the bottom
workflow editor: the main editor to drag and drop a workflow plan in the middle

Each components has 4 files (generated automatically by Angular CLI):
for example:
xxx.component.html: this is the HTML template that each component uses to display the View
xxx.component.scss: this is the scss (better CSS) file to control the style
xxx.component.ts: the main typescript (better Javascript) file corresponds to a component. This file contains a class that controls the logic and data of each component
xxx.component.spec.ts: this is the test typescript file automatically generated by Angular CLI.

Component Layout

We use Grid Layout ( a new and most powerful layout system available in CSS). Grid layout suits the need of the project. The UI is divided into a 3 x 3 grid. Each component occupies one or more grids. For example, the navigation component occupies all 3 grids of the first row.

UI screenshot

The frontend looks like this after the PR:

screen shot 2018-03-27 at 4 09 31 pm

Frontend Testing

This PR integrated the frontend Angular testing framework and lifecycle into our Travis Continuous Integration process. Now when Travis test the project, it will also run the frontend tests along with the backend tests. This is the screenshot of Travis successfully runs 5 initial placeholder tests:

screen shot 2018-03-28 at 5 21 26 pm

Relevant files:

This PR contains many files that are automatically generated by Angular CLI (angular's official command line helper tool) when creating a new project. These are the specific files that we write and needs to pay special attention. All other config files can be safely ignored.

  • .travis.yml - we added necessary configuration for Travis CI to add frontend testing for each build
  • new-gui/src/app/app.module.ts - this file contains the declaration for all the components / modules
  • everything under new-gui/src/app/workspace/component - these files are actual components that we added

@zuozhiw

zuozhiw commented Mar 27, 2018

Copy link
Copy Markdown
Contributor Author

@henrychen0220 @avinash0161 Please review this PR

@henrychen0220

henrychen0220 commented Mar 28, 2018 •

Copy link
Copy Markdown
Contributor

Some comments are added to the workspace.component.scss file under src/app/workspace/component directory. These comments will give a basic overview of how we layout the application using css grid.

@zuozhiw

zuozhiw commented Mar 29, 2018

Copy link
Copy Markdown
Contributor Author

I have added the initial frontend testing into the new gui code and integrated the testing procedure into Travis CI

capabilities: {
'browserName': 'chrome'
},
directConnect: true,

@avinash0161 avinash0161 Mar 30, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this is an automatically generated script. The github page at top lists that we should give a driver path. But it's not here. Have we tested this config?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This file is automatically generated by Angular CLI when creating a new project, you ignore can all these config files.


it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to texera!');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand that this is just the first PR to integrate the testing mechanism, but we should settle on a proper naming and directory structure, so that tests can be mapped to components easily. Something like we have for backend

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This file is generated by Angular CLI as a placeholder of the file structure. So it's sort of official recommended placeholder test. We haven't integrated e2e test, which means "end to end test". into our project yet. You can ignore everything under e2e.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NVM. Just saw that this is an automatically generated page. Individual component test files are attached with the components themselves. However, for the end to end tests too, we should formalize a directory structure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This directory structure is generated by Angular CLI, so we can view it as official recommended best practice directory structure.

Comment thread .travis.yml
- cd core
- mvn test --batch-mode
- mvn test --batch-mode
- cd new-gui

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In protractor config file, we say that source is localhost:4200. This will work locally if we have executed 'ng serve'. But, how will this work on Travis? Is this why we have 'ng test --browsers ChromeHeadless --single-run true'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it seems like protractor file is used by e2e test, which we haven't touched. They are just placeholders, please ignore them.

}

getParagraphText() {
return element(by.css('texera-root h1')).getText();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment as above. Once we have proper refactoring, 'texera-root h1' should come from a common variable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same comment, please ignore everything under e2e

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@avinash0161 I have added a new Relevant files: section, please look at files under there.

@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

@avinash0161 avinash0161 Mar 30, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The website at top says that VS code has to install an extension to support editor config. If so, can you change your ppt on frontend to include that this extension should also be installed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, this is a nice suggestion.

@zuozhiw

zuozhiw commented Mar 30, 2018

Copy link
Copy Markdown
Contributor Author

@avinash0161 the purpose of .editorconfig is not to deal with vscode specific stuff. .editorconfig is a generic configuration that can be used by editors to determine document and coding style.

However, this is another way to achieve what you said. They are .vscode/settings.json and .vscode/extensions.json. VSCode will use them to recommend extensions if you haven't install them, there's a screenshot:
screen shot 2018-03-29 at 5 48 28 pm

@@ -0,0 +1,6 @@
/* tslint:disable:no-inferrable-types */
export class AppSettings {
private static readonly SERVER_ADDRESS: string = 'http://localhost';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

where is the code to change this to actual server IP when deployed on server? Or will we manually do it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we manually do it, unless we find a way to do it better in the future

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Henry and I found a better solution about this, you can check this class again.

MatGridListModule,
MatIconModule,
MatInputModule,
MatListModule,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This file includes many custom imports which will be included in app module. Is it possible to write a broad description at the beginning of the file about what these imports are used for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

comments added.

// Accordion //////////////////////////////////////////////////

interface AccordionOptions extends AccordionEvents {
active?: any; // boolean or number

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought we weren't using JQuery.
Again a short description about why this file is needed will be helpful.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

jquery ui is used for drag and drop later. and jquery is used by jointjs. We avoid using jquery in our own code. but when it comes to jointjs, we have to use it. Later when we introduce the drag and drop stuff, there will be description

We have to include this jquery ui type declaration file separately to let it work.

@avinash0161 avinash0161 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Considering this is the first PR with entire framework, it contained many files which is fine. I hope next PRs have fewer files.

I have given some comments. Please take a look.

@zuozhiw

zuozhiw commented Mar 30, 2018

Copy link
Copy Markdown
Contributor Author

@avinash0161 please do a second round of review according to my replies and new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants