Repository navigation
[#603][2] Add Operator Panel to the new GUI - #605
Conversation
| @@ -1,4 +1,5 @@ | |||
| import { Component } from '@angular/core'; | |||
| import { WorkspaceComponent } from './workspace/component/workspace.component'; | |||
| // providers: [ | ||
| // { provide: OperatorMetadataService, useClass: StubOperatorMetadataService } | ||
| // ], | ||
| // schemas: [ NO_ERRORS_SCHEMA ] |
There was a problem hiding this comment.
This file is tool generated. Then, why is this portion commented out?
There was a problem hiding this comment.
the test case will be added back into a future PR
| } | ||
|
|
||
| export interface GroupInfo { | ||
| groupName: string; |
There was a problem hiding this comment.
In case of such definitions, which serve as a protocol with server, please give an example of what is expected from server and explain.
There was a problem hiding this comment.
it's in another mock data file. Comments are added to point to that file.
| * | ||
| */ | ||
| public getOperatorMetadata(): Observable<OperatorMetadata> { | ||
| return this.httpClient |
There was a problem hiding this comment.
Do services have the concept of static variables? Once brought we can initialize it and any call to the function will first check it.
There was a problem hiding this comment.
https://stackoverflow.com/questions/36271899/what-is-the-correct-way-to-share-the-result-of-an-angular-http-network-call-in-r/36296015#36296015
The answer by Gunter appears to do something like caching of results.
|
|
||
| describe('OperatorMetadataService', () => { | ||
|
|
||
| let service: OperatorMetadataService; |
There was a problem hiding this comment.
Shouldn't this be StubOperatorMetadataService?
However, in order to make sure that when server's operator schema changes, the front end's tests fail, we should contact the actual backend and not just mock it.
|
|
||
| constructor() { } | ||
| constructor( | ||
| private operatorMetadataService: OperatorMetadataService, |
There was a problem hiding this comment.
why is the service needed in this constructor?
There was a problem hiding this comment.
it's not needed, will be removed later
| it('should receive operator metadata from service', () => { | ||
| // if the length of our schema list is equal to the length of mock data | ||
| // we assume the mock data has been received | ||
| expect(component.operatorSchemaList.length).toEqual(MOCK_OPERATOR_SCHEMA_LIST.length); |
There was a problem hiding this comment.
F2FQ: What is component here?
There was a problem hiding this comment.
component is declared above, and initialized in the beforeEach function, which is called every time before each test
| declarations: [ OperatorPanelComponent ] | ||
| declarations: [OperatorPanelComponent], | ||
| providers: [ | ||
| { provide: OperatorMetadataService, useClass: StubOperatorMetadataService } |
There was a problem hiding this comment.
F2FQ: so which class are we using operator or stuboperator?
There was a problem hiding this comment.
OperatorMetadataService is the provided class we try to mock, StubOperatorMetadataService is the actual class used to mock that class.
| @@ -0,0 +1,3 @@ | |||
| <mat-card class="texera-operator-label mat-elevation-z1" [attr.id]="operatorLabelID"> | |||
There was a problem hiding this comment.
F2FQ: What is [attr.id]'s brackets mean? Angular Tutorial said it meant input into the child component. But here mat-card is not a child.
There was a problem hiding this comment.
[attr.id] is set the DOM element's ID using a variable in the class.
id=something will interpret something as a string
[attr.id]=something will interpret something as a public variable in the component class. It's Angular's syntax.
| selector: 'texera-workspace', | ||
| templateUrl: './workspace.component.html', | ||
| styleUrls: ['./workspace.component.scss'] | ||
| styleUrls: ['./workspace.component.scss'], |
There was a problem hiding this comment.
Shouldn't there be changes in workspace html too where you include operator label and operator panel html tags? Or are you planning to get it reviewed at the last?
There was a problem hiding this comment.
operator panel component is already included in workspace.component.html, operator label component is included inside operator-panel.component.html
avinash0161
left a comment
There was a problem hiding this comment.
Ignore the questions which start with F2FQ. These are some questions that I have and can be solved with a f2f discussion.
Other than that, please take a look.
This PR adds the Operator Panel to the new GUI. The Operator Panel Component shows the list of operators grouped with their operator group.
This PR also adds OperatorMetadataService. It fetches the operator metadata from the backend. This PR also adds Typescript typing declarations for the interfaces related to operator metadata.
In Angular, Services are singleton instances that provides specific functionaries that are not tightly related to the view. Services are also the primary way for different components to communicate each other. In the new GUI, most of the logic and data are processed in the service. Components only get the data and listen to events from Services.
Service singleton instances are initialized by Angular when the app initializes. And then these service instances are provided to other classes by Angular Dependency Injection https://angular.io/guide/architecture-services
In this PR, OperatorMetadataService's job is to send an HTTP request to the backend API endpoint to fetch the operator metadata and when the HTTP request is done, it passes the metadata to the OperatorPanelComponent through an observable.
The file structure now looks like this (only shows partial structure inside "workspace" folder)
The current UI looks like this:
